replace String.random with randomstring

This commit is contained in:
undefined committed 2025-06-30 16:24:35 +08:00
1 parent b18cce3f66
commit 5d7f5fef38
22 files changed
+64 -48

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@ import { PassThrough } from 'stream';
import yaml from 'js-yaml';
import { JSDOM } from 'jsdom';
import {
buildContent, Logger, sleep, STATUS,
buildContent, Logger, randomstring, sleep, STATUS,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -186,7 +186,7 @@ export default class CodeforcesProvider extends BasicFetcher implements IBasicPr
if (!src.startsWith('http')) continue;
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
}
+4 -2
View File
@@ -1,7 +1,9 @@
/* eslint-disable no-await-in-loop */
import { PassThrough } from 'stream';
import { JSDOM } from 'jsdom';
import { Logger, sleep, STATUS } from 'hydrooj';
import {
Logger, randomstring, sleep, STATUS,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -91,7 +93,7 @@ export default class CSGOJProvider extends BasicFetcher implements IBasicProvide
}
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
images[src] = fid;
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
+2 -2
View File
@@ -4,7 +4,7 @@ import { JSDOM } from 'jsdom';
import charset from 'superagent-charset';
import proxy from 'superagent-proxy';
import {
htmlEncode, Logger, parseMemoryMB, parseTimeMS, sleep, STATUS, superagent,
htmlEncode, Logger, parseMemoryMB, parseTimeMS, randomstring, sleep, STATUS, superagent,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -67,7 +67,7 @@ export default class HDUOJProvider extends BasicFetcher implements IBasicProvide
}
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
images[src] = fid;
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
+2 -2
View File
@@ -2,7 +2,7 @@
import { PassThrough } from 'stream';
import { JSDOM } from 'jsdom';
import {
htmlEncode, Logger, parseMemoryMB, parseTimeMS, sleep, STATUS,
htmlEncode, Logger, parseMemoryMB, parseTimeMS, randomstring, sleep, STATUS,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -95,7 +95,7 @@ export default class POJProvider extends BasicFetcher implements IBasicProvider
}
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
images[src] = fid;
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
+2 -2
View File
@@ -2,7 +2,7 @@
import { PassThrough } from 'stream';
import { JSDOM } from 'jsdom';
import {
Logger, parseMemoryMB, sleep, STATUS,
Logger, parseMemoryMB, randomstring, sleep, STATUS,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -53,7 +53,7 @@ export default class SPOJProvider extends BasicFetcher implements IBasicProvider
if (!src.startsWith('http')) continue;
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
}
+2 -2
View File
@@ -2,7 +2,7 @@
import { PassThrough } from 'stream';
import { JSDOM } from 'jsdom';
import {
Logger, parseMemoryMB, parseTimeMS, sleep, STATUS,
Logger, parseMemoryMB, parseTimeMS, randomstring, sleep, STATUS,
} from 'hydrooj';
import { BasicFetcher } from '../fetch';
import { IBasicProvider, RemoteAccount } from '../interface';
@@ -74,7 +74,7 @@ export default class UOJProvider extends BasicFetcher implements IBasicProvider
if (!src.startsWith('http')) continue;
const file = new PassThrough();
this.get(src).pipe(file);
const fid = String.random(8);
const fid = randomstring(8);
files[`${fid}.png`] = file;
ele.setAttribute('src', `file://${fid}.png`);
}