1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-02 17:35:17 +02:00
This commit is contained in:
François Darveau 2022-04-15 14:40:47 -04:00
commit 4c827d2c91
85 changed files with 1657 additions and 568 deletions

View file

@ -1,6 +1,6 @@
class Logger {
log(message, level = 'INFO') {
console.log(`[${this.generateTimestamp()}] [${level}] ${message}`)
console.log(`[${this.generateTimestamp()}] [${level}] ${message}`);
}
generateTimestamp() {
@ -20,7 +20,9 @@ class Logger {
// Timezone
const tz = -d.getTimezoneOffset() / 60;
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}.${miliseconds} UTC${tz >= 0 ? '+' + tz : tz}`;
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}.${miliseconds} UTC${
tz >= 0 ? '+' + tz : tz
}`;
}
parseDate(date, ms = false) {
@ -36,4 +38,4 @@ class Logger {
}
}
module.exports = Logger;
module.exports = Logger;

View file

@ -1,11 +1,13 @@
const initConfig = require('./initConfig');
const initFiles = require('./initFiles');
const initDockerSecrets = require('./initDockerSecrets');
const normalizeTheme = require('./normalizeTheme');
const initApp = async () => {
initDockerSecrets();
await initFiles();
await initConfig();
await normalizeTheme();
};
module.exports = initApp;

View file

@ -17,6 +17,7 @@
"hideEmptyCategories": true,
"hideSearch": false,
"defaultSearchProvider": "l",
"secondarySearchProvider": "d",
"dockerApps": false,
"dockerHost": "localhost",
"kubernetesApps": false,

View file

@ -27,6 +27,166 @@
"queries": []
},
"isJSON": true
},
{
"name": "themes.json",
"msg": {
"created": "Created default theme file",
"found": "Found theme file"
},
"paths": {
"src": "../../data",
"dest": "../../data"
},
"template": {
"themes": [
{
"name": "blackboard",
"colors": {
"background": "#1a1a1a",
"primary": "#FFFDEA",
"accent": "#5c5c5c"
},
"isCustom": false
},
{
"name": "gazette",
"colors": {
"background": "#F2F7FF",
"primary": "#000000",
"accent": "#5c5c5c"
},
"isCustom": false
},
{
"name": "espresso",
"colors": {
"background": "#21211F",
"primary": "#D1B59A",
"accent": "#4E4E4E"
},
"isCustom": false
},
{
"name": "cab",
"colors": {
"background": "#F6D305",
"primary": "#1F1F1F",
"accent": "#424242"
},
"isCustom": false
},
{
"name": "cloud",
"colors": {
"background": "#f1f2f0",
"primary": "#35342f",
"accent": "#37bbe4"
},
"isCustom": false
},
{
"name": "lime",
"colors": {
"background": "#263238",
"primary": "#AABBC3",
"accent": "#aeea00"
},
"isCustom": false
},
{
"name": "white",
"colors": {
"background": "#ffffff",
"primary": "#222222",
"accent": "#dddddd"
},
"isCustom": false
},
{
"name": "tron",
"colors": {
"background": "#242B33",
"primary": "#EFFBFF",
"accent": "#6EE2FF"
},
"isCustom": false
},
{
"name": "blues",
"colors": {
"background": "#2B2C56",
"primary": "#EFF1FC",
"accent": "#6677EB"
},
"isCustom": false
},
{
"name": "passion",
"colors": {
"background": "#f5f5f5",
"primary": "#12005e",
"accent": "#8e24aa"
},
"isCustom": false
},
{
"name": "chalk",
"colors": {
"background": "#263238",
"primary": "#AABBC3",
"accent": "#FF869A"
},
"isCustom": false
},
{
"name": "paper",
"colors": {
"background": "#F8F6F1",
"primary": "#4C432E",
"accent": "#AA9A73"
},
"isCustom": false
},
{
"name": "neon",
"colors": {
"background": "#091833",
"primary": "#EFFBFF",
"accent": "#ea00d9"
},
"isCustom": false
},
{
"name": "pumpkin",
"colors": {
"background": "#2d3436",
"primary": "#EFFBFF",
"accent": "#ffa500"
},
"isCustom": false
},
{
"name": "onedark",
"colors": {
"background": "#282c34",
"primary": "#dfd9d6",
"accent": "#98c379"
},
"isCustom": false
},
{
"name": "mint",
"colors": {
"background": "#282525",
"primary": "#d9d9d9",
"accent": "#50fbc2"
},
"isCustom": false
}
]
},
"isJSON": true
}
]
}

