downgrade node-widevine
--fixes flake
This commit is contained in:
parent
44cd13f10c
commit
eb3ef84800
7 changed files with 44 additions and 230 deletions
|
@ -41,7 +41,7 @@ const envSchema = z.object({
|
|||
export let defaultConfig = false;
|
||||
if (!fs.existsSync("config.toml")) {
|
||||
if (!fs.existsSync("config.example.toml")) {
|
||||
log.error("config.toml AND config.example.toml not found?? stop this tomfoolery at once");
|
||||
log.error("no available config file!");
|
||||
process.exit(1);
|
||||
}
|
||||
log.warn("config.toml not found, copying over config.example.toml");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { LicenseType, Session } from "node-widevine";
|
||||
import { Session } from "node-widevine";
|
||||
import { env } from "../config.js";
|
||||
import { appleMusicApi } from "../appleMusicApi/index.js";
|
||||
import { dataUriToBuffer } from "data-uri-to-buffer";
|
||||
|
@ -14,7 +14,7 @@ export async function getWidevineDecryptionKey(psshDataUri: string, trackId: str
|
|||
|
||||
let challenge: Buffer;
|
||||
try {
|
||||
challenge = session.createLicenseRequest(LicenseType.STREAMING);
|
||||
challenge = session.createLicenseRequest();
|
||||
} catch (err) {
|
||||
// for some reason, if gotten from a webplayback manifest, the pssh is in a completely different format
|
||||
// well, somewhat. it's just the raw data, we have to rebuild the pssh
|
||||
|
@ -29,7 +29,7 @@ export async function getWidevineDecryptionKey(psshDataUri: string, trackId: str
|
|||
|
||||
pssh = Buffer.from(rebuiltPssh, "base64");
|
||||
session = new Session({ privateKey, identifierBlob }, pssh);
|
||||
challenge = session.createLicenseRequest(LicenseType.STREAMING);
|
||||
challenge = session.createLicenseRequest();
|
||||
}
|
||||
|
||||
const response = await appleMusicApi.getWidevineLicense(
|
||||
|
|
12
src/log.ts
12
src/log.ts
|
@ -37,7 +37,7 @@ function timePrefix(): string {
|
|||
}
|
||||
function stackPrefix(): string {
|
||||
// little tidbit: this does not work on *some* engines (v8 stack format)
|
||||
// i think bun will work, i think deno will not
|
||||
// i think bun will work, i think deno will not??
|
||||
const frame = sourceMapSupport.wrapCallSite(callsites()[3] as sourceMapSupport.CallSite);
|
||||
|
||||
const file = frame.getFileName();
|
||||
|
@ -46,9 +46,15 @@ function stackPrefix(): string {
|
|||
|
||||
if (file === null || line === null || column === null) { return chalk.gray("unknown caller!"); }
|
||||
|
||||
const filePatched = `${path.relative(process.cwd(), fileURLToPath(file))}`;
|
||||
// TODO: optimize this -- probably not very great currently
|
||||
const relative = path.relative(process.cwd(), fileURLToPath(file));
|
||||
const parts = relative.split(path.sep);
|
||||
const srcIndex = parts.indexOf("src");
|
||||
const formatted = srcIndex !== -1
|
||||
? path.join(...parts.slice(srcIndex))
|
||||
: relative;
|
||||
|
||||
return chalk.gray(`${filePatched}:${line}:${column}`);
|
||||
return chalk.gray(`${formatted}:${line}:${column}`);
|
||||
}
|
||||
function levelPrefix(level: Level): string {
|
||||
const highestLevelLength = Math.max(...Object.values(levelNames).map(n => n.length));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue