feat(files): MAX_VERSIONS_KEPT statt zweier Konstanten
Die Zahl stand doppelt im Quelltext: als const im Backend und noch einmal im Verlaufs-Dialog, verbunden nur durch den Kommentar "muss zu maxVersionsKept im Backend passen". Ein Satz ist keine Zusicherung - beim ersten Aendern haette der Dialog eine andere Zahl genannt als die, die der Server anwendet. Jetzt eine .env-Variable (Vorgabe 5), die der Server ueber /api/v1/public/config mitliefert. Werte unter 1 werden verworfen: Die Zahl geht als OFFSET in die Aufraeumabfrage, und OFFSET 0 loeschte jede Fassung - aus "keine Grenze" wuerde "kein Verlauf". Gemessen: MAX_VERSIONS_KEPT=3, Datei siebenmal ueberschrieben, uebrig bleiben v6, v5, v4 bei aktueller v7. Dazu ein README-Abschnitt "Versionen" - Standard aus, warum das so ist, Kontingent, und dass jedes Strg+S in Office eine Fassung anlegt. Bisher stand zu alldem nichts im README. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7fc8bb51d5
commit
ebff565367
10 files changed
+119
-14
No files matched your search
@@ -24,12 +24,16 @@ interface AppSettingsValue {
|
||||
globalColors: { primary?: string; accent?: string }
|
||||
/** Gibt es einen Office-Server? Steuert nur, ob der Menuepunkt erscheint. */
|
||||
officeEnabled: boolean
|
||||
/** Wie viele frühere Fassungen der Server aufhebt. Kommt vom Server, damit
|
||||
* der Dialog nicht eine andere Zahl nennt als die, die angewendet wird. */
|
||||
maxVersionsKept: number
|
||||
refresh: () => Promise<void>
|
||||
}
|
||||
|
||||
const Ctx = createContext<AppSettingsValue>({
|
||||
cloudName: 'Aether',
|
||||
officeEnabled: false,
|
||||
maxVersionsKept: 5,
|
||||
logoUrl: '',
|
||||
faviconUrl: '',
|
||||
appIconUrl: '',
|
||||
@@ -84,6 +88,7 @@ export function AppSettingsProvider({ children }: { children: ReactNode }) {
|
||||
const [appIconUrl, setAppIconUrl] = useState('')
|
||||
const [globalColors, setGlobalColors] = useState<{ primary?: string; accent?: string }>({})
|
||||
const [officeEnabled, setOfficeEnabled] = useState(false)
|
||||
const [maxVersionsKept, setMaxVersionsKept] = useState(5)
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
try {
|
||||
@@ -95,6 +100,9 @@ export function AppSettingsProvider({ children }: { children: ReactNode }) {
|
||||
applyFavicon(cfg.favicon_url ?? '', cfg.apple_touch_icon_url ?? '')
|
||||
setGlobalColors({ primary: cfg.primary_color, accent: cfg.accent_color })
|
||||
setOfficeEnabled(!!cfg.office_enabled)
|
||||
if (typeof cfg.max_versions_kept === 'number' && cfg.max_versions_kept > 0) {
|
||||
setMaxVersionsKept(cfg.max_versions_kept)
|
||||
}
|
||||
applyTheme(cfg.primary_color, cfg.accent_color)
|
||||
applyThemeColor(cfg.primary_color)
|
||||
document.title = cfg.cloud_name || 'Aether'
|
||||
@@ -106,7 +114,7 @@ export function AppSettingsProvider({ children }: { children: ReactNode }) {
|
||||
useEffect(() => { void refresh() }, [refresh])
|
||||
|
||||
return (
|
||||
<Ctx.Provider value={{ cloudName, logoUrl, faviconUrl, appIconUrl, globalColors, officeEnabled, refresh }}>{children}</Ctx.Provider>
|
||||
<Ctx.Provider value={{ cloudName, logoUrl, faviconUrl, appIconUrl, globalColors, officeEnabled, maxVersionsKept, refresh }}>{children}</Ctx.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user