Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: Support per-connection remote extension trust in GUI https://github.com/siyuan-note/siyuan/issues/19204

Daniel4d83f49bc83a
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index ae4fa5b36b..4076437fa1 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "الوثوق بالإضافات والمظهر البعيد وتحميلهما",
+ "trustRemoteExtensionsTip": "يمكن للإضافات البعيدة قراءة الملفات المحلية وكتابتها وتشغيل البرامج. ثق فقط بالخوادم الموثوقة وتحديثات إضافاتها المستقبلية. يُحفظ إعداد الثقة محليًا لكل عنوان ويُطبّق عند الاتصال التالي",
"remoteConnectionHistory": "سجل الاتصالات البعيدة",
"connectRemoteKernel": "الاتصال بنواة بعيدة...",
"remoteConnection": "بعيد",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index fa2ff4195f..391c36f159 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Remote-Plugins und Erscheinungsbild vertrauen und laden",
+ "trustRemoteExtensionsTip": "Remote-Erweiterungen können lokale Dateien lesen und schreiben sowie Programme ausführen. Vertrauen Sie nur zuverlässigen Servern und ihren zukünftigen Erweiterungsupdates. Die Einstellung wird lokal je Adresse gespeichert und gilt ab der nächsten Verbindung",
"remoteConnectionHistory": "Verlauf der Remoteverbindungen",
"connectRemoteKernel": "Mit entferntem Kernel verbinden...",
"remoteConnection": "Remote",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index f2e8225a01..686a383ac1 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Trust and load remote plugins and appearance",
+ "trustRemoteExtensionsTip": "Remote extensions can read and write local files and execute programs. Only trust reliable servers and their future extension updates. Trust is saved locally per address and takes effect on the next connection",
"remoteConnectionHistory": "Remote connection history",
"connectRemoteKernel": "Connect to remote kernel...",
"remoteConnection": "Remote",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 6a9af45924..bb9647a289 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Confiar en los complementos y la apariencia remotos y cargarlos",
+ "trustRemoteExtensionsTip": "Las extensiones remotas pueden leer y escribir archivos locales y ejecutar programas. Confía solo en servidores fiables y en las futuras actualizaciones de sus extensiones. La confianza se guarda localmente por dirección y se aplica en la próxima conexión",
"remoteConnectionHistory": "Historial de conexiones remotas",
"connectRemoteKernel": "Conectar a un núcleo remoto...",
"remoteConnection": "Remoto",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index be2fa11de8..7116de4f93 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Faire confiance aux plugins et à l’apparence distants et les charger",
+ "trustRemoteExtensionsTip": "Les extensions distantes peuvent lire et écrire des fichiers locaux et exécuter des programmes. Ne faites confiance qu’aux serveurs fiables et aux futures mises à jour de leurs extensions. Ce choix est enregistré localement par adresse et prend effet à la prochaine connexion",
"remoteConnectionHistory": "Historique des connexions distantes",
"connectRemoteKernel": "Se connecter à un noyau distant...",
"remoteConnection": "Distant",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index 67b68fd588..fb48def24d 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "לתת אמון בתוספים ובעיצוב המרוחקים ולטעון אותם",
+ "trustRemoteExtensionsTip": "הרחבות מרוחקות יכולות לקרוא ולכתוב קבצים מקומיים ולהפעיל תוכניות. יש לתת אמון רק בשרתים אמינים ובעדכוני ההרחבות העתידיים שלהם. ההגדרה נשמרת מקומית לכל כתובת ותחול בחיבור הבא",
"remoteConnectionHistory": "היסטוריית חיבורים מרוחקים",
"connectRemoteKernel": "התחברות לליבה מרוחקת...",
"remoteConnection": "מרוחק",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index e7ea095dc0..194e64b9c0 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "दूरस्थ प्लगइन और रूप-रंग पर भरोसा करें और लोड करें",
+ "trustRemoteExtensionsTip": "दूरस्थ एक्सटेंशन स्थानीय फ़ाइलें पढ़ और लिख सकते हैं तथा प्रोग्राम चला सकते हैं। केवल विश्वसनीय सर्वर और उनके भविष्य के एक्सटेंशन अपडेट पर भरोसा करें। भरोसे की सेटिंग प्रत्येक पते के लिए स्थानीय रूप से सहेजी जाती है और अगले कनेक्शन पर लागू होती है",
"remoteConnectionHistory": "दूरस्थ कनेक्शन इतिहास",
"connectRemoteKernel": "दूरस्थ कर्नेल से कनेक्ट करें...",
"remoteConnection": "दूरस्थ",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index afd06a7443..dbf519455a 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Percayai dan muat plugin serta tampilan jarak jauh",
+ "trustRemoteExtensionsTip": "Ekstensi jarak jauh dapat membaca dan menulis berkas lokal serta menjalankan program. Hanya percayai server tepercaya dan pembaruan ekstensinya di masa mendatang. Pengaturan kepercayaan disimpan secara lokal per alamat dan berlaku pada koneksi berikutnya",
"remoteConnectionHistory": "Riwayat koneksi jarak jauh",
"connectRemoteKernel": "Hubungkan ke kernel jarak jauh...",
"remoteConnection": "Jarak jauh",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 7a567782ce..371e8ce9ca 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Considera attendibili e carica i plugin e l’aspetto remoti",
+ "trustRemoteExtensionsTip": "Le estensioni remote possono leggere e scrivere file locali ed eseguire programmi. Considera attendibili solo i server affidabili e i futuri aggiornamenti delle loro estensioni. La scelta viene salvata localmente per indirizzo e applicata alla connessione successiva",
"remoteConnectionHistory": "Cronologia delle connessioni remote",
"connectRemoteKernel": "Connetti a un kernel remoto...",
"remoteConnection": "Remoto",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index b16866015e..9c71aad5f8 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "リモートのプラグインと外観を信頼して読み込む",
+ "trustRemoteExtensionsTip": "リモート拡張機能はローカルファイルの読み書きやプログラムの実行ができます。信頼できるサーバーと今後の拡張機能の更新のみを許可してください。信頼設定はアドレスごとにローカルに保存され、次回の接続時に適用されます",
"remoteConnectionHistory": "リモート接続履歴",
"connectRemoteKernel": "リモートカーネルに接続...",
"remoteConnection": "リモート",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index a32503d464..c800be2e05 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "원격 플러그인과 외형을 신뢰하고 불러오기",
+ "trustRemoteExtensionsTip": "원격 확장 기능은 로컬 파일을 읽고 쓰거나 프로그램을 실행할 수 있습니다. 신뢰할 수 있는 서버와 향후 확장 기능 업데이트만 허용하세요. 신뢰 설정은 주소별로 로컬에 저장되며 다음 연결부터 적용됩니다",
"remoteConnectionHistory": "원격 연결 기록",
"connectRemoteKernel": "원격 커널에 연결...",
"remoteConnection": "원격",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index 21c8e1c4fa..db3f81ae01 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Externe plug-ins en vormgeving vertrouwen en laden",
+ "trustRemoteExtensionsTip": "Externe uitbreidingen kunnen lokale bestanden lezen en schrijven en programma’s uitvoeren. Vertrouw alleen betrouwbare servers en toekomstige updates van hun uitbreidingen. De instelling wordt lokaal per adres opgeslagen en geldt vanaf de volgende verbinding",
"remoteConnectionHistory": "Geschiedenis van externe verbindingen",
"connectRemoteKernel": "Verbinden met externe kernel...",
"remoteConnection": "Extern",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 33cdb2fef4..c360526279 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Ufaj zdalnym wtyczkom i wyglądowi oraz je wczytuj",
+ "trustRemoteExtensionsTip": "Zdalne rozszerzenia mogą odczytywać i zapisywać pliki lokalne oraz uruchamiać programy. Ufaj tylko wiarygodnym serwerom i przyszłym aktualizacjom ich rozszerzeń. Ustawienie jest zapisywane lokalnie dla każdego adresu i obowiązuje od następnego połączenia",
"remoteConnectionHistory": "Historia połączeń zdalnych",
"connectRemoteKernel": "Połącz ze zdalnym jądrem...",
"remoteConnection": "Zdalne",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 2bd0074e7b..7861a29e1e 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Confiar nos plugins e na aparência remotos e carregá-los",
+ "trustRemoteExtensionsTip": "Extensões remotas podem ler e gravar arquivos locais e executar programas. Confie apenas em servidores confiáveis e nas futuras atualizações de suas extensões. A confiança é salva localmente por endereço e aplicada na próxima conexão",
"remoteConnectionHistory": "Histórico de conexões remotas",
"connectRemoteKernel": "Conectar ao kernel remoto...",
"remoteConnection": "Remoto",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 52e9a5461b..f1148968d7 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Доверять удалённым плагинам и оформлению и загружать их",
+ "trustRemoteExtensionsTip": "Удалённые расширения могут читать и записывать локальные файлы и запускать программы. Доверяйте только надёжным серверам и будущим обновлениям их расширений. Настройка сохраняется локально для каждого адреса и применяется при следующем подключении",
"remoteConnectionHistory": "История удалённых подключений",
"connectRemoteKernel": "Подключиться к удалённому ядру...",
"remoteConnection": "Удалённое",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 444d446230..ea57eb3580 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Dôverovať vzdialeným doplnkom a vzhľadu a načítať ich",
+ "trustRemoteExtensionsTip": "Vzdialené rozšírenia môžu čítať a zapisovať lokálne súbory a spúšťať programy. Dôverujte iba spoľahlivým serverom a budúcim aktualizáciám ich rozšírení. Nastavenie sa ukladá lokálne pre každú adresu a platí od ďalšieho pripojenia",
"remoteConnectionHistory": "História vzdialených pripojení",
"connectRemoteKernel": "Pripojiť k vzdialenému jadru...",
"remoteConnection": "Vzdialené",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 29cbc70df8..7db0cf122c 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "เชื่อถือและโหลดปลั๊กอินและรูปลักษณ์ระยะไกล",
+ "trustRemoteExtensionsTip": "ส่วนขยายระยะไกลสามารถอ่านและเขียนไฟล์ในเครื่อง รวมถึงเรียกใช้โปรแกรมได้ โปรดเชื่อถือเฉพาะเซิร์ฟเวอร์ที่เชื่อถือได้และการอัปเดตส่วนขยายในอนาคต การตั้งค่าความเชื่อถือจะบันทึกไว้ในเครื่องแยกตามที่อยู่ และมีผลในการเชื่อมต่อครั้งถัดไป",
"remoteConnectionHistory": "ประวัติการเชื่อมต่อระยะไกล",
"connectRemoteKernel": "เชื่อมต่อเคอร์เนลระยะไกล...",
"remoteConnection": "ระยะไกล",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 76e7d3ec3b..7ca982e1fd 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Uzak eklentilere ve görünüme güven ve bunları yükle",
+ "trustRemoteExtensionsTip": "Uzak uzantılar yerel dosyaları okuyup yazabilir ve program çalıştırabilir. Yalnızca güvenilir sunuculara ve uzantılarının gelecekteki güncellemelerine güvenin. Güven ayarı her adres için yerel olarak kaydedilir ve sonraki bağlantıda geçerli olur",
"remoteConnectionHistory": "Uzak bağlantı geçmişi",
"connectRemoteKernel": "Uzak çekirdeğe bağlan...",
"remoteConnection": "Uzak",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 43106c1884..85e72a00d8 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "Довіряти віддаленим плагінам і оформленню та завантажувати їх",
+ "trustRemoteExtensionsTip": "Віддалені розширення можуть читати й записувати локальні файли та запускати програми. Довіряйте лише надійним серверам і майбутнім оновленням їхніх розширень. Налаштування зберігається локально для кожної адреси й застосовується під час наступного підключення",
"remoteConnectionHistory": "Історія віддалених підключень",
"connectRemoteKernel": "Підключитися до віддаленого ядра...",
"remoteConnection": "Віддалене",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index dcbd7f3624..39396c793a 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "信任并加载远程插件与外观",
+ "trustRemoteExtensionsTip": "远程扩展可以读写本机文件和执行程序,请仅信任可靠的服务器及其后续扩展更新。信任设置按地址保存在本机,下次连接时生效",
"remoteConnectionHistory": "远程连接历史",
"connectRemoteKernel": "连接远程内核...",
"remoteConnection": "远程",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index fd0769865f..feb452229f 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,6 @@
{
+ "trustRemoteExtensions": "信任並載入遠端外掛與外觀",
+ "trustRemoteExtensionsTip": "遠端擴充功能可以讀寫本機檔案和執行程式,請僅信任可靠的伺服器及其後續擴充功能更新。信任設定依位址儲存在本機,下次連線時生效",
"remoteConnectionHistory": "遠端連線記錄",
"connectRemoteKernel": "連線至遠端核心...",
"remoteConnection": "遠端",
diff --git a/app/electron/connectionManager.js b/app/electron/connectionManager.js
index 498844fd6b..bf89b020fc 100644
--- a/app/electron/connectionManager.js
+++ b/app/electron/connectionManager.js
@@ -131,7 +131,17 @@ const createConnectionManager = ({confDir, languageDir, restart, currentTarget,
}
return response;
};
- const list = () => readConnections(file).origins.map(origin => ({mode: "remote", origin}));
+ const list = () => {
+ const history = readConnections(file);
+ return history.origins.map(origin => ({mode: "remote", origin,
+ trustRemoteExtensions: history.trustedOrigins.includes(origin)}));
+ };
+ const setTrust = (history, origin, trusted) => {
+ history.trustedOrigins = history.trustedOrigins.filter(item => item !== origin && history.origins.includes(item));
+ if (trusted === true) {
+ history.trustedOrigins.push(origin);
+ }
+ };
ipcMain.handle("siyuan-connections", async (event, data) => {
if (data.cmd === "init" && data.dialog && isTrustedDialogSender(event)) {
releaseDialog();
@@ -188,6 +198,7 @@ const createConnectionManager = ({confDir, languageDir, restart, currentTarget,
const origin = normalizeRemoteKernelOrigin(data.origin);
updateHistory(history => {
history.origins = history.origins.filter(item => item !== origin);
+ setTrust(history, origin, false);
});
return {entries: list()};
}
@@ -197,13 +208,30 @@ const createConnectionManager = ({confDir, languageDir, restart, currentTarget,
} catch (error) {
throw new Error(languages().remoteKernelAddressTip);
}
+ if (data.cmd === "trust") {
+ if (typeof data.trustRemoteExtensions !== "boolean") {
+ throw new Error(languages().remoteKernelConnectionFailed);
+ }
+ updateHistory(history => {
+ if (!history.origins.includes(origin)) {
+ throw new Error(languages().remoteKernelConnectionFailed);
+ }
+ setTrust(history, origin, data.trustRemoteExtensions);
+ });
+ return {entries: list()};
+ }
if (data.cmd === "open") {
if (checkedOrigin !== origin || authenticatedOrigin !== origin) {
throw new Error(languages().remoteKernelConnectionFailed);
}
await getRemoteSession({origin}).cookies.flushStore();
- remember(origin);
- await restart({mode: "remote", origin, lang: language, sessionHandoff: await stageSession(origin)});
+ const trustRemoteExtensions = data.trustRemoteExtensions === true;
+ updateHistory(history => {
+ history.origins = [origin, ...history.origins.filter(item => item !== origin)].slice(0, 50);
+ setTrust(history, origin, trustRemoteExtensions);
+ });
+ await restart({mode: "remote", origin, lang: language, trustRemoteExtensions,
+ sessionHandoff: await stageSession(origin)});
return {};
}
controller?.abort();
diff --git a/app/electron/connectionManager.test.js b/app/electron/connectionManager.test.js
index 308c1e09f9..fdc6af8f21 100644
--- a/app/electron/connectionManager.test.js
+++ b/app/electron/connectionManager.test.js
@@ -124,6 +124,11 @@ if (!process.versions.electron) {
assert.equal((await invoke({cmd: "login", origin, authCode: "valid", rememberMe: true})).authenticated, true);
assert.deepEqual(await invoke({cmd: "open", origin}), {});
assert.equal(restarts[0].origin, origin);
+ assert.equal(restarts[0].trustRemoteExtensions, false);
+ assert.ok((await invoke({cmd: "trust", origin, trustRemoteExtensions: "true"})).error);
+ assert.ok((await invoke({cmd: "trust", origin: "https://example.com:8443", trustRemoteExtensions: true})).error);
+ assert.equal((await invoke({cmd: "trust", origin, trustRemoteExtensions: true})).entries[0].trustRemoteExtensions, true);
+ assert.deepEqual(readConnections(path.join(profile, "connections.json")).trustedOrigins, [origin]);
if (restarts[0].sessionHandoff) {
const token = restarts[0].sessionHandoff;
const handoff = path.join(profile, "connection-session-" + token + ".bin");
@@ -138,6 +143,7 @@ if (!process.versions.electron) {
assert.deepEqual(readConnections(path.join(profile, "connections.json")).origins, [origin]);
assert.ok((await invoke({cmd: "remove", origin})).entries);
assert.deepEqual(readConnections(path.join(profile, "connections.json")).origins, []);
+ assert.deepEqual(readConnections(path.join(profile, "connections.json")).trustedOrigins, []);
slow = true;
const pending = invoke({cmd: "check", origin});
await new Promise(resolve => setTimeout(resolve, 50));
@@ -215,6 +221,8 @@ if (!process.versions.electron) {
fs.writeFileSync(path.join(os.tmpdir(), "siyuan-connection-dialog-preview.png"), (await dialogHost.webContents.capturePage()).toPNG());
}
const windowCount = BrowserWindow.getAllWindows().length;
+ assert.equal(await runDialog('document.querySelector("[data-field=trust]").checked'), false);
+ await runDialog('document.querySelector("[data-field=trust]").checked = true; document.querySelector("[data-field=trust]").dispatchEvent(new Event("change"))');
await runDialog('window.openRemoteConnection(); document.querySelector("[data-field=connect]").click()');
await waitDialog('!document.querySelector("[data-field=auth]").classList.contains("fn__none")');
assert.equal(BrowserWindow.getAllWindows().length, windowCount);
@@ -224,11 +232,32 @@ if (!process.versions.electron) {
await waitDialog('!document.querySelector("[data-field=connect]").disabled');
assert.equal(restarts.length, 2);
assert.equal(restarts[1].origin, origin);
+ assert.equal(restarts[1].trustRemoteExtensions, true);
+ assert.deepEqual(readConnections(path.join(profile, "connections.json")).trustedOrigins, [origin]);
assert.ok((await handler({sender: dialogHost.webContents, senderFrame: {}}, {cmd: "init", dialog: true})).error);
await runDialog('document.querySelector("[data-field=cancel]").click()');
await waitDialog('!document.querySelector(".b3-dialog")');
assert.equal(dialogHost.isDestroyed(), false);
assert.ok((await handler({sender: dialogHost.webContents, senderFrame: dialogHost.webContents.mainFrame}, {cmd: "open", origin})).error);
+ await runDialog(`window.openRemoteConnection(${JSON.stringify(origin)})`);
+ await waitDialog('!document.querySelector("[data-field=connect]").disabled');
+ assert.equal(await runDialog('document.querySelector("[data-field=trust]").checked'), true);
+ assert.equal(await runDialog('document.querySelector("[data-field=history] input").checked'), true);
+ if (process.env.SIYUAN_CONNECTION_PREVIEW) {
+ await waitDialog('document.querySelector(".b3-dialog--open")');
+ await new Promise(resolve => setTimeout(resolve, 200));
+ fs.writeFileSync(path.join(os.tmpdir(), "siyuan-connection-trust-preview.png"), (await dialogHost.webContents.capturePage()).toPNG());
+ }
+ await runDialog('document.querySelector("[data-field=origin]").value = "https://example.com:8443"; document.querySelector("[data-field=origin]").dispatchEvent(new Event("input"))');
+ assert.equal(await runDialog('document.querySelector("[data-field=trust]").checked'), false);
+ await runDialog(`document.querySelector("[data-field=origin]").value = ${JSON.stringify(origin)}; document.querySelector("[data-field=origin]").dispatchEvent(new Event("input"))`);
+ assert.equal(await runDialog('document.querySelector("[data-field=trust]").checked'), true);
+ await runDialog('document.querySelector("[data-field=history] input").click()');
+ await waitDialog('!document.querySelector("[data-field=trust]").checked');
+ assert.deepEqual(readConnections(path.join(profile, "connections.json")).trustedOrigins, []);
+ await runDialog('document.querySelector("[data-field=connect]").click()');
+ await waitDialog('!document.querySelector("[data-field=connect]").disabled');
+ assert.equal(restarts[2].trustRemoteExtensions, false);
dialogHost.destroy();
otherWindow.destroy();
console.log("Connection manager passed");
diff --git a/app/electron/connectionStore.js b/app/electron/connectionStore.js
index 7393d10cc0..8636e6731e 100644
--- a/app/electron/connectionStore.js
+++ b/app/electron/connectionStore.js
@@ -6,19 +6,23 @@ const {normalizeRemoteKernelOrigin, getUnsafeRemoteChromiumSwitchName} = require
const remotePartition = (origin) => "persist:siyuan-remote-" +
crypto.createHash("sha256").update(normalizeRemoteKernelOrigin(origin)).digest("hex");
-// 只保留地址记录,会话凭据由 Electron 会话存储管理。
+// 保存地址和逐地址信任选项,会话凭据由 Electron 会话存储管理。
const readConnections = (file) => {
try {
const data = JSON.parse(fs.readFileSync(file, "utf8"));
if (data.version !== 1 || !Array.isArray(data.origins) ||
- (data.migrated !== undefined && !Array.isArray(data.migrated))) {
+ (data.migrated !== undefined && !Array.isArray(data.migrated)) ||
+ (data.trustedOrigins !== undefined && !Array.isArray(data.trustedOrigins))) {
throw new Error("Unsupported connection history");
}
- return {...data, origins: [...new Set(data.origins.map(normalizeRemoteKernelOrigin))],
- migrated: (data.migrated || []).map(normalizeRemoteKernelOrigin)};
+ const origins = [...new Set(data.origins.map(normalizeRemoteKernelOrigin))];
+ return {...data, origins,
+ migrated: (data.migrated || []).map(normalizeRemoteKernelOrigin),
+ trustedOrigins: [...new Set((data.trustedOrigins || []).map(normalizeRemoteKernelOrigin))]
+ .filter(origin => origins.includes(origin))};
} catch (error) {
if (error.code === "ENOENT") {
- return {version: 1, origins: [], migrated: []};
+ return {version: 1, origins: [], migrated: [], trustedOrigins: []};
}
throw error;
}
@@ -49,7 +53,8 @@ const connectionArgs = (args, target, currentOrigin) => {
if (/^[a-f0-9]{48}$/.test(target.sessionHandoff || "")) {
result.push("--connection-session=" + target.sessionHandoff);
}
- if (origin === currentOrigin && args.includes("--trust-remote-extensions")) {
+ if (target.trustRemoteExtensions === true || (target.trustRemoteExtensions === undefined &&
+ origin === currentOrigin && args.includes("--trust-remote-extensions"))) {
result.push("--trust-remote-extensions");
}
} else if (target.mode === "local") {
diff --git a/app/electron/connectionStore.test.js b/app/electron/connectionStore.test.js
index 48f36994c2..1db426393c 100644
--- a/app/electron/connectionStore.test.js
+++ b/app/electron/connectionStore.test.js
@@ -32,6 +32,10 @@ test("switching removes stale connection flags and keeps unrelated launch settin
assert.equal(connectionArgs(args, {mode: "local"}).some(arg => arg.startsWith("--remote")), false);
assert.equal(connectionArgs(args, {mode: "remote", origin: "https://a.example"}, "https://a.example")
.includes("--trust-remote-extensions"), true);
+ assert.equal(connectionArgs(args, {mode: "remote", origin: "https://a.example", trustRemoteExtensions: false}, "https://a.example")
+ .includes("--trust-remote-extensions"), false);
+ assert.equal(connectionArgs(args, {mode: "remote", origin: "https://b.example", trustRemoteExtensions: true}, "https://a.example")
+ .includes("--trust-remote-extensions"), true);
assert.throws(() => connectionArgs(args, {mode: "remote", origin: "http://example.com"}));
assert.throws(() => connectionArgs(args, {mode: "local", path: "relative"}));
const localPath = path.join(os.tmpdir(), "notes with spaces");
@@ -49,12 +53,17 @@ test("connection history preserves corrupt or unsupported files and writes atomi
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "siyuan-connections-test-"));
const file = path.join(directory, "connections.json");
try {
- assert.deepEqual(readConnections(file), {version: 1, origins: [], migrated: []});
+ assert.deepEqual(readConnections(file), {version: 1, origins: [], migrated: [], trustedOrigins: []});
writeConnections(file, {version: 1, origins: ["https://EXAMPLE.com:443/", "https://example.com"], migrated: []});
assert.deepEqual(readConnections(file).origins, ["https://example.com"]);
+ assert.deepEqual(readConnections(file).trustedOrigins, []);
+ writeConnections(file, {...readConnections(file), trustedOrigins: ["https://EXAMPLE.com:443/", "https://example.com:8443"]});
+ assert.deepEqual(readConnections(file).trustedOrigins, ["https://example.com"]);
assert.deepEqual(fs.readdirSync(directory), ["connections.json"]);
for (const contents of ["corrupt", '{"version":2,"origins":[]}',
- '{"version":1,"origins":["http://example.com"]}']) {
+ '{"version":1,"origins":["http://example.com"]}',
+ '{"version":1,"origins":[],"trustedOrigins":true}',
+ '{"version":1,"origins":[],"trustedOrigins":["http://example.com"]}']) {
fs.writeFileSync(file, contents);
assert.throws(() => readConnections(file));
assert.equal(fs.readFileSync(file, "utf8"), contents);
diff --git a/app/electron/connections.css b/app/electron/connections.css
index 33ca5810f0..e79f34d942 100644
--- a/app/electron/connections.css
+++ b/app/electron/connections.css
@@ -8,7 +8,7 @@ button { padding: 6px 12px; border: 1px solid #888; border-radius: 4px; backgrou
button:hover { background: #8882; }
button:disabled { opacity: .5; cursor: default; }
#connect { background: #3573f0; color: white; border-color: #3573f0; }
-#addressTip, #restartTip { opacity: .75; }
+#addressTip, #restartTip, #trustTip { opacity: .75; }
#message { overflow-wrap: anywhere; min-height: 24px; }
fieldset { border: 0; padding: 8px 0; margin: 0; }
.actions, .entry { display: flex; gap: 8px; margin-top: 12px; }
diff --git a/app/electron/connections.html b/app/electron/connections.html
index 40a3e699aa..1258dedc33 100644
--- a/app/electron/connections.html
+++ b/app/electron/connections.html
@@ -16,6 +16,8 @@
<label id="addressLabel" for="origin"></label>
<input id="origin" type="url" placeholder="https://siyuan.example.com" required autofocus>
<p id="addressTip"></p>
+ <label><input id="trust" type="checkbox"><span id="trustLabel"></span></label>
+ <p id="trustTip"></p>
<fieldset id="auth" hidden>
<input id="authCode" type="password" autocomplete="current-password">
<div id="captchaRow" hidden><input id="captcha" autocomplete="off"><button id="refreshCaptcha" type="button"><img id="captchaImage"></button></div>
diff --git a/app/electron/connections.js b/app/electron/connections.js
index cd67efb7a5..9a04a836c9 100644
--- a/app/electron/connections.js
+++ b/app/electron/connections.js
@@ -6,6 +6,17 @@ let languages;
let checked = false;
let authenticated = false;
let sequence = 0;
+let history = [];
+const selectedOrigin = () => {
+ try {
+ return new URL(element("origin").value.trim()).origin;
+ } catch (error) {
+ return "";
+ }
+};
+const restoreTrust = () => {
+ element("trust").checked = history.some(entry => entry.origin === selectedOrigin() && entry.trustRemoteExtensions);
+};
const message = (value) => { element("message").textContent = value || ""; };
const reset = () => {
sequence++;
@@ -32,6 +43,7 @@ const refreshCaptcha = async () => {
}
};
const renderHistory = (entries) => {
+ history = entries;
element("history").replaceChildren();
entries.forEach(entry => {
const row = document.createElement("div");
@@ -42,6 +54,7 @@ const renderHistory = (entries) => {
open.addEventListener("click", () => {
reset();
element("origin").value = entry.origin;
+ restoreTrust();
element("connectionForm").requestSubmit();
});
row.append(open);
@@ -53,20 +66,56 @@ const renderHistory = (entries) => {
const result = await invoke("remove", {origin: entry.origin});
if (result.entries) {
renderHistory(result.entries);
+ if (selectedOrigin() === entry.origin) {
+ reset();
+ restoreTrust();
+ }
}
message(result.error);
});
row.append(remove);
}
- element("history").append(row);
+ const trustLabel = document.createElement("label");
+ trustLabel.title = languages.trustRemoteExtensionsTip;
+ const trust = document.createElement("input");
+ trust.type = "checkbox";
+ trust.checked = entry.trustRemoteExtensions;
+ trustLabel.append(trust, document.createTextNode(languages.trustRemoteExtensions));
+ trust.addEventListener("change", async () => {
+ trust.disabled = true;
+ try {
+ const result = await invoke("trust", {origin: entry.origin, trustRemoteExtensions: trust.checked});
+ if (result.entries) {
+ renderHistory(result.entries);
+ if (selectedOrigin() === entry.origin) {
+ reset();
+ restoreTrust();
+ }
+ } else {
+ trust.checked = entry.trustRemoteExtensions;
+ }
+ message(result.error);
+ } catch (error) {
+ trust.checked = entry.trustRemoteExtensions;
+ message(String(error.message));
+ } finally {
+ trust.disabled = false;
+ }
+ });
+ element("history").append(row, trustLabel);
});
};
-element("origin").addEventListener("input", reset);
+element("origin").addEventListener("input", () => {
+ reset();
+ restoreTrust();
+});
+element("trust").addEventListener("change", reset);
ipcRenderer.on("siyuan-connection-target", (event, data) => {
reset();
if (data.origin) {
element("origin").value = data.origin;
}
+ restoreTrust();
message(data.error);
element("origin").focus();
});
@@ -76,6 +125,7 @@ element("connectionForm").addEventListener("submit", async (event) => {
event.preventDefault();
const requestSequence = ++sequence;
const origin = element("origin").value.trim();
+ const trustRemoteExtensions = element("trust").checked;
element("connect").disabled = true;
message(languages.checkingRemoteKernel);
try {
@@ -97,7 +147,7 @@ element("connectionForm").addEventListener("submit", async (event) => {
authenticated = result.authenticated;
}
if (authenticated) {
- message((await invoke("open", {origin})).error || languages.switchConnectionRestartTip);
+ message((await invoke("open", {origin, trustRemoteExtensions})).error || languages.switchConnectionRestartTip);
} else {
message(result.error);
element("auth").hidden = !checked;
@@ -131,6 +181,8 @@ void invoke("init").then(result => {
element("title").textContent = languages.connectRemoteKernel;
element("addressLabel").textContent = languages.remoteConnection;
element("addressTip").textContent = languages.remoteKernelAddressTip;
+ element("trustLabel").textContent = languages.trustRemoteExtensions;
+ element("trustTip").textContent = languages.trustRemoteExtensionsTip;
element("restartTip").textContent = languages.switchConnectionRestartTip;
element("connect").textContent = languages.connectRemoteKernel;
element("cancel").textContent = languages.cancel;
@@ -144,4 +196,5 @@ void invoke("init").then(result => {
element("origin").value = result.origin;
message(result.error);
renderHistory(result.entries);
+ restoreTrust();
});
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260903150000-s4hctea.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260903150000-s4hctea.sy
index bc2f16192f..71ce6c1a2e 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260903150000-s4hctea.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260903150000-s4hctea.sy
@@ -6,23 +6,24 @@
"id": "20260903150000-s4hctea",
"title": "Connect to a Remote Kernel",
"type": "doc",
- "updated": "20260908104736"
+ "updated": "20260908110648"
},
"Children": [
{"ID": "20260903150000-mz3r596", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-mz3r596", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "Overview"}]},
{"ID": "20260903150000-dood0bb", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-dood0bb", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "The desktop app can connect to a SiYuan kernel running on another device and use the local desktop interface for editing. Remote mode only connects to an existing kernel and does not start a kernel on the local device."}]},
- {"ID": "20260908100358-97gqv2l", "Type": "NodeHeading", "Properties": {"id": "20260908100358-97gqv2l", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "Connection methods"}], "HeadingLevel": 2},
- {"ID": "20260908104736-op9vzxg", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-op9vzxg", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "Desktop interface"}]},
+ {"ID": "20260908100358-97gqv2l", "Type": "NodeHeading", "Properties": {"id": "20260908100358-97gqv2l", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "Connection methods"}], "HeadingLevel": 2},
+ {"ID": "20260908104736-op9vzxg", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-op9vzxg", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "Desktop interface"}]},
{"ID": "20260908100358-kpwyker", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-kpwyker", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "In the desktop workspace menu, select "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "Workspaces"}, {"Type": "NodeText", "Data": " - "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "Connect to remote kernel..."}, {"Type": "NodeText", "Data": ", enter the remote server’s HTTPS address, and connect. The address must not contain a path, query, username, or password. The client checks the kernel version and login state, then displays an access authorization code field when authentication is required. You can choose to remember your login."}]},
- {"ID": "20260908100358-nvq3oum", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-nvq3oum", "updated": "20260908103205"}, "Children": [{"Type": "NodeText", "Data": "The connection window lists remote connection history. Select an address to reconnect or remove a history entry. Removing an entry only removes its address; it does not delete server data or clear the login session."}]},
+ {"ID": "20260908100358-nvq3oum", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-nvq3oum", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "The connection interface lists remote connection history. Select an address to reconnect, change its trust setting, or remove the entry. Removing an entry deletes its address and trust setting without deleting server data, clearing the login session, or revoking permissions from extensions already loaded in the current connection."}]},
{"ID": "20260908100358-67icxqc", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-67icxqc", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "Switching connections saves and safely closes the open workspaces, then automatically restarts the desktop client with the selected connection. It does not stop or restart remote kernels. Wait for saving and shutdown to finish."}]},
{"ID": "20260908100358-h2ypcuv", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-h2ypcuv", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "The first launch, remote startup, and authentication pages provide access to remote connections. Connection failures open the connection window, where you can edit the address, retry, or select another remote connection. Checks can be canceled. Remote history is stored on the client, and authorization codes are not saved as plaintext configuration. GUI connections do not enable remote extension trust by default."}]},
{"ID": "20260903150000-c2oh8cr", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260903150000-c2oh8cr", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "Command line"}]},
{"ID": "20260903150000-601s61t", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-601s61t", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "After completely exiting the SiYuan desktop client, start the desktop app from a command line and append "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port]"}, {"Type": "NodeText", "Data": ". If an instance is already running, the single-instance mechanism does not switch its current connection."}]},
{"ID": "20260903150000-rir445a", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-rir445a", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "Security and Version"}]},
{"ID": "20260903150000-0ekr8rg", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-0ekr8rg", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "Only HTTPS remote addresses are supported, and the client operating system must trust the server's TLS certificate. Connect only to a server you trust. The desktop client and remote kernel versions must match exactly; otherwise, the connection is rejected. The core frontend and sign-in page always come from the client installation package. Remote extension code is disabled by default, and remote HTML embeds are unavailable."}]},
- {"ID": "20260908082237-ng9rmna", "Type": "NodeHeading", "Properties": {"id": "20260908082237-ng9rmna", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "Trust Remote Extensions"}], "HeadingLevel": 2},
- {"ID": "20260908082237-vrsfycm", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-vrsfycm", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "After completely exiting the desktop client, start it with "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": ". This option is off by default and applies only to the server specified for this launch. It is not saved in a trust list or automatically added to launch-at-login arguments. Starting another instance does not change the running instance's trust state. To revoke trust, completely exit and start again without this option."}]},
+ {"ID": "20260908082237-ng9rmna", "Type": "NodeHeading", "Properties": {"id": "20260908082237-ng9rmna", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "Trust Remote Extensions"}], "HeadingLevel": 2},
+ {"ID": "20260908110648-flull9v", "Type": "NodeParagraph", "Properties": {"id": "20260908110648-flull9v", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "Select "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "Trust and load remote plugins and appearance"}, {"Type": "NodeText", "Data": " in the connection interface to load extensions from that server. New addresses and history from earlier versions are untrusted by default. After a successful connection, the choice is saved locally per HTTPS address, including the port, and restored when you next connect to that address through the GUI. You can also edit it directly in history. Clear the checkbox and reconnect to restart the client without loading that server’s remote extensions. Changing the setting alone does not immediately change the current connection’s permissions."}]},
+ {"ID": "20260908082237-vrsfycm", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-vrsfycm", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "For command-line use, completely exit the desktop client and start it with "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": ". This command-line option trusts only the server specified for this launch. It does not change saved GUI trust settings or get added automatically to launch-at-login arguments. Command-line startup does not read GUI trust settings. Starting another instance does not change the running instance’s trust state. To revoke trust, completely exit and start again without this option."}]},
{"ID": "20260908082237-czd7cy0", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-czd7cy0", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "Once enabled, plugins, theme scripts, icon scripts, and JavaScript code snippets from the remote workspace execute in the local desktop environment. They can use Node.js to read and write local files and execute programs. Use this option only if you trust the server and the extension code it supplies, including future updates."}]},
{"ID": "20260908082237-9eymwn3", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-9eymwn3", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "This option enables plugins, Bazaar, custom themes, icons, fonts, and code snippets. The bundled frontend, themes, and icons still come from the client. Widgets and the other remote-mode restrictions remain unchanged. Plugin code runs on the client while the workspace is on the server. Plugins that depend on local workspace paths, native modules, or external programs may require adaptation; compatibility with every desktop plugin is not guaranteed."}]},
{"ID": "20260903150000-knpctlf", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-knpctlf", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "Limitations"}]},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260903150000-u4065fm.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260903150000-u4065fm.sy
index 2627ae2dad..c1fbc8fe66 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260903150000-u4065fm.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260903150000-u4065fm.sy
@@ -6,7 +6,7 @@
"id": "20260903150000-u4065fm",
"title": "连接远程内核",
"type": "doc",
- "updated": "20260908104736"
+ "updated": "20260908110648"
},
"Children": [
{
@@ -38,10 +38,10 @@
}
]
},
- {"ID": "20260908100338-b5ef1sw", "Type": "NodeHeading", "Properties": {"id": "20260908100338-b5ef1sw", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "连接方式"}], "HeadingLevel": 2},
- {"ID": "20260908104736-5cp1hsm", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-5cp1hsm", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "图形界面"}]},
+ {"ID": "20260908100338-b5ef1sw", "Type": "NodeHeading", "Properties": {"id": "20260908100338-b5ef1sw", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "连接方式"}], "HeadingLevel": 2},
+ {"ID": "20260908104736-5cp1hsm", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-5cp1hsm", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "图形界面"}]},
{"ID": "20260908100338-7lr3clk", "Type": "NodeParagraph", "Properties": {"id": "20260908100338-7lr3clk", "updated": "20260908100338"}, "Children": [{"Type": "NodeText", "Data": "在桌面端的工作空间菜单中选择 "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "工作空间"}, {"Type": "NodeText", "Data": " - "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "连接远程内核..."}, {"Type": "NodeText", "Data": ",输入远程服务器的 HTTPS 地址,然后连接。地址不能包含路径、查询参数或用户名和密码。客户端会检查内核版本和登录状态,需要鉴权时显示访问授权码输入框;可选择记住登录状态。"}]},
- {"ID": "20260908100338-yvellnc", "Type": "NodeParagraph", "Properties": {"id": "20260908100338-yvellnc", "updated": "20260908103205"}, "Children": [{"Type": "NodeText", "Data": "连接窗口列出远程连接历史。点击地址可重新连接,也可移除历史记录。移除只删除地址记录,不删除服务器上的数据或清除登录状态。"}]},
+ {"ID": "20260908100338-yvellnc", "Type": "NodeParagraph", "Properties": {"id": "20260908100338-yvellnc", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "连接界面列出远程连接历史。点击地址可重新连接,也可修改该地址的信任设置或移除历史记录。移除会删除地址及其信任设置,不删除服务器上的数据或清除登录状态,也不会撤销当前连接已加载的扩展权限。"}]},
{"ID": "20260908100338-5tea9ns", "Type": "NodeParagraph", "Properties": {"id": "20260908100338-5tea9ns", "updated": "20260908100338"}, "Children": [{"Type": "NodeText", "Data": "切换连接时,客户端会通过保存和安全退出流程关闭当前打开的工作空间,然后自动重启并连接所选目标。远程内核不会因此停止或重启。请等待保存和退出完成。"}]},
{"ID": "20260908100338-ri3ltil", "Type": "NodeParagraph", "Properties": {"id": "20260908100338-ri3ltil", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "首次启动页、远程启动等待页和鉴权页提供远程连接入口。连接失败时会打开连接窗口,可修改地址或重试,也可选择其他远程连接;检查过程中可取消。远程连接历史保存在客户端,授权码不会作为明文配置保存。图形界面连接默认不启用远程扩展信任。"}]},
{
@@ -111,8 +111,9 @@
}
]
},
- {"ID": "20260908082237-1yxgmt2", "Type": "NodeHeading", "Properties": {"id": "20260908082237-1yxgmt2", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "信任远程扩展"}], "HeadingLevel": 2},
- {"ID": "20260908082237-t1800dj", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-t1800dj", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "完全退出桌面客户端后,可使用参数 "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " 启动。该选项默认关闭,只信任本次指定的服务器,不会保存为信任列表,也不会自动加入开机启动参数。运行中的实例不会因再次启动而改变信任状态;如需撤销,请完全退出后去掉该参数重新启动。"}]},
+ {"ID": "20260908082237-1yxgmt2", "Type": "NodeHeading", "Properties": {"id": "20260908082237-1yxgmt2", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "信任远程扩展"}], "HeadingLevel": 2},
+ {"ID": "20260908110648-5b7ars8", "Type": "NodeParagraph", "Properties": {"id": "20260908110648-5b7ars8", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "在连接界面勾选 "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "信任并加载远程插件与外观"}, {"Type": "NodeText", "Data": " 可加载该服务器的远程扩展。新地址和旧版历史记录默认不勾选。成功连接后,选项按 HTTPS 地址(包括端口)保存在本机,下次通过图形界面连接同一地址时自动恢复;也可直接在历史记录中修改。取消勾选后重新连接,客户端会重启并停止加载该服务器的远程扩展。仅修改选项不会立即改变当前连接的权限。"}]},
+ {"ID": "20260908082237-t1800dj", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-t1800dj", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "使用命令行时,完全退出桌面客户端后,可使用参数 "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " 启动。该命令行参数仅信任本次指定的服务器,不会修改图形界面保存的信任设置,也不会自动加入开机启动参数。命令行启动不会读取图形界面的信任设置。运行中的实例不会因再次启动而改变信任状态;如需撤销,请完全退出后去掉该参数重新启动。"}]},
{"ID": "20260908082237-6wn2z6e", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-6wn2z6e", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "开启后,远程工作空间中的插件、主题脚本、图标脚本和 JavaScript 代码片段会在本机桌面环境中执行,能够通过 Node.js 读写本机文件和执行程序。请仅在信任服务器及其提供的扩展代码(包括后续更新)时使用。"}]},
{"ID": "20260908082237-cfxcjm5", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-cfxcjm5", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "该选项开放插件、集市、自定义主题、图标、字体和代码片段。内置前端、主题和图标仍由客户端提供,小部件及其他远程模式限制保持不变。插件代码在客户端运行,工作空间位于服务器;依赖本地工作空间路径、原生模块或外部程序的插件可能需要适配,不能保证所有桌面插件都兼容。"}]},
{
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260903150000-3qa6edk.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260903150000-3qa6edk.sy
index 70e7cdf5f0..4d3ad3ced7 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260903150000-3qa6edk.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260903150000-3qa6edk.sy
@@ -6,23 +6,24 @@
"id": "20260903150000-3qa6edk",
"title": "連線至遠端內核",
"type": "doc",
- "updated": "20260908104736"
+ "updated": "20260908110648"
},
"Children": [
{"ID": "20260903150000-jrf9aw4", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-jrf9aw4", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "概述"}]},
{"ID": "20260903150000-6shebfx", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-6shebfx", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "桌面端可以連線至其他裝置上執行的思源內核,並使用本機桌面介面進行編輯。遠端模式僅用於連線至現有內核,不會在本機啟動內核。"}]},
- {"ID": "20260908100358-u9jb6fe", "Type": "NodeHeading", "Properties": {"id": "20260908100358-u9jb6fe", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "連線方式"}], "HeadingLevel": 2},
- {"ID": "20260908104736-q8215x7", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-q8215x7", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "圖形介面"}]},
+ {"ID": "20260908100358-u9jb6fe", "Type": "NodeHeading", "Properties": {"id": "20260908100358-u9jb6fe", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "連線方式"}], "HeadingLevel": 2},
+ {"ID": "20260908104736-q8215x7", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-q8215x7", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "圖形介面"}]},
{"ID": "20260908100358-1qurfwt", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-1qurfwt", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "在桌面端的工作空間選單中選擇 "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "工作空間"}, {"Type": "NodeText", "Data": " - "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "連線至遠端核心..."}, {"Type": "NodeText", "Data": ",輸入遠端伺服器的 HTTPS 網址,然後連線。網址不能包含路徑、查詢參數或使用者名稱和密碼。用戶端會檢查核心版本與登入狀態,需要驗證時顯示存取授權碼輸入框;可選擇記住登入狀態。"}]},
- {"ID": "20260908100358-es7xe07", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-es7xe07", "updated": "20260908103205"}, "Children": [{"Type": "NodeText", "Data": "連線視窗列出遠端連線記錄。點選網址可重新連線,也可移除記錄。移除只刪除網址記錄,不刪除伺服器上的資料或清除登入狀態。"}]},
+ {"ID": "20260908100358-es7xe07", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-es7xe07", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "連線介面列出遠端連線記錄。點選位址可重新連線,也可修改該位址的信任設定或移除記錄。移除會刪除位址及其信任設定,不刪除伺服器上的資料或清除登入狀態,也不會撤銷目前連線已載入的擴充功能權限。"}]},
{"ID": "20260908100358-wba4bpx", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-wba4bpx", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "切換連線時,用戶端會透過儲存與安全結束流程關閉目前開啟的工作空間,然後自動重新啟動並連線至所選目標。遠端核心不會因此停止或重新啟動。請等待儲存與結束完成。"}]},
{"ID": "20260908100358-f7rav2z", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-f7rav2z", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "首次啟動頁、遠端啟動等待頁與驗證頁提供遠端連線入口。連線失敗時會開啟連線視窗,可修改網址或重試,也可選擇其他遠端連線;檢查過程中可取消。遠端連線記錄儲存在用戶端,授權碼不會以明文設定儲存。圖形介面連線預設不啟用遠端擴充套件信任。"}]},
{"ID": "20260903150000-o9vrit3", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260903150000-o9vrit3", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "命令列"}]},
{"ID": "20260903150000-m5fkfh5", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-m5fkfh5", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "完全結束思源桌面用戶端後,從命令列啟動桌面端並加入參數 "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port]"}, {"Type": "NodeText", "Data": "。如果已有執行中的實例,單一實例機制不會切換目前的連線。"}]},
{"ID": "20260903150000-l1lghrh", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-l1lghrh", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "安全性與版本"}]},
{"ID": "20260903150000-dk8m7z0", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-dk8m7z0", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "僅支援 HTTPS 遠端位址,用戶端作業系統必須信任伺服器使用的 TLS 憑證。請只連線至你信任的伺服器;桌面用戶端與遠端內核的版本必須完全一致,否則無法連線。桌面用戶端始終使用安裝套件內建的核心前端與登入頁面,預設不載入遠端擴充程式碼;遠端 HTML 嵌入內容不可用。"}]},
- {"ID": "20260908082237-vvacz9q", "Type": "NodeHeading", "Properties": {"id": "20260908082237-vvacz9q", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "信任遠端擴充功能"}], "HeadingLevel": 2},
- {"ID": "20260908082237-rkm8fy4", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-rkm8fy4", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "完全結束桌面用戶端後,可使用參數 "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " 啟動。此選項預設關閉,僅信任本次指定的伺服器,不會儲存為信任清單,也不會自動加入開機啟動參數。執行中的實例不會因再次啟動而改變信任狀態;如需撤銷,請完全結束後移除此參數重新啟動。"}]},
+ {"ID": "20260908082237-vvacz9q", "Type": "NodeHeading", "Properties": {"id": "20260908082237-vvacz9q", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "信任遠端擴充功能"}], "HeadingLevel": 2},
+ {"ID": "20260908110648-f6nek7x", "Type": "NodeParagraph", "Properties": {"id": "20260908110648-f6nek7x", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "在連線介面勾選 "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "信任並載入遠端外掛與外觀"}, {"Type": "NodeText", "Data": " 可載入該伺服器的遠端擴充功能。新位址與舊版記錄預設不勾選。成功連線後,選項依 HTTPS 位址(含連接埠)儲存在本機,下次透過圖形介面連線至相同位址時自動還原;也可直接在記錄中修改。取消勾選後重新連線,用戶端會重新啟動並停止載入該伺服器的遠端擴充功能。僅修改選項不會立即變更目前連線的權限。"}]},
+ {"ID": "20260908082237-rkm8fy4", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-rkm8fy4", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "使用命令列時,完全結束桌面用戶端後,可使用參數 "}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " 啟動。此命令列參數僅信任本次指定的伺服器,不會修改圖形介面儲存的信任設定,也不會自動加入開機啟動參數。命令列啟動不會讀取圖形介面的信任設定。執行中的實例不會因再次啟動而改變信任狀態;如需撤銷,請完全結束後移除此參數重新啟動。"}]},
{"ID": "20260908082237-q1w5tx8", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-q1w5tx8", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "啟用後,遠端工作空間中的外掛程式、佈景主題指令碼、圖示指令碼和 JavaScript 程式碼片段會在本機桌面環境中執行,能夠透過 Node.js 讀寫本機檔案和執行程式。請僅在信任伺服器及其提供的擴充程式碼(包括後續更新)時使用。"}]},
{"ID": "20260908082237-hz1tyvi", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-hz1tyvi", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "此選項開放外掛程式、集市、自訂佈景主題、圖示、字型和程式碼片段。內建前端、佈景主題和圖示仍由用戶端提供,小工具及其他遠端模式限制維持不變。外掛程式碼在用戶端執行,工作空間位於伺服器;依賴本機工作空間路徑、原生模組或外部程式的外掛程式可能需要調整,無法保證所有桌面外掛程式都相容。"}]},
{"ID": "20260903150000-uleg2f1", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-uleg2f1", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "功能限制"}]},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260903150000-hpfmx4t.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260903150000-hpfmx4t.sy
index 2441d01d47..453dc5c04c 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260903150000-hpfmx4t.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260903150000-hpfmx4t.sy
@@ -6,23 +6,24 @@
"id": "20260903150000-hpfmx4t",
"title": "リモートカーネルへの接続",
"type": "doc",
- "updated": "20260908104736"
+ "updated": "20260908110648"
},
"Children": [
{"ID": "20260903150000-ekjy0ld", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-ekjy0ld", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "概要"}]},
{"ID": "20260903150000-0adfpc3", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-0adfpc3", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "デスクトップ版では、別のデバイスで動作している SiYuan カーネルに接続し、ローカルのデスクトップ UI から編集できます。リモートモードは既存のカーネルへの接続専用であり、ローカルではカーネルを起動しません。"}]},
- {"ID": "20260908100358-365wfm2", "Type": "NodeHeading", "Properties": {"id": "20260908100358-365wfm2", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "接続方法"}], "HeadingLevel": 2},
- {"ID": "20260908104736-r99lh8j", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-r99lh8j", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "グラフィカルインターフェース"}]},
+ {"ID": "20260908100358-365wfm2", "Type": "NodeHeading", "Properties": {"id": "20260908100358-365wfm2", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "接続方法"}], "HeadingLevel": 2},
+ {"ID": "20260908104736-r99lh8j", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260908104736-r99lh8j", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "グラフィカルインターフェース"}]},
{"ID": "20260908100358-0tb3jc9", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-0tb3jc9", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "デスクトップのワークスペースメニューで "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "ワークスペース"}, {"Type": "NodeText", "Data": " - "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "リモートカーネルに接続..."}, {"Type": "NodeText", "Data": " を選択し、リモートサーバーの HTTPS アドレスを入力して接続します。アドレスにパス、クエリ、ユーザー名、パスワードは含められません。クライアントはカーネルのバージョンとログイン状態を確認し、認証が必要な場合はアクセス認証コードの入力欄を表示します。ログイン状態を記憶することもできます。"}]},
- {"ID": "20260908100358-tt94c3t", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-tt94c3t", "updated": "20260908103205"}, "Children": [{"Type": "NodeText", "Data": "接続ウィンドウにはリモート接続履歴が表示されます。アドレスを選んで再接続したり、履歴を削除したりできます。履歴の削除はアドレスの記録のみを削除し、サーバー上のデータやログイン状態には影響しません。"}]},
+ {"ID": "20260908100358-tt94c3t", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-tt94c3t", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "接続画面にはリモート接続履歴が表示されます。アドレスを選んで再接続したり、そのアドレスの信頼設定を変更したり、履歴を削除したりできます。削除するとアドレスと信頼設定が削除されますが、サーバー上のデータやログイン状態には影響せず、現在の接続で読み込み済みの拡張機能の権限も取り消されません。"}]},
{"ID": "20260908100358-z5xdi86", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-z5xdi86", "updated": "20260908100358"}, "Children": [{"Type": "NodeText", "Data": "接続を切り替えると、開いているワークスペースを保存して安全に終了した後、デスクトップクライアントが自動的に再起動し、選択した接続先を開きます。リモートカーネルは停止も再起動もしません。保存と終了が完了するまでお待ちください。"}]},
{"ID": "20260908100358-4piqgjo", "Type": "NodeParagraph", "Properties": {"id": "20260908100358-4piqgjo", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "初回起動画面、リモート起動待機画面、認証画面からリモート接続を開けます。接続に失敗すると接続ウィンドウが開き、アドレスの変更、再試行、別のリモート接続の選択ができます。確認中の処理はキャンセルできます。リモート接続履歴はクライアントに保存され、認証コードを平文の設定として保存することはありません。画面からの接続では、リモート拡張機能への信頼は既定で無効です。"}]},
{"ID": "20260903150000-c8khz3k", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": {"id": "20260903150000-c8khz3k", "updated": "20260908104736"}, "Children": [{"Type": "NodeText", "Data": "コマンドライン"}]},
{"ID": "20260903150000-bqc7crd", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-bqc7crd", "updated": "20260903150000"}, "Children": [{"Type": "NodeText", "Data": "SiYuan デスクトップクライアントを完全に終了してから、コマンドラインでデスクトップ版を起動し、"}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port]"}, {"Type": "NodeText", "Data": " パラメーターを追加します。既存のインスタンスが実行中の場合、シングルインスタンス機構によって現在の接続先が切り替わることはありません。"}]},
{"ID": "20260903150000-csljqix", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-csljqix", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "セキュリティとバージョン"}]},
{"ID": "20260903150000-1qj316h", "Type": "NodeParagraph", "Properties": {"id": "20260903150000-1qj316h", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "リモートアドレスには HTTPS のみを使用でき、クライアントのオペレーティングシステムがサーバーの TLS 証明書を信頼している必要があります。信頼できるサーバーにのみ接続してください。デスクトップクライアントとリモートカーネルのバージョンは完全に一致している必要があります。一致しない場合は接続できません。コアフロントエンドとログインページは常にクライアントのインストールパッケージから読み込みます。リモート拡張機能のコードは既定では読み込まず、リモート HTML の埋め込みは利用できません。"}]},
- {"ID": "20260908082237-zf9x3va", "Type": "NodeHeading", "Properties": {"id": "20260908082237-zf9x3va", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "リモート拡張機能を信頼する"}], "HeadingLevel": 2},
- {"ID": "20260908082237-qepobrf", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-qepobrf", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "デスクトップクライアントを完全に終了してから、"}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " を指定して起動できます。このオプションは既定では無効で、今回の起動で指定したサーバーにのみ適用されます。信頼リストには保存されず、ログイン時の自動起動引数にも自動では追加されません。別のインスタンスを起動しても、実行中のインスタンスの信頼状態は変わりません。信頼を取り消すには、完全に終了してからこのオプションを外して起動してください。"}]},
+ {"ID": "20260908082237-zf9x3va", "Type": "NodeHeading", "Properties": {"id": "20260908082237-zf9x3va", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "リモート拡張機能を信頼する"}], "HeadingLevel": 2},
+ {"ID": "20260908110648-wbcbara", "Type": "NodeParagraph", "Properties": {"id": "20260908110648-wbcbara", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "接続画面で "}, {"Type": "NodeTextMark", "TextMarkType": "kbd", "TextMarkTextContent": "リモートのプラグインと外観を信頼して読み込む"}, {"Type": "NodeText", "Data": " を選択すると、そのサーバーの拡張機能を読み込めます。新しいアドレスと旧バージョンの履歴では既定でオフです。接続に成功すると、ポートを含む HTTPS アドレスごとに設定がローカルに保存され、次回グラフィカルインターフェースから同じアドレスに接続するときに復元されます。履歴から直接変更することもできます。チェックを外して再接続すると、クライアントが再起動し、そのサーバーのリモート拡張機能を読み込まなくなります。設定の変更だけでは、現在の接続の権限はすぐには変わりません。"}]},
+ {"ID": "20260908082237-qepobrf", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-qepobrf", "updated": "20260908110648"}, "Children": [{"Type": "NodeText", "Data": "コマンドラインを使う場合は、デスクトップクライアントを完全に終了してから、"}, {"Type": "NodeTextMark", "TextMarkType": "code", "TextMarkTextContent": "--remote=https://host[:port] --trust-remote-extensions"}, {"Type": "NodeText", "Data": " を指定して起動します。このコマンドラインオプションは今回指定したサーバーのみを信頼し、画面で保存した信頼設定を変更せず、ログイン時の自動起動引数にも自動では追加されません。コマンドライン起動では画面の信頼設定を読み取りません。別のインスタンスを起動しても、実行中のインスタンスの信頼状態は変わりません。信頼を取り消すには、完全に終了してからこのオプションを外して起動してください。"}]},
{"ID": "20260908082237-843e8r9", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-843e8r9", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "有効にすると、リモートワークスペースのプラグイン、テーマスクリプト、アイコンスクリプト、JavaScript コードスニペットがローカルのデスクトップ環境で実行されます。これらは Node.js を使ってローカルファイルの読み書きやプログラムの実行ができます。サーバーと、今後の更新を含めてサーバーが提供する拡張機能のコードを信頼できる場合にのみ使用してください。"}]},
{"ID": "20260908082237-jlqabtc", "Type": "NodeParagraph", "Properties": {"id": "20260908082237-jlqabtc", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "このオプションはプラグイン、マーケットプレイス、カスタムテーマ、アイコン、フォント、コードスニペットを有効にします。内蔵のフロントエンド、テーマ、アイコンは引き続きクライアントから読み込みます。ウィジェットおよびその他のリモートモードの制限は変わりません。プラグインのコードはクライアントで実行され、ワークスペースはサーバーにあります。ローカルのワークスペースパス、ネイティブモジュール、外部プログラムに依存するプラグインには対応作業が必要な場合があり、すべてのデスクトッププラグインとの互換性は保証されません。"}]},
{"ID": "20260903150000-uo7ekyt", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": {"id": "20260903150000-uo7ekyt", "updated": "20260908082237"}, "Children": [{"Type": "NodeText", "Data": "機能制限"}]},
diff --git a/app/src/dialog/remoteConnection.ts b/app/src/dialog/remoteConnection.ts
index 43379954c9..a521339813 100644
--- a/app/src/dialog/remoteConnection.ts
+++ b/app/src/dialog/remoteConnection.ts
@@ -16,16 +16,21 @@ export const openRemoteConnection = (initialOrigin = "") => {
let checked = false;
let authenticated = false;
let initialized = false;
+ let history: {origin: string, trustRemoteExtensions: boolean}[] = [];
const dialog = new Dialog({
title: escapeHtml(languages.connectRemoteKernel),
width: "600px",
- content: `<div class="b3-dialog__content">
+ content: `<div class="b3-dialog__content" style="word-break:normal;overflow-wrap:anywhere">
<div class="ft__on-surface">${escapeHtml(languages.switchConnectionRestartTip)}</div>
<div class="fn__hr"></div>
<form>
<input data-field="origin" class="b3-text-field fn__block" type="url" placeholder="https://siyuan.example.com" required aria-label="${escapeAttr(escapeHtml(languages.remoteConnection))}">
<div class="fn__hr"></div>
<div class="ft__on-surface">${escapeHtml(languages.remoteKernelAddressTip)}</div>
+ <div class="fn__hr"></div>
+ <label class="fn__flex"><input data-field="trust" type="checkbox" class="b3-switch"><span class="fn__space"></span>${escapeHtml(languages.trustRemoteExtensions)}</label>
+ <div class="fn__hr"></div>
+ <div class="ft__on-surface">${escapeHtml(languages.trustRemoteExtensionsTip)}</div>
<div data-field="auth" class="fn__none">
<div class="fn__hr"></div>
<input data-field="authCode" class="b3-text-field fn__block" type="password" autocomplete="current-password">
@@ -68,6 +73,17 @@ export const openRemoteConnection = (initialOrigin = "") => {
const authCode = field<HTMLInputElement>("authCode");
const captcha = field<HTMLInputElement>("captcha");
const connect = field<HTMLButtonElement>("connect");
+ const trust = field<HTMLInputElement>("trust");
+ const selectedOrigin = () => {
+ try {
+ return new URL(origin.value.trim()).origin;
+ } catch (error) {
+ return "";
+ }
+ };
+ const restoreTrust = () => {
+ trust.checked = history.some(entry => entry.origin === selectedOrigin() && entry.trustRemoteExtensions);
+ };
const form = dialog.element.querySelector("form");
const message = (value = "", error = true) => {
field("message").textContent = value;
@@ -103,7 +119,8 @@ export const openRemoteConnection = (initialOrigin = "") => {
}
}
};
- const renderHistory = (entries: {origin: string}[]) => {
+ const renderHistory = (entries: {origin: string, trustRemoteExtensions: boolean}[]) => {
+ history = entries;
field("historySection").classList.toggle("fn__none", entries.length === 0);
field("history").replaceChildren();
entries.forEach(entry => {
@@ -115,8 +132,42 @@ export const openRemoteConnection = (initialOrigin = "") => {
open.addEventListener("click", () => {
reset();
origin.value = entry.origin;
+ restoreTrust();
form.requestSubmit();
});
+ const trustLabel = document.createElement("label");
+ trustLabel.className = "fn__flex";
+ trustLabel.title = languages.trustRemoteExtensionsTip;
+ const trustEntry = document.createElement("input");
+ trustEntry.type = "checkbox";
+ trustEntry.className = "b3-switch";
+ trustEntry.checked = entry.trustRemoteExtensions;
+ const space = document.createElement("span");
+ space.className = "fn__space";
+ trustLabel.append(trustEntry, space, document.createTextNode(languages.trustRemoteExtensions));
+ trustEntry.addEventListener("change", async () => {
+ trustEntry.disabled = true;
+ try {
+ const result = await invoke("trust", {origin: entry.origin, trustRemoteExtensions: trustEntry.checked});
+ if (!closed) {
+ if (result.entries) {
+ renderHistory(result.entries);
+ if (selectedOrigin() === entry.origin) {
+ reset();
+ restoreTrust();
+ }
+ } else {
+ trustEntry.checked = entry.trustRemoteExtensions;
+ }
+ message(result.error);
+ }
+ } catch (error) {
+ trustEntry.checked = entry.trustRemoteExtensions;
+ message(String(error.message));
+ } finally {
+ trustEntry.disabled = false;
+ }
+ });
const remove = document.createElement("button");
remove.className = "b3-button b3-button--outline";
remove.textContent = languages.remove;
@@ -126,6 +177,10 @@ export const openRemoteConnection = (initialOrigin = "") => {
if (!closed) {
if (result.entries) {
renderHistory(result.entries);
+ if (selectedOrigin() === entry.origin) {
+ reset();
+ restoreTrust();
+ }
}
message(result.error);
}
@@ -136,7 +191,7 @@ export const openRemoteConnection = (initialOrigin = "") => {
}
});
row.append(open, remove);
- field("history").append(row);
+ field("history").append(row, trustLabel);
});
};
form.addEventListener("submit", async event => {
@@ -146,6 +201,7 @@ export const openRemoteConnection = (initialOrigin = "") => {
}
const requestSequence = ++sequence;
const address = origin.value.trim();
+ const trustRemoteExtensions = trust.checked;
connect.disabled = true;
message(languages.checkingRemoteKernel, false);
try {
@@ -167,7 +223,7 @@ export const openRemoteConnection = (initialOrigin = "") => {
authenticated = result.authenticated;
}
if (authenticated) {
- const opened = await invoke("open", {origin: address});
+ const opened = await invoke("open", {origin: address, trustRemoteExtensions});
if (!closed && sequence === requestSequence) {
message(opened.error || languages.switchConnectionRestartTip, !!opened.error);
}
@@ -192,7 +248,11 @@ export const openRemoteConnection = (initialOrigin = "") => {
}
}
});
- origin.addEventListener("input", reset);
+ origin.addEventListener("input", () => {
+ reset();
+ restoreTrust();
+ });
+ trust.addEventListener("change", reset);
field("cancel").addEventListener("click", () => dialog.destroy());
field("refreshCaptcha").addEventListener("click", refreshCaptcha);
connect.addEventListener("click", () => form.requestSubmit());
@@ -216,6 +276,7 @@ export const openRemoteConnection = (initialOrigin = "") => {
origin.value = result.origin;
message(result.error);
renderHistory(result.entries);
+ restoreTrust();
initialized = true;
connect.disabled = false;
}).catch(error => {