krillplayer-plugin 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -156,6 +156,7 @@
156
156
  crypto: freeze({
157
157
  randomBytes: (length) => call("crypto.randomBytes", [length]),
158
158
  digest: async (algorithm, data) => call("crypto.digest", [algorithm, data]),
159
+ rc4: async (key, data) => call("crypto.rc4", [key, data]),
159
160
  // contract.md 6.3.1:检查与计算都在宿主一侧,这里只把 ArrayBuffer 与别的视图换成线格式认得的 Uint8Array。
160
161
  subtle: freeze(fromEntries(["generateKey", "importKey", "exportKey", "sign", "verify", "encrypt", "decrypt", "digest",
161
162
  "deriveBits", "deriveKey", "wrapKey", "unwrapKey"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krillplayer-plugin",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Write, pack, record and test KrillPlayer source plugins on the App's own QuickJS-ng engine, with an AI skill.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://krillplayer.kami.asia",
@@ -41,6 +41,6 @@
41
41
  "eslint": "9.39.5"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@krillplayer/plugin-engine-darwin-arm64": "0.4.0"
44
+ "@krillplayer/plugin-engine-darwin-arm64": "0.5.0"
45
45
  }
46
46
  }
@@ -927,7 +927,11 @@ export interface Subtitle {
927
927
  }
928
928
 
929
929
  // krillplayer.formats 的结果。只带出有值的字段;时间是 Unix 秒,时长是秒。
930
- // M3U:attributes 是 #EXTINF 上的全部属性(键转成小写),常用的几项另外带出;headers 来自 #EXTVLCOPT。
930
+ // M3U:attributes 是 #EXTINF 上的全部属性(键转成小写),常用的几项另外带出。headers 是清单给这条流的请求头,
931
+ // 认 #EXTINF 的 http-user-agent、http-referrer、http-header,#EXTVLCOPT 的 http-user-agent、http-referrer,
932
+ // #KODIPROP 的 inputstream.adaptive.*_headers 与地址后缀 `|名=值&!名=值`(`|` 后面每一段都是这种写法才算后缀,从 url 里去掉;
933
+ // 否则 `|` 是地址自己的字符,url 原样);同一个头几处都给时后缀最优先,其次指令行,最后 #EXTINF 的属性。
934
+ // Host、Content-Length、Connection 这类系统网络层自己管的请求头不带出(Authorization 照带)。
931
935
  export interface M3UEntry {
932
936
  url: string;
933
937
  title: string;
@@ -1052,7 +1056,9 @@ export interface MetadataListOptions {
1052
1056
  }
1053
1057
 
1054
1058
  // 登录规格:插件只给数据,界面由内核按种类渲染,没有按来源写的登录界面。
1055
- // web:内核打开 url,loggedInCookie 出现即视为登录成功,cookies 里列出的 Cookie 按名字存成凭证项。
1059
+ // web:内核打开 url,loggedInCookie 出现后(没声明的由用户点完成)把 cookies 里列出的 Cookie 按名字收成凭证项,
1060
+ // 导出了 login.account 的先带着这份还没存的凭证调它向平台核验:返回账号才算登录成功、存下凭证;
1061
+ // 报 loginRequired 或返回 null 算平台还没认下,不存、登录窗口留着。核验时 krillplayer.credentials.set 抛错。
1056
1062
  // qrCode:内核调 login.qrCode 取二维码、按 interval 秒调 login.poll;确认后插件经 krillplayer.credentials.set 写入凭证。
1057
1063
  // fields:内核按 fields 画表单,填的值按字段名存成凭证项。note 是给用户看的一句说明。
1058
1064
  export interface LoginMethod {
@@ -1272,7 +1278,12 @@ export interface KrillPlayer {
1272
1278
  decompress(format: "gzip" | "deflate" | "deflate-raw", data: Uint8Array): Promise<Uint8Array>;
1273
1279
  crypto: {
1274
1280
  randomBytes(length: number): Uint8Array;
1275
- digest(algorithm: "sha-1" | "sha-256" | "sha-384" | "sha-512", data: Uint8Array | string): Promise<Uint8Array>;
1281
+ // 算法名不分大小写;字符串按 UTF-8。md5(RFC 1321)与 sm3(GB/T 32905)是 WebCrypto 没有的,subtle.digest 不收。
1282
+ // MD5 不提供安全保证(能造出碰撞),只为与已有协议互通,新协议用 sha-256。
1283
+ digest(algorithm: "sha-1" | "sha-256" | "sha-384" | "sha-512" | "md5" | "sm3", data: Uint8Array | string): Promise<Uint8Array>;
1284
+ // RC4 流密码:密钥 1 到 256 字节,加密与解密是同一个调用。不提供安全保证(密钥流有偏差、没有完整性校验),
1285
+ // 只为与已有协议互通,新协议用 subtle 的 AES-GCM。
1286
+ rc4(key: Uint8Array | string, data: Uint8Array | string): Promise<Uint8Array>;
1276
1287
  // WebCrypto 的 crypto.subtle:签名与验签、加解密、摘要,生成、导入与导出密钥,派生与包装密钥。报错文本以 krillplayer.crypto.subtle.<函数>: 开头并写明原因。
1277
1288
  subtle: KrillPlayerSubtle;
1278
1289
  };