Files
Termix/src/ui/api/look-api.ts
T
96b8520fb4 v26.10.5 (#1710)
* feat: add an auto or fixed columns picker to card grids

* feat: add safe mode that only runs layout and theme plugins

* docs: add simple layout to plugin table

* fix: ask for local network access in the macOS app

* feat: allow plugin registries on listed private hosts (#1705)

* chore: add private registry hosts to the changelog

* feat: use the proxy for plugin registry downloads

* fix: allow changing connection origin on shared hosts

* chore: update translations and plugin pins

* chore: lint, format, and bump version to 26.10.5

---------

Co-authored-by: Lukas <80832688+0skater0@users.noreply.github.com>
2026-10-22 13:30:48 -05:00

51 lines
1.5 KiB
TypeScript

import { authApi } from "@/main-axios";
/** A layout or theme plugin the server found but could not load. */
export interface UnavailableLook {
id: string;
version: string | null;
layouts: string[];
themes: string[];
error: string;
}
/** Everything the browser picks the layout and theme from. */
export interface LookResponse {
layoutId: string | null;
themeId: string | null;
/** Admin defaults. */
defaults: { layout: string | null; theme: string | null };
/** The default-look plugin's layout and theme. */
defaultLook: { layout: string | null; theme: string | null };
/** TERMIX_SAFE_LAYOUT is set on the server. */
safeLayout: boolean;
/** TERMIX_SAFE_MODE is set: only layout and theme plugins run. */
safeMode?: boolean;
unavailable: UnavailableLook[];
}
export async function getLook(): Promise<LookResponse> {
const response = await authApi.get("/user-preferences/look");
return response.data;
}
/** The user's own layout and theme; null follows the default. */
export async function saveUserLook(look: {
layoutId?: string | null;
themeId?: string | null;
}): Promise<void> {
await authApi.put("/user-preferences", look);
}
/** Admin only. Null clears a default. */
export async function saveDefaultLook(defaults: {
layout?: string | null;
theme?: string | null;
}): Promise<{ layout: string | null; theme: string | null }> {
const response = await authApi.put(
"/user-preferences/look/defaults",
defaults,
);
return response.data;
}