feat(remote_judger/codeforces): show remote problem basic info in result

This commit is contained in:
Baoshuo Ren 2023-02-06 10:41:22 +08:00
parent a5a2b4547b
commit 464e5a965d
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 230 additions and 1 deletions

View File

@ -15,6 +15,7 @@
"lodash.flattendeep": "^4.4.0",
"math-sum": "^2.0.0",
"reggol": "^1.3.4",
"string-strip-html": "^13.1.0",
"superagent": "^8.0.6",
"superagent-proxy": "^3.0.0"
},
@ -216,6 +217,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/codsen-utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/codsen-utils/-/codsen-utils-1.2.0.tgz",
"integrity": "sha512-cejy31V+xUI6oxQFTxUmT2cZrmIgUg+bZlWtofn8Xdh2JV43ncJK149QNLfPl4G90nkSrqWn9Xu7ZIcbqMDr4A==",
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@ -657,6 +666,11 @@
"node": ">=12"
}
},
"node_modules/html-entities": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",
"integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@ -807,11 +821,26 @@
"node": ">= 0.8.0"
}
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="
},
"node_modules/lodash.flattendeep": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz",
"integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ=="
},
"node_modules/lodash.trim": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz",
"integrity": "sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg=="
},
"node_modules/lodash.without": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.4.0.tgz",
"integrity": "sha512-M3MefBwfDhgKgINVuBJCO1YR3+gf6s9HNJsIiZ/Ru77Ws6uTb9eBuvrkpzO+9iLoAaRodGuq7tyrPCx+74QYGQ=="
},
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -1083,6 +1112,50 @@
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
},
"node_modules/ranges-apply": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/ranges-apply/-/ranges-apply-7.0.4.tgz",
"integrity": "sha512-n+ARZO3ZeSa2Ot9FUzDsJLeC3sB+c2jPmDoo2/H26NyABCc7ixMYlvoEf2PW2hJ724gYAGYreA3THWloga8FrQ==",
"dependencies": {
"ranges-merge": "^9.0.4",
"tiny-invariant": "^1.3.1"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/ranges-merge": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/ranges-merge/-/ranges-merge-9.0.4.tgz",
"integrity": "sha512-LAtgcJFpiMqZdgUpj2c+aMfjQFmGT869c3f38w/Ex2mnJ9/Ds/DHH3fvFLfGVw8w+nbILBqhwwKUrL5j9jAEAQ==",
"dependencies": {
"ranges-push": "^7.0.4",
"ranges-sort": "^6.0.4"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/ranges-push": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/ranges-push/-/ranges-push-7.0.4.tgz",
"integrity": "sha512-gGrO5/lwdRDJVcWfAw2Kz/Rg5yJ71RHtLisincBWPkuP065E9Pr62fdu2TbG5X/jxyXaJ1B6BE7vmZlYi9QseQ==",
"dependencies": {
"string-collapse-leading-whitespace": "^7.0.3",
"string-trim-spaces-only": "^5.0.4"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/ranges-sort": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/ranges-sort/-/ranges-sort-6.0.4.tgz",
"integrity": "sha512-SW0OIXtZ76jLxjwhKEchAihBcxT5A/XW88IHaED/8ty/GWgYgAITaVO+i7AniPfnVS5v/PTK0uTgbsiCJ382Iw==",
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/raw-body": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
@ -1233,6 +1306,51 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="
},
"node_modules/string-collapse-leading-whitespace": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/string-collapse-leading-whitespace/-/string-collapse-leading-whitespace-7.0.3.tgz",
"integrity": "sha512-gQz3NEpbEqXgbXIi19rsBm8ivq2TAyhQe6/a0qxGcGYzxlCPrNm+gR60OEeUWLap17IPjVlEfsGl6kWlzfWpFg==",
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/string-left-right": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/string-left-right/-/string-left-right-6.0.7.tgz",
"integrity": "sha512-mvo3eW75j7bsGRyvpzQYlHekI2M3HBeYGIvt/eUX0HnPU8rZMAS765zMkT0a4Qidrmz8RyRTYFvsQxrdH3DvUA==",
"dependencies": {
"codsen-utils": "^1.2.0",
"lodash.clonedeep": "^4.5.0"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/string-strip-html": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/string-strip-html/-/string-strip-html-13.1.0.tgz",
"integrity": "sha512-6pHQfDkBfa4p0gMJGGCOF3Cboo2OpUr/p3P+1zeIVHvC9qP+/MEJ9x4sXHSMS9Jw3i3I1FRzN20qD5XbfkPG9w==",
"dependencies": {
"codsen-utils": "^1.2.0",
"html-entities": "^2.3.3",
"lodash.trim": "^4.5.1",
"lodash.without": "^4.4.0",
"ranges-apply": "^7.0.4",
"ranges-push": "^7.0.4",
"string-left-right": "^6.0.7"
},
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/string-trim-spaces-only": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/string-trim-spaces-only/-/string-trim-spaces-only-5.0.4.tgz",
"integrity": "sha512-EfgB6r9AxMPJdO6RWvnig55qhyjLp377ot3qcmLIeoDV2CC1EB2yirrWEPUIcudrofwGCzyUVcvGUgtVhNajRg==",
"engines": {
"node": ">=14.18.0"
}
},
"node_modules/superagent": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.6.tgz",
@ -1287,6 +1405,11 @@
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
},
"node_modules/tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
"integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -1704,6 +1827,11 @@
"get-intrinsic": "^1.0.2"
}
},
"codsen-utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/codsen-utils/-/codsen-utils-1.2.0.tgz",
"integrity": "sha512-cejy31V+xUI6oxQFTxUmT2cZrmIgUg+bZlWtofn8Xdh2JV43ncJK149QNLfPl4G90nkSrqWn9Xu7ZIcbqMDr4A=="
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@ -2031,6 +2159,11 @@
"whatwg-encoding": "^2.0.0"
}
},
"html-entities": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",
"integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@ -2150,11 +2283,26 @@
"type-check": "~0.3.2"
}
},
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="
},
"lodash.flattendeep": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz",
"integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ=="
},
"lodash.trim": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz",
"integrity": "sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg=="
},
"lodash.without": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.4.0.tgz",
"integrity": "sha512-M3MefBwfDhgKgINVuBJCO1YR3+gf6s9HNJsIiZ/Ru77Ws6uTb9eBuvrkpzO+9iLoAaRodGuq7tyrPCx+74QYGQ=="
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -2361,6 +2509,38 @@
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
},
"ranges-apply": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/ranges-apply/-/ranges-apply-7.0.4.tgz",
"integrity": "sha512-n+ARZO3ZeSa2Ot9FUzDsJLeC3sB+c2jPmDoo2/H26NyABCc7ixMYlvoEf2PW2hJ724gYAGYreA3THWloga8FrQ==",
"requires": {
"ranges-merge": "^9.0.4",
"tiny-invariant": "^1.3.1"
}
},
"ranges-merge": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/ranges-merge/-/ranges-merge-9.0.4.tgz",
"integrity": "sha512-LAtgcJFpiMqZdgUpj2c+aMfjQFmGT869c3f38w/Ex2mnJ9/Ds/DHH3fvFLfGVw8w+nbILBqhwwKUrL5j9jAEAQ==",
"requires": {
"ranges-push": "^7.0.4",
"ranges-sort": "^6.0.4"
}
},
"ranges-push": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/ranges-push/-/ranges-push-7.0.4.tgz",
"integrity": "sha512-gGrO5/lwdRDJVcWfAw2Kz/Rg5yJ71RHtLisincBWPkuP065E9Pr62fdu2TbG5X/jxyXaJ1B6BE7vmZlYi9QseQ==",
"requires": {
"string-collapse-leading-whitespace": "^7.0.3",
"string-trim-spaces-only": "^5.0.4"
}
},
"ranges-sort": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/ranges-sort/-/ranges-sort-6.0.4.tgz",
"integrity": "sha512-SW0OIXtZ76jLxjwhKEchAihBcxT5A/XW88IHaED/8ty/GWgYgAITaVO+i7AniPfnVS5v/PTK0uTgbsiCJ382Iw=="
},
"raw-body": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
@ -2481,6 +2661,39 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="
},
"string-collapse-leading-whitespace": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/string-collapse-leading-whitespace/-/string-collapse-leading-whitespace-7.0.3.tgz",
"integrity": "sha512-gQz3NEpbEqXgbXIi19rsBm8ivq2TAyhQe6/a0qxGcGYzxlCPrNm+gR60OEeUWLap17IPjVlEfsGl6kWlzfWpFg=="
},
"string-left-right": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/string-left-right/-/string-left-right-6.0.7.tgz",
"integrity": "sha512-mvo3eW75j7bsGRyvpzQYlHekI2M3HBeYGIvt/eUX0HnPU8rZMAS765zMkT0a4Qidrmz8RyRTYFvsQxrdH3DvUA==",
"requires": {
"codsen-utils": "^1.2.0",
"lodash.clonedeep": "^4.5.0"
}
},
"string-strip-html": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/string-strip-html/-/string-strip-html-13.1.0.tgz",
"integrity": "sha512-6pHQfDkBfa4p0gMJGGCOF3Cboo2OpUr/p3P+1zeIVHvC9qP+/MEJ9x4sXHSMS9Jw3i3I1FRzN20qD5XbfkPG9w==",
"requires": {
"codsen-utils": "^1.2.0",
"html-entities": "^2.3.3",
"lodash.trim": "^4.5.1",
"lodash.without": "^4.4.0",
"ranges-apply": "^7.0.4",
"ranges-push": "^7.0.4",
"string-left-right": "^6.0.7"
}
},
"string-trim-spaces-only": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/string-trim-spaces-only/-/string-trim-spaces-only-5.0.4.tgz",
"integrity": "sha512-EfgB6r9AxMPJdO6RWvnig55qhyjLp377ot3qcmLIeoDV2CC1EB2yirrWEPUIcudrofwGCzyUVcvGUgtVhNajRg=="
},
"superagent": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.6.tgz",
@ -2520,6 +2733,11 @@
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
},
"tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
"integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="
},
"toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",

