From 3038d5d088f33c40557f3886f28280c478acae5e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Feb 2023 21:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=91=E9=81=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/isekaiwiki/_group.yml | 2 +- channels/isekaiwiki/admin/_group.yml | 2 +- channels/isekaiwiki/admin/autoReview.yml | 22 +++++++++++----------- channels/isekaiwiki/admin/needReview.yml | 23 ++++++++++++----------- channels/isekaiwiki/editPage.yml | 22 +++++++++++----------- channels/isekaiwiki/newPage.yml | 23 ++++++++++++----------- src/SubscribeManager.ts | 21 +++------------------ 7 files changed, 51 insertions(+), 64 deletions(-) diff --git a/channels/isekaiwiki/_group.yml b/channels/isekaiwiki/_group.yml index d370f19..456618a 100644 --- a/channels/isekaiwiki/_group.yml +++ b/channels/isekaiwiki/_group.yml @@ -1 +1 @@ -name: "异世界百科" +name: "异世界百科" diff --git a/channels/isekaiwiki/admin/_group.yml b/channels/isekaiwiki/admin/_group.yml index 3766773..c0827b6 100644 --- a/channels/isekaiwiki/admin/_group.yml +++ b/channels/isekaiwiki/admin/_group.yml @@ -1 +1 @@ -name: "管理信息" +name: "管理信息" diff --git a/channels/isekaiwiki/admin/autoReview.yml b/channels/isekaiwiki/admin/autoReview.yml index 95b1e86..0b15b1e 100644 --- a/channels/isekaiwiki/admin/autoReview.yml +++ b/channels/isekaiwiki/admin/autoReview.yml @@ -1,11 +1,11 @@ -name: 自动审核通过 -provider: pusher -source: - service: pusher - channel: isekaiwiki - type: autoReview -tpl: - default: |- - {{data.author}} 更新了新页面: {{data.title}} - {{data.summary}} - {{data.result}} +name: 自动审核通过 +provider: pusher +source: + service: pusher + channel: isekaiwiki + type: autoReview +tpl: + default: |- + {{{author}}} 更新了新页面: {{{title}}} + {{{summary}}} + {{{result}}} diff --git a/channels/isekaiwiki/admin/needReview.yml b/channels/isekaiwiki/admin/needReview.yml index 0ef04fe..22f3867 100644 --- a/channels/isekaiwiki/admin/needReview.yml +++ b/channels/isekaiwiki/admin/needReview.yml @@ -1,11 +1,12 @@ -name: 待审页面 -provider: pusher -source: - service: pusher - channel: isekaiwiki - type: needReview -tpl: - default: |- - Review队列更新: - {{data.author}} 更新了新页面: {{data.title}} - {{data.summary}} +name: 待审页面 +provider: pusher +source: + service: pusher + channel: isekaiwiki + type: needReview +tpl: + default: |- + Review队列中增加了新页面: + 编辑者: {{{author}}} + 标题: {{{title}}} + {{{summary}}} diff --git a/channels/isekaiwiki/editPage.yml b/channels/isekaiwiki/editPage.yml index 3b2a693..7bbfd2c 100644 --- a/channels/isekaiwiki/editPage.yml +++ b/channels/isekaiwiki/editPage.yml @@ -1,11 +1,11 @@ -name: 修改页面 -provider: pusher -source: - service: pusher - channel: isekaiwiki - type: edit -tpl: - default: |- - {{data.author}} 更新了页面: {{data.title}} - {{data.summary}} - {{data.url}} +name: 修改页面 +provider: pusher +source: + service: pusher + channel: isekaiwiki + type: edit +tpl: + default: |- + {{{author}}} 更新了页面《{{{title}}}》: + {{{summary}}} + {{{url}}} diff --git a/channels/isekaiwiki/newPage.yml b/channels/isekaiwiki/newPage.yml index 867490c..c6eab36 100644 --- a/channels/isekaiwiki/newPage.yml +++ b/channels/isekaiwiki/newPage.yml @@ -1,11 +1,12 @@ -name: 新页面 -provider: pusher -source: - service: pusher - channel: isekaiwiki - type: new -tpl: - default: |- - {{data.author}} 创建了新页面: {{data.title}} - {{data.summary}} - {{data.url}} +name: 新页面 +provider: pusher +source: + service: pusher + channel: isekaiwiki + type: new +tpl: + default: |- + {{{author}}} 创建了新页面《{{{title}}}》: + {{{summary}}} + + {{{url}}} diff --git a/src/SubscribeManager.ts b/src/SubscribeManager.ts index aef287c..63e63f3 100644 --- a/src/SubscribeManager.ts +++ b/src/SubscribeManager.ts @@ -38,6 +38,7 @@ export class SubscribeManager { this.subscribeConfig = {}; this.loadSubscribeFile(); + this.rebuildTree(); } public async initialize() { @@ -133,23 +134,7 @@ export class SubscribeManager { * @param channelId 频道ID */ public addChannel(channelId: string) { - this.subscribeList[channelId] = {}; - for (let robotId in this.subscribeConfig) { - this.prepareTree(robotId, channelId); // 这里就先创建tree - let targetConf = this.subscribeConfig[robotId]; - for (let targetType in targetConf) { - let targetList = targetConf[targetType]; - for (let targetIdentity in targetList) { - let subscribeChannelList = targetList[targetIdentity]; - if (subscribeChannelList.includes(channelId)) { - this.subscribeList[channelId][robotId].push({ - type: targetType, - identity: targetIdentity - }); - } - } - } - } + } /** @@ -157,7 +142,7 @@ export class SubscribeManager { * @param channelId 频道ID */ public removeChannel(channelId: string) { - delete this.subscribeList[channelId]; + } /**