From 799a85457de074bf040fa0a5b9064bb67dbbcba8 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Thu, 31 Jan 2019 18:56:33 +0530 Subject: [PATCH 1/7] typecast vars while creating minio.Client --- src/utils/s3.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/s3.ts b/src/utils/s3.ts index 6ccd6c4..490c010 100644 --- a/src/utils/s3.ts +++ b/src/utils/s3.ts @@ -5,8 +5,8 @@ import config = require('../../config') const client = new Minio.Client({ endPoint: config.S3.endpoint, - port: config.S3.port, - useSSL: config.S3.ssl, + port: +config.S3.port, + useSSL: !!config.S3.ssl, accessKey: config.S3.accessKey, secretKey: config.S3.secretKey, }) From 5ebb146d23561c1c3e2b7918f625f095c53e330e Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Thu, 31 Jan 2019 22:27:35 +0530 Subject: [PATCH 2/7] handle no authorization header case --- src/validators/ApiKeyValidators.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/validators/ApiKeyValidators.ts b/src/validators/ApiKeyValidators.ts index c056191..c693347 100644 --- a/src/validators/ApiKeyValidators.ts +++ b/src/validators/ApiKeyValidators.ts @@ -4,7 +4,8 @@ import {ApiKeyAttrs, ApiKeys} from '../db/models' export function checkValidApiKey (req: Request): Promise { return new Promise((resolve, reject) => { - let apiKey = req.header('Authorization').split('Bearer ')[1] + let apiKey = req.header('Authorization') + apiKey = apiKey && apiKey.split('Bearer ')[1] if (!apiKey) { reject(new Error('No API Key in request')) } @@ -42,4 +43,4 @@ export function checkValidApiKey (req: Request): Promise { -} \ No newline at end of file +} From 6b4727ed1b30b70f9cc9d96c3b39c7792a1fb7f7 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Fri, 1 Feb 2019 18:19:11 +0530 Subject: [PATCH 3/7] change apidoc endpoint --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c211f03..21ff830 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ }, "apidoc": { "title": "judge-blocks API", - "url": "http://judge.cb.lk/api", - "sampleUrl": "http://judge.cb.lk/api" + "url": "https://judge2.codingblocks.com/api", + "sampleUrl": "https://judge2.codingblocks.com/api" }, "nyc": { "extension": [ From b4b108f656814367f076ce23d4f448ee4e3fddac Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Fri, 1 Feb 2019 19:22:35 +0530 Subject: [PATCH 4/7] docs: /runs param input -> stdin --- src/routes/api/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/api/run.ts b/src/routes/api/run.ts index a45b967..6097a2d 100644 --- a/src/routes/api/run.ts +++ b/src/routes/api/run.ts @@ -109,7 +109,7 @@ const getRunPoolElement = function (body: RunRequestBody, res: Response): RunPoo * * @apiParam {String(Base64)} source source code to run (encoded in base64) * @apiParam {Enum} lang Language of code to execute - * @apiParam {String(Base64)} input [Optional] stdin input for the program (encoded in base64) + * @apiParam {String(Base64)} stdin [Optional] stdin input for the program (encoded in base64) * @apiParam {Enum} mode [Optional] mode for request. Default = `sync`, see: https://github.com/coding-blocks/judge-api/issues/16 * @apiParam {String)} callback [Optional] callback url for request. Required for `mode = callback` * @apiParam {String)} enc [Optional] Encoding type for stdin and source. Can be `url`|`base64`. Default = 'base64' From 8ee3fa6e5af2d02ac998e27fcc458690bc890373 Mon Sep 17 00:00:00 2001 From: Muhammad Farhan Date: Fri, 17 May 2019 04:53:27 +0530 Subject: [PATCH 5/7] runpool entity deleted --- src/routes/api/run.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/api/run.ts b/src/routes/api/run.ts index 6097a2d..7c5903b 100644 --- a/src/routes/api/run.ts +++ b/src/routes/api/run.ts @@ -50,6 +50,8 @@ const handleTimeoutForSubmission = function (submissionId: number) { case 'callback': axios.post(job.callback, errorResponse) } + + delete runPool[submissionId] } const handleSuccessForSubmission = function (result: RunResponse) { @@ -79,6 +81,8 @@ const handleSuccessForSubmission = function (result: RunResponse) { })() break; } + + delete runPool[result.id] } /** @@ -172,7 +176,6 @@ route.post('/', (req, res, next) => { setTimeout(() => { if (runPool[submission.id]) { handleTimeoutForSubmission(submission.id) - delete runPool[submission.id] } }, config.RUN.TIMEOUT) @@ -198,7 +201,6 @@ route.post('/', (req, res, next) => { successListener.on('success', (result: RunResponse) => { if (runPool[result.id]) { handleSuccessForSubmission(result) - delete runPool[result.id] } Submissions.update({ end_time: new Date() From aa9750a5f585df6a76ca6b925c59e7b99aae5652 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 21:49:48 +0000 Subject: [PATCH 6/7] chore(package): update @types/mocha to version 7.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 21ff830..e3dd093 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@types/debug": "^0.0.30", "@types/express": "^4.0.39", "@types/minio": "^7.0.1", - "@types/mocha": "^5.0.0", + "@types/mocha": "^7.0.0", "@types/request": "^2.0.8", "@types/sequelize": "^4.0.79", "chai": "^4.1.2", From 24b232c91bc047baf00e195e7c81619fdf1f113c Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 21:49:57 +0000 Subject: [PATCH 7/7] chore(package): update lockfile yarn.lock --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index db0dc65..4d7be3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -163,10 +163,10 @@ dependencies: "@types/node" "*" -"@types/mocha@^5.0.0": - version "5.2.5" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.5.tgz#8a4accfc403c124a0bafe8a9fc61a05ec1032073" - integrity sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww== +"@types/mocha@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.0.tgz#ac65f97746464ec84ce15f4743cd61c449822ad4" + integrity sha512-6mh1VlA343Ax31blo37+KZ0DxDOA8b6cL963xPOOt7fMYtG07aJJ+0FRLvcDO4KrL45faOS104G7kwAjZc9l4w== "@types/node@*": version "8.0.51"