mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
weird ssr
This commit is contained in:
parent
c1e699ebaf
commit
9b7e9bc7b8
@ -1,3 +1,4 @@
|
|||||||
|
import { browser } from '$app/environment';
|
||||||
function getBoolean(string: string | null, fallback: boolean) {
|
function getBoolean(string: string | null, fallback: boolean) {
|
||||||
if (string === null) {
|
if (string === null) {
|
||||||
return fallback;
|
return fallback;
|
||||||
@ -10,18 +11,25 @@ function getNumber(string: string | null, fallback: number) {
|
|||||||
}
|
}
|
||||||
return Number.parseInt(string);
|
return Number.parseInt(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const storage = browser
|
||||||
|
? localStorage
|
||||||
|
: {
|
||||||
|
getItem: () => null,
|
||||||
|
};
|
||||||
|
|
||||||
export const TUNABLES = {
|
export const TUNABLES = {
|
||||||
LAYOUT: {
|
LAYOUT: {
|
||||||
WASM: getBoolean(localStorage.getItem('LAYOUT.WASM'), false),
|
WASM: getBoolean(storage.getItem('LAYOUT.WASM'), false),
|
||||||
},
|
},
|
||||||
TIMELINE: {
|
TIMELINE: {
|
||||||
INTERSECTION_EXPAND_TOP: getNumber(localStorage.getItem('TIMELINE_INTERSECTION_EXPAND_TOP'), 500),
|
INTERSECTION_EXPAND_TOP: getNumber(storage.getItem('TIMELINE_INTERSECTION_EXPAND_TOP'), 500),
|
||||||
INTERSECTION_EXPAND_BOTTOM: getNumber(localStorage.getItem('TIMELINE_INTERSECTION_EXPAND_BOTTOM'), 500),
|
INTERSECTION_EXPAND_BOTTOM: getNumber(storage.getItem('TIMELINE_INTERSECTION_EXPAND_BOTTOM'), 500),
|
||||||
},
|
},
|
||||||
ASSET_GRID: {
|
ASSET_GRID: {
|
||||||
NAVIGATE_ON_ASSET_IN_VIEW: getBoolean(localStorage.getItem('ASSET_GRID.NAVIGATE_ON_ASSET_IN_VIEW'), false),
|
NAVIGATE_ON_ASSET_IN_VIEW: getBoolean(storage.getItem('ASSET_GRID.NAVIGATE_ON_ASSET_IN_VIEW'), false),
|
||||||
},
|
},
|
||||||
IMAGE_THUMBNAIL: {
|
IMAGE_THUMBNAIL: {
|
||||||
THUMBHASH_FADE_DURATION: getNumber(localStorage.getItem('THUMBHASH_FADE_DURATION'), 150),
|
THUMBHASH_FADE_DURATION: getNumber(storage.getItem('THUMBHASH_FADE_DURATION'), 150),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user