diff options
author | 2022-04-15 02:00:25 -0700 | |
---|---|---|
committer | 2022-04-16 21:57:57 +0530 | |
commit | 210131ca184c3aa043371857c022aa1aa149efbf (patch) | |
tree | 6bc4e10a1540e55a66146c099bc468a12287425e /src/internal-server/start | |
parent | Update submodule url to ferdium-recipes (#1) (diff) | |
download | ferdium-app-210131ca184c3aa043371857c022aa1aa149efbf.tar.gz ferdium-app-210131ca184c3aa043371857c022aa1aa149efbf.tar.zst ferdium-app-210131ca184c3aa043371857c022aa1aa149efbf.zip |
Matched casing for almost all replacements
Diffstat (limited to 'src/internal-server/start')
-rw-r--r-- | src/internal-server/start/migrate.js | 16 | ||||
-rw-r--r-- | src/internal-server/start/routes.js | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/internal-server/start/migrate.js b/src/internal-server/start/migrate.js index 97cefcc54..403f7cb86 100644 --- a/src/internal-server/start/migrate.js +++ b/src/internal-server/start/migrate.js | |||
@@ -1,13 +1,13 @@ | |||
1 | const { ferdiVersion } = require('../../environment-remote'); | 1 | const { ferdiumVersion } = require('../../environment-remote'); |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Migrate server database to work with current Ferdi version | 4 | * Migrate server database to work with current Ferdium version |
5 | */ | 5 | */ |
6 | const Database = use('Database'); | 6 | const Database = use('Database'); |
7 | const User = use('App/Models/User'); | 7 | const User = use('App/Models/User'); |
8 | 8 | ||
9 | const migrateLog = text => { | 9 | const migrateLog = text => { |
10 | console.log('\u001B[36m%s\u001B[0m', 'Ferdi Migration:', '\u001B[0m', text); | 10 | console.log('\u001B[36m%s\u001B[0m', 'Ferdium Migration:', '\u001B[0m', text); |
11 | }; | 11 | }; |
12 | 12 | ||
13 | module.exports = async () => { | 13 | module.exports = async () => { |
@@ -21,7 +21,7 @@ module.exports = async () => { | |||
21 | const user = await User.find(1); | 21 | const user = await User.find(1); |
22 | let settings; | 22 | let settings; |
23 | if (!user) { | 23 | if (!user) { |
24 | migrateLog("🎩 Migrating from old Ferdi version as user doesn't exist"); | 24 | migrateLog("🎩 Migrating from old Ferdium version as user doesn't exist"); |
25 | 25 | ||
26 | // Create new user | 26 | // Create new user |
27 | await Database.raw('INSERT INTO "users" ("id") VALUES (\'1\');'); | 27 | await Database.raw('INSERT INTO "users" ("id") VALUES (\'1\');'); |
@@ -35,18 +35,18 @@ module.exports = async () => { | |||
35 | if ( | 35 | if ( |
36 | !settings || | 36 | !settings || |
37 | !settings.db_version || | 37 | !settings.db_version || |
38 | settings.db_version !== ferdiVersion | 38 | settings.db_version !== ferdiumVersion |
39 | ) { | 39 | ) { |
40 | const srcVersion = | 40 | const srcVersion = |
41 | settings && settings.db_version ? settings.db_version : '5.4.0-beta.2'; | 41 | settings && settings.db_version ? settings.db_version : '5.4.0-beta.2'; |
42 | migrateLog(`🔮 Migrating table from ${srcVersion} to ${ferdiVersion}`); | 42 | migrateLog(`🔮 Migrating table from ${srcVersion} to ${ferdiumVersion}`); |
43 | 43 | ||
44 | // Migrate database to current Ferdi version | 44 | // Migrate database to current Ferdium version |
45 | // Currently no migrations | 45 | // Currently no migrations |
46 | 46 | ||
47 | // Update version number in database | 47 | // Update version number in database |
48 | if (!settings) settings = {}; | 48 | if (!settings) settings = {}; |
49 | settings.db_version = ferdiVersion; | 49 | settings.db_version = ferdiumVersion; |
50 | const newUser = await User.find(1); // Fetch user again as we might have only just created it | 50 | const newUser = await User.find(1); // Fetch user again as we might have only just created it |
51 | newUser.settings = JSON.stringify(settings); | 51 | newUser.settings = JSON.stringify(settings); |
52 | await newUser.save(); | 52 | await newUser.save(); |
diff --git a/src/internal-server/start/routes.js b/src/internal-server/start/routes.js index c8cab2164..63d0876e3 100644 --- a/src/internal-server/start/routes.js +++ b/src/internal-server/start/routes.js | |||
@@ -14,7 +14,7 @@ const migrate = require('./migrate'); | |||
14 | 14 | ||
15 | migrate(); | 15 | migrate(); |
16 | 16 | ||
17 | const OnlyAllowFerdi = async ({ request, response }, next) => { | 17 | const OnlyAllowFerdium = async ({ request, response }, next) => { |
18 | const version = request.header('X-Franz-Version'); | 18 | const version = request.header('X-Franz-Version'); |
19 | if (!version) { | 19 | if (!version) { |
20 | return response.status(403).redirect('/'); | 20 | return response.status(403).redirect('/'); |
@@ -30,7 +30,7 @@ Route.get('health', ({ response }) => | |||
30 | api: 'success', | 30 | api: 'success', |
31 | db: 'success', | 31 | db: 'success', |
32 | }), | 32 | }), |
33 | ).middleware(OnlyAllowFerdi); | 33 | ).middleware(OnlyAllowFerdium); |
34 | 34 | ||
35 | // API is grouped under '/v1/' route | 35 | // API is grouped under '/v1/' route |
36 | Route.group(() => { | 36 | Route.group(() => { |
@@ -63,7 +63,7 @@ Route.group(() => { | |||
63 | Route.get('workspace', 'WorkspaceController.list'); | 63 | Route.get('workspace', 'WorkspaceController.list'); |
64 | }) | 64 | }) |
65 | .prefix(API_VERSION) | 65 | .prefix(API_VERSION) |
66 | .middleware(OnlyAllowFerdi); | 66 | .middleware(OnlyAllowFerdium); |
67 | 67 | ||
68 | Route.group(() => { | 68 | Route.group(() => { |
69 | Route.get('icon/:id', 'ServiceController.icon'); | 69 | Route.get('icon/:id', 'ServiceController.icon'); |
@@ -75,7 +75,7 @@ Route.get('import', ({ view }) => view.render('import')); | |||
75 | 75 | ||
76 | // Account transfer | 76 | // Account transfer |
77 | Route.get('export', 'UserController.export'); | 77 | Route.get('export', 'UserController.export'); |
78 | Route.post('transfer', 'UserController.importFerdi'); | 78 | Route.post('transfer', 'UserController.importFerdium'); |
79 | Route.get('transfer', ({ view }) => view.render('transfer')); | 79 | Route.get('transfer', ({ view }) => view.render('transfer')); |
80 | 80 | ||
81 | // Index | 81 | // Index |