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