6b245c628c
Add complete project scaffold for Gitpub Desktop (Tauri + Rust backend and vanilla HTML/CSS/JS frontend). Includes frontend entry (index.html), styles (base/components CSS), app logic and modules (app.js, gitea-api.js, tauri-api.js, state.js, storage.js), static assets and component READMEs, README.md, VSCode recommendations, and project config (package.json, package-lock.json). Also adds src-tauri skeleton (Cargo.toml, main.rs, lib.rs, build.rs, tauri.conf.json), application icons, and .gitignore files. Provides MVP plumbing for server setup and management, repository dashboard, local repo opening, and Git operations via Tauri invoke (clone/pull/push/status/branch).
30 lines
715 B
JavaScript
30 lines
715 B
JavaScript
const STORAGE_KEY = "gitpub-desktop-settings-v1";
|
|
|
|
export function getDefaultSettings() {
|
|
return {
|
|
theme: "dark",
|
|
gitExecutablePath: "",
|
|
defaultCloneDirectory: "",
|
|
activeServerId: null,
|
|
servers: [],
|
|
recentRepositories: [],
|
|
};
|
|
}
|
|
|
|
export function loadSettings() {
|
|
try {
|
|
const rawValue = localStorage.getItem(STORAGE_KEY);
|
|
if (!rawValue) return getDefaultSettings();
|
|
|
|
const parsed = JSON.parse(rawValue);
|
|
return { ...getDefaultSettings(), ...parsed };
|
|
} catch (error) {
|
|
console.error("Failed to load settings:", error);
|
|
return getDefaultSettings();
|
|
}
|
|
}
|
|
|
|
export function saveSettings(settings) {
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
|
|
}
|