View File

@ -18,6 +18,7 @@
"lodash.flattendeep": "^4.4.0",
"math-sum": "^2.0.0",
"reggol": "^1.3.4",
"string-strip-html": "^13.1.0",
"superagent": "^8.0.6",
"superagent-proxy": "^3.0.0"
},

View File

@ -2,6 +2,7 @@ import { JSDOM } from 'jsdom';
import superagent from 'superagent';
import proxy from 'superagent-proxy';
import { crlf, LF } from 'crlf-normalize';
import { stripHtml } from 'string-strip-html';
import sleep from '../utils/sleep';
import mathSum from 'math-sum';
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
@ -418,9 +419,18 @@ export default class CodeforcesProvider implements IBasicProvider {
tests.push(test_info);
}
const remote_handle = stripHtml(body.partyName).result;
const details =
'<div>' +
`<info-block>REMOTE_SUBMISSION_ID = ${id}\nVERDICT = ${status}</info-block>` +
'<div class="border-bottom p-3">' +
`<p><b>Contest:</b> ${stripHtml(body.contestName).result}</p>` +
`<p><b>Problem:</b> ${stripHtml(body.problemName).result}</p>` +
`<p><b>Remote submission:</b> <a href="https://codeforces.com${body.href}" target="_blank">${id}</a></p>` +
`<p><b>Remote account:</b> <a href="https://codeforces.com/profile/${remote_handle}" target="_blank">${remote_handle}</a></p>` +
`<p class="mb-0"><b>Verdict:</b> ${
stripHtml(body.verdict).result
}</p>` +
'</div>' +
`<tests>${tests.join('\n')}</tests>` +
'</div>';