nits, fixes
This commit is contained in:
parent
e82de63b34
commit
454ee6cf4c
@ -7,12 +7,6 @@ import settings from "./settings";
|
|||||||
export async function updateAutoLaunch() {
|
export async function updateAutoLaunch() {
|
||||||
let isAutoLaunchEnabled = settings.get("auto_launch_enabled");
|
let isAutoLaunchEnabled = settings.get("auto_launch_enabled");
|
||||||
|
|
||||||
// set default to enabled
|
|
||||||
if (isAutoLaunchEnabled === undefined) {
|
|
||||||
settings.set("auto_launch_enabled", true);
|
|
||||||
isAutoLaunchEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't run this in development
|
// Don't run this in development
|
||||||
if (electronIsDev) {
|
if (electronIsDev) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,7 +44,7 @@ export default () => {
|
|||||||
settings.get("servers") || [
|
settings.get("servers") || [
|
||||||
// TODO: remove this default server
|
// TODO: remove this default server
|
||||||
{
|
{
|
||||||
_id: "1",
|
_id: `${Date.now()}-1`,
|
||||||
name: "WA Demo",
|
name: "WA Demo",
|
||||||
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
||||||
},
|
},
|
||||||
|
@ -6,13 +6,27 @@ export type SettingsData = {
|
|||||||
log_level: ElectronLog.LogLevel;
|
log_level: ElectronLog.LogLevel;
|
||||||
auto_launch_enabled: boolean;
|
auto_launch_enabled: boolean;
|
||||||
servers: Server[];
|
servers: Server[];
|
||||||
shortcuts: Record<"mute_toggle" | "camera_toggle", string | null>;
|
shortcuts: Record<"mute_toggle" | "camera_toggle", string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
let settings: SettingsData;
|
let settings: SettingsData;
|
||||||
|
|
||||||
|
const defaultSettings: SettingsData = {
|
||||||
|
log_level: "info",
|
||||||
|
auto_launch_enabled: true,
|
||||||
|
servers: [],
|
||||||
|
shortcuts: {
|
||||||
|
mute_toggle: "",
|
||||||
|
camera_toggle: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
settings = (await Settings.get()) as SettingsData;
|
let _settings = await Settings.get();
|
||||||
|
if (_settings !== undefined) {
|
||||||
|
_settings = defaultSettings;
|
||||||
|
}
|
||||||
|
settings = _settings as SettingsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get(): SettingsData;
|
function get(): SettingsData;
|
||||||
|
@ -4,7 +4,7 @@ import { showAboutWindow } from "electron-util";
|
|||||||
|
|
||||||
import * as autoUpdater from "./auto-updater";
|
import * as autoUpdater from "./auto-updater";
|
||||||
import * as log from "./log";
|
import * as log from "./log";
|
||||||
import { getWindow } from "./window";
|
import { getAppView, getWindow } from "./window";
|
||||||
|
|
||||||
let tray: Tray | undefined;
|
let tray: Tray | undefined;
|
||||||
|
|
||||||
@ -46,6 +46,13 @@ export function createTray() {
|
|||||||
log.openLog();
|
log.openLog();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Open DevTools",
|
||||||
|
click() {
|
||||||
|
getWindow()?.webContents.openDevTools({ mode: "detach" });
|
||||||
|
getAppView()?.webContents.openDevTools({ mode: "detach" });
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "About",
|
label: "About",
|
||||||
click() {
|
click() {
|
||||||
|
@ -93,12 +93,6 @@ export async function createWindow() {
|
|||||||
|
|
||||||
mainWindow.once("ready-to-show", () => {
|
mainWindow.once("ready-to-show", () => {
|
||||||
mainWindow?.show();
|
mainWindow?.show();
|
||||||
if (electronIsDev) {
|
|
||||||
// appView?.webContents.openDevTools({
|
|
||||||
// mode: "detach",
|
|
||||||
// });
|
|
||||||
// mainWindow?.webContents.openDevTools({ mode: "detach" });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on("did-finish-load", () => {
|
mainWindow.webContents.on("did-finish-load", () => {
|
||||||
|
@ -41,15 +41,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
/* TODO */
|
|
||||||
background-color: #30343d;
|
background-color: #30343d;
|
||||||
|
|
||||||
/* background-color: #2b2f37; */
|
|
||||||
|
|
||||||
/* color: #62727c;
|
|
||||||
border: 1px solid #62727c; */
|
|
||||||
|
|
||||||
/* border-color: #e1e4e8;
|
|
||||||
color: #e1e4e8; */
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
return serverColors[i % serverColors.length];
|
return serverColors[i % serverColors.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedServer.subscribe((e) => {
|
|
||||||
console.log("selected server changed", e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$: serverWithSelection = $servers.map((s) => ({ ...s, isSelected: $selectedServer === s._id }))
|
$: serverWithSelection = $servers.map((s) => ({ ...s, isSelected: $selectedServer === s._id }))
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function saveShortcut(key: keyof SettingsData["shortcuts"], value: string) {
|
async function saveShortcut(key: keyof SettingsData["shortcuts"], value: string) {
|
||||||
const shortcuts = get(settings)['shortcuts'] || { "camera_toggle": "", "mute_toggle": "" };
|
const shortcuts = get(settings)['shortcuts'];
|
||||||
shortcuts[key] = value;
|
shortcuts[key] = value;
|
||||||
settings.update((s) => ({ ...s, shortcuts }));
|
settings.update((s) => ({ ...s, shortcuts }));
|
||||||
await api.saveSetting("shortcuts", shortcuts);
|
await api.saveSetting("shortcuts", shortcuts);
|
||||||
|
Loading…
Reference in New Issue
Block a user