feat: 更新版本号至 1.1.9,优化 API 错误处理,调整设置界面名称

This commit is contained in:
huojl 2026-06-13 14:09:37 +08:00
parent b6050bfdfc
commit b5ece3cabf
6 changed files with 17 additions and 13 deletions

View file

@ -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

View file

@ -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": {

View file

@ -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}`);

View file

@ -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<SonicNotePluginSettings> | null;
this.settings = Object.assign({}, DEFAULT_SETTINGS, saved);
}
async saveSettings() {

View file

@ -26,7 +26,7 @@ export class SonicNoteSettingTab extends PluginSettingTab {
containerEl.empty();
new Setting(containerEl)
.setName('SonicNote Sync 设置')
.setName('设置')
.setHeading();
// Sync folder

View file

@ -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"
}