debug mode
This commit is contained in:
@@ -11,6 +11,7 @@ pub use window::open_config_window;
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
pub struct AppConfig {
|
||||
pub api_base_url: Option<String>,
|
||||
pub debug_mode: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
||||
@@ -54,6 +54,7 @@ fn sanitize(mut config: AppConfig) -> AppConfig {
|
||||
pub fn default_app_config() -> AppConfig {
|
||||
AppConfig {
|
||||
api_base_url: Some(DEFAULT_API_BASE_URL.to_string()),
|
||||
debug_mode: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ userStatusChanged: "user-status-changed"
|
||||
/** user-defined types **/
|
||||
|
||||
export type ActiveDollSpriteChanged = string | null
|
||||
export type AppConfig = { api_base_url: string | null }
|
||||
export type AppConfig = { api_base_url: string | null; debug_mode: boolean }
|
||||
export type AppDataRefreshed = UserData
|
||||
export type AuthFlowStatus = "started" | "succeeded" | "failed" | "cancelled"
|
||||
export type AuthFlowUpdated = AuthFlowUpdatedPayload
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
let form: AppConfig = {
|
||||
api_base_url: "",
|
||||
debug_mode: false,
|
||||
};
|
||||
|
||||
let saving = false;
|
||||
@@ -16,6 +17,7 @@
|
||||
const config = await commands.getClientConfig();
|
||||
form = {
|
||||
api_base_url: config.api_base_url ?? "",
|
||||
debug_mode: config.debug_mode ?? false,
|
||||
};
|
||||
} catch (err) {
|
||||
errorMessage = `Failed to load config: ${err}`;
|
||||
@@ -53,6 +55,7 @@
|
||||
try {
|
||||
await commands.saveClientConfig({
|
||||
api_base_url: form.api_base_url?.trim() || null,
|
||||
debug_mode: form.debug_mode,
|
||||
});
|
||||
|
||||
successMessage = "Success. Restart to apply changes.";
|
||||
@@ -91,6 +94,15 @@
|
||||
placeholder="https://api.friendolls.adamcv.com"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-row items-center gap-3 cursor-pointer">
|
||||
<span class="text-sm">Debug Mode</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox checkbox-primary"
|
||||
bind:checked={form.debug_mode}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{#if errorMessage}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { cursorPositionOnScreen } from "../../events/cursor";
|
||||
import { friendsCursorPositions } from "../../events/friend-cursor";
|
||||
import { appData } from "../../events/app-data";
|
||||
@@ -17,6 +18,13 @@
|
||||
import PetMessageSend from "./components/pet-message-send.svelte";
|
||||
import type { UserBasicDto } from "$lib/bindings";
|
||||
|
||||
let debugMode = false;
|
||||
|
||||
onMount(async () => {
|
||||
const config = await commands.getClientConfig();
|
||||
debugMode = config.debug_mode;
|
||||
});
|
||||
|
||||
function getFriend(friendId: string): UserBasicDto | undefined {
|
||||
return (
|
||||
($appData?.friends ?? []).find((friend) => friend.friend?.id === friendId)
|
||||
@@ -56,14 +64,16 @@
|
||||
</Neko>
|
||||
{/if}
|
||||
{/each}
|
||||
<div id="debug-bar">
|
||||
<DebugBar
|
||||
{#if debugMode}
|
||||
<div id="debug-bar">
|
||||
<DebugBar
|
||||
isInteractive={$sceneInteractive}
|
||||
cursorPosition={$cursorPositionOnScreen}
|
||||
presenceStatus={$currentPresenceState?.presenceStatus ?? null}
|
||||
friendsCursorPositions={$friendsCursorPositions}
|
||||
friends={$appData?.friends ?? []}
|
||||
friendsPresenceStates={$friendsPresenceStates}
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user