diff --git a/README.md b/README.md index 50905e2..74da10b 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,13 @@ Flame is self-hosted startpage for your server. Its design is inspired (heavily) by [SUI](https://github.com/jeroenpardon/sui). Flame is very easy to setup and use. With built-in editors, it allows you to setup your very own application hub in no time - no file editing necessary. ## Functionality -📝 Create, update, delete your applications and bookmarks directly from the app using built-in GUI editors - -📌 Pin your favorite items to the homescreen for quick and easy access - -🔍 Integrated search bar with local filtering, 11 web search providers and ability to add your own - -🔑 Authentication system to protect your settings, apps and bookmarks - -🔨 Dozens of option to customize Flame interface to your needs, including support for custom CSS and 15 built-in color themes - -☀️ Weather widget with current temperature, cloud coverage and animated weather status - -🐳 Docker integration to automatically pick and add apps based on their labels +- 📝 Create, update, delete your applications and bookmarks directly from the app using built-in GUI editors +- 📌 Pin your favorite items to the homescreen for quick and easy access +- 🔍 Integrated search bar with local filtering, 11 web search providers and ability to add your own +- 🔑 Authentication system to protect your settings, apps and bookmarks +- 🔨 Dozens of option to customize Flame interface to your needs, including support for custom CSS and 15 built-in color themes +- ☀️ Weather widget with current temperature, cloud coverage and animated weather status +- 🐳 Docker integration to automatically pick and add apps based on their labels ## Installation @@ -55,7 +49,7 @@ docker buildx build \ ```sh # run container -docker run -p 5005:5005 -v /path/to/data:/app/data flame +docker run -p 5005:5005 -v /path/to/data:/app/data -e PASSWORD=flame_password flame ``` #### Docker-Compose @@ -124,7 +118,7 @@ npm run dev ![Settings screenshot](.github/settings.png) -![Themes screenshot](.github/_themes.png) +![Themes screenshot](.github/themes.png) ## Usage diff --git a/db/index.js b/db/index.js index 500a261..8b65c68 100644 --- a/db/index.js +++ b/db/index.js @@ -1,8 +1,9 @@ const { Sequelize } = require('sequelize'); const { join } = require('path'); const Umzug = require('umzug'); -const backupDB = require('./utils/backupDb'); +// Utils +const backupDB = require('./utils/backupDb'); const Logger = require('../utils/Logger'); const logger = new Logger(); @@ -28,15 +29,16 @@ const connectDB = async () => { backupDB(); await sequelize.authenticate(); - logger.log('Connected to database'); - // migrations + // execute all pending migrations const pendingMigrations = await umzug.pending(); if (pendingMigrations.length > 0) { logger.log('Executing pending migrations'); await umzug.up(); } + + logger.log('Connected to database'); } catch (error) { logger.log(`Unable to connect to the database: ${error.message}`, 'ERROR'); process.exit(1); diff --git a/db/utils/backupDb.js b/db/utils/backupDb.js index 572679b..cb615e9 100644 --- a/db/utils/backupDb.js +++ b/db/utils/backupDb.js @@ -1,12 +1,12 @@ const fs = require('fs'); +const { slugify } = require('./slugify'); const backupDB = () => { if (!fs.existsSync('data/db_backups')) { fs.mkdirSync('data/db_backups'); } - const version = process.env.VERSION; - const slug = `db-${version.replace(/\./g, '')}-backup.sqlite`; + const slug = slugify(); const srcPath = 'data/db.sqlite'; const destPath = `data/db_backups/${slug}`; diff --git a/db/utils/slugify.js b/db/utils/slugify.js new file mode 100644 index 0000000..0f50dcd --- /dev/null +++ b/db/utils/slugify.js @@ -0,0 +1,19 @@ +const slugify = () => { + const version = process.env.VERSION; + const slug = `db-${version.replace(/\./g, '')}-backup.sqlite`; + return slug; +}; + +const parseSlug = (slug) => { + const parts = slug.split('-'); + const version = { + raw: parts[1], + parsed: parts[1].split('').join('.'), + }; + return version; +}; + +module.exports = { + slugify, + parseSlug, +}; diff --git a/server.js b/server.js index 5c1d0fa..c6f25f9 100644 --- a/server.js +++ b/server.js @@ -20,9 +20,9 @@ const logger = new Logger(); const PORT = process.env.PORT || 5005; // Init app + await initApp(); await connectDB(); await associateModels(); - await initApp(); // Create server for Express API and WebSockets const server = http.createServer();