681efe95af
* fix: release workflow * feat: move mostly to internal tasks system * feat: migrate object clean to new task system * fix: release not getting good base version * chore: set version v0.3.0 * chore: style * feat: basic task concurrency * feat: temp pages to fill in page links * feat: inital i18n support * feat: localize store page * chore: style * fix: weblate doesn't like multifile thing * fix: update nuxt * feat: improved error logging * fix: using old task api * feat: basic translation docs * feat: add i18n eslint plugin * feat: translate store and auth pages * feat: more translation progress * feat: admin dash i18n progress * feat: enable update check by default in prod * fix: using wrong i18n keys * fix: crash in library sources page * feat: finish i18n work * fix: missing i18n translations * feat: use twemoji for emojis * feat: sanatize object ids * fix: EmojiText's alt text * fix: UserWidget not using links * feat: cache and auth for emoji api * fix: add more missing translations
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
class SystemConfig {
|
|
private libraryFolder = process.env.LIBRARY ?? "./.data/library";
|
|
private dataFolder = process.env.DATA ?? "./.data/data";
|
|
|
|
private dropVersion;
|
|
private gitRef;
|
|
|
|
private checkForUpdates = getUpdateCheckConfig();
|
|
|
|
constructor() {
|
|
// get drop version and git ref from nuxt config
|
|
const config = useRuntimeConfig();
|
|
this.dropVersion = config.dropVersion;
|
|
this.gitRef = config.gitRef;
|
|
}
|
|
|
|
getLibraryFolder() {
|
|
return this.libraryFolder;
|
|
}
|
|
|
|
getDataFolder() {
|
|
return this.dataFolder;
|
|
}
|
|
|
|
getDropVersion() {
|
|
return this.dropVersion;
|
|
}
|
|
|
|
getGitRef() {
|
|
return this.gitRef;
|
|
}
|
|
|
|
shouldCheckForUpdates() {
|
|
return this.checkForUpdates;
|
|
}
|
|
}
|
|
|
|
export const systemConfig = new SystemConfig();
|
|
|
|
/**
|
|
* Gets the configuration for checking updates based on various conditions
|
|
* @returns true if updates should be checked, false otherwise.
|
|
*/
|
|
function getUpdateCheckConfig(): boolean {
|
|
const envCheckUpdates = process.env.CHECK_FOR_UPDATES;
|
|
|
|
// Check environment variable
|
|
if (envCheckUpdates !== undefined) {
|
|
// if explicitly set to true or false, return that value
|
|
if (envCheckUpdates.toLocaleLowerCase() === "true") {
|
|
return true;
|
|
} else if (envCheckUpdates.toLocaleLowerCase() === "false") {
|
|
return false;
|
|
}
|
|
} else if (process.env.NODE_ENV === "production") {
|
|
// default to true in production
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|