aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-05-19 11:28:09 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-05-19 12:03:29 +0530
commit9a93be2752ec81ed1f634adbb63aef2d1c5272de (patch)
tree53cacbc4670ba017a7533ca9d378d98dea3bf629 /app
parentAdded husky pre-commit hook to run linter (diff)
downloadferdium-server-9a93be2752ec81ed1f634adbb63aef2d1c5272de.tar.gz
ferdium-server-9a93be2752ec81ed1f634adbb63aef2d1c5272de.tar.zst
ferdium-server-9a93be2752ec81ed1f634adbb63aef2d1c5272de.zip
Applied linter fixes.
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/Http/DashboardController.js11
-rw-r--r--app/Controllers/Http/ServiceController.js1
-rw-r--r--app/Controllers/Http/StaticController.js9
-rw-r--r--app/Controllers/Http/UserController.js11
-rw-r--r--app/Controllers/Http/WorkspaceController.js3
-rw-r--r--app/Middleware/HandleDoubleSlash.js6
-rw-r--r--app/Models/Token.js2
7 files changed, 24 insertions, 19 deletions
diff --git a/app/Controllers/Http/DashboardController.js b/app/Controllers/Http/DashboardController.js
index 2f06961..a588c75 100644
--- a/app/Controllers/Http/DashboardController.js
+++ b/app/Controllers/Http/DashboardController.js
@@ -63,7 +63,8 @@ class DashboardController {
63 } 63 }
64 try { 64 try {
65 await Persona.forgotPassword(request.input('mail')); 65 await Persona.forgotPassword(request.input('mail'));
66 } catch(e) {} 66 // eslint-disable-next-line no-empty
67 } catch (e) {}
67 68
68 return view.render('others.message', { 69 return view.render('others.message', {
69 heading: 'Reset password', 70 heading: 'Reset password',
@@ -91,11 +92,11 @@ class DashboardController {
91 const payload = { 92 const payload = {
92 password: crypto.createHash('sha256').update(request.input('password')).digest('base64'), 93 password: crypto.createHash('sha256').update(request.input('password')).digest('base64'),
93 password_confirmation: crypto.createHash('sha256').update(request.input('password_confirmation')).digest('base64'), 94 password_confirmation: crypto.createHash('sha256').update(request.input('password_confirmation')).digest('base64'),
94 } 95 };
95 96
96 try { 97 try {
97 await Persona.updatePasswordByToken(request.input('token'), payload); 98 await Persona.updatePasswordByToken(request.input('token'), payload);
98 } catch(e) { 99 } catch (e) {
99 return view.render('others.message', { 100 return view.render('others.message', {
100 heading: 'Cannot reset your password', 101 heading: 'Cannot reset your password',
101 text: 'Please make sure you are using a valid and recent link to reset your password and that your passwords entered match.', 102 text: 'Please make sure you are using a valid and recent link to reset your password and that your passwords entered match.',
@@ -122,7 +123,7 @@ class DashboardController {
122 return view.render('dashboard.account', { 123 return view.render('dashboard.account', {
123 username: auth.user.username, 124 username: auth.user.username,
124 email: auth.user.email, 125 email: auth.user.email,
125 lastname: auth.user.lastname 126 lastname: auth.user.lastname,
126 }); 127 });
127 } 128 }
128 129
@@ -136,7 +137,7 @@ class DashboardController {
136 let validation = await validateAll(request.all(), { 137 let validation = await validateAll(request.all(), {
137 username: 'required', 138 username: 'required',
138 email: 'required', 139 email: 'required',
139 lastname: 'required' 140 lastname: 'required',
140 }); 141 });
141 if (validation.fails()) { 142 if (validation.fails()) {
142 session.withErrors(validation.messages()).flashExcept(['password']); 143 session.withErrors(validation.messages()).flashExcept(['password']);
diff --git a/app/Controllers/Http/ServiceController.js b/app/Controllers/Http/ServiceController.js
index a1d26cb..05d093b 100644
--- a/app/Controllers/Http/ServiceController.js
+++ b/app/Controllers/Http/ServiceController.js
@@ -140,6 +140,7 @@ class ServiceController {
140 let iconId; 140 let iconId;
141 do { 141 do {
142 iconId = uuid() + uuid(); 142 iconId = uuid() + uuid();
143 // eslint-disable-next-line no-await-in-loop
143 } while (await fs.exists(path.join(Helpers.tmpPath('uploads'), iconId))); 144 } while (await fs.exists(path.join(Helpers.tmpPath('uploads'), iconId)));
144 145
145 await icon.move(Helpers.tmpPath('uploads'), { 146 await icon.move(Helpers.tmpPath('uploads'), {
diff --git a/app/Controllers/Http/StaticController.js b/app/Controllers/Http/StaticController.js
index d1a1179..114e369 100644
--- a/app/Controllers/Http/StaticController.js
+++ b/app/Controllers/Http/StaticController.js
@@ -34,7 +34,6 @@ class StaticController {
34 defaultTrialPlan: 'franz-pro-yearly', 34 defaultTrialPlan: 'franz-pro-yearly',
35 subscribeURL: 'https://getferdi.com', 35 subscribeURL: 'https://getferdi.com',
36 planSelectionURL: 'https://getferdi.com', 36 planSelectionURL: 'https://getferdi.com',
37 isMagicBarEnabled: true,
38 hasInlineCheckout: true, 37 hasInlineCheckout: true,
39 isPlanSelectionEnabled: false, 38 isPlanSelectionEnabled: false,
40 isTrialStatusBarEnabled: false, 39 isTrialStatusBarEnabled: false,
@@ -101,9 +100,11 @@ class StaticController {
101 }) { 100 }) {
102 return response.send( 101 return response.send(
103 fs 102 fs
104 .readJsonSync(path.join( 103 .readJsonSync(path.join(
105 Helpers.appRoot(), "officialrecipes", "recipes", "all.json")) 104 Helpers.appRoot(), 'officialrecipes', 'recipes', 'all.json',
106 .filter((recipe) => recipe.featured)); 105 ))
106 .filter((recipe) => recipe.featured),
107 );
107 } 108 }
108 109
109 // Show announcements 110 // Show announcements
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js
index e19e15e..0d768a9 100644
--- a/app/Controllers/Http/UserController.js
+++ b/app/Controllers/Http/UserController.js
@@ -177,6 +177,7 @@ class UserController {
177 ...request.all(), 177 ...request.all(),
178 }; 178 };
179 179
180 // eslint-disable-next-line no-param-reassign
180 auth.user.settings = JSON.stringify(newSettings); 181 auth.user.settings = JSON.stringify(newSettings);
181 await auth.user.save(); 182 await auth.user.save();
182 183
@@ -249,7 +250,7 @@ class UserController {
249 email, 250 email,
250 password: hashedPassword, 251 password: hashedPassword,
251 username: 'Franz', 252 username: 'Franz',
252 lastname: 'Franz' 253 lastname: 'Franz',
253 }); 254 });
254 255
255 return response.send('Your account has been created but due to this server\'s configuration, we could not import your Franz account data.\n\nIf you are the server owner, please set CONNECT_WITH_FRANZ to true to enable account imports.'); 256 return response.send('Your account has been created but due to this server\'s configuration, we could not import your Franz account data.\n\nIf you are the server owner, please set CONNECT_WITH_FRANZ to true to enable account imports.');
@@ -263,7 +264,7 @@ class UserController {
263 try { 264 try {
264 const basicToken = btoa(`${email}:${hashedPassword}`); 265 const basicToken = btoa(`${email}:${hashedPassword}`);
265 const loginBody = { 266 const loginBody = {
266 isZendeskLogin: false 267 isZendeskLogin: false,
267 }; 268 };
268 269
269 const rawResponse = await fetch(`${base}auth/login`, { 270 const rawResponse = await fetch(`${base}auth/login`, {
@@ -273,8 +274,8 @@ class UserController {
273 Authorization: `Basic ${basicToken}`, 274 Authorization: `Basic ${basicToken}`,
274 'User-Agent': userAgent, 275 'User-Agent': userAgent,
275 'Content-Type': 'application/json', 276 'Content-Type': 'application/json',
276 'accept': '*/*', 277 accept: '*/*',
277 'x-franz-source': 'Web' 278 'x-franz-source': 'Web',
278 }, 279 },
279 }); 280 });
280 const content = await rawResponse.json(); 281 const content = await rawResponse.json();
@@ -312,7 +313,7 @@ class UserController {
312 email: userInf.email, 313 email: userInf.email,
313 password: hashedPassword, 314 password: hashedPassword,
314 username: userInf.firstname, 315 username: userInf.firstname,
315 lastname: userInf.lastname 316 lastname: userInf.lastname,
316 }); 317 });
317 } catch (e) { 318 } catch (e) {
318 const errorMessage = `Could not create your user in our system.\nError: ${e}`; 319 const errorMessage = `Could not create your user in our system.\nError: ${e}`;
diff --git a/app/Controllers/Http/WorkspaceController.js b/app/Controllers/Http/WorkspaceController.js
index cbb6873..496912e 100644
--- a/app/Controllers/Http/WorkspaceController.js
+++ b/app/Controllers/Http/WorkspaceController.js
@@ -112,7 +112,8 @@ class WorkspaceController {
112 } 112 }
113 113
114 async delete({ 114 async delete({
115 request, 115 // eslint-disable-next-line no-unused-vars
116 _request,
116 response, 117 response,
117 auth, 118 auth,
118 params, 119 params,
diff --git a/app/Middleware/HandleDoubleSlash.js b/app/Middleware/HandleDoubleSlash.js
index 456b774..c4bc053 100644
--- a/app/Middleware/HandleDoubleSlash.js
+++ b/app/Middleware/HandleDoubleSlash.js
@@ -1,4 +1,3 @@
1'use strict'
2/** @typedef {import('@adonisjs/framework/src/Request')} Request */ 1/** @typedef {import('@adonisjs/framework/src/Request')} Request */
3/** @typedef {import('@adonisjs/framework/src/Response')} Response */ 2/** @typedef {import('@adonisjs/framework/src/Response')} Response */
4/** @typedef {import('@adonisjs/framework/src/View')} View */ 3/** @typedef {import('@adonisjs/framework/src/View')} View */
@@ -9,7 +8,8 @@ class HandleDoubleSlash {
9 * @param {Request} ctx.request 8 * @param {Request} ctx.request
10 * @param {Function} next 9 * @param {Function} next
11 */ 10 */
12 async handle ({ request, response }, next) { 11 // eslint-disable-next-line consistent-return
12 async handle({ request, response }, next) {
13 // Redirect requests that contain duplicate slashes to the right path 13 // Redirect requests that contain duplicate slashes to the right path
14 if (request.url().includes('//')) { 14 if (request.url().includes('//')) {
15 return response.redirect( 15 return response.redirect(
@@ -21,4 +21,4 @@ class HandleDoubleSlash {
21 } 21 }
22} 22}
23 23
24module.exports = HandleDoubleSlash 24module.exports = HandleDoubleSlash;
diff --git a/app/Models/Token.js b/app/Models/Token.js
index 50bcf1d..4a6c286 100644
--- a/app/Models/Token.js
+++ b/app/Models/Token.js
@@ -4,7 +4,7 @@ const Model = use('Model');
4 4
5class Token extends Model { 5class Token extends Model {
6 user() { 6 user() {
7 return this.belongsTo('App/Models/User') 7 return this.belongsTo('App/Models/User');
8 } 8 }
9} 9}
10 10