fix(modifier): apply fixes for nhentai random

このコミットが含まれているのは:
sinkaroid 2022-08-12 02:27:19 +07:00
コミット 6a850e7009
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: A7DF4E245FDD8159
1個のファイルの変更13行の追加7行の削除

ファイルの表示

@ -83,13 +83,19 @@ export async function getIdRandomPururin (): Promise<number> {
} }
export async function getIdRandomNhentai (): Promise<number> { export async function getIdRandomNhentai (): Promise<number> {
const res: any = await p({ if (await mock(c.NHENTAI)) {
url: `${c.NHENTAI}/random`, const res: any = await p({
followRedirects: true, url: `${c.NHENTAI}/random`,
}); followRedirects: true,
});
const getId = res.socket._httpMessage.path;
return parseInt(getId.replace(/^\/g\/([0-9]+)\/?$/, "$1")); const getId = res.socket._httpMessage.path;
return parseInt(getId.replace(/^\/g\/([0-9]+)\/?$/, "$1"));
} else {
const end = 1234;
const start = 567890;
return Math.floor(Math.random() * (end - start + 1)) + start;
}
} }