diff --git a/manifest.json b/manifest.json index ff2439a..44cbcf2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "sonicnote-sync", "name": "SonicNote Sync", - "version": "1.1.8", - "minAppVersion": "0.15.0", + "version": "1.1.9", + "minAppVersion": "1.6.0", "description": "Sync recordings from SonicNote as Markdown files with transcripts, AI summaries, and study reports.", "author": "EasyLinkIn", "isDesktopOnly": false diff --git a/package.json b/package.json index 3caca9c..df2536b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sonicnote-sync", - "version": "1.1.8", + "version": "1.1.9", "description": "Sync recordings from SonicNote to Obsidian as Markdown files", "main": "main.js", "scripts": { diff --git a/src/api.ts b/src/api.ts index a043c6a..af77c9d 100644 --- a/src/api.ts +++ b/src/api.ts @@ -46,7 +46,7 @@ export class SonicNoteApiClient { } catch (e: unknown) { const err = e as { json?: BackendResponse; message?: string }; if (err?.json) { - return err.json as BackendResponse; + return err.json; } console.error(`[SonicNote] 请求失败 ${method} ${path}:`, err?.message || e); throw new Error(err?.message || `请求失败: ${method} ${path}`); diff --git a/src/main.ts b/src/main.ts index 547dc12..42909a8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,13 @@ -import { Notice, Plugin } from 'obsidian'; +import { App, Notice, Plugin } from 'obsidian'; import { SonicNoteApiClient } from './api'; import { SyncService } from './sync'; import { SonicNoteSettingTab } from './settings'; import { DEFAULT_SETTINGS, SonicNotePluginSettings } from './types'; +interface AppWithSetting extends App { + setting: { open: () => void; openTabById: (id: string) => void }; +} + export default class SonicNoteSyncPlugin extends Plugin { settings: SonicNotePluginSettings = DEFAULT_SETTINGS; private api!: SonicNoteApiClient; @@ -15,7 +19,6 @@ export default class SonicNoteSyncPlugin extends Plugin { async onload() { await this.loadSettings(); - // Initialize API client and sync service this.api = new SonicNoteApiClient(() => this.settings); this.syncService = new SyncService( this.app, @@ -44,10 +47,9 @@ export default class SonicNoteSyncPlugin extends Plugin { id: 'login', name: '登录', callback: () => { - // @ts-ignore - internal API to open settings - this.app.setting.open(); - // @ts-ignore - this.app.setting.openTabById('sonicnote-sync'); + const app = this.app as AppWithSetting; + app.setting.open(); + app.setting.openTabById('sonicnote-sync'); }, }); @@ -89,7 +91,8 @@ export default class SonicNoteSyncPlugin extends Plugin { } async loadSettings() { - this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + const saved = await this.loadData() as Partial | null; + this.settings = Object.assign({}, DEFAULT_SETTINGS, saved); } async saveSettings() { diff --git a/src/settings.ts b/src/settings.ts index e7a2081..b4195d2 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -26,7 +26,7 @@ export class SonicNoteSettingTab extends PluginSettingTab { containerEl.empty(); new Setting(containerEl) - .setName('SonicNote Sync 设置') + .setName('设置') .setHeading(); // Sync folder diff --git a/versions.json b/versions.json index 38cadcc..c14a7a6 100644 --- a/versions.json +++ b/versions.json @@ -4,5 +4,6 @@ "1.1.2": "0.15.0", "1.1.3": "0.15.0", "1.1.4": "0.15.0", - "1.1.8": "0.15.0" + "1.1.8": "1.6.0", + "1.1.9": "1.6.0" }