Remove uploading css functionality. Themes are hard-coded. Change the code
This commit is contained in:
+10
-49
@@ -84,45 +84,20 @@ export class ApiError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export type ColorScheme =
|
||||
| 'light'
|
||||
| 'dark'
|
||||
| 'system'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'blue'
|
||||
| 'yellow'
|
||||
| 'pink'
|
||||
| 'orange'
|
||||
| 'light_green'
|
||||
| 'light_red'
|
||||
| 'light_blue'
|
||||
| 'light_yellow'
|
||||
| 'light_pink'
|
||||
| 'light_orange'
|
||||
/** Name of a theme embedded in this build (see `GET /api/themes`), or `"system"` to follow the OS light/dark preference. */
|
||||
export type Theme = string
|
||||
|
||||
export interface Settings {
|
||||
color_scheme: ColorScheme
|
||||
theme: Theme
|
||||
active_profile: string | null
|
||||
/** Maximum ingested logs kept in memory; `null` means unlimited. */
|
||||
max_logs: number | null
|
||||
/** Id of the selected custom theme entry, or `null` if `color_scheme` alone applies. */
|
||||
custom_theme_id: string | null
|
||||
/** Ntfy topic every alert rule delivers to; `null` until configured. */
|
||||
ntfy_topic: string | null
|
||||
/** Ntfy server override; `null` means `https://ntfy.sh`. */
|
||||
ntfy_server: string | null
|
||||
}
|
||||
|
||||
export type CssEntryKind = 'imported' | 'linked'
|
||||
|
||||
export interface CssEntry {
|
||||
id: string
|
||||
kind: CssEntryKind
|
||||
filename: string | null
|
||||
path_or_url: string | null
|
||||
}
|
||||
|
||||
export interface ProfileSummary {
|
||||
name: string
|
||||
param_count: number
|
||||
@@ -352,42 +327,28 @@ export function fetchSettings(): Promise<Settings> {
|
||||
}
|
||||
|
||||
export function updateSettings(update: {
|
||||
colorScheme?: ColorScheme
|
||||
theme?: Theme
|
||||
/** Omit to leave unchanged; `null` clears the cap back to unlimited. */
|
||||
maxLogs?: number | null
|
||||
/** Omit to leave unchanged; `null` clears the selection (falls back to `colorScheme`). */
|
||||
customThemeId?: string | null
|
||||
/** Omit to leave unchanged; `null` clears the configured topic. */
|
||||
ntfyTopic?: string | null
|
||||
/** Omit to leave unchanged; `null` falls back to `https://ntfy.sh`. */
|
||||
ntfyServer?: string | null
|
||||
}): Promise<Settings> {
|
||||
const body: Record<string, unknown> = { color_scheme: update.colorScheme }
|
||||
const body: Record<string, unknown> = { theme: update.theme }
|
||||
if ('maxLogs' in update) body.max_logs = update.maxLogs
|
||||
if ('customThemeId' in update) body.custom_theme_id = update.customThemeId
|
||||
if ('ntfyTopic' in update) body.ntfy_topic = update.ntfyTopic
|
||||
if ('ntfyServer' in update) body.ntfy_server = update.ntfyServer
|
||||
return sendJson('/api/settings', 'PATCH', body)
|
||||
}
|
||||
|
||||
export function fetchCssEntries(): Promise<CssEntry[]> {
|
||||
return getJson('/api/settings/css')
|
||||
/** Names of the themes embedded in this build (see `themes/` at the repo root). */
|
||||
export function fetchThemes(): Promise<string[]> {
|
||||
return getJson('/api/themes')
|
||||
}
|
||||
|
||||
export function importCss(filename: string, content: string): Promise<CssEntry> {
|
||||
return sendJson('/api/settings/css', 'POST', { filename, content })
|
||||
}
|
||||
|
||||
export function linkCss(pathOrUrl: string): Promise<CssEntry> {
|
||||
return sendJson('/api/settings/css/link', 'POST', { path_or_url: pathOrUrl })
|
||||
}
|
||||
|
||||
export function deleteCssEntry(id: string): Promise<void> {
|
||||
return sendJson(`/api/settings/css/${encodeURIComponent(id)}`, 'DELETE')
|
||||
}
|
||||
|
||||
export function cssContentUrl(id: string): string {
|
||||
return `/api/settings/css/${encodeURIComponent(id)}/content`
|
||||
export function themeCssUrl(name: string): string {
|
||||
return `/api/themes/${encodeURIComponent(name)}`
|
||||
}
|
||||
|
||||
export function fetchProfiles(): Promise<ProfileSummary[]> {
|
||||
|
||||
Reference in New Issue
Block a user