mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-28 09:48:14 -07:00
GPS feature webapp side: GPS mode selector, fixed mode lat/lon, API endpoint. Merging with Wifi client and webdav features
This commit is contained in:
committed by
Will Greenberg
parent
ac33ebaf53
commit
c107314194
@@ -46,6 +46,9 @@ export interface Config {
|
||||
firewall_restrict_outbound: boolean;
|
||||
firewall_allowed_ports: number[] | null;
|
||||
webdav: WebdavConfig;
|
||||
gps_mode: number;
|
||||
gps_fixed_latitude: number | null;
|
||||
gps_fixed_longitude: number | null;
|
||||
}
|
||||
|
||||
export interface WifiStatus {
|
||||
@@ -153,3 +156,20 @@ export interface TimeResponse {
|
||||
export async function get_daemon_time(): Promise<TimeResponse> {
|
||||
return JSON.parse(await req('GET', '/api/time'));
|
||||
}
|
||||
|
||||
export interface GpsData {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export async function get_gps(): Promise<GpsData | null> {
|
||||
const response = await fetch('/api/gps');
|
||||
if (response.status === 404) {
|
||||
return null;
|
||||
}
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
return response.json();
|
||||
}
|
||||
throw new Error(await response.text());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user