mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat: shell controller, TabStage, layout and theme plugins with repair view
This commit is contained in:
1 parent
aff29a9581
commit
86161d66e2
120 files changed
+23693
-3381
No files matched your search
@@ -0,0 +1,48 @@
|
||||
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;
|
||||
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;
|
||||
}
|
||||
Reference in new issue
Block a user