View file

@ -0,0 +1,28 @@
const { readFile, writeFile } = require('fs/promises');
const normalizeTheme = async () => {
// open main config file
const configFile = await readFile('data/config.json', 'utf8');
const config = JSON.parse(configFile);
// open default themes file
const themesFile = await readFile('utils/init/themes.json', 'utf8');
const { themes } = JSON.parse(themesFile);
// find theme
const theme = themes.find((t) => t.name === config.defaultTheme);
if (theme) {
// save theme in new format
// PAB - primary;accent;background
const { primary: p, accent: a, background: b } = theme.colors;
const normalizedTheme = `${p};${a};${b}`;
await writeFile(
'data/config.json',
JSON.stringify({ ...config, defaultTheme: normalizedTheme })
);
}
};
module.exports = normalizeTheme;

148
utils/init/themes.json Normal file
View file

@ -0,0 +1,148 @@
{
"themes": [
{
"name": "blackboard",
"colors": {
"background": "#1a1a1a",
"primary": "#FFFDEA",
"accent": "#5c5c5c"
},
"isCustom": false
},
{
"name": "gazette",
"colors": {
"background": "#F2F7FF",
"primary": "#000000",
"accent": "#5c5c5c"
},
"isCustom": false
},
{
"name": "espresso",
"colors": {
"background": "#21211F",
"primary": "#D1B59A",
"accent": "#4E4E4E"
},
"isCustom": false
},
{
"name": "cab",
"colors": {
"background": "#F6D305",
"primary": "#1F1F1F",
"accent": "#424242"
},
"isCustom": false
},
{
"name": "cloud",
"colors": {
"background": "#f1f2f0",
"primary": "#35342f",
"accent": "#37bbe4"
},
"isCustom": false
},
{
"name": "lime",
"colors": {
"background": "#263238",
"primary": "#AABBC3",
"accent": "#aeea00"
},
"isCustom": false
},
{
"name": "white",
"colors": {
"background": "#ffffff",
"primary": "#222222",
"accent": "#dddddd"
},
"isCustom": false
},
{
"name": "tron",
"colors": {
"background": "#242B33",
"primary": "#EFFBFF",
"accent": "#6EE2FF"
},
"isCustom": false
},
{
"name": "blues",
"colors": {
"background": "#2B2C56",
"primary": "#EFF1FC",
"accent": "#6677EB"
},
"isCustom": false
},
{
"name": "passion",
"colors": {
"background": "#f5f5f5",
"primary": "#12005e",
"accent": "#8e24aa"
},
"isCustom": false
},
{
"name": "chalk",
"colors": {
"background": "#263238",
"primary": "#AABBC3",
"accent": "#FF869A"
},
"isCustom": false
},
{
"name": "paper",
"colors": {
"background": "#F8F6F1",
"primary": "#4C432E",
"accent": "#AA9A73"
},
"isCustom": false
},
{
"name": "neon",
"colors": {
"background": "#091833",
"primary": "#EFFBFF",
"accent": "#ea00d9"
},
"isCustom": false
},
{
"name": "pumpkin",
"colors": {
"background": "#2d3436",
"primary": "#EFFBFF",
"accent": "#ffa500"
},
"isCustom": false
},
{
"name": "onedark",
"colors": {
"background": "#282c34",
"primary": "#dfd9d6",
"accent": "#98c379"
},
"isCustom": false
},
{
"name": "mint",
"colors": {
"background": "#282525",
"primary": "#d9d9d9",
"accent": "#50fbc2"
},
"isCustom": false
}
]
}