Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SettingsPage } from './pages/SettingsPage';
import { ErrorBoundary } from './components/ErrorBoundary';
import { ToastNotifications } from './components/ToastNotifications';
import { useThemeSync } from './hooks/useThemeSync';
import { loadConfig } from './redux/slices/config';
import { loadConfig, setBranding, setFeatures } from './redux/slices/config';
import { setConfigDefaults } from './redux/slices/userSettings';
import type { RootState, AppDispatch } from './redux/store';

Expand All @@ -22,9 +22,19 @@ export default function App() {

// Load config at app init
useEffect(() => {
// Seed branding/features from server-injected HTML data
const serverBranding = (window as any).APP_DATA?.branding;
const serverFeatures = (window as any).APP_DATA?.features;
if (serverBranding) {
dispatch(setBranding(serverBranding));
}
if (serverFeatures) {
dispatch(setFeatures(serverFeatures));
dispatch(setConfigDefaults({ debug_mode_default: serverFeatures.debug_mode_default }));
}

dispatch(loadConfig()).then((result: any) => {
if (result.meta.requestStatus === 'fulfilled' && result.payload?.features) {
// Apply feature flag defaults to user settings
dispatch(setConfigDefaults({
debug_mode_default: result.payload.features.debug_mode_default,
}));
Expand Down
3 changes: 3 additions & 0 deletions src/server/router/client.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ async function routes(fastify: FastifyInstance) {
};

const agentName = await getAgentName();
const cfg = getSettings();
const appData = {
apiUrl: basePath ? `${basePath}/api/proxy/agent` : "",
basePath: basePath || "/",
refreshableToken: "",
agentName,
branding: cfg.branding,
features: cfg.features,
};

reply.type("text/html");
Expand Down
Loading