Say local engine in the import dialog and the offline errors
A tester saw "raw files are demosaiced by the server" and read it as an upload to someone else's machine. In desktop mode the decoder runs in the bundle on this PC, so the import dialog, the join page and the "cannot reach" error now say local engine, while team-server installs keep the server wording.
This commit is contained in:
+16
-1
@@ -35,6 +35,17 @@ export interface UploadResult {
|
||||
note?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* True once /api/health reports LUMINARY_LOCAL=1: the engine runs inside this
|
||||
* app's own folder, so copy must not send users looking for a remote server.
|
||||
*/
|
||||
let localEngine = false;
|
||||
|
||||
/** Whether this app talks to the engine in its own bundle (desktop mode). */
|
||||
export function isLocalEngine(): boolean {
|
||||
return localEngine;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
status: number;
|
||||
constructor(message: string, status: number) {
|
||||
@@ -48,7 +59,10 @@ export async function request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
try {
|
||||
res = await fetch(path, { credentials: 'same-origin', ...init });
|
||||
} catch {
|
||||
throw new ApiError('Cannot reach the Luminary server', 0);
|
||||
throw new ApiError(
|
||||
localEngine ? 'Cannot reach the Luminary local engine' : 'Cannot reach the Luminary server',
|
||||
0,
|
||||
);
|
||||
}
|
||||
if (!res.ok) {
|
||||
let message = `Request failed (${res.status})`;
|
||||
@@ -78,6 +92,7 @@ export async function getHealth(): Promise<Health | null> {
|
||||
const res = await fetch('/api/health', { credentials: 'same-origin' });
|
||||
if (!res.ok) return null;
|
||||
const body = (await res.json()) as Health;
|
||||
localEngine = body?.local === true;
|
||||
return body?.ok ? body : null;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user