mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
"offline": true in tools-settings.json hides tools that need internet access (menus and routes). Tools declare it with requiresInternet, either always or unless an intranet mirror is configured. The settings helper lives in a module without top-level await so eagerly loaded tool index.ts files can use it without delaying app boot. Refs sharevb/it-tools#571 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
18 lines
937 B
TypeScript
18 lines
937 B
TypeScript
import { appBaseUrl as base } from '@/utils/base-url';
|
|
import type { ToolsSettings } from '@/utils/tools-settings';
|
|
|
|
export { type ToolsSettings, getToolsSettingString } from '@/utils/tools-settings';
|
|
|
|
// Optional per-deployment settings. Lives in its own top-level-await module so the
|
|
// fetch runs concurrently with the config fetches in src/tools/index.ts (sibling async
|
|
// module subgraphs evaluate in parallel) instead of serially after them.
|
|
export const toolsSettings: ToolsSettings = await fetch(`${base}tools-settings.json`)
|
|
.then((response) => (response.ok ? (response.json() as Promise<ToolsSettings>) : {}))
|
|
.catch(() => ({}));
|
|
|
|
/**
|
|
* `"offline": true` in tools-settings.json marks a deployment without internet access (an air-gapped intranet).
|
|
* Tools that only work with internet are hidden, and tools with a bundled or mirrored fallback switch to it.
|
|
*/
|
|
export const isOfflineMode = toolsSettings.offline === true;
|