aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/Http/Api/Static/AnnouncementsController.ts3
-rw-r--r--app/Controllers/Http/RecipeController.ts8
-rw-r--r--app/Controllers/Http/UserController.ts3
-rw-r--r--app/Models/User.ts4
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';
6export default class AnnouncementsController { 6export 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';
3import hash from '@adonisjs/core/services/hash'; 3import hash from '@adonisjs/core/services/hash';
4import emitter from '@adonisjs/core/services/emitter'; 4import emitter from '@adonisjs/core/services/emitter';
5import moment from 'moment'; 5import moment from 'moment';
6import { Encryption } from '@adonisjs/core/encryption';
7import randtoken from 'rand-token'; 6import randtoken from 'rand-token';
8import Token from './Token.js'; 7import Token from './Token.js';
9import Workspace from './Workspace.js'; 8import Workspace from './Workspace.js';
@@ -12,6 +11,7 @@ import mail from '@adonisjs/mail/services/main';
12import { url } from '#config/app'; 11import { url } from '#config/app';
13import { mailFrom } from '#config/dashboard'; 12import { mailFrom } from '#config/dashboard';
14import type { HasMany } from '@adonisjs/lucid/types/relations'; 13import type { HasMany } from '@adonisjs/lucid/types/relations';
14import encryption from '@adonisjs/core/services/encryption';
15 15
16export default class User extends BaseModel { 16export 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