Fix Nitro client launcher: read the nitro_path setting
The /client launcher read a non-existent `nitro_client_url` setting, so it
always fell through to "No client configured" and the client never launched.
Faithful to AtomCMS's NitroController + nitro.blade.php, build the launch URL
as {nitro_path}/index.html?sso=<ticket> plus the toolbar colour params, via a
shared buildNitroClientUrl helper. The Flash launcher's Nitro fallback used the
same dead key and is fixed too.
This commit is contained in:
1 parent
54ec99de6d
commit
56cd6fd058
4 files changed
+62
-26
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { siteSettings } from "./site-settings";
|
||||
|
||||
/**
|
||||
* Builds the Nitro client launch URL, faithful to AtomCMS's NitroController +
|
||||
* nitro.blade.php:
|
||||
*
|
||||
* {nitro_path}/index.html?sso={ticket}&toolbar_primary=…&toolbar_hover=…
|
||||
* &toolbar_border=…&toolbar_text=…
|
||||
*
|
||||
* The client files are served by the web root at `nitro_path` (e.g.
|
||||
* `/Nitro-V3/dist`). Returns "" when no `nitro_path` is configured.
|
||||
*/
|
||||
export async function buildNitroClientUrl(ticket: string): Promise<string> {
|
||||
const [nitroPathRaw, tPrimary, tHover, tBorder, tText, bPrimary, bHover, bBorder, bText] =
|
||||
await Promise.all([
|
||||
siteSettings.get("nitro_path", ""),
|
||||
siteSettings.get("toolbar_primary_color", ""),
|
||||
siteSettings.get("toolbar_hover_color", ""),
|
||||
siteSettings.get("toolbar_border_color", ""),
|
||||
siteSettings.get("toolbar_text_color", ""),
|
||||
siteSettings.get("button_primary_color", ""),
|
||||
siteSettings.get("button_hover_color", ""),
|
||||
siteSettings.get("button_border_color", ""),
|
||||
siteSettings.get("button_text_color", ""),
|
||||
]);
|
||||
|
||||
const nitroPath = (nitroPathRaw ?? "").trim().replace(/\/+$/, "");
|
||||
if (!nitroPath) return "";
|
||||
|
||||
// Same fallbacks as the blade: toolbar_* color, else button_* color, else the
|
||||
// atom defaults. URLSearchParams encodes "#" → "%23" so the query is valid.
|
||||
const params = new URLSearchParams({ sso: ticket });
|
||||
params.set("toolbar_primary", tPrimary || bPrimary || "#eeb425");
|
||||
params.set("toolbar_hover", tHover || bHover || "#cf9d15");
|
||||
params.set("toolbar_border", tBorder || bBorder || "#cf9d15");
|
||||
params.set("toolbar_text", tText || bText || "#1a1a2e");
|
||||
|
||||
return `${nitroPath}/index.html?${params.toString()}`;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ const DEFAULTS: Record<string, string> = {
|
||||
hotel_name: "Atom",
|
||||
habbo_imaging_url: "https://www.habbo.com/habbo-imaging/avatarimage",
|
||||
logo_url: "",
|
||||
nitro_client_url: "",
|
||||
nitro_path: "",
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user