fix typecheck
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
"WebFetch(domain:www.artplayer.org)",
|
||||
"WebFetch(domain:m.douban.com)",
|
||||
"WebFetch(domain:movie.douban.com)",
|
||||
"Bash(cat:*)"
|
||||
"Bash(cat:*)",
|
||||
"Bash(pnpm typecheck)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
import React, { createContext, useContext, useEffect, useState, useCallback } from 'react';
|
||||
import { useWatchRoom } from '@/hooks/useWatchRoom';
|
||||
import type { Room, Member, ChatMessage, WatchRoomConfig } from '@/types/watch-room';
|
||||
import type { WatchRoomSocket } from '@/lib/watch-room-socket';
|
||||
import Toast, { ToastProps } from '@/components/Toast';
|
||||
|
||||
// Import type from watch-room-socket
|
||||
type WatchRoomSocket = import('@/lib/watch-room-socket').WatchRoomSocket;
|
||||
|
||||
interface WatchRoomContextType {
|
||||
socket: WatchRoomSocket | null;
|
||||
isConnected: boolean;
|
||||
|
||||
@@ -139,8 +139,8 @@ export class AESDecryptor {
|
||||
const invSubMix2 = invSubMix[2];
|
||||
const invSubMix3 = invSubMix[3];
|
||||
|
||||
let prev;
|
||||
let t;
|
||||
let prev: number = 0;
|
||||
let t: number;
|
||||
|
||||
for (ksRow = 0; ksRow < ksRows; ksRow++) {
|
||||
if (ksRow < keySize) {
|
||||
@@ -168,6 +168,10 @@ export class AESDecryptor {
|
||||
t = keySchedule[ksRow - 4];
|
||||
}
|
||||
|
||||
if (t === undefined) {
|
||||
throw new Error('Invalid key schedule');
|
||||
}
|
||||
|
||||
if (invKsRow < 4 || ksRow <= 4) {
|
||||
invKeySchedule[invKsRow] = t;
|
||||
} else {
|
||||
|
||||
@@ -545,8 +545,10 @@ export class M3U8Downloader {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
task.aesConf.key = xhr.response;
|
||||
// 初始化 AES 解密器
|
||||
task.aesConf.decryption = new AESDecryptor();
|
||||
task.aesConf.decryption.expandKey(task.aesConf.key);
|
||||
if (task.aesConf.key) {
|
||||
task.aesConf.decryption = new AESDecryptor();
|
||||
task.aesConf.decryption.expandKey(task.aesConf.key);
|
||||
}
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Error('获取 AES 密钥失败'));
|
||||
@@ -562,7 +564,7 @@ export class M3U8Downloader {
|
||||
* AES 解密
|
||||
*/
|
||||
private aesDecrypt(task: M3U8DownloadTask, data: ArrayBuffer, index: number): ArrayBuffer {
|
||||
if (!task.aesConf.decryption) {
|
||||
if (!task.aesConf.decryption || !task.aesConf.key) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "Node16",
|
||||
"moduleResolution": "node16",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
@@ -26,6 +26,5 @@
|
||||
]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"],
|
||||
"moduleResolution": ["node_modules", ".next", "node"]
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user