Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update apidoc to the latest version 🚀 #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
greenkeeper wants to merge 12 commits into master
base: master
Choose a base branch
Loading
from greenkeeper/apidoc-0.18.0
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
8408325
Merge branch 'master' into runModes
abhishek97 Jan 28, 2019
799a854
typecast vars while creating minio.Client
abhishek97 Jan 31, 2019
5ebb146
handle no authorization header case
championswimmer Jan 31, 2019
ae953b0
Merge pull request #27 from abhishek97/misc
abhishek97 Feb 1, 2019
a764e68
Merge pull request #28 from coding-blocks/auth_key_missing_fix
abhishek97 Feb 1, 2019
6b4727e
change apidoc endpoint
abhishek97 Feb 1, 2019
8f7ee6a
Merge branch 'master' of github.com:coding-blocks/judge-api
abhishek97 Feb 1, 2019
b4b108f
docs: /runs param input -> stdin
abhishek97 Feb 1, 2019
8ee3fa6
runpool entity deleted
farhan787 May 16, 2019
02977aa
Merge pull request #34 from farhan787/issue-#24
abhishek97 May 17, 2019
64f0a82
fix(package): update apidoc to version 0.18.0
greenkeeper[bot] Nov 13, 2019
e6bd926
chore(package): update lockfile yarn.lock
greenkeeper[bot] Nov 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@types/amqplib": "^0.5.4",
"amqplib": "^0.5.2",
"apidoc": "^0.17.6",
"apidoc": "^0.18.0",
"axios": "^0.18.0",
"base-64": "^0.1.0",
"debug": "^4.0.0",
Expand Down Expand Up @@ -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": [
Expand Down
8 changes: 5 additions & 3 deletions src/routes/api/run.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const handleTimeoutForSubmission = function (submissionId: number) {
case 'callback':
axios.post(job.callback, errorResponse)
}

delete runPool[submissionId]
}

const handleSuccessForSubmission = function (result: RunResponse) {
Expand Down Expand Up @@ -79,6 +81,8 @@ const handleSuccessForSubmission = function (result: RunResponse) {
})()
break;
}

delete runPool[result.id]
}

/**
Expand Down Expand Up @@ -109,7 +113,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'
Expand Down Expand Up @@ -172,7 +176,6 @@ route.post('/', (req, res, next) => {
setTimeout(() => {
if (runPool[submission.id]) {
handleTimeoutForSubmission(submission.id)
delete runPool[submission.id]
}
}, config.RUN.TIMEOUT)

Expand All @@ -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(<any>{
end_time: new Date()
Expand Down
4 changes: 2 additions & 2 deletions src/utils/s3.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
5 changes: 3 additions & 2 deletions src/validators/ApiKeyValidators.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {ApiKeyAttrs, ApiKeys} from '../db/models'

export function checkValidApiKey (req: Request): Promise<boolean> {
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'))
}
Expand Down Expand Up @@ -42,4 +43,4 @@ export function checkValidApiKey (req: Request): Promise<boolean> {



}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /