5htp-core 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/client/assets/css/components/button.less +47 -44
- package/src/client/assets/css/components/card.less +43 -21
- package/src/client/assets/css/components/components.less +25 -0
- package/src/client/assets/css/components/lists.less +30 -15
- package/src/client/assets/css/components/other.less +9 -5
- package/src/client/assets/css/core.less +1 -0
- package/src/client/assets/css/layouts.less +25 -10
- package/src/client/assets/css/medias.less +3 -1
- package/src/client/assets/css/spacing.less +2 -1
- package/src/client/assets/css/text/icons.less +1 -1
- package/src/client/assets/css/text/text.less +17 -11
- package/src/client/assets/css/text/titres.less +5 -5
- package/src/client/assets/css/theme.less +15 -13
- package/src/client/components/Dialog/card.tsx +1 -1
- package/src/client/components/Dialog/index.less +4 -3
- package/src/client/components/Form/index.tsx +2 -2
- package/src/client/components/Select/index.tsx +58 -0
- package/src/client/components/button.tsx +1 -1
- package/src/client/components/chart/base.tsx +1 -1
- package/src/client/components/containers/Scrollbar/index.less +1 -1
- package/src/client/components/containers/tabs/index.tsx +2 -2
- package/src/client/components/data/progressbar/circular/index.tsx +1 -1
- package/src/client/components/data/progressbar/index.less +5 -3
- package/src/client/components/data/progressbar/index.tsx +3 -3
- package/src/client/components/dropdown/index.tsx +12 -21
- package/src/client/components/input/BaseV2/index.less +4 -3
- package/src/client/components/input/BaseV2/index.tsx +4 -2
- package/src/client/components/input/Slider/index.less +1 -1
- package/src/client/components/input/UploadImage/index.less +1 -1
- package/src/client/context/index.ts +45 -41
- package/src/client/router/component.tsx +1 -0
- package/src/client/router/index.tsx +10 -3
- package/src/client/router/request/index.ts +0 -0
- package/src/common/data/input/validate.ts +2 -2
- package/src/common/data/input/validators/basic.ts +18 -18
- package/src/common/data/input/validators/build.ts +2 -2
- package/src/common/data/number/percentage.ts +4 -2
- package/src/common/errors/index.ts +17 -13
- package/src/common/router/index.ts +1 -1
- package/src/server/app/index.ts +70 -17
- package/src/server/data/Cache.ts +10 -4
- package/src/server/data/Token.olg.ts +2 -2
- package/src/server/data/aes.ts +2 -2
- package/src/server/patch.ts +0 -11
- package/src/server/routes/auth.ts +6 -0
- package/src/server/services/auth/base.ts +20 -12
- package/src/server/services/console/bugReporter.ts +31 -27
- package/src/server/services/console/html.ts +0 -0
- package/src/server/services/console/index.ts +1 -1
- package/src/server/services/cron/index.ts +2 -2
- package/src/server/services/database/index.ts +9 -11
- package/src/server/services/email/index.ts +2 -5
- package/src/server/services/router/index.ts +2 -2
- package/src/server/services/router/request/index.ts +1 -1
- package/src/server/services/router/request/services/auth.ts +5 -5
- package/src/server/services/router/request/services/detect.ts +4 -4
- package/src/server/services/router/request/services/tracking.ts +2 -2
- package/src/server/services/router/response/index.ts +3 -3
- package/src/server/services/socket/index.ts +1 -1
|
@@ -174,7 +174,7 @@ export default class ServerRequest extends BaseRequest {
|
|
|
174
174
|
|
|
175
175
|
console.log("Validate request data:", this.data);
|
|
176
176
|
|
|
177
|
-
// Les
|
|
177
|
+
// Les InputError seront propagées vers le middleware dédié à la gestion des erreurs
|
|
178
178
|
const { valeurs } = await validerSchema(
|
|
179
179
|
schema,
|
|
180
180
|
this.data,
|
|
@@ -9,7 +9,7 @@ import jwt from 'jsonwebtoken';
|
|
|
9
9
|
|
|
10
10
|
// Cre
|
|
11
11
|
import app, { $ } from '@server/app';
|
|
12
|
-
import {
|
|
12
|
+
import { InputError, AuthRequired, Forbidden } from '@common/errors';
|
|
13
13
|
import { TUserRole } from '@common/models';
|
|
14
14
|
|
|
15
15
|
/*----------------------------------
|
|
@@ -70,7 +70,7 @@ export default class AuthService {
|
|
|
70
70
|
// Une erreur s'affichera à chaque tentatove de login
|
|
71
71
|
if (user.banned) {
|
|
72
72
|
req.res.clearCookie('authorization');
|
|
73
|
-
throw new
|
|
73
|
+
throw new Forbidden("Your account has been suspended. If you think it's a mistake, please contact me: contact@gaetan-legac.fr.");
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
}
|
|
@@ -111,7 +111,7 @@ export default class AuthService {
|
|
|
111
111
|
if (role === false) {
|
|
112
112
|
|
|
113
113
|
if (user !== null)
|
|
114
|
-
throw new
|
|
114
|
+
throw new InputError("You're already logged in.");
|
|
115
115
|
|
|
116
116
|
} else if (role === 'DEV' && (process.env.environnement === 'local' || (user && user.roles.includes('ADMIN')))) {
|
|
117
117
|
|
|
@@ -121,13 +121,13 @@ export default class AuthService {
|
|
|
121
121
|
|
|
122
122
|
console.warn("Refusé pour anonyme (" + this.request.ip + ")");
|
|
123
123
|
|
|
124
|
-
throw new
|
|
124
|
+
throw new AuthRequired(motivation);
|
|
125
125
|
|
|
126
126
|
} else if (!user.roles.includes(role)) {
|
|
127
127
|
|
|
128
128
|
console.warn("Refusé: " + role + " pour " + user.name + " (" + (user.roles ? user.roles.join(', ') : 'role inconnu') + ")");
|
|
129
129
|
|
|
130
|
-
throw new
|
|
130
|
+
throw new Forbidden("You do not have sufficient permissions to access this resource.");
|
|
131
131
|
|
|
132
132
|
} else {
|
|
133
133
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import express from 'express';
|
|
7
7
|
|
|
8
8
|
// Core
|
|
9
|
-
import {
|
|
9
|
+
import { Forbidden } from '@common/errors';
|
|
10
10
|
import request from '@server/data/ApiClient';
|
|
11
11
|
import ServerRequest from '..';
|
|
12
12
|
import TrackerService from './tracking';
|
|
@@ -54,7 +54,7 @@ export default class ProtectService {
|
|
|
54
54
|
// If IP Address already used by another account
|
|
55
55
|
/*const username = whitelist || this.request.user?.name;
|
|
56
56
|
if (ip.user_name !== undefined && ip.user_name !== null && (username === undefined || username !== ip.user_name))
|
|
57
|
-
throw new
|
|
57
|
+
throw new Forbidden(`
|
|
58
58
|
I noticed you're trying to use multiple accounts.
|
|
59
59
|
Only one account is allowed per IP address.
|
|
60
60
|
If you think I'm wrong, please contact me at contact@gaetan-legac.fr and I will solve the problem.
|
|
@@ -90,7 +90,7 @@ export default class ProtectService {
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
if (!token)
|
|
93
|
-
throw new
|
|
93
|
+
throw new Forbidden("Le captcha n'a pas été complété.");
|
|
94
94
|
|
|
95
95
|
const res = await request.post('https://www.google.com/recaptcha/api/siteverify', {}, {
|
|
96
96
|
params: {
|
|
@@ -105,7 +105,7 @@ export default class ProtectService {
|
|
|
105
105
|
|
|
106
106
|
const ok = res.success || false;
|
|
107
107
|
|
|
108
|
-
if (!ok) throw new
|
|
108
|
+
if (!ok) throw new Forbidden("Le captcha est incorrect");
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
}
|
|
@@ -9,7 +9,7 @@ import got from 'got';
|
|
|
9
9
|
|
|
10
10
|
// Core
|
|
11
11
|
import { arrayToObj } from '@common/data/tableaux';
|
|
12
|
-
import {
|
|
12
|
+
import { Forbidden } from '@common/errors';
|
|
13
13
|
import requete from '@server/data/ApiClient';
|
|
14
14
|
import app, { $ } from '@server/app';
|
|
15
15
|
|
|
@@ -183,7 +183,7 @@ export default class TrackerService {
|
|
|
183
183
|
|
|
184
184
|
// Déjà banni
|
|
185
185
|
if (ip.banned)
|
|
186
|
-
throw new
|
|
186
|
+
throw new Forbidden(`Banned for the following reason: ` + ip.banReason);
|
|
187
187
|
|
|
188
188
|
// Données expirées
|
|
189
189
|
const tempsDepuisDerniereMaj = dayjs().diff(ip.dateMaj, 'day');
|
|
@@ -13,7 +13,7 @@ import express from 'express';
|
|
|
13
13
|
|
|
14
14
|
// Core
|
|
15
15
|
import { $ } from '@server/app';
|
|
16
|
-
import {
|
|
16
|
+
import { NotFound, Forbidden } from '@common/errors';
|
|
17
17
|
|
|
18
18
|
// Libs métier
|
|
19
19
|
import * as render from '../../../libs/pages/render';
|
|
@@ -174,7 +174,7 @@ export default class ServerResponse<TData extends TResponseData = TResponseData>
|
|
|
174
174
|
|
|
175
175
|
// Securité
|
|
176
176
|
if (fichier.includes('..'))
|
|
177
|
-
throw new
|
|
177
|
+
throw new Forbidden("Disallowed");
|
|
178
178
|
|
|
179
179
|
// Force absolute path
|
|
180
180
|
if (!fichier.startsWith( app.path.root ))
|
|
@@ -187,7 +187,7 @@ export default class ServerResponse<TData extends TResponseData = TResponseData>
|
|
|
187
187
|
// Verif existance
|
|
188
188
|
if (!fs.existsSync(fichier)) {
|
|
189
189
|
console.log("File " + fichier + " was not found.");
|
|
190
|
-
throw new
|
|
190
|
+
throw new NotFound();
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// envoi fichier
|