Google OAuth

This commit is contained in:
undefined committed 2020-06-22 13:29:14 +08:00
1 parent 8476eac3b4
commit d2173eeb38
12 files changed
+261 -117

No files matched your search

+3 -2
View File
@@ -1,6 +1,7 @@
const assert = require('assert');
const { download, axios } = global.Hydro.lib;
const { download } = global.Hydro.lib;
const { superagent } = global.nodeModules;
const { ValidationError, RemoteOnlineJudgeError } = global.Hydro.error;
async function syzoj(url, handler) {
@@ -8,7 +9,7 @@ async function syzoj(url, handler) {
assert(url.match(RE_SYZOJ), new ValidationError('url'));
if (!url.endsWith('/')) url += '/';
const [, host, pid] = RE_SYZOJ.exec(url);
const res = await axios.get(`${url}export`);
const res = await superagent.get(`${url}export`);
assert(res.status === 200, new RemoteOnlineJudgeError('Cannot connect to target server'));
assert(res.data.success, new RemoteOnlineJudgeError((res.data.error || {}).message));
const p = res.data.obj;