fix: homelab save erstellt parent dir via mkdir_with_parents, string statt TextEncoder für GLib.file_set_contents
This commit is contained in:
@@ -9,10 +9,11 @@ const CONFIG_PATH = GLib.getenv("HOMELAB_CONFIG") || `${GLib.getenv("HOME")}/.co
|
|||||||
|
|
||||||
function saveConfig(host: string, user: string, port: string) {
|
function saveConfig(host: string, user: string, port: string) {
|
||||||
const yaml = `# Homelab Configuration\ngenerated_by: Omeron\n\nserver:\n address: "${host}"\n username: "${user}"\n port: ${port}\n\ncontrol_center:\n refresh_interval: 5\n theme: "dark"\n\nfeatures:\n docker: true\n services: true\n storage: true\n network: true\n monitoring: true\n`;
|
const yaml = `# Homelab Configuration\ngenerated_by: Omeron\n\nserver:\n address: "${host}"\n username: "${user}"\n port: ${port}\n\ncontrol_center:\n refresh_interval: 5\n theme: "dark"\n\nfeatures:\n docker: true\n services: true\n storage: true\n network: true\n monitoring: true\n`;
|
||||||
GLib.file_set_contents(CONFIG_PATH, new TextEncoder().encode(yaml));
|
GLib.mkdir_with_parents(GLib.path_get_dirname(CONFIG_PATH), 0o755);
|
||||||
|
GLib.file_set_contents(CONFIG_PATH, yaml);
|
||||||
hasConfig = true;
|
hasConfig = true;
|
||||||
const win = app.get_window("homelab-control");
|
const win = app.get_window("homelab-control");
|
||||||
if (win) win.set_child(<box marginTop={WINDOW_MARGIN_TOP}>{authed ? <DashboardView /> : <LoginView />}</box> as Gtk.Widget);
|
if (win) win.set_child(<box marginTop={WINDOW_MARGIN_TOP}>{!hasConfig ? <SetupView /> : (authed ? <DashboardView /> : <LoginView />)}</box> as Gtk.Widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadConfig() {
|
function loadConfig() {
|
||||||
|
|||||||
Reference in New Issue
Block a user