Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • add_route_assignments
  • ask-user-to-delete-exercises-on-duplicates
  • bedran_exercise-list
  • jw_sonar
  • jw_sonar_backup
  • main
  • update-dependencies
  • v6.0.0
  • 2.0.0
  • 2.1.0
  • 2.2.0
  • 3.0.0
  • 3.0.1
  • 3.1.0
  • 3.1.1
  • 3.1.2
  • 3.1.3
  • 3.2.0
  • 3.3.0
  • 3.4.0
  • 3.4.1
  • 3.4.2
  • 3.5.0
  • 3.5.1
  • 3.5.2
  • 3.5.3
  • 4.0.0
  • 4.1.0
  • 5.0.0
  • 5.0.1
  • 6.0.0-dev
  • v1.0.1
32 results

Target

Select target project
  • Dojo_Project_Nguyen/backend/dojobackendapi
  • dojo_project/projects/backend/dojobackendapi
2 results
Select Git revision
  • add_route_assignments
  • ask-user-to-delete-exercises-on-duplicates
  • bedran_exercise-list
  • jw_sonar
  • jw_sonar_backup
  • main
  • update-dependencies
  • v6.0.0
  • 2.0.0
  • 2.1.0
  • 2.2.0
  • 3.0.0
  • 3.0.1
  • 3.1.0
  • 3.1.1
  • 3.1.2
  • 3.1.3
  • 3.2.0
  • 3.3.0
  • 3.4.0
  • 3.4.1
  • 3.4.2
  • 3.5.0
  • 3.5.1
  • 3.5.2
  • 3.5.3
  • 4.0.0
  • 4.1.0
  • 5.0.0
  • 5.0.1
  • 6.0.0-dev
  • v1.0.1
32 results
Show changes
Commits on Source (2)
...@@ -18,7 +18,16 @@ ...@@ -18,7 +18,16 @@
--> -->
## 4.0.0 (???) ## 4.1.0 (Upcoming)
### ✨ Feature
- Add features related to corrige (commentary, commit specific link / update, delete link)
### 🎨 Interface
- Ask for confirmation before creating an exercise that already exists
## 4.0.0 (2024-04-19)
### ✨ Feature ### ✨ Feature
- Add features related to corrige (commentary, commit specific link / update, delete link) - Add features related to corrige (commentary, commit specific link / update, delete link)
......
...@@ -20,5 +20,6 @@ export default tseslint.config({ ...@@ -20,5 +20,6 @@ export default tseslint.config({
'@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/require-await': 'off', '@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-template-expressions': 'off', '@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-floating-promises': 'off',
} }
}); });
\ No newline at end of file
{ {
"name": "dojo_backend_api", "name": "dojo_backend_api",
"version": "4.0.0", "version": "4.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dojo_backend_api", "name": "dojo_backend_api",
"version": "4.0.0", "version": "4.1.0",
"license": "AGPLv3", "license": "AGPLv3",
"dependencies": { "dependencies": {
"@dotenvx/dotenvx": "^0.27.1", "@dotenvx/dotenvx": "^0.27.1",
......
{ {
"name" : "dojo_backend_api", "name" : "dojo_backend_api",
"description" : "Backend API of the Dojo project", "description" : "Backend API of the Dojo project",
"version" : "4.0.0", "version" : "4.1.0",
"license" : "AGPLv3", "license" : "AGPLv3",
"author" : "Michaël Minelli <dojo@minelli.me>", "author" : "Michaël Minelli <dojo@minelli.me>",
"main" : "dist/src/app.js", "main" : "dist/src/app.js",
......
...@@ -66,8 +66,8 @@ class Session { ...@@ -66,8 +66,8 @@ class Session {
*/ */
sendResponse(res: express.Response | undefined, code: number, data?: unknown, descriptionOverride?: string, internalCode?: number) { sendResponse(res: express.Response | undefined, code: number, data?: unknown, descriptionOverride?: string, internalCode?: number) {
if ( res ) { if ( res ) {
void Promise.resolve(data).then((toReturn: unknown) => { Promise.resolve(data).then((toReturn: unknown) => {
void this.getResponse(internalCode ?? code, toReturn, descriptionOverride).then(response => { this.getResponse(internalCode ?? code, toReturn, descriptionOverride).then(response => {
res.status(code).json(response); res.status(code).json(response);
}); });
}); });
......
...@@ -46,7 +46,7 @@ class API implements WorkerTask { ...@@ -46,7 +46,7 @@ class API implements WorkerTask {
this.backend.use(compression()); //Compress responses this.backend.use(compression()); //Compress responses
this.backend.use((_req, res, next) => { this.backend.use((_req, res, next) => {
void DojoCliVersionHelper.getLatestVersion().then((latestVersion) => { DojoCliVersionHelper.getLatestVersion().then(latestVersion => {
res.header('dojocli-latest-version', latestVersion); res.header('dojocli-latest-version', latestVersion);
next(); next();
}); });
......
...@@ -62,7 +62,7 @@ class DojoValidators { ...@@ -62,7 +62,7 @@ class DojoValidators {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const template = this.getParamValue(req, path) as string; const template = this.getParamValue(req, path) as string;
if ( template ) { if ( template ) {
void GitlabManager.checkTemplateAccess(template, req).then(templateAccess => { GitlabManager.checkTemplateAccess(template, req).then(templateAccess => {
templateAccess ? resolve(true) : reject(); templateAccess ? resolve(true) : reject();
}); });
} }
......
...@@ -11,7 +11,7 @@ type GetFunction = (id: string | number, ...args: Array<unknown>) => Promise<unk ...@@ -11,7 +11,7 @@ type GetFunction = (id: string | number, ...args: Array<unknown>) => Promise<unk
class ParamsCallbackManager { class ParamsCallbackManager {
protected listenParam(paramName: string, backend: Express, getFunction: GetFunction, args: Array<unknown>, indexName: string) { protected listenParam(paramName: string, backend: Express, getFunction: GetFunction, args: Array<unknown>, indexName: string) {
backend.param(paramName, (req: express.Request, res: express.Response, next: express.NextFunction, id: string | number) => { backend.param(paramName, (req: express.Request, res: express.Response, next: express.NextFunction, id: string | number) => {
void getFunction(id, ...args).then(result => { getFunction(id, ...args).then(result => {
if ( result ) { if ( result ) {
this.initBoundParams(req); this.initBoundParams(req);
(req.boundParams as Record<string, unknown>)[indexName] = result; (req.boundParams as Record<string, unknown>)[indexName] = result;
......
...@@ -10,7 +10,7 @@ class ParamsValidatorMiddleware { ...@@ -10,7 +10,7 @@ class ParamsValidatorMiddleware {
validations = ExpressValidator.checkSchema(validations); validations = ExpressValidator.checkSchema(validations);
} }
void Promise.all(validations.map(validation => validation.run(req))).then(() => { Promise.all(validations.map(validation => validation.run(req))).then(() => {
const errors = ExpressValidator.validationResult(req); const errors = ExpressValidator.validationResult(req);
if ( !errors.isEmpty() ) { if ( !errors.isEmpty() ) {
req.session.sendResponse(res, StatusCodes.BAD_REQUEST, { errors: errors.array() }); req.session.sendResponse(res, StatusCodes.BAD_REQUEST, { errors: errors.array() });
......
...@@ -6,8 +6,8 @@ import AssignmentManager from '../managers/AssignmentManager.js'; ...@@ -6,8 +6,8 @@ import AssignmentManager from '../managers/AssignmentManager.js';
class SecurityMiddleware { class SecurityMiddleware {
private isConnected(checkIfConnected: boolean, req: express.Request): boolean { private checkIfConnected(checkIfConnected: boolean, req: express.Request): boolean {
return checkIfConnected && req.session.profile !== null && req.session.profile !== undefined; return !checkIfConnected || (req.session.profile !== null && req.session.profile !== undefined);
} }
private async checkType(checkType: SecurityCheckType, req: express.Request): Promise<boolean> { private async checkType(checkType: SecurityCheckType, req: express.Request): Promise<boolean> {
...@@ -34,6 +34,7 @@ class SecurityMiddleware { ...@@ -34,6 +34,7 @@ class SecurityMiddleware {
check(checkIfConnected: boolean, ...checkTypes: Array<SecurityCheckType>): (req: express.Request, res: express.Response, next: express.NextFunction) => void { check(checkIfConnected: boolean, ...checkTypes: Array<SecurityCheckType>): (req: express.Request, res: express.Response, next: express.NextFunction) => void {
return (req: express.Request, res: express.Response, next: express.NextFunction) => { return (req: express.Request, res: express.Response, next: express.NextFunction) => {
if ( !this.isConnected(checkIfConnected, req) ) { if ( !this.isConnected(checkIfConnected, req) ) {
if ( !this.checkIfConnected(checkIfConnected, req) ) {
return req.session.sendResponse(res, StatusCodes.UNAUTHORIZED); return req.session.sendResponse(res, StatusCodes.UNAUTHORIZED);
} }
......
...@@ -7,7 +7,7 @@ class SessionMiddleware { ...@@ -7,7 +7,7 @@ class SessionMiddleware {
registerOnBackend(backend: Express) { registerOnBackend(backend: Express) {
backend.use((req: express.Request, res: express.Response, next: express.NextFunction) => { backend.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
req.session = new Session(); req.session = new Session();
void req.session.initSession(req, res).then(() => { req.session.initSession(req, res).then(() => {
next(); next();
}); });
}); });
......
Subproject commit 771f8cd079b39ec4050c5ece024dc4d70f342529 Subproject commit c2afa861bf6306ddec79ffd465a4c7b0edcd3453