diff --git a/client/web/assets/images/avatar/github-color.webp b/client/web/assets/images/avatar/github-color.webp
new file mode 100644
index 00000000..c1a81c6b
Binary files /dev/null and b/client/web/assets/images/avatar/github-color.webp differ
diff --git a/client/web/assets/images/avatar/github-dark.svg b/client/web/assets/images/avatar/github-dark.svg
new file mode 100644
index 00000000..46a93e9e
--- /dev/null
+++ b/client/web/assets/images/avatar/github-dark.svg
@@ -0,0 +1,12 @@
+
diff --git a/client/web/assets/images/avatar/github.svg b/client/web/assets/images/avatar/github.svg
new file mode 100644
index 00000000..a7ca7f54
--- /dev/null
+++ b/client/web/assets/images/avatar/github.svg
@@ -0,0 +1,12 @@
+
diff --git a/client/web/assets/images/avatar/robot.webp b/client/web/assets/images/avatar/robot.webp
new file mode 100644
index 00000000..7d5c4873
Binary files /dev/null and b/client/web/assets/images/avatar/robot.webp differ
diff --git a/client/web/build/webpack.config.ts b/client/web/build/webpack.config.ts
index 53b0597b..3eea23e5 100644
--- a/client/web/build/webpack.config.ts
+++ b/client/web/build/webpack.config.ts
@@ -83,6 +83,10 @@ const plugins: Configuration['plugins'] = [
from: path.resolve(ROOT_PATH, './assets/images/logo/'),
to: 'images/logo/',
},
+ {
+ from: path.resolve(ROOT_PATH, './assets/images/avatar/'),
+ to: 'images/avatar/',
+ },
{
from: path.resolve(ROOT_PATH, '../../vercel.json'),
to: 'vercel.json',
diff --git a/server/plugins/com.msgbyte.github/services/subscribe.service.ts b/server/plugins/com.msgbyte.github/services/subscribe.service.ts
index dfed0aad..580f24d8 100644
--- a/server/plugins/com.msgbyte.github/services/subscribe.service.ts
+++ b/server/plugins/com.msgbyte.github/services/subscribe.service.ts
@@ -60,7 +60,7 @@ class GithubSubscribeService extends TcService {
const botUserId = await this.broker.call('user.ensurePluginBot', {
botId: 'github-bot',
nickname: 'Github Bot',
- avatar: 'https://api.iconify.design/akar-icons/github-fill.svg',
+ avatar: 'https://api.iconify.design/entypo-social/github.svg',
});
this.logger.info('Github Bot Id:', botUserId);
diff --git a/server/plugins/com.msgbyte.simplenotify/services/simplenotify.service.ts b/server/plugins/com.msgbyte.simplenotify/services/simplenotify.service.ts
index 5be2d62d..bc0e8c05 100644
--- a/server/plugins/com.msgbyte.simplenotify/services/simplenotify.service.ts
+++ b/server/plugins/com.msgbyte.simplenotify/services/simplenotify.service.ts
@@ -70,8 +70,7 @@ class SimpleNotifyService extends TcService {
const botUserId = await this.broker.call('user.ensurePluginBot', {
botId: 'simple-notify-bot',
nickname: 'Notify Bot',
- avatar:
- 'https://api.iconify.design/icon-park-outline/volume-notice.svg',
+ avatar: '/images/avatar/robot.webp',
});
this.logger.info('Simple Notify Bot Id:', botUserId);
diff --git a/server/services/core/user/user.service.ts b/server/services/core/user/user.service.ts
index d6a15cc0..96e8e1bc 100644
--- a/server/services/core/user/user.service.ts
+++ b/server/services/core/user/user.service.ts
@@ -602,24 +602,34 @@ class UserService extends TcService {
async ensurePluginBot(
ctx: TcContext<{
- botId: 'string';
- nickname: 'string';
- avatar: { type: 'string'; optional: true };
+ botId: string;
+ nickname: string;
+ avatar: string;
}>
): Promise {
const { botId, nickname, avatar } = ctx.params;
const email = this.buildPluginBotEmail(botId);
- const bot = await this.adapter.model.findOne(
- {
- email,
- },
- {
- _id: 1,
- }
- );
+ const bot = await this.adapter.model.findOne({
+ email,
+ });
if (bot) {
+ if (bot.nickname !== nickname || bot.avatar !== avatar) {
+ /**
+ * 如果信息不匹配,则更新
+ */
+ this.logger.info('检查到插件机器人信息不匹配, 更新机器人信息:', {
+ nickname,
+ avatar,
+ });
+ await bot.updateOne({
+ nickname,
+ avatar,
+ });
+ await this.cleanUserInfoCache(String(bot._id));
+ }
+
return String(bot._id);
}
@@ -634,10 +644,22 @@ class UserService extends TcService {
return String(newBot._id);
}
+ /**
+ * 清理当前用户的缓存信息
+ */
private async cleanCurrentUserCache(ctx: TcContext) {
const { token, userId } = ctx.meta;
- this.cleanActionCache('resolveToken', [token]);
- this.cleanActionCache('getUserInfo', [userId]);
+ await Promise.all([
+ this.cleanActionCache('resolveToken', [token]),
+ this.cleanActionCache('getUserInfo', [userId]),
+ ]);
+ }
+
+ /**
+ * 根据用户ID清理缓存信息
+ */
+ private async cleanUserInfoCache(userId: string) {
+ await this.cleanActionCache('getUserInfo', [String(userId)]);
}
/**