diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Controllers/Http/Api/Static/AnnouncementsController.ts | 3 | ||||
-rw-r--r-- | app/Controllers/Http/RecipeController.ts | 8 | ||||
-rw-r--r-- | app/Controllers/Http/UserController.ts | 3 | ||||
-rw-r--r-- | app/Models/User.ts | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/app/Controllers/Http/Api/Static/AnnouncementsController.ts b/app/Controllers/Http/Api/Static/AnnouncementsController.ts index 565df5e..85aed4d 100644 --- a/app/Controllers/Http/Api/Static/AnnouncementsController.ts +++ b/app/Controllers/Http/Api/Static/AnnouncementsController.ts | |||
@@ -6,7 +6,8 @@ import fs from 'fs-extra'; | |||
6 | export default class AnnouncementsController { | 6 | export default class AnnouncementsController { |
7 | public async show({ response, params }: HttpContext) { | 7 | public async show({ response, params }: HttpContext) { |
8 | const announcement = path.join( | 8 | const announcement = path.join( |
9 | app.resourcesPath(), | 9 | app.appRoot.host, |
10 | 'resources', | ||
10 | 'announcements', | 11 | 'announcements', |
11 | `${params.version}.json`, | 12 | `${params.version}.json`, |
12 | ); | 13 | ); |
diff --git a/app/Controllers/Http/RecipeController.ts b/app/Controllers/Http/RecipeController.ts index 4d01a02..fd3c57e 100644 --- a/app/Controllers/Http/RecipeController.ts +++ b/app/Controllers/Http/RecipeController.ts | |||
@@ -51,7 +51,7 @@ export default class RecipesController { | |||
51 | // List official and custom recipes | 51 | // List official and custom recipes |
52 | public async list({ response }: HttpContext) { | 52 | public async list({ response }: HttpContext) { |
53 | const officialRecipes = fs.readJsonSync( | 53 | const officialRecipes = fs.readJsonSync( |
54 | path.join(app.appRoot, 'recipes', 'all.json'), | 54 | path.join(app.appRoot.host, 'recipes', 'all.json'), |
55 | ); | 55 | ); |
56 | const customRecipesArray = await Recipe.all(); | 56 | const customRecipesArray = await Recipe.all(); |
57 | const customRecipes = customRecipesArray.map(recipe => ({ | 57 | const customRecipes = customRecipesArray.map(recipe => ({ |
@@ -113,7 +113,7 @@ export default class RecipesController { | |||
113 | // Compress files to .tar.gz file | 113 | // Compress files to .tar.gz file |
114 | const source = app.tmpPath('recipe'); | 114 | const source = app.tmpPath('recipe'); |
115 | const destination = path.join( | 115 | const destination = path.join( |
116 | app.appRoot, | 116 | app.appRoot.host, |
117 | `/recipes/archives/${data.id}.tar.gz`, | 117 | `/recipes/archives/${data.id}.tar.gz`, |
118 | ); | 118 | ); |
119 | 119 | ||
@@ -186,7 +186,7 @@ export default class RecipesController { | |||
186 | public popularRecipes({ response }: HttpContext) { | 186 | public popularRecipes({ response }: HttpContext) { |
187 | return response.send( | 187 | return response.send( |
188 | fs | 188 | fs |
189 | .readJsonSync(path.join(app.appRoot, 'recipes', 'all.json')) | 189 | .readJsonSync(path.join(app.appRoot.host, 'recipes', 'all.json')) |
190 | // eslint-disable-next-line @typescript-eslint/no-explicit-any | 190 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
191 | .filter((recipe: any) => recipe.featured), | 191 | .filter((recipe: any) => recipe.featured), |
192 | ); | 192 | ); |
@@ -197,7 +197,7 @@ export default class RecipesController { | |||
197 | const updates = []; | 197 | const updates = []; |
198 | const recipes = request.all(); | 198 | const recipes = request.all(); |
199 | const allJson = fs.readJsonSync( | 199 | const allJson = fs.readJsonSync( |
200 | path.join(app.appRoot, 'recipes', 'all.json'), | 200 | path.join(app.appRoot.host, 'recipes', 'all.json'), |
201 | ); | 201 | ); |
202 | 202 | ||
203 | for (const recipe of Object.keys(recipes)) { | 203 | for (const recipe of Object.keys(recipes)) { |
diff --git a/app/Controllers/Http/UserController.ts b/app/Controllers/Http/UserController.ts index 667786b..bcf0171 100644 --- a/app/Controllers/Http/UserController.ts +++ b/app/Controllers/Http/UserController.ts | |||
@@ -292,7 +292,8 @@ export default class UsersController { | |||
292 | 'x-franz-source': 'Web', | 292 | 'x-franz-source': 'Web', |
293 | }, | 293 | }, |
294 | }); | 294 | }); |
295 | const content = await rawResponse.json(); | 295 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
296 | const content: any = await rawResponse.json(); | ||
296 | 297 | ||
297 | if (!content.message || content.message !== 'Successfully logged in') { | 298 | if (!content.message || content.message !== 'Successfully logged in') { |
298 | const errorMessage = | 299 | const errorMessage = |
diff --git a/app/Models/User.ts b/app/Models/User.ts index 34df86f..1f10f37 100644 --- a/app/Models/User.ts +++ b/app/Models/User.ts | |||
@@ -3,7 +3,6 @@ import { BaseModel, beforeSave, column, hasMany } from '@adonisjs/lucid/orm'; | |||
3 | import hash from '@adonisjs/core/services/hash'; | 3 | import hash from '@adonisjs/core/services/hash'; |
4 | import emitter from '@adonisjs/core/services/emitter'; | 4 | import emitter from '@adonisjs/core/services/emitter'; |
5 | import moment from 'moment'; | 5 | import moment from 'moment'; |
6 | import { Encryption } from '@adonisjs/core/encryption'; | ||
7 | import randtoken from 'rand-token'; | 6 | import randtoken from 'rand-token'; |
8 | import Token from './Token.js'; | 7 | import Token from './Token.js'; |
9 | import Workspace from './Workspace.js'; | 8 | import Workspace from './Workspace.js'; |
@@ -12,6 +11,7 @@ import mail from '@adonisjs/mail/services/main'; | |||
12 | import { url } from '#config/app'; | 11 | import { url } from '#config/app'; |
13 | import { mailFrom } from '#config/dashboard'; | 12 | import { mailFrom } from '#config/dashboard'; |
14 | import type { HasMany } from '@adonisjs/lucid/types/relations'; | 13 | import type { HasMany } from '@adonisjs/lucid/types/relations'; |
14 | import encryption from '@adonisjs/core/services/encryption'; | ||
15 | 15 | ||
16 | export default class User extends BaseModel { | 16 | export default class User extends BaseModel { |
17 | @column({ isPrimary: true }) | 17 | @column({ isPrimary: true }) |
@@ -99,7 +99,7 @@ export default class User extends BaseModel { | |||
99 | return row.token; | 99 | return row.token; |
100 | } | 100 | } |
101 | 101 | ||
102 | const token = Encryption.encrypt(randtoken.generate(16)); | 102 | const token = encryption.encrypt(randtoken.generate(16)); |
103 | 103 | ||
104 | await user.related('tokens').create({ type, token }); | 104 | await user.related('tokens').create({ type, token }); |
105 | 105 | ||