koishi-plugin-wordpress-notifier 2.0.1 → 2.0.2
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/README.md +7 -0
- package/lib/index.js +2 -14
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -78,6 +78,8 @@ function apply(ctx, config) {
|
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
80
|
ctx.logger.error(`获取 WordPress 用户失败: ${error}`);
|
|
81
|
+
ctx.logger.error(`WordPress REST API 的 users 端点可能需要认证才能访问,当前版本暂不支持认证配置`);
|
|
82
|
+
// 返回空数组,确保插件继续运行
|
|
81
83
|
return [];
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -94,10 +96,6 @@ function apply(ctx, config) {
|
|
|
94
96
|
return [];
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
async function isPostPushed(postId) {
|
|
98
|
-
const record = await ctx.database.get('wordpress_posts', { postId });
|
|
99
|
-
return record.length > 0;
|
|
100
|
-
}
|
|
101
99
|
async function isUserPushed(userId) {
|
|
102
100
|
const record = await ctx.database.get('wordpress_user_registrations', { userId });
|
|
103
101
|
return record.length > 0;
|
|
@@ -110,12 +108,6 @@ function apply(ctx, config) {
|
|
|
110
108
|
const record = await ctx.database.get('wordpress_group_pushes', { groupId, postId });
|
|
111
109
|
return record.length > 0;
|
|
112
110
|
}
|
|
113
|
-
async function markPostAsPushed(postId) {
|
|
114
|
-
await ctx.database.create('wordpress_posts', {
|
|
115
|
-
postId,
|
|
116
|
-
pushedAt: new Date()
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
111
|
async function markUserAsPushed(userId) {
|
|
120
112
|
await ctx.database.create('wordpress_user_registrations', {
|
|
121
113
|
userId,
|
|
@@ -243,10 +235,6 @@ function apply(ctx, config) {
|
|
|
243
235
|
ctx.logger.error(`错误详情: ${JSON.stringify(error)}`);
|
|
244
236
|
}
|
|
245
237
|
}
|
|
246
|
-
// 标记文章已推送(全局记录)
|
|
247
|
-
if (!(await isPostPushed(post.id))) {
|
|
248
|
-
await markPostAsPushed(post.id);
|
|
249
|
-
}
|
|
250
238
|
}
|
|
251
239
|
}
|
|
252
240
|
}
|