diff --git a/bin/web/src/lib/components/ConfigForm.svelte b/bin/web/src/lib/components/ConfigForm.svelte new file mode 100644 index 0000000..d8b8c59 --- /dev/null +++ b/bin/web/src/lib/components/ConfigForm.svelte @@ -0,0 +1,279 @@ + + +
+ + + {#if showConfig} + {#if loading} +
Loading config...
+ {:else if config} +
{ e.preventDefault(); saveConfig(); }}> +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+

Analyzer Settings

+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+ + + +
+
+ + {#if message} +
+ {message} +
+ {/if} + {:else} +
+ Failed to load configuration. Please try reloading the page. +
+ {/if} + {/if} +
\ No newline at end of file diff --git a/bin/web/src/lib/utils.svelte.ts b/bin/web/src/lib/utils.svelte.ts index a720b08..30a379a 100644 --- a/bin/web/src/lib/utils.svelte.ts +++ b/bin/web/src/lib/utils.svelte.ts @@ -1,6 +1,24 @@ import { Manifest } from "./manifest.svelte"; import type { SystemStats } from "./systemStats"; +export interface AnalyzerConfig { + imsi_requested: boolean; + connection_redirect_2g_downgrade: boolean; + lte_sib6_and_7_downgrade: boolean; + null_cipher: boolean; +} + +export interface Config { + qmdl_store_path: string; + port: number; + debug_mode: boolean; + ui_level: number; + enable_dummy_analyzer: boolean; + colorblind_mode: boolean; + key_input_mode: number; + analyzers: AnalyzerConfig; +} + export async function req(method: string, url: string): Promise { const response = await fetch(url, { method: method, @@ -21,3 +39,22 @@ export async function get_manifest(): Promise { export async function get_system_stats(): Promise { return JSON.parse(await req('GET', '/api/system-stats')); } + +export async function get_config(): Promise { + return JSON.parse(await req('GET', '/api/config')); +} + +export async function set_config(config: Config): Promise { + const response = await fetch('/api/config', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(config) + }); + + if (!response.ok) { + const error = await response.text(); + throw new Error(error); + } +} diff --git a/bin/web/src/routes/+page.svelte b/bin/web/src/routes/+page.svelte index f924909..2d78f6c 100644 --- a/bin/web/src/routes/+page.svelte +++ b/bin/web/src/routes/+page.svelte @@ -8,6 +8,7 @@ import SystemStatsTable from "$lib/components/SystemStatsTable.svelte"; import DeleteAllButton from "$lib/components/DeleteAllButton.svelte"; import RecordingControls from "$lib/components//RecordingControls.svelte"; + import ConfigForm from "$lib/components/ConfigForm.svelte"; let manager: AnalysisManager = new AnalysisManager(); let loaded = $state(false); @@ -75,6 +76,7 @@ + {:else}