mirror of
https://github.com/long2icc/sonicnote-sync.git
synced 2026-07-22 07:45:14 +00:00
feat: 更新版本至1.1.6,支持使用API Key登录并更新相关文档
This commit is contained in:
parent
758396777d
commit
99ae04dad6
8 changed files with 35 additions and 32 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "sonicnote-sync",
|
||||
"name": "SonicNote Sync",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Sync recordings from SonicNote to Obsidian as Markdown files",
|
||||
"author": "EasyLinkIn",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sonicnote-sync",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"description": "Sync recordings from SonicNote to Obsidian as Markdown files",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@
|
|||
|
||||
<header class="header">
|
||||
<div class="badges">
|
||||
<span class="badge badge-version">v1.1.5</span>
|
||||
<span class="badge badge-version">v1.1.6</span>
|
||||
<span class="badge badge-plugin">Obsidian 插件</span>
|
||||
<span class="badge badge-skill">2 个 Skills</span>
|
||||
<span class="badge" style="background: var(--tag-green); color: var(--tag-green-text);">视频教程</span>
|
||||
|
|
@ -351,7 +351,7 @@
|
|||
<h1>SonicNote for Obsidian</h1>
|
||||
<p>录音同步、待办提取、工作总结 — 让 Obsidian 成为你的智能笔记中心</p>
|
||||
<div class="header-actions">
|
||||
<a class="download-btn" href="sonicnote-sync-v1.1.5.zip" download>
|
||||
<a class="download-btn" href="sonicnote-sync-v1.1.6.zip" download>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
||||
SonicNote Sync 插件
|
||||
</a>
|
||||
|
|
@ -407,6 +407,10 @@
|
|||
|
||||
<div class="card">
|
||||
<h2>更新记录</h2>
|
||||
<h3>v1.1.6</h3>
|
||||
<ul>
|
||||
<li>登录方式从手机号+验证码切换为 API Key(在妙记 App → 我的 → API Key 管理中创建)</li>
|
||||
</ul>
|
||||
<h3>v1.1.5</h3>
|
||||
<ul>
|
||||
<li>新增学习总结同步:自动同步知识全景图、核心收获和课后巩固内容</li>
|
||||
|
|
@ -447,7 +451,7 @@
|
|||
<div class="card">
|
||||
<h2>安装</h2>
|
||||
<ol>
|
||||
<li>点击上方按钮下载 <span class="inline-code">sonicnote-sync-v1.1.5.zip</span></li>
|
||||
<li>点击上方按钮下载 <span class="inline-code">sonicnote-sync-v1.1.6.zip</span></li>
|
||||
<li>解压 zip 文件,得到以下文件:
|
||||
<ul style="margin-top:4px;">
|
||||
<li><span class="inline-code">main.js</span></li>
|
||||
|
|
@ -476,7 +480,7 @@
|
|||
<ol>
|
||||
<li>进入 <strong>设置 → SonicNote Sync</strong></li>
|
||||
<li>点击"登录"按钮</li>
|
||||
<li>输入 SonicNote 妙记的手机号和密码(使用 APP 验证码或申领长期密码)</li>
|
||||
<li>输入 API Key(在妙记 App → 我的 → API Key 管理中创建,格式:<span class="inline-code">sk-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</span>)</li>
|
||||
</ol>
|
||||
|
||||
<h3>同步录音</h3>
|
||||
|
|
|
|||
BIN
release/sonicnote-sync-1.1.6.zip
Normal file
BIN
release/sonicnote-sync-1.1.6.zip
Normal file
Binary file not shown.
|
|
@ -52,9 +52,9 @@ export class SonicNoteApiClient {
|
|||
}
|
||||
}
|
||||
|
||||
async login(phone: string, code: string): Promise<{ token: string; userId: string }> {
|
||||
const res = await this.request('POST', '/app/user/loginByPhone', {
|
||||
body: { phonenumber: phone, code: code },
|
||||
async login(apiKey: string): Promise<{ token: string; userId: string }> {
|
||||
const res = await this.request('POST', '/app/mcp/login', {
|
||||
body: { apiKey },
|
||||
});
|
||||
if (res.code !== 200) {
|
||||
throw new Error(res.msg || '登录失败');
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class SonicNoteSyncPlugin extends Plugin {
|
|||
name: '登出',
|
||||
callback: async () => {
|
||||
this.settings.token = '';
|
||||
this.settings.phoneNumber = '';
|
||||
this.settings.apiKey = '';
|
||||
await this.saveSettings();
|
||||
new Notice('已登出 SonicNote');
|
||||
this.updateStatusBar();
|
||||
|
|
|
|||
|
|
@ -177,15 +177,18 @@ export class SonicNoteSettingTab extends PluginSettingTab {
|
|||
loginSection.createEl('h3', { text: '账号' });
|
||||
|
||||
if (this.api.isAuthenticated()) {
|
||||
const maskedKey = settings.apiKey.length > 10
|
||||
? settings.apiKey.slice(0, 10) + '...'
|
||||
: settings.apiKey;
|
||||
new Setting(loginSection)
|
||||
.setName('登录状态')
|
||||
.setDesc(`已登录: ${settings.phoneNumber}`)
|
||||
.setDesc(`已登录: ${maskedKey}`)
|
||||
.addButton(btn => btn
|
||||
.setButtonText('登出')
|
||||
.setWarning()
|
||||
.onClick(async () => {
|
||||
settings.token = '';
|
||||
settings.phoneNumber = '';
|
||||
settings.apiKey = '';
|
||||
await this.saveSettings();
|
||||
new Notice('已登出');
|
||||
this.display();
|
||||
|
|
@ -193,7 +196,7 @@ export class SonicNoteSettingTab extends PluginSettingTab {
|
|||
} else {
|
||||
new Setting(loginSection)
|
||||
.setName('登录')
|
||||
.setDesc('使用手机号和验证码登录智音笔记')
|
||||
.setDesc('使用 API Key 登录 SonicNote')
|
||||
.addButton(btn => btn
|
||||
.setButtonText('登录')
|
||||
.onClick(() => {
|
||||
|
|
@ -229,38 +232,34 @@ class LoginModal extends Modal {
|
|||
|
||||
contentEl.createEl('h2', { text: '登录 SonicNote' });
|
||||
|
||||
let phone = '';
|
||||
let code = '';
|
||||
let apiKey = '';
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName('手机号')
|
||||
.addText(text => text
|
||||
.setPlaceholder('请输入手机号')
|
||||
.onChange((value) => { phone = value; }));
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName('密码')
|
||||
.setDesc('使用 APP 验证码或者申领长期密码')
|
||||
.addText(text => text
|
||||
.setPlaceholder('请输入密码')
|
||||
.onChange((value) => { code = value; }));
|
||||
.setName('API Key')
|
||||
.setDesc('在妙记 App → 我的 → API Key 管理中创建')
|
||||
.addText(text => {
|
||||
text
|
||||
.setPlaceholder('sk-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
|
||||
.onChange((value) => { apiKey = value; });
|
||||
text.inputEl.type = 'password';
|
||||
});
|
||||
|
||||
new Setting(contentEl)
|
||||
.addButton(btn => btn
|
||||
.setButtonText('登录')
|
||||
.setCta()
|
||||
.onClick(async () => {
|
||||
if (!phone || !code) {
|
||||
new Notice('请输入手机号和密码');
|
||||
if (!apiKey) {
|
||||
new Notice('请输入 API Key');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
btn.setButtonText('登录中...');
|
||||
btn.setDisabled(true);
|
||||
const result = await this.api.login(phone, code);
|
||||
const result = await this.api.login(apiKey);
|
||||
const settings = this.getSettings();
|
||||
settings.token = result.token;
|
||||
settings.phoneNumber = phone;
|
||||
settings.apiKey = apiKey;
|
||||
await this.saveSettings();
|
||||
new Notice('登录成功');
|
||||
this.close();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export interface SonicNotePluginSettings {
|
|||
frontmatterFields: Record<string, boolean>;
|
||||
customFrontmatter: CustomFrontmatterField[];
|
||||
token: string;
|
||||
phoneNumber: string;
|
||||
apiKey: string;
|
||||
lastSyncTime: string;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ export const DEFAULT_SETTINGS: SonicNotePluginSettings = {
|
|||
},
|
||||
customFrontmatter: [],
|
||||
token: '',
|
||||
phoneNumber: '',
|
||||
apiKey: '',
|
||||
lastSyncTime: '',
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue