@bilibili-notify/extension 0.1.0-alpha.2 → 0.1.0-alpha.4
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.
- package/DEVELOPMENT.md +3 -1
- package/build.mjs +14 -2
- package/index.d.mts +11 -3
- package/package.json +1 -1
package/DEVELOPMENT.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 版本与工程
|
|
6
6
|
|
|
7
|
-
宿主契约为 `apiVersion: 1
|
|
7
|
+
宿主契约为 `apiVersion: 1`。群聊作品与来源扫码登录要求 `apiRevision: 1`,展示账号要求 `apiRevision: 2`,作品收藏数要求 `apiRevision: 3`。适配器如果依赖 `send` 第四个参数 `options.singleAttempt` 来关闭手动测试的重试,需要声明 `apiRevision: 4`。同一小号支持适配器在 `capabilities().inbound` 中返回 `groupTestReply: "token"`,让宿主使用纯文本群接收测试码。只用原有能力的拓展仍可省略小号(按 0 处理)。SDK 的 npm 版本和拓展自己的 `version` 分别管理。使用新增能力时应声明对应小号并核对宿主兼容性。
|
|
8
8
|
|
|
9
9
|
创建器默认生成独立Git工程、示例来源、完整vp命令、锁文件、提交hooks与GitHub Actions:
|
|
10
10
|
|
|
@@ -102,6 +102,8 @@ export function activate(ctx: ExtensionContext): void {
|
|
|
102
102
|
|
|
103
103
|
`start(sourceCtx)`得到运行中的来源上下文:从`subscriptions()`读取自己平台的创作者名单,监听`onSubscriptionsChanged`,以`externalId`上报。`reportProfile`更新资料,`reportPost`交作品,`reportLive`交开播、状态或下播信号;具体载荷使用SDK的`ExtensionPostReport`、`ExtensionLiveSignalReport`等公开类型。直播`status`只更新状态,不触发推送。
|
|
104
104
|
|
|
105
|
+
作品上报和群聊链接预览可用 `post.stats.saves` 传收藏数。平台未给出数值时省略,明确为零时传 `0`。使用此字段的拓展要求 `apiRevision: 3`。
|
|
106
|
+
|
|
105
107
|
### 展示账号(API 1 修订 2)
|
|
106
108
|
|
|
107
109
|
`externalId`是稳定身份,始终用于候选选择、请求和上报。用户可读但可能改变的公开账号放在`CreatorProfileReport.displayId`,搜索候选和`fetchProfile`也用同一字段。省略时保留旧资料,空串清除,最长256字。界面优先展示该账号,缺失时显示原身份;不会按展示账号合并或迁移订阅。
|
package/build.mjs
CHANGED
|
@@ -70,6 +70,7 @@ function translate(dict, locale, key, values = {}) {
|
|
|
70
70
|
const UNBOUND_LAYERS = {
|
|
71
71
|
"zh-CN": {
|
|
72
72
|
plain: {
|
|
73
|
+
"ai.modelSafety.refused": "模型安全审核拒绝了这次请求。",
|
|
73
74
|
"internal.settings.imageAllowedCidrs": "请填写有效的 IPv4 或 IPv6 CIDR 地址段,例如 198.18.0.0/16。",
|
|
74
75
|
"internal.commands.aliasBlank": "别名不能为空或带首尾空格",
|
|
75
76
|
"internal.commands.prefixBlank": "前缀不能是纯空白",
|
|
@@ -393,6 +394,7 @@ const UNBOUND_LAYERS = {
|
|
|
393
394
|
"internal.card-skin.144": "点赞数",
|
|
394
395
|
"internal.card-skin.145": "文字",
|
|
395
396
|
"internal.card-skin.146": "图标",
|
|
397
|
+
"internal.card-skin.saveCount": "收藏数",
|
|
396
398
|
"internal.card-skin.147": "留言",
|
|
397
399
|
"internal.card-skin.148": "留言气泡",
|
|
398
400
|
"internal.card-skin.149": "留言文本",
|
|
@@ -685,6 +687,7 @@ const UNBOUND_LAYERS = {
|
|
|
685
687
|
"image.icons.forward": "转发",
|
|
686
688
|
"image.icons.comment": "评论",
|
|
687
689
|
"image.icons.like": "点赞",
|
|
690
|
+
"image.icons.save": "收藏",
|
|
688
691
|
"image.icons.topic": "话题",
|
|
689
692
|
"image.icons.view": "播放量",
|
|
690
693
|
"image.icons.danmaku": "弹幕",
|
|
@@ -860,6 +863,7 @@ const UNBOUND_LAYERS = {
|
|
|
860
863
|
},
|
|
861
864
|
"zh-TW": {
|
|
862
865
|
plain: {
|
|
866
|
+
"ai.modelSafety.refused": "模型安全審核拒絕了這次請求。",
|
|
863
867
|
"internal.settings.imageAllowedCidrs": "請填寫有效的 IPv4 或 IPv6 CIDR 網段,例如 198.18.0.0/16。",
|
|
864
868
|
"storage.log.masterReadFailed": "主金鑰讀取失敗(非缺失),保留原檔案並停止載入",
|
|
865
869
|
"storage.log.masterLoaded": "主金鑰已載入",
|
|
@@ -1126,6 +1130,7 @@ const UNBOUND_LAYERS = {
|
|
|
1126
1130
|
"image.icons.forward": "轉發",
|
|
1127
1131
|
"image.icons.comment": "留言",
|
|
1128
1132
|
"image.icons.like": "按讚",
|
|
1133
|
+
"image.icons.save": "收藏",
|
|
1129
1134
|
"image.icons.topic": "話題",
|
|
1130
1135
|
"image.icons.view": "播放次數",
|
|
1131
1136
|
"image.icons.danmaku": "彈幕",
|
|
@@ -1522,6 +1527,7 @@ const UNBOUND_LAYERS = {
|
|
|
1522
1527
|
"internal.card-skin.144": "按讚數",
|
|
1523
1528
|
"internal.card-skin.145": "文字",
|
|
1524
1529
|
"internal.card-skin.146": "圖示",
|
|
1530
|
+
"internal.card-skin.saveCount": "收藏數",
|
|
1525
1531
|
"internal.card-skin.147": "留言",
|
|
1526
1532
|
"internal.card-skin.148": "留言氣泡",
|
|
1527
1533
|
"internal.card-skin.149": "留言文字",
|
|
@@ -1649,6 +1655,7 @@ const UNBOUND_LAYERS = {
|
|
|
1649
1655
|
}
|
|
1650
1656
|
},
|
|
1651
1657
|
en: { plain: {
|
|
1658
|
+
"ai.modelSafety.refused": "The model safety check declined this request.",
|
|
1652
1659
|
"internal.settings.imageAllowedCidrs": "Enter a valid IPv4 or IPv6 CIDR range, such as 198.18.0.0/16.",
|
|
1653
1660
|
"storage.log.masterReadFailed": "Cannot read the existing master key; preserving the file and stopping the load",
|
|
1654
1661
|
"storage.log.masterLoaded": "Master key loaded",
|
|
@@ -1915,6 +1922,7 @@ const UNBOUND_LAYERS = {
|
|
|
1915
1922
|
"image.icons.forward": "Repost",
|
|
1916
1923
|
"image.icons.comment": "Comment",
|
|
1917
1924
|
"image.icons.like": "Like",
|
|
1925
|
+
"image.icons.save": "Save",
|
|
1918
1926
|
"image.icons.topic": "Topic",
|
|
1919
1927
|
"image.icons.view": "Views",
|
|
1920
1928
|
"image.icons.danmaku": "Chat messages",
|
|
@@ -2318,6 +2326,7 @@ const UNBOUND_LAYERS = {
|
|
|
2318
2326
|
"internal.card-skin.144": "Like count",
|
|
2319
2327
|
"internal.card-skin.145": "Text",
|
|
2320
2328
|
"internal.card-skin.146": "Icon",
|
|
2329
|
+
"internal.card-skin.saveCount": "Save count",
|
|
2321
2330
|
"internal.card-skin.147": "Message",
|
|
2322
2331
|
"internal.card-skin.148": "Message bubble",
|
|
2323
2332
|
"internal.card-skin.149": "Message text",
|
|
@@ -2355,6 +2364,7 @@ const UNBOUND_LAYERS = {
|
|
|
2355
2364
|
} },
|
|
2356
2365
|
ja: {
|
|
2357
2366
|
plain: {
|
|
2367
|
+
"ai.modelSafety.refused": "モデルの安全確認でリクエストが拒否されました。",
|
|
2358
2368
|
"internal.settings.imageAllowedCidrs": "198.18.0.0/16 など、有効な IPv4 または IPv6 の CIDR 範囲を入力してください。",
|
|
2359
2369
|
"storage.log.masterReadFailed": "既存のマスターキーを読み取れません。ファイルを保持して読み込みを中止します",
|
|
2360
2370
|
"storage.log.masterLoaded": "マスターキーを読み込みました",
|
|
@@ -2621,6 +2631,7 @@ const UNBOUND_LAYERS = {
|
|
|
2621
2631
|
"image.icons.forward": "リポスト",
|
|
2622
2632
|
"image.icons.comment": "コメント",
|
|
2623
2633
|
"image.icons.like": "いいね",
|
|
2634
|
+
"image.icons.save": "保存",
|
|
2624
2635
|
"image.icons.topic": "トピック",
|
|
2625
2636
|
"image.icons.view": "再生数",
|
|
2626
2637
|
"image.icons.danmaku": "弾幕",
|
|
@@ -3017,6 +3028,7 @@ const UNBOUND_LAYERS = {
|
|
|
3017
3028
|
"internal.card-skin.144": "いいね数",
|
|
3018
3029
|
"internal.card-skin.145": "テキスト",
|
|
3019
3030
|
"internal.card-skin.146": "アイコン",
|
|
3031
|
+
"internal.card-skin.saveCount": "保存数",
|
|
3020
3032
|
"internal.card-skin.147": "メッセージ",
|
|
3021
3033
|
"internal.card-skin.148": "メッセージの吹き出し",
|
|
3022
3034
|
"internal.card-skin.149": "メッセージ本文",
|
|
@@ -3276,7 +3288,7 @@ const EXTENSION_IMAGE_MAX_CHARS = 32768;
|
|
|
3276
3288
|
* ⚠️ 不带 `g`:几处共用这一个对象,带 `g` 的话 `test()` 会在两次调用之间记着 `lastIndex`。
|
|
3277
3289
|
*/
|
|
3278
3290
|
const EXTENSION_IMAGE_DATA_URL_RE = /^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+=*$/;
|
|
3279
|
-
// ../internal/lib/settings-fields-from-schema-
|
|
3291
|
+
// ../internal/lib/settings-fields-from-schema-BYg_-YGh.mjs
|
|
3280
3292
|
const VARIABLE_QUANTIFIER = String.raw`(?:[+*]|\{\d+,\d*\})`;
|
|
3281
3293
|
const NESTED_QUANTIFIER = new RegExp(String.raw`\((?:\?[:=!][^)]*|[^)]*)${VARIABLE_QUANTIFIER}[^)]*\)\s*(?:[+*]|\{\d+(?:,\d*)?\})`);
|
|
3282
3294
|
function hasOverlappingAlternationUnderQuantifier(src) {
|
|
@@ -3355,7 +3367,7 @@ const CREATOR_SEARCH_KINDS = [
|
|
|
3355
3367
|
const EXTENSION_API_RANGE = Object.freeze({
|
|
3356
3368
|
min: 1,
|
|
3357
3369
|
current: 1,
|
|
3358
|
-
revision:
|
|
3370
|
+
revision: 4
|
|
3359
3371
|
});
|
|
3360
3372
|
/** 这一档落不落在区间里(不看小号)。 */
|
|
3361
3373
|
function tierAccepted(apiVersion, range) {
|
package/index.d.mts
CHANGED
|
@@ -370,6 +370,7 @@ interface Post {
|
|
|
370
370
|
shares?: number;
|
|
371
371
|
comments?: number;
|
|
372
372
|
likes?: number;
|
|
373
|
+
saves?: number;
|
|
373
374
|
};
|
|
374
375
|
}
|
|
375
376
|
/**
|
|
@@ -935,7 +936,11 @@ interface PlatformAdapter {
|
|
|
935
936
|
*/
|
|
936
937
|
isAvailable(connection: Connection, destination: DestinationRef): boolean;
|
|
937
938
|
/** Deliver `payload` to `destination` over `connection`. 群还是私聊只看 `destination.scope`。 */
|
|
938
|
-
send(connection: Connection, destination: DestinationRef, payload: NotificationPayload
|
|
939
|
+
send(connection: Connection, destination: DestinationRef, payload: NotificationPayload,
|
|
940
|
+
/** 手动能力测试只投递一次。日常推送沿用连接的重试配置。 */
|
|
941
|
+
options?: {
|
|
942
|
+
singleAttempt: boolean;
|
|
943
|
+
}): Promise<DeliveryResult>;
|
|
939
944
|
/** 构造对应能力的真实样例;不支持时拒绝,不用文本替代。没有此成员的旧适配器仍可测试普通文本。 */
|
|
940
945
|
createTestPayload?(connection: Connection, destination: DestinationRef, kind: SendTestKind, samples: PlatformTestOptions): Result<{
|
|
941
946
|
payload: NotificationPayload;
|
|
@@ -945,7 +950,7 @@ interface PlatformAdapter {
|
|
|
945
950
|
* (老的拓展适配器)各项按「还不知道」算,怎么对待「还不知道」见 internal 的
|
|
946
951
|
* `shouldSendAtAll` / `canReceiveReply` / `listsForLinkPreview`。
|
|
947
952
|
*/
|
|
948
|
-
capabilities?(connection: Connection): ConnectionCapabilities;
|
|
953
|
+
capabilities?(connection: Connection, destination?: DestinationRef): ConnectionCapabilities;
|
|
949
954
|
/** 宿主只读查询会话内身份与使用记录;暂不向拓展开放。 */
|
|
950
955
|
fetchDestinationStatus?(connection: Connection, destination: DestinationRef, signal: AbortSignal, options?: {
|
|
951
956
|
refresh?: boolean;
|
|
@@ -1433,7 +1438,10 @@ interface ConnectionCapabilities {
|
|
|
1433
1438
|
* 「还不知道」时**审批不能开**(开错了整期草稿都会等到超时作废);
|
|
1434
1439
|
* 链接解析设置列不列这个群也读它,「还不知道」时**照列**(今天对拓展连接一律列)。
|
|
1435
1440
|
*/
|
|
1436
|
-
inbound: CapabilitySupport
|
|
1441
|
+
inbound: CapabilitySupport & {
|
|
1442
|
+
/** 群接收测试可用纯文本验证码;缺省沿用含链接的回传,兼容只转发链接的桥。 */
|
|
1443
|
+
groupTestReply?: "token";
|
|
1444
|
+
};
|
|
1437
1445
|
/**
|
|
1438
1446
|
* 能不能发原生分享(平台自己的分享卡)。链接预览的门读它:发不了就回落图片;
|
|
1439
1447
|
* 「还不知道」时门先探一次,探完仍未知按不能算。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilibili-notify/extension",
|
|
3
3
|
"description": "Public contract and build helpers for bilibili-notify extensions",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/Akokk0/bilibili-notify"
|