Files
RSSHub/lib/routes/tingtingfm/utils.ts
T
Tony 1acb805799 style: migrate eslint to oxlint (#21224)
* chore: add oxlint support

* style: apply autofix

* style: apply autofix for toSorted

* style: use alternative api for nsfw-flag jsPlugins

* fix: git diff

* fix: codeql

* test: console.log

* style: update lint workflow to use Checkstyle SARIF converter

* style: remove debug log from extractDateFromURL function

* chore: use oxlint-json-to-sarif

* test: console.log

* test: remove console.log

* test: update cookie data expectation in getCookies test

https://github.com/mccutchen/go-httpbin/pull/235 breaks this

* style: type-aware linting

* style: enable type-aware linting for oxlint
2026-02-28 21:23:11 +08:00

31 lines
784 B
TypeScript

/* eslint-disable unicorn/prefer-code-point */
import md5 from '@/utils/md5';
const SALT = '1Ftjv0bfpVmqbE38';
const getClientVal = (length) => {
let result = '';
const randomChar = () => {
const random = Math.floor(62 * Math.random());
if (random < 10) {
return random;
} else if (random < 36) {
return String.fromCharCode(random + 55);
} else {
return String.fromCharCode(random + 61);
}
};
while (result.length < length) {
result += randomChar();
}
return `h5_${result}`;
};
const sign = (params) => {
const searchParams = new URLSearchParams(params);
searchParams.sort();
return md5(`${searchParams.toString()}_${SALT}`);
};
export { getClientVal, sign };