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 8f58f7961023ff04b7bade2759eae998eaf13910 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2020 20:29:30 +0000 Subject: [PATCH 6/7] chore(package): update mkdirp to version 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 21ff830..d3ab15c 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@types/request": "^2.0.8", "@types/sequelize": "^4.0.79", "chai": "^4.1.2", - "mkdirp": "^0.5.1", + "mkdirp": "^1.0.0", "mocha": "^5.0.0", "nyc": "^12.0.1", "request": "^2.83.0", From 0a8a85897479ca2fe9b99738a57549764ebf92df Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2020 20:29:40 +0000 Subject: [PATCH 7/7] chore(package): update lockfile yarn.lock --- yarn.lock | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yarn.lock b/yarn.lock index db0dc65..7b5c14b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1891,6 +1891,11 @@ mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" +mkdirp@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.2.tgz#5ccd93437619ca7050b538573fc918327eba98fb" + integrity sha512-N2REVrJ/X/jGPfit2d7zea2J1pf7EAR5chIUcfHffAZ7gmlam5U65sAm76+o4ntQbSRdTjYf7qZz3chuHlwXEA== + mocha@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6"