mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 18:34:09 +00:00
style(server): format the files the health lanes added or moved
Prettier on every new or moved file that was not formatted, so lint:format holds them; the files taken off the format baseline are the ones that moved or were formatted on the way.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { z } from 'zod';
|
||||
import { readEnv } from '../../app-config';
|
||||
import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* The instance-wide settings (`app_settings`) the server reads by name, in one
|
||||
* typed register.
|
||||
@@ -51,10 +52,25 @@ export const APP_SETTINGS = {
|
||||
allow_registration: { schema: flag, default: 'true', adminForm: true },
|
||||
allowed_file_types: { schema: text, default: null, adminForm: true },
|
||||
require_mfa: { schema: flag, default: 'false', adminForm: true, publicConfig: true },
|
||||
smtp_host: { schema: text, default: null, env: (e) => e.smtp.host, adminForm: true, managedLocked: true, publicConfig: true },
|
||||
smtp_host: {
|
||||
schema: text,
|
||||
default: null,
|
||||
env: (e) => e.smtp.host,
|
||||
adminForm: true,
|
||||
managedLocked: true,
|
||||
publicConfig: true,
|
||||
},
|
||||
smtp_port: { schema: intText, default: null, env: (e) => e.smtp.port, adminForm: true, managedLocked: true },
|
||||
smtp_user: { schema: text, default: null, env: (e) => e.smtp.user, adminForm: true, managedLocked: true },
|
||||
smtp_pass: { schema: text, default: null, env: (e) => e.smtp.pass, adminForm: true, masked: true, encrypted: 'always', managedLocked: true },
|
||||
smtp_pass: {
|
||||
schema: text,
|
||||
default: null,
|
||||
env: (e) => e.smtp.pass,
|
||||
adminForm: true,
|
||||
masked: true,
|
||||
encrypted: 'always',
|
||||
managedLocked: true,
|
||||
},
|
||||
smtp_from: { schema: text, default: null, env: (e) => e.smtp.from, adminForm: true, managedLocked: true },
|
||||
smtp_skip_tls_verify: { schema: flag, default: 'false', adminForm: true, managedLocked: true },
|
||||
notification_channels: { schema: text, default: null, adminForm: true, publicConfig: true },
|
||||
@@ -101,7 +117,8 @@ export const APP_SETTINGS = {
|
||||
export type AppSettingKey = keyof typeof APP_SETTINGS;
|
||||
|
||||
const ENTRIES = Object.entries(APP_SETTINGS) as Array<[AppSettingKey, AppSettingDef]>;
|
||||
const keysWhere = (pick: (def: AppSettingDef) => unknown): AppSettingKey[] => ENTRIES.filter(([, def]) => pick(def)).map(([key]) => key);
|
||||
const keysWhere = (pick: (def: AppSettingDef) => unknown): AppSettingKey[] =>
|
||||
ENTRIES.filter(([, def]) => pick(def)).map(([key]) => key);
|
||||
|
||||
/** The admin settings form's keys, in the order its answer has always listed them. */
|
||||
export const ADMIN_FORM_SETTING_KEYS: readonly AppSettingKey[] = keysWhere((d) => d.adminForm);
|
||||
|
||||
@@ -15,6 +15,5 @@ export const GOOGLE_SHORT_HOSTS = ['goo.gl', 'maps.app.goo.gl'];
|
||||
* `google.evil.com` is not a Google host.
|
||||
*/
|
||||
export function isGoogleMapsHost(hostname: string): boolean {
|
||||
return GOOGLE_SHORT_HOSTS.includes(hostname)
|
||||
|| /^(www\.|maps\.)?google\.[a-z]{2,3}(\.[a-z]{2})?$/.test(hostname);
|
||||
return GOOGLE_SHORT_HOSTS.includes(hostname) || /^(www\.|maps\.)?google\.[a-z]{2,3}(\.[a-z]{2})?$/.test(hostname);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TRANSIT_PROVIDERS, type TransitProvider } from '@trek/shared';
|
||||
import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';
|
||||
import { TRANSIT_PROVIDERS, type TransitProvider } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* Which backend answers /api/transit (#1699), stored as one `app_settings` row.
|
||||
@@ -34,7 +34,10 @@ export async function readTransitProvider(appSettings: AppSettingsRepository): P
|
||||
return isTransitProvider(value) ? value : DEFAULT_TRANSIT_PROVIDER;
|
||||
}
|
||||
|
||||
export async function writeTransitProvider(appSettings: AppSettingsRepository, provider: TransitProvider): Promise<TransitProvider> {
|
||||
export async function writeTransitProvider(
|
||||
appSettings: AppSettingsRepository,
|
||||
provider: TransitProvider,
|
||||
): Promise<TransitProvider> {
|
||||
await appSettings.setValue(TRANSIT_PROVIDER_SETTING, provider);
|
||||
return provider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user