mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-03 03:33:34 -07:00
requests addressed, better error handling, more logging, small text corrections
This commit is contained in:
committed by
Will Greenberg
parent
ba78c7bd01
commit
5a4a3034be
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { type ReportMetadata } from '$lib/analysis.svelte';
|
||||
import type { ManifestEntry } from '$lib/manifest.svelte';
|
||||
import { GpsMode } from '$lib/utils.svelte';
|
||||
import { AnalysisManager } from '$lib/analysisManager.svelte';
|
||||
import AnalysisTable from './AnalysisTable.svelte';
|
||||
import ReAnalyzeButton from './ReAnalyzeButton.svelte';
|
||||
@@ -72,7 +73,7 @@
|
||||
{/if}
|
||||
<p>
|
||||
<b>GPS Mode:</b>
|
||||
{(entry.gps_mode ?? 0) === 0 ? 'Disabled' : entry.gps_mode === 1 ? 'Fixed coordinates' : 'API endpoint'}
|
||||
{(entry.gps_mode ?? GpsMode.Disabled) === GpsMode.Disabled ? 'Disabled' : entry.gps_mode === GpsMode.Fixed ? 'Fixed coordinates' : 'API endpoint'}
|
||||
</p>
|
||||
</div>
|
||||
{#if metadata && metadata.analyzers}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
test_notification,
|
||||
get_wifi_status,
|
||||
scan_wifi_networks,
|
||||
GpsMode,
|
||||
type Config,
|
||||
type WifiStatus,
|
||||
type WifiNetwork,
|
||||
@@ -785,21 +786,21 @@
|
||||
<div>
|
||||
<label for="gps_mode" class="block text-sm font-medium text-gray-700 mb-1">GPS Mode</label>
|
||||
<select id="gps_mode" bind:value={config.gps_mode} class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-rayhunter-blue">
|
||||
<option value={0}>Disabled</option>
|
||||
<option value={1}>Fixed coordinates</option>
|
||||
<option value={2}>API endpoint</option>
|
||||
<option value={GpsMode.Disabled}>Disabled</option>
|
||||
<option value={GpsMode.Fixed}>Fixed coordinates</option>
|
||||
<option value={GpsMode.Api}>API endpoint</option>
|
||||
</select>
|
||||
<p class="text-xs text-gray-500 mt-1">
|
||||
{#if config.gps_mode === 2}
|
||||
{#if config.gps_mode === GpsMode.Api}
|
||||
POST latitude, longitude, and timestamp to <code>/api/gps</code> from any device on the network.
|
||||
{:else if config.gps_mode === 1}
|
||||
{:else if config.gps_mode === GpsMode.Fixed}
|
||||
GPS coordinates are fixed to the values below.
|
||||
{:else}
|
||||
GPS is disabled; no coordinates will be tracked.
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
{#if config.gps_mode === 1}
|
||||
{#if config.gps_mode === GpsMode.Fixed}
|
||||
<div>
|
||||
<label for="gps_fixed_latitude" class="block text-sm font-medium text-gray-700 mb-1">Fixed Latitude</label>
|
||||
<input id="gps_fixed_latitude" type="number" min="-90" max="90" step="any" required
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { ManifestEntry } from '$lib/manifest.svelte';
|
||||
import { GpsMode } from '$lib/utils.svelte';
|
||||
import { AnalysisManager } from '$lib/analysisManager.svelte';
|
||||
import DownloadLink from '$lib/components/DownloadLink.svelte';
|
||||
import DeleteButton from '$lib/components/DeleteButton.svelte';
|
||||
@@ -88,7 +89,7 @@
|
||||
{/if}
|
||||
{#if entry.gps_mode !== undefined}
|
||||
<div class="text-sm text-gray-500">
|
||||
GPS: {entry.gps_mode === 0 ? 'Disabled' : entry.gps_mode === 1 ? 'Fixed coordinates' : 'API endpoint'}
|
||||
GPS: {entry.gps_mode === GpsMode.Disabled ? 'Disabled' : entry.gps_mode === GpsMode.Fixed ? 'Fixed coordinates' : 'API endpoint'}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-row justify-between lg:justify-end gap-1 mt-2 overflow-x-auto">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { get_report, type AnalysisReport } from './analysis.svelte';
|
||||
import { AnalysisStatus, type AnalysisManager } from './analysisManager.svelte';
|
||||
import { GpsMode } from './utils.svelte';
|
||||
|
||||
interface JsonManifest {
|
||||
entries: JsonManifestEntry[];
|
||||
@@ -13,7 +14,7 @@ interface JsonManifestEntry {
|
||||
qmdl_size_bytes: number;
|
||||
stop_reason: string | null;
|
||||
upload_time: string | null;
|
||||
gps_mode: number | null;
|
||||
gps_mode: GpsMode | null;
|
||||
}
|
||||
|
||||
export class Manifest {
|
||||
@@ -62,7 +63,7 @@ export class ManifestEntry {
|
||||
public analysis_report: AnalysisReport | string | undefined = $state(undefined);
|
||||
public stop_reason: string | undefined = $state(undefined);
|
||||
public upload_time: Date | undefined = $state(undefined);
|
||||
public gps_mode: number | undefined = $state(undefined);
|
||||
public gps_mode: GpsMode | undefined = $state(undefined);
|
||||
|
||||
constructor(json: JsonManifestEntry) {
|
||||
this.name = json.name;
|
||||
|
||||
@@ -28,6 +28,13 @@ export interface WebdavConfig {
|
||||
delete_on_upload: boolean;
|
||||
}
|
||||
|
||||
export enum GpsMode {
|
||||
Disabled = 0,
|
||||
Fixed = 1,
|
||||
Api = 2,
|
||||
}
|
||||
|
||||
|
||||
export interface Config {
|
||||
device: string;
|
||||
ui_level: number;
|
||||
@@ -46,7 +53,7 @@ export interface Config {
|
||||
firewall_restrict_outbound: boolean;
|
||||
firewall_allowed_ports: number[] | null;
|
||||
webdav: WebdavConfig;
|
||||
gps_mode: number;
|
||||
gps_mode: GpsMode;
|
||||
gps_fixed_latitude: number | null;
|
||||
gps_fixed_longitude: number | null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { ManifestEntry } from '$lib/manifest.svelte';
|
||||
import { get_manifest, get_system_stats, get_gps, get_config, type GpsData } from '$lib/utils.svelte';
|
||||
import { get_manifest, get_system_stats, get_gps, get_config, GpsMode, type GpsData } from '$lib/utils.svelte';
|
||||
import ManifestTable from '$lib/components/ManifestTable.svelte';
|
||||
import Card from '$lib/components/ManifestCard.svelte';
|
||||
import type { SystemStats } from '$lib/systemStats';
|
||||
@@ -23,7 +23,7 @@
|
||||
let logview_shown: boolean = $state(false);
|
||||
let config_shown: boolean = $state(false);
|
||||
let gps_data: GpsData | null = $state(null);
|
||||
let gps_mode: number = $state(0);
|
||||
let gps_mode: GpsMode = $state(GpsMode.Disabled);
|
||||
$effect(() => {
|
||||
get_config().then((c) => {
|
||||
gps_mode = c.gps_mode;
|
||||
@@ -290,7 +290,7 @@
|
||||
{/if}
|
||||
<SystemStatsTable stats={system_stats!} />
|
||||
</div>
|
||||
{#if gps_mode !== 0}
|
||||
{#if gps_mode !== GpsMode.Disabled}
|
||||
<div class="bg-white border border-gray-200 drop-shadow rounded-md p-4 flex flex-col gap-2">
|
||||
<span class="text-lg font-semibold flex flex-row items-center gap-2">
|
||||
<svg class="w-5 h-5 text-rayhunter-blue" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
||||
|
||||
Reference in New Issue
Block a user