robosats/frontend/src/models/Settings.model.ts
+shyfire131 3bd7ade298 Fix lnproxy support and add lnproxy relays workflow (#586)
* Use new lnproxy API

- Use POST instead of GET, so create and send a body parameter
- Path is /spec/ instead of /api/, and list of relays from lnproxy will contain /spec already, so path parameter for ApiClient.post() is an empty string

* add lnproxy sync workflow

* Use new lnproxy JSON structure

* Remove virtualenv

doing this so that the “scripts” subfolder in .github/workflows can be added

* Move workflow script to subfolder

* Add translation support

Locale strings not added yet

* Simplify coordinator updates, automatic migrations and collect statics (#583)

* Delete commited proto files

* Run sync workflow weekly instead of hourly

* Tweak display name for relays

* Update sync script to be append-only

* Use new naming convention for relays

* Fix bitcoinNetwork hydration

* PR Feedback

- Change hook deps from settings.network to settings
- routing_msat param updates for lnproxy API

* Actually set host in settings

* Updated parsing of LnProxy response

---------

Co-authored-by: +shyfire131 <shyfire131@shyfire131.net>
Co-authored-by: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com>
Co-authored-by: Reckless_Satoshi <reckless.satoshi@protonmail.com>
2023-05-18 11:14:11 +00:00

63 lines
1.6 KiB
TypeScript

import i18n from '../i18n/Web';
import { systemClient } from '../services/System';
import { getHost } from '../utils';
import type Coordinator from './Coordinator.model';
export type Language =
| 'en'
| 'es'
| 'ru'
| 'de'
| 'pl'
| 'fr'
| 'ca'
| 'it'
| 'pt'
| 'eu'
| 'cs'
| 'th'
| 'pl'
| 'sv'
| 'zh-SI'
| 'zh-TR';
class BaseSettings {
constructor() {
const modeCookie: 'light' | 'dark' | '' = systemClient.getItem('settings_mode');
this.mode =
modeCookie !== ''
? modeCookie
: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light';
this.lightQRs = systemClient.getItem('settings_light_qr') === 'true';
const languageCookie = systemClient.getItem('settings_language');
this.language =
languageCookie !== ''
? languageCookie
: i18n.resolvedLanguage == null
? 'en'
: i18n.resolvedLanguage.substring(0, 2);
const networkCookie = systemClient.getItem('settings_network');
this.network = networkCookie !== '' ? networkCookie : 'mainnet';
this.host = getHost();
}
public frontend: 'basic' | 'pro' = 'basic';
public mode: 'light' | 'dark' = 'light';
public fontSize: number = 14;
public lightQRs: boolean = false;
public language?: Language;
public freezeViewports: boolean = false;
public network: 'mainnet' | 'testnet' = 'mainnet';
public coordinator: Coordinator | undefined = undefined;
public host?: string;
public unsafeClient: boolean = false;
public selfhostedClient: boolean = false;
}
export default BaseSettings;