From 167794ce4c665d4370fa8ef4b719f28a883b772a Mon Sep 17 00:00:00 2001 From: wood chen Date: Sat, 12 Jul 2025 01:59:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=80=9A=E7=9F=A5=E5=8A=9F=E8=83=BD=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=A8=A1=E6=80=81=E6=A1=86=EF=BC=8C=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=E3=80=82=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E6=96=87=E4=BB=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8E=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E6=96=87=E6=9C=AC=E3=80=82=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=BB=E6=96=87=E4=BB=B6=E5=AF=BC=E5=85=A5=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E9=99=A4=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/en.ts | 8 +------ src/i18n/zh-CN.ts | 8 +------ src/main.ts | 28 +---------------------- src/ui.ts | 58 +---------------------------------------------- 4 files changed, 4 insertions(+), 98 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 15dcfcd..6f6ed70 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -88,11 +88,5 @@ export default { 'USER_API_KEY_DESC': 'Current configured User-API-Key (read-only)', 'USER_API_KEY_EMPTY': 'Please use the process below to obtain one', 'COPY_API_KEY': 'Copy', - 'API_KEY_COPIED': '✅ API Key copied to clipboard', - - // Version update notice - 'UPDATE_NOTICE_TITLE': '🔄 Plugin Updated - Reconfiguration Required', - 'UPDATE_NOTICE_MESSAGE': 'Due to major changes in authentication method, you need to reconfigure your User-API-Key. The old API Key and username method has been removed. Please go to settings to reconfigure.', - 'UPDATE_NOTICE_BUTTON': 'Go to Settings', - 'UPDATE_NOTICE_DISMISS': 'I understand' + 'API_KEY_COPIED': '✅ API Key copied to clipboard' } \ No newline at end of file diff --git a/src/i18n/zh-CN.ts b/src/i18n/zh-CN.ts index be7da7b..74888a2 100644 --- a/src/i18n/zh-CN.ts +++ b/src/i18n/zh-CN.ts @@ -88,11 +88,5 @@ export default { 'USER_API_KEY_DESC': '当前配置的 User-API-Key(只读)', 'USER_API_KEY_EMPTY': '请使用下面的流程获取', 'COPY_API_KEY': '复制', - 'API_KEY_COPIED': '✅ API Key 已复制到剪贴板', - - // 版本更新提示 - 'UPDATE_NOTICE_TITLE': '🔄 插件已更新 - 需要重新配置', - 'UPDATE_NOTICE_MESSAGE': '由于认证方式的重大变化,您需要重新配置 User-API-Key。旧的 API Key 和用户名方式已被移除,请前往设置页面重新配置。', - 'UPDATE_NOTICE_BUTTON': '前往设置', - 'UPDATE_NOTICE_DISMISS': '我知道了' + 'API_KEY_COPIED': '✅ API Key 已复制到剪贴板' } \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 3b11831..ce7b423 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,7 @@ import { t, setLocale } from './i18n'; import { expandEmbeds } from './expand-embeds'; import { DiscourseAPI } from './api'; import { EmbedHandler } from './embed-handler'; -import { SelectCategoryModal, CategoryConflictModal, UpdateNoticeModal } from './ui'; +import { SelectCategoryModal, CategoryConflictModal } from './ui'; import { NotifyUser } from './notification'; import { getFrontMatter, removeFrontMatter } from './utils'; import { ActiveFile, PluginInterface } from './types'; @@ -30,9 +30,6 @@ export default class PublishToDiscourse extends Plugin implements PluginInterfac // 加载设置 await this.loadSettings(); - // 检查是否需要显示更新通知 - await this.checkForUpdateNotice(); - // 初始化API和嵌入处理器 this.api = new DiscourseAPI(this.app, this.settings); this.embedHandler = new EmbedHandler(this.app, this.api); @@ -74,29 +71,6 @@ export default class PublishToDiscourse extends Plugin implements PluginInterfac await this.saveData(this.settings); } - // 检查是否需要显示更新通知 - private async checkForUpdateNotice() { - const currentVersion = this.manifest.version; - const lastNotifiedVersion = this.settings.lastNotifiedVersion; - - // 如果是首次运行当前版本,显示更新通知 - if (lastNotifiedVersion !== currentVersion) { - // 延迟显示,确保界面已完全加载 - setTimeout(() => { - const modal = new UpdateNoticeModal(this.app, this, () => { - // 打开设置页面 - (this.app as any).setting.open(); - (this.app as any).setting.openTabById(this.manifest.id); - }); - modal.open(); - }, 1000); - - // 更新记录的版本 - this.settings.lastNotifiedVersion = currentVersion; - await this.saveSettings(); - } - } - // 注册目录菜单 registerDirMenu(menu: Menu, file: TFile) { const syncDiscourse = (item: MenuItem) => { diff --git a/src/ui.ts b/src/ui.ts index 116a58d..95a2706 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -344,60 +344,4 @@ export class CategoryConflictModal extends Modal { this.resolve(false); } } -} - -// 版本更新通知模态框 -export class UpdateNoticeModal extends Modal { - plugin: PluginInterface; - onSettingsClick: () => void; - - constructor(app: App, plugin: PluginInterface, onSettingsClick: () => void) { - super(app); - this.plugin = plugin; - this.onSettingsClick = onSettingsClick; - } - - onOpen() { - const { contentEl } = this; - contentEl.empty(); - contentEl.addClass('discourse-update-notice-modal'); - - // 标题 - contentEl.createEl('h2', { - text: t('UPDATE_NOTICE_TITLE'), - cls: 'update-notice-title' - }); - - // 消息内容 - const messageEl = contentEl.createEl('div', { - cls: 'update-notice-message' - }); - messageEl.createEl('p', { text: t('UPDATE_NOTICE_MESSAGE') }); - - // 按钮区域 - const buttonArea = contentEl.createEl('div', { cls: 'update-notice-buttons' }); - - // 前往设置按钮 - const settingsButton = buttonArea.createEl('button', { - cls: 'mod-cta', - text: t('UPDATE_NOTICE_BUTTON') - }); - settingsButton.onclick = () => { - this.close(); - this.onSettingsClick(); - }; - - // 我知道了按钮 - const dismissButton = buttonArea.createEl('button', { - text: t('UPDATE_NOTICE_DISMISS') - }); - dismissButton.onclick = () => { - this.close(); - }; - } - - onClose() { - const { contentEl } = this; - contentEl.empty(); - } -} \ No newline at end of file +} \ No newline at end of file