mirror of
https://github.com/YuzuZensai/Termix.git
synced 2026-11-12 09:37:05 +00:00
* 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>
51 lines
1.5 KiB
TypeScript
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;
|
|
}
|