update
This commit is contained in:
+7
-3
@@ -236,6 +236,8 @@ function initialStatus(scenario: MockScenario): Status {
|
||||
portable: false,
|
||||
sync: null,
|
||||
live: null,
|
||||
map_from_site: null,
|
||||
map_problem: null,
|
||||
};
|
||||
switch (scenario) {
|
||||
case "first-run":
|
||||
@@ -319,7 +321,7 @@ class MockBackend implements Backend {
|
||||
this.status = initialStatus(scenario);
|
||||
this.conflicts = scenario === "sync-conflicts" ? structuredClone(MOCK_CONFLICTS) : [];
|
||||
this.network = this.status.online;
|
||||
this.settings = { site_url: SITE_URL, mcp_url: MCP_URL, install_dir: DEFAULT_DIR };
|
||||
this.settings = { site_url: SITE_URL, mcp_url: MCP_URL, ai_url: "", install_dir: DEFAULT_DIR };
|
||||
if (this.status.installed) {
|
||||
// An installed mock PC has the basemap, Dark V2 and a stopped satellite download.
|
||||
for (const item of MOCK_MARKET) if (item.required) this.marketPresent.set(item.key, "installed");
|
||||
@@ -605,10 +607,12 @@ class MockBackend implements Backend {
|
||||
}
|
||||
|
||||
async setSettings(settings: Settings): Promise<Status> {
|
||||
for (const [label, url] of [
|
||||
// The AI address is optional: empty means the client stays offline.
|
||||
for (const [label, url] of ([
|
||||
["DHP URL", settings.site_url],
|
||||
["MCP URL", settings.mcp_url],
|
||||
] as const) {
|
||||
...(settings.ai_url.trim() ? [["AI URL", settings.ai_url] as const] : []),
|
||||
] as const)) {
|
||||
try {
|
||||
new URL(url);
|
||||
} catch {
|
||||
|
||||
@@ -50,6 +50,13 @@ export interface Status {
|
||||
* this PC. null when ODIAN is not running, or the DHP offers no Engine API.
|
||||
*/
|
||||
live: boolean | null;
|
||||
/**
|
||||
* While ODIAN runs: false when the map is being drawn from this PC because the site's
|
||||
* tile service did not answer. null when ODIAN is not running, or no site is set.
|
||||
*/
|
||||
map_from_site: boolean | null;
|
||||
/** Why, in one line, when `map_from_site` is false. */
|
||||
map_problem: string | null;
|
||||
}
|
||||
|
||||
/** A marketplace item: one tile set or source file of the version. */
|
||||
@@ -118,6 +125,11 @@ export interface Settings {
|
||||
site_url: string;
|
||||
/** Site MCP, for Keycloak sign-in. */
|
||||
mcp_url: string;
|
||||
/**
|
||||
* The MCP serving ODIAN's AI features (`/api/ai/...`), reached over the internet. Empty
|
||||
* keeps the client wholly offline; set, it is the one address the client may reach.
|
||||
*/
|
||||
ai_url: string;
|
||||
install_dir: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user