separated web and api, build improvements

wip:
- separate web and api servers.
- script for building static pages.
- building improvements.
- async localisation preloading.
This commit is contained in:
wukko
2023-05-19 16:13:38 +06:00
parent fa4e418e36
commit 4d369170ff
13 changed files with 315 additions and 26 deletions

View File

@@ -7,16 +7,13 @@ const locPath = './src/localization/languages';
let loc = {}
let languages = [];
export function loadLoc() {
fs.readdir(locPath, (err, files) => {
if (err) return false;
files.forEach(file => {
loc[file.split('.')[0]] = loadJson(`${locPath}/${file}`);
languages.push(file.split('.')[0])
});
})
export async function loadLoc() {
const files = await fs.promises.readdir(locPath).catch((e) => { return [] });
files.forEach(file => {
loc[file.split('.')[0]] = loadJson(`${locPath}/${file}`);
languages.push(file.split('.')[0])
});
}
loadLoc();
export function replaceBase(s) {
return s.replace(/\n/g, '<br/>').replace(/{saveToGalleryShortcut}/g, links.saveToGalleryShortcut).replace(/{appName}/g, appName).replace(/{repo}/g, repo).replace(/\*;/g, "&bull;");