Skip to content

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

:sparkles: Supports configuring secrets and variables https://github.com/siyuan-note/siyuan/issues/17933

Daniel922c2fcf0d24
diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html
index f07abfb885..d1c89ef783 100644
--- a/app/appearance/icons/index.html
+++ b/app/appearance/icons/index.html
@@ -28,6 +28,12 @@
<body>
<h2>SiYuan</h2>
<div class="fn__clear">
+ <div>
+ <svg>
+ <use xlink:href="#iconSquareAsterisk"></use>
+ </svg>
+ iconSquareAsterisk
+ </div>
<div>
<svg>
<use xlink:href="#iconSquarePlus"></use>
diff --git a/app/appearance/icons/litheness/icon.js b/app/appearance/icons/litheness/icon.js
index 17932bb621..15380bde7b 100644
--- a/app/appearance/icons/litheness/icon.js
+++ b/app/appearance/icons/litheness/icon.js
@@ -1,5 +1,8 @@
document.body.insertAdjacentHTML('afterbegin', `<svg id="iconsLitheness" style="position: absolute; width: 0; height: 0; overflow: hidden;">
<defs>
+ <symbol id="iconSquareAsterisk" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
+ <rect width="18" height="18" x="3" y="3" rx="2"/><path d="M12 8v8"/><path d="m8.5 14 7-4"/><path d="m8.5 10 7 4"/>
+ </symbol>
<symbol id="iconSquarePlus" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>
</symbol>
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 7aee53500f..a9bef03561 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "الأسرار والمتغيرات",
+ "secrets": "الأسرار",
+ "variables": "المتغيرات",
+ "secretsTip": "تُقدَّم لـ Skill و MCP والإضافات للإشارة إليها عبر {{secrets.NAME}}. تُخزن مشفّرة",
+ "variablesTip": "تُقدَّم لـ Skill و MCP والإضافات للإشارة إليها عبر {{vars.NAME}}. تُخزن كنص عادي للبيانات غير الحساسة",
+ "secretName": "اسم السر",
+ "variableName": "اسم المتغير",
+ "addSecret": "إضافة سر",
+ "addVariable": "إضافة متغير",
+ "secretValue": "قيمة السر",
+ "variableValue": "قيمة المتغير",
+ "secretNameTip": "الاسم المستخدم للإشارة إلى هذا السر، استخدم {{secrets.NAME}} في Skill والإضافات",
+ "variableNameTip": "الاسم المستخدم للإشارة إلى هذا المتغير، استخدم {{vars.NAME}} في Skill والإضافات",
+ "secretNameRequired": "اسم السر مطلوب",
+ "secretNameDuplicate": "يوجد سر بنفس الاسم بالفعل",
+ "variableNameRequired": "اسم المتغير مطلوب",
+ "variableNameDuplicate": "يوجد متغير بنفس الاسم بالفعل",
+ "noSecretConfigured": "لم يتم تكوين أي أسرار",
+ "noVariableConfigured": "لم يتم تكوين أي متغيرات",
"agentGoToSetting": "الذهاب إلى الإعدادات",
"kernelFault3": "‫الأسباب الشائعة واستكشاف الأخطاء وإصلاحها‬",
"kernelFault4": "<div class=\"b3-typography\"><p><b>‫1. الوكيل العكسي لا يعيد توجيه WebSocket‬</b><br>‫إذا كنت تصل إلى SiYuan عبر وكيل عكسي مثل NGINX، فيجب تكوين رؤوس ترقية البروتوكول لـ <code>/ws</code> بشكل منفصل، وإلا سيفشل مصافحة WebSocket.</p></div><div class=\"b3-typography\"><p><b>‫2. انتهت عملية النواة أو تعطلت‬</b><br>‫تأكد من أن الحاوية أو الخدمة لا تزال قيد التشغيل، وأعد تشغيلها عند الحاجة. يمكنك تصدير السجلات الكاملة من [الإعدادات - حول - سجل النظام].‬</p></div>",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index f80b6a553f..60d81d8488 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secrets und Variablen",
+ "secrets": "Secrets",
+ "variables": "Variablen",
+ "secretsTip": "Werden Skill, MCP und Plugins zum Referenzieren über {{secrets.NAME}} bereitgestellt. Verschlüsselt gespeichert",
+ "variablesTip": "Werden Skill, MCP und Plugins zum Referenzieren über {{vars.NAME}} bereitgestellt. Als Klartext für nicht sensible Daten gespeichert",
+ "secretName": "Secret-Name",
+ "variableName": "Variablenname",
+ "addSecret": "Secret hinzufügen",
+ "addVariable": "Variable hinzufügen",
+ "secretValue": "Secret-Wert",
+ "variableValue": "Variablenwert",
+ "secretNameTip": "Name zum Referenzieren dieses Secrets, in Skill und Plugins {{secrets.NAME}} verwenden",
+ "variableNameTip": "Name zum Referenzieren dieser Variablen, in Skill und Plugins {{vars.NAME}} verwenden",
+ "secretNameRequired": "Secret-Name ist erforderlich",
+ "secretNameDuplicate": "Ein Secret mit diesem Namen existiert bereits",
+ "variableNameRequired": "Variablenname ist erforderlich",
+ "variableNameDuplicate": "Eine Variable mit diesem Namen existiert bereits",
+ "noSecretConfigured": "Keine Secrets konfiguriert",
+ "noVariableConfigured": "Keine Variablen konfiguriert",
"agentGoToSetting": "Zu den Einstellungen",
"kernelFault3": "Häufige Ursachen und Fehlerbehebung",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Reverse-Proxy leitet WebSocket nicht weiter</b><br>Wenn Sie über einen Reverse-Proxy wie NGINX zugreifen, müssen Sie die Protokoll-Upgrade-Header für <code>/ws</code> separat konfigurieren, da der WebSocket-Handshake sonst fehlschlägt.</p></div><div class=\"b3-typography\"><p><b>2. Kernel-Prozess beendet oder abgestürzt</b><br>Stellen Sie sicher, dass der Container oder Dienst noch läuft, und starten Sie ihn bei Bedarf neu. Sie können die vollständigen Protokolle unter [Einstellungen - Über - Systemprotokoll] exportieren.</p></div>",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index f3ce75e5dd..ee918ae486 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secrets and Variables",
+ "secrets": "Secrets",
+ "variables": "Variables",
+ "secretsTip": "Provided for Skill, MCP and plugins to reference via {{secrets.NAME}}. Stored encrypted",
+ "variablesTip": "Provided for Skill, MCP and plugins to reference via {{vars.NAME}}. Stored as plain text for non-sensitive data",
+ "secretName": "Secret name",
+ "variableName": "Variable name",
+ "addSecret": "Add secret",
+ "addVariable": "Add variable",
+ "secretValue": "Secret value",
+ "variableValue": "Variable value",
+ "secretNameTip": "Name used to reference this secret, use {{secrets.NAME}} in Skill and plugins",
+ "variableNameTip": "Name used to reference this variable, use {{vars.NAME}} in Skill and plugins",
+ "secretNameRequired": "Secret name is required",
+ "secretNameDuplicate": "A secret with this name already exists",
+ "variableNameRequired": "Variable name is required",
+ "variableNameDuplicate": "A variable with this name already exists",
+ "noSecretConfigured": "No secrets configured",
+ "noVariableConfigured": "No variables configured",
"agentGoToSetting": "Go to Settings",
"kernelFault3": "Common causes and troubleshooting",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Reverse proxy does not forward WebSocket</b><br>If you access SiYuan through a reverse proxy such as NGINX, you must configure the protocol upgrade headers for <code>/ws</code> separately, otherwise the WebSocket handshake will fail.</p></div><div class=\"b3-typography\"><p><b>2. Kernel process exited or crashed</b><br>Make sure the container or service is still running, and restart it if needed. You can export the full logs in [Settings - About - System log].</p></div>",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 43e6f9dcfd..23c6548b8f 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secretos y variables",
+ "secrets": "Secretos",
+ "variables": "Variables",
+ "secretsTip": "Se proporcionan a Skill, MCP y complementos para referenciarlos mediante {{secrets.NAME}}. Se almacenan cifrados",
+ "variablesTip": "Se proporcionan a Skill, MCP y complementos para referenciarlos mediante {{vars.NAME}}. Se almacenan como texto plano para datos no sensibles",
+ "secretName": "Nombre del secreto",
+ "variableName": "Nombre de la variable",
+ "addSecret": "Añadir secreto",
+ "addVariable": "Añadir variable",
+ "secretValue": "Valor del secreto",
+ "variableValue": "Valor de la variable",
+ "secretNameTip": "Nombre para referenciar este secreto, usa {{secrets.NAME}} en Skill y complementos",
+ "variableNameTip": "Nombre para referenciar esta variable, usa {{vars.NAME}} en Skill y complementos",
+ "secretNameRequired": "El nombre del secreto es obligatorio",
+ "secretNameDuplicate": "Ya existe un secreto con este nombre",
+ "variableNameRequired": "El nombre de la variable es obligatorio",
+ "variableNameDuplicate": "Ya existe una variable con este nombre",
+ "noSecretConfigured": "No hay secretos configurados",
+ "noVariableConfigured": "No hay variables configuradas",
"agentGoToSetting": "Ir a la configuración",
"kernelFault3": "Causas comunes y solución de problemas",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. El proxy inverso no reenvía el WebSocket</b><br>Si accede a SiYuan a través de un proxy inverso como NGINX, debe configurar los encabezados de actualización de protocolo para <code>/ws</code> por separado; de lo contrario, el handshake del WebSocket fallará.</p></div><div class=\"b3-typography\"><p><b>2. El proceso del kernel se cerró o se bloqueó</b><br>Compruebe que el contenedor o el servicio sigan en ejecución y reinícielo si es necesario. Puede exportar los registros completos en [Ajustes - Acerca de - Registro del sistema].</p></div>",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 8d8aaed706..d826775bf2 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secrets et variables",
+ "secrets": "Secrets",
+ "variables": "Variables",
+ "secretsTip": "Mis à disposition de Skill, MCP et plugins pour y faire référence via {{secrets.NAME}}. Stockés chiffrés",
+ "variablesTip": "Mises à disposition de Skill, MCP et plugins pour y faire référence via {{vars.NAME}}. Stockées en texte clair pour les données non sensibles",
+ "secretName": "Nom du secret",
+ "variableName": "Nom de la variable",
+ "addSecret": "Ajouter un secret",
+ "addVariable": "Ajouter une variable",
+ "secretValue": "Valeur du secret",
+ "variableValue": "Valeur de la variable",
+ "secretNameTip": "Nom utilisé pour référencer ce secret, utilisez {{secrets.NAME}} dans Skill et plugins",
+ "variableNameTip": "Nom utilisé pour référencer cette variable, utilisez {{vars.NAME}} dans Skill et plugins",
+ "secretNameRequired": "Le nom du secret est requis",
+ "secretNameDuplicate": "Un secret avec ce nom existe déjà",
+ "variableNameRequired": "Le nom de la variable est requis",
+ "variableNameDuplicate": "Une variable avec ce nom existe déjà",
+ "noSecretConfigured": "Aucun secret configuré",
+ "noVariableConfigured": "Aucune variable configurée",
"agentGoToSetting": "Aller aux paramètres",
"kernelFault3": "Causes courantes et dépannage",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Le proxy inverse ne transmet pas le WebSocket</b><br>Si vous accédez à SiYuan via un proxy inverse tel que NGINX, vous devez configurer les en-têtes de mise à niveau de protocole pour <code>/ws</code> séparément, sinon la poignée de main WebSocket échouera.</p></div><div class=\"b3-typography\"><p><b>2. Le processus du noyau s'est arrêté ou a planté</b><br>Vérifiez que le conteneur ou le service fonctionne toujours et redémarrez-le si nécessaire. Vous pouvez exporter les journaux complets dans [Paramètres - À propos - Journal système].</p></div>",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index a80b15b59f..84bfbeca9a 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "סודות ומשתנים",
+ "secrets": "סודות",
+ "variables": "משתנים",
+ "secretsTip": "מסופקים ל-Skill, MCP ותוספים להפניה אליהם באמצעות {{secrets.NAME}}. מאוחסנים מוצפנים",
+ "variablesTip": "מסופקים ל-Skill, MCP ותוספים להפניה אליהם באמצעות {{vars.NAME}}. מאוחסנים כטקסט רגיל לנתונים לא רגישים",
+ "secretName": "שם הסוד",
+ "variableName": "שם המשתנה",
+ "addSecret": "הוסף סוד",
+ "addVariable": "הוסף משתנה",
+ "secretValue": "ערך הסוד",
+ "variableValue": "ערך המשתנה",
+ "secretNameTip": "שם המשמש להפניה לסוד זה, השתמש ב-{{secrets.NAME}} ב-Skill ותוספים",
+ "variableNameTip": "שם המשמש להפניה למשתנה זה, השתמש ב-{{vars.NAME}} ב-Skill ותוספים",
+ "secretNameRequired": "נדרש שם סוד",
+ "secretNameDuplicate": "סוד בשם זה כבר קיים",
+ "variableNameRequired": "נדרש שם משתנה",
+ "variableNameDuplicate": "משתנה בשם זה כבר קיים",
+ "noSecretConfigured": "לא הוגדרו סודות",
+ "noVariableConfigured": "לא הוגדרו משתנים",
"agentGoToSetting": "עבור להגדרות",
"kernelFault3": "גורמים נפוצים ופתרון בעיות",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. פרוקסי הפוך אינו מעביר WebSocket</b><br>אם אתה ניגש ל-SiYuan דרך פרוקסי הפוך כמו NGINX, עליך להגדיר את כותרות שדרוג הפרוטוקול עבור <code>/ws</code> בנפרד, אחרת לחיצת היד של WebSocket תיכשל.</p></div><div class=\"b3-typography\"><p><b>2. תהליך הליבה הסתיים או קרס</b><br>ודא שהמיכל או השירות עדיין פועלים והפעל אותם מחדש במידת הצורך. תוכל לייצא את היומנים המלאים ב-[הגדרות - אודות - יומן מערכת].</p></div>",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index fd62184d03..b632e75dea 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "रहस्य और चर",
+ "secrets": "रहस्य",
+ "variables": "चर",
+ "secretsTip": "Skill, MCP और प्लगइन्स को {{secrets.NAME}} के माध्यम से संदर्भित करने के लिए प्रदान किए जाते हैं। एन्क्रिप्टेड संग्रहीत",
+ "variablesTip": "Skill, MCP और प्लगइन्स को {{vars.NAME}} के माध्यम से संदर्भित करने के लिए प्रदान किए जाते हैं। गैर-संवेदनशील डेटा के लिए सादे पाठ में संग्रहीत",
+ "secretName": "रहस्य नाम",
+ "variableName": "चर नाम",
+ "addSecret": "रहस्य जोड़ें",
+ "addVariable": "चर जोड़ें",
+ "secretValue": "रहस्य मान",
+ "variableValue": "चर मान",
+ "secretNameTip": "इस रहस्य को संदर्भित करने के लिए नाम, Skill और प्लगइन्स में {{secrets.NAME}} का उपयोग करें",
+ "variableNameTip": "इस चर को संदर्भित करने के लिए नाम, Skill और प्लगइन्स में {{vars.NAME}} का उपयोग करें",
+ "secretNameRequired": "रहस्य नाम आवश्यक है",
+ "secretNameDuplicate": "इस नाम का रहस्य पहले से मौजूद है",
+ "variableNameRequired": "चर नाम आवश्यक है",
+ "variableNameDuplicate": "इस नाम का चर पहले से मौजूद है",
+ "noSecretConfigured": "कोई रहस्य कॉन्फ़िगर नहीं किया गया",
+ "noVariableConfigured": "कोई चर कॉन्फ़िगर नहीं किए गए",
"agentGoToSetting": "सेटिंग्स पर जाएँ",
"kernelFault3": "सामान्य कारण और समस्या निवारण",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. रिवर्स प्रॉक्सी WebSocket अग्रेषित नहीं कर रहा</b><br>यदि आप NGINX जैसे रिवर्स प्रॉक्सी के माध्यम से SiYuan तक पहुँचते हैं, तो आपको <code>/ws</code> के लिए प्रोटोकॉल अपग्रेड हेडर अलग से कॉन्फ़िगर करने होंगे, अन्यथा WebSocket हैंडशेक विफल हो जाएगा।</p></div><div class=\"b3-typography\"><p><b>2. कर्नेल प्रक्रिया समाप्त या क्रैश हो गई</b><br>सुनिश्चित करें कि कंटेनर या सेवा अभी भी चल रही है, और आवश्यक हो तो पुनः प्रारंभ करें। आप पूर्ण लॉग [सेटिंग्स - के बारे में - सिस्टम लॉग] में निर्यात कर सकते हैं।</p></div>",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 9c1c20cdb1..6d99394494 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Rahasia dan Variabel",
+ "secrets": "Rahasia",
+ "variables": "Variabel",
+ "secretsTip": "Disediakan untuk Skill, MCP dan plugin untuk dirujuk melalui {{secrets.NAME}}. Disimpan terenkripsi",
+ "variablesTip": "Disediakan untuk Skill, MCP dan plugin untuk dirujuk melalui {{vars.NAME}}. Disimpan sebagai teks biasa untuk data non-sensitif",
+ "secretName": "Nama rahasia",
+ "variableName": "Nama variabel",
+ "addSecret": "Tambah rahasia",
+ "addVariable": "Tambah variabel",
+ "secretValue": "Nilai rahasia",
+ "variableValue": "Nilai variabel",
+ "secretNameTip": "Nama untuk merujuk rahasia ini, gunakan {{secrets.NAME}} dalam Skill dan plugin",
+ "variableNameTip": "Nama untuk merujuk variabel ini, gunakan {{vars.NAME}} dalam Skill dan plugin",
+ "secretNameRequired": "Nama rahasia wajib diisi",
+ "secretNameDuplicate": "Rahasia dengan nama ini sudah ada",
+ "variableNameRequired": "Nama variabel wajib diisi",
+ "variableNameDuplicate": "Variabel dengan nama ini sudah ada",
+ "noSecretConfigured": "Tidak ada rahasia yang dikonfigurasi",
+ "noVariableConfigured": "Tidak ada variabel yang dikonfigurasi",
"agentGoToSetting": "Buka Konfigurasi",
"kernelFault3": "Penyebab umum dan pemecahan masalah",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Reverse proxy tidak meneruskan WebSocket</b><br>Jika Anda mengakses SiYuan melalui reverse proxy seperti NGINX, Anda harus mengonfigurasi header peningkatan protokol untuk <code>/ws</code> secara terpisah, jika tidak, handshake WebSocket akan gagal.</p></div><div class=\"b3-typography\"><p><b>2. Proses kernel berakhir atau macet</b><br>Pastikan kontainer atau layanan masih berjalan, dan mulai ulang jika perlu. Anda dapat mengekspor log lengkap di [Pengaturan - Tentang - Log sistem].</p></div>",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index dc3d04f1d5..939f45c057 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secret e variabili",
+ "secrets": "Secret",
+ "variables": "Variabili",
+ "secretsTip": "Messi a disposizione di Skill, MCP e plugin per il riferimento tramite {{secrets.NAME}}. Memorizzati crittografati",
+ "variablesTip": "Messe a disposizione di Skill, MCP e plugin per il riferimento tramite {{vars.NAME}}. Memorizzate come testo in chiaro per dati non sensibili",
+ "secretName": "Nome del secret",
+ "variableName": "Nome della variabile",
+ "addSecret": "Aggiungi secret",
+ "addVariable": "Aggiungi variabile",
+ "secretValue": "Valore del secret",
+ "variableValue": "Valore della variabile",
+ "secretNameTip": "Nome usato per riferirsi a questo secret, usa {{secrets.NAME}} in Skill e plugin",
+ "variableNameTip": "Nome usato per riferirsi a questa variabile, usa {{vars.NAME}} in Skill e plugin",
+ "secretNameRequired": "Il nome del secret è obbligatorio",
+ "secretNameDuplicate": "Esiste già un secret con questo nome",
+ "variableNameRequired": "Il nome della variabile è obbligatorio",
+ "variableNameDuplicate": "Esiste già una variabile con questo nome",
+ "noSecretConfigured": "Nessun secret configurato",
+ "noVariableConfigured": "Nessuna variabile configurata",
"agentGoToSetting": "Vai alle impostazioni",
"kernelFault3": "Cause comuni e risoluzione dei problemi",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Il reverse proxy non inoltra il WebSocket</b><br>Se accedi a SiYuan tramite un reverse proxy come NGINX, devi configurare le intestazioni di aggiornamento del protocollo per <code>/ws</code> separatamente, altrimenti l'handshake WebSocket fallirà.</p></div><div class=\"b3-typography\"><p><b>2. Il processo del kernel è terminato o è andato in crash</b><br>Verifica che il container o il servizio sia ancora in esecuzione e riavvialo se necessario. Puoi esportare i log completi in [Impostazioni - Informazioni - Log di sistema].</p></div>",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 6ba393e574..e0b7d2192e 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "シークレットと変数",
+ "secrets": "シークレット",
+ "variables": "変数",
+ "secretsTip": "Skill、MCP、プラグインが {{secrets.NAME}} を介して参照するために提供されます。暗号化して保存",
+ "variablesTip": "Skill、MCP、プラグインが {{vars.NAME}} を介して参照するために提供されます。非機密データは平文で保存",
+ "secretName": "シークレット名",
+ "variableName": "変数名",
+ "addSecret": "シークレットを追加",
+ "addVariable": "変数を追加",
+ "secretValue": "シークレットの値",
+ "variableValue": "変数の値",
+ "secretNameTip": "このシークレットを参照する名前。Skill とプラグインで {{secrets.NAME}} を使用",
+ "variableNameTip": "この変数を参照する名前。Skill とプラグインで {{vars.NAME}} を使用",
+ "secretNameRequired": "シークレット名は必須です",
+ "secretNameDuplicate": "同名のシークレットが既に存在します",
+ "variableNameRequired": "変数名は必須です",
+ "variableNameDuplicate": "同名の変数が既に存在します",
+ "noSecretConfigured": "シークレットが設定されていません",
+ "noVariableConfigured": "変数が設定されていません",
"agentGoToSetting": "設定に進む",
"kernelFault3": "一般的な原因とトラブルシューティング",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. リバースプロキシが WebSocket を転送していない</b><br>NGINX などのリバースプロキシ経由でアクセスする場合、<code>/ws</code> 用にプロトコルアップグレードヘッダーを個別に設定する必要があります。設定しないと WebSocket ハンドシェイクが失敗します。</p></div><div class=\"b3-typography\"><p><b>2. カーネルプロセスが終了またはクラッシュした</b><br>コンテナやサービスがまだ実行中か確認し、必要に応じて再起動してください。完全なログは [設定 - About - システムログ] でエクスポートできます。</p></div>",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 9f02bd1537..ee231a12fc 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "시크릿 및 변수",
+ "secrets": "시크릿",
+ "variables": "변수",
+ "secretsTip": "Skill, MCP 및 플러그인에서 {{secrets.NAME}}을 통해 참조하도록 제공됩니다. 암호화되어 저장",
+ "variablesTip": "Skill, MCP 및 플러그인에서 {{vars.NAME}}을 통해 참조하도록 제공됩니다. 민감하지 않은 데이터는 평문으로 저장",
+ "secretName": "시크릿 이름",
+ "variableName": "변수 이름",
+ "addSecret": "시크릿 추가",
+ "addVariable": "변수 추가",
+ "secretValue": "시크릿 값",
+ "variableValue": "변수 값",
+ "secretNameTip": "이 시크릿을 참조하는 이름, Skill과 플러그인에서 {{secrets.NAME}} 사용",
+ "variableNameTip": "이 변수를 참조하는 이름, Skill과 플러그인에서 {{vars.NAME}} 사용",
+ "secretNameRequired": "시크릿 이름이 필요합니다",
+ "secretNameDuplicate": "같은 이름의 시크릿이 이미 존재합니다",
+ "variableNameRequired": "변수 이름이 필요합니다",
+ "variableNameDuplicate": "같은 이름의 변수가 이미 존재합니다",
+ "noSecretConfigured": "구성된 시크릿이 없습니다",
+ "noVariableConfigured": "구성된 변수가 없습니다",
"agentGoToSetting": "설정으로 이동",
"kernelFault3": "일반적인 원인 및 문제 해결",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. 역방향 프록시가 WebSocket을 전달하지 않음</b><br>NGINX 등의 역방향 프록시로 접속하는 경우, <code>/ws</code>에 대해 프로토콜 업그레이드 헤더를 별도로 설정해야 합니다. 그렇지 않으면 WebSocket 핸드셰이크가 실패합니다.</p></div><div class=\"b3-typography\"><p><b>2. 커널 프로세스가 종료되었거나 충돌함</b><br>컨테이너나 서비스가 여전히 실행 중인지 확인하고, 필요하면 다시 시작하세요. 전체 로그는 [설정 - 정보 - 시스템 로그]에서 내보낼 수 있습니다.</p></div>",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index d9d1c414c2..905b111b72 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Secrets en variabelen",
+ "secrets": "Secrets",
+ "variables": "Variabelen",
+ "secretsTip": "Beschikbaar gesteld voor Skill, MCP en plugins om te verwijzen via {{secrets.NAME}}. Versleuteld opgeslagen",
+ "variablesTip": "Beschikbaar gesteld voor Skill, MCP en plugins om te verwijzen via {{vars.NAME}}. Opgeslagen als platte tekst voor niet-gevoelige gegevens",
+ "secretName": "Secret-naam",
+ "variableName": "Variabelenaam",
+ "addSecret": "Secret toevoegen",
+ "addVariable": "Variabele toevoegen",
+ "secretValue": "Secret-waarde",
+ "variableValue": "Variabele-waarde",
+ "secretNameTip": "Naam om naar dit secret te verwijzen, gebruik {{secrets.NAME}} in Skill en plugins",
+ "variableNameTip": "Naam om naar deze variabele te verwijzen, gebruik {{vars.NAME}} in Skill en plugins",
+ "secretNameRequired": "Secret-naam is vereist",
+ "secretNameDuplicate": "Er bestaat al een secret met deze naam",
+ "variableNameRequired": "Variabelenaam is vereist",
+ "variableNameDuplicate": "Er bestaat al een variabele met deze naam",
+ "noSecretConfigured": "Geen secrets geconfigureerd",
+ "noVariableConfigured": "Geen variabelen geconfigureerd",
"agentGoToSetting": "Naar instellingen",
"kernelFault3": "Veelvoorkomende oorzaken en probleemoplossing",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Reverse proxy stuurt WebSocket niet door</b><br>Als je SiYuan via een reverse proxy zoals NGINX benadert, moet je de protocol-upgrade headers voor <code>/ws</code> apart configureren, anders mislukt de WebSocket-handshake.</p></div><div class=\"b3-typography\"><p><b>2. Kernelproces is afgesloten of gecrasht</b><br>Controleer of de container of service nog draait en start deze zo nodig opnieuw. Je kunt de volledige logs exporteren in [Instellingen - Over - Systeemlog].</p></div>",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index f9778ca709..f522a2b1e7 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Tajemnice i zmienne",
+ "secrets": "Tajemnice",
+ "variables": "Zmienne",
+ "secretsTip": "Udostępniane Skill, MCP i wtyczkom do odwoływania się przez {{secrets.NAME}}. Przechowywane zaszyfrowane",
+ "variablesTip": "Udostępniane Skill, MCP i wtyczkom do odwoływania się przez {{vars.NAME}}. Przechowywane jako zwykły tekst dla danych niewrażliwych",
+ "secretName": "Nazwa tajemnicy",
+ "variableName": "Nazwa zmiennej",
+ "addSecret": "Dodaj tajemnicę",
+ "addVariable": "Dodaj zmienną",
+ "secretValue": "Wartość tajemnicy",
+ "variableValue": "Wartość zmiennej",
+ "secretNameTip": "Nazwa używana do odwoływania się do tej tajemnicy, użyj {{secrets.NAME}} w Skill i wtyczkach",
+ "variableNameTip": "Nazwa używana do odwoływania się do tej zmiennej, użyj {{vars.NAME}} w Skill i wtyczkach",
+ "secretNameRequired": "Nazwa tajemnicy jest wymagana",
+ "secretNameDuplicate": "Tajemnica o tej nazwie już istnieje",
+ "variableNameRequired": "Nazwa zmiennej jest wymagana",
+ "variableNameDuplicate": "Zmienna o tej nazwie już istnieje",
+ "noSecretConfigured": "Brak skonfigurowanych tajemnic",
+ "noVariableConfigured": "Brak skonfigurowanych zmiennych",
"agentGoToSetting": "Przejdź do ustawień",
"kernelFault3": "Częste przyczyny i rozwiązywanie problemów",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Odwrotne proxy nie przekazuje WebSocket</b><br>Jeśli korzystasz z SiYuan przez odwrotne proxy, takie jak NGINX, musisz osobno skonfigurować nagłówki uaktualnienia protokołu dla <code>/ws</code>, w przeciwnym razie uścisk dłoni WebSocket nie powiedzie się.</p></div><div class=\"b3-typography\"><p><b>2. Proces jądra zakończony lub uległ awarii</b><br>Upewnij się, że kontener lub usługa nadal działa, i w razie potrzeby uruchom je ponownie. Pełne dzienniki możesz wyeksportować w [Ustawienia - O programie - Dziennik systemowy].</p></div>",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 270e517d0f..1ff149ff0e 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Segredos e variáveis",
+ "secrets": "Segredos",
+ "variables": "Variáveis",
+ "secretsTip": "Fornecidos para Skill, MCP e plugins referenciarem via {{secrets.NAME}}. Armazenados criptografados",
+ "variablesTip": "Fornecidas para Skill, MCP e plugins referenciarem via {{vars.NAME}}. Armazenadas como texto simples para dados não sensíveis",
+ "secretName": "Nome do segredo",
+ "variableName": "Nome da variável",
+ "addSecret": "Adicionar segredo",
+ "addVariable": "Adicionar variável",
+ "secretValue": "Valor do segredo",
+ "variableValue": "Valor da variável",
+ "secretNameTip": "Nome usado para referenciar este segredo, use {{secrets.NAME}} em Skill e plugins",
+ "variableNameTip": "Nome usado para referenciar esta variável, use {{vars.NAME}} em Skill e plugins",
+ "secretNameRequired": "O nome do segredo é obrigatório",
+ "secretNameDuplicate": "Já existe um segredo com este nome",
+ "variableNameRequired": "O nome da variável é obrigatório",
+ "variableNameDuplicate": "Já existe uma variável com este nome",
+ "noSecretConfigured": "Nenhum segredo configurado",
+ "noVariableConfigured": "Nenhuma variável configurada",
"agentGoToSetting": "Ir para configurações",
"kernelFault3": "Causas comuns e solução de problemas",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. O proxy reverso não encaminha o WebSocket</b><br>Se você acessa o SiYuan por meio de um proxy reverso como NGINX, é necessário configurar os cabeçalhos de atualização de protocolo para <code>/ws</code> separadamente; caso contrário, o handshake do WebSocket falhará.</p></div><div class=\"b3-typography\"><p><b>2. O processo do kernel foi encerrado ou travou</b><br>Verifique se o contêiner ou serviço ainda está em execução e reinicie-o se necessário. Você pode exportar os logs completos em [Configurações - Sobre - Log do sistema].</p></div>",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 2209853614..711f515ba8 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Секреты и переменные",
+ "secrets": "Секреты",
+ "variables": "Переменные",
+ "secretsTip": "Предоставляются Skill, MCP и плагинам для ссылки через {{secrets.NAME}}. Хранятся в зашифрованном виде",
+ "variablesTip": "Предоставляются Skill, MCP и плагинам для ссылки через {{vars.NAME}}. Хранятся в открытом виде для несекретных данных",
+ "secretName": "Имя секрета",
+ "variableName": "Имя переменной",
+ "addSecret": "Добавить секрет",
+ "addVariable": "Добавить переменную",
+ "secretValue": "Значение секрета",
+ "variableValue": "Значение переменной",
+ "secretNameTip": "Имя для ссылки на этот секрет, используйте {{secrets.NAME}} в Skill и плагинах",
+ "variableNameTip": "Имя для ссылки на эту переменную, используйте {{vars.NAME}} в Skill и плагинах",
+ "secretNameRequired": "Имя секрета обязательно",
+ "secretNameDuplicate": "Секрет с таким именем уже существует",
+ "variableNameRequired": "Имя переменной обязательно",
+ "variableNameDuplicate": "Переменная с таким именем уже существует",
+ "noSecretConfigured": "Секреты не настроены",
+ "noVariableConfigured": "Переменные не настроены",
"agentGoToSetting": "Перейти в настройки",
"kernelFault3": "Частые причины и устранение неполадок",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Обратный прокси не перенаправляет WebSocket</b><br>Если вы обращаетесь к SiYuan через обратный прокси, например NGINX, необходимо отдельно настроить заголовки обновления протокола для <code>/ws</code>, иначе рукопожатие WebSocket завершится неудачей.</p></div><div class=\"b3-typography\"><p><b>2. Процесс ядра завершился или упал</b><br>Убедитесь, что контейнер или служба всё ещё работают, и при необходимости перезапустите их. Полные журналы можно экспортировать в [Настройки - О программе - Системный журнал].</p></div>",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index a1fa3f9a51..af3b118822 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Tajomstvá a premenné",
+ "secrets": "Tajomstvá",
+ "variables": "Premenné",
+ "secretsTip": "Poskytované Skill, MCP a pluginom na odkazovanie cez {{secrets.NAME}}. Ukladané šifrovane",
+ "variablesTip": "Poskytované Skill, MCP a pluginom na odkazovanie cez {{vars.NAME}}. Ukladané ako obyčajný text pre necitlivé údaje",
+ "secretName": "Názov tajomstva",
+ "variableName": "Názov premennej",
+ "addSecret": "Pridať tajomstvo",
+ "addVariable": "Pridať premennú",
+ "secretValue": "Hodnota tajomstva",
+ "variableValue": "Hodnota premennej",
+ "secretNameTip": "Názov na odkazovanie na toto tajomstvo, použite {{secrets.NAME}} v Skill a pluginoch",
+ "variableNameTip": "Názov na odkazovanie na túto premennú, použite {{vars.NAME}} v Skill a pluginoch",
+ "secretNameRequired": "Názov tajomstva je povinný",
+ "secretNameDuplicate": "Tajomstvo s týmto názvom už existuje",
+ "variableNameRequired": "Názov premennej je povinný",
+ "variableNameDuplicate": "Premenná s týmto názvom už existuje",
+ "noSecretConfigured": "Žiadne tajomstvá nie sú nakonfigurované",
+ "noVariableConfigured": "Žiadne premenné nie sú nakonfigurované",
"agentGoToSetting": "Prejsť do nastavení",
"kernelFault3": "Časté príčiny a riešenie problémov",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Reverzný proxy nepreposiela WebSocket</b><br>Ak pristupujete k SiYuan cez reverzný proxy ako NGINX, musíte samostatne nakonfigurovať hlavičky aktualizácie protokolu pre <code>/ws</code>, inak zlyhá handshake WebSocketu.</p></div><div class=\"b3-typography\"><p><b>2. Proces jadra sa ukončil alebo zlyhal</b><br>Uistite sa, že kontajner alebo služba stále beží, a v prípade potreby ich reštartujte. Úplné denníky môžete exportovať v [Nastavenia - O programe - Systémový denník].</p></div>",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index acf01c2b77..ee5744ecc5 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "ความลับและตัวแปร",
+ "secrets": "ความลับ",
+ "variables": "ตัวแปร",
+ "secretsTip": "จัดให้สำหรับ Skill, MCP และปลั๊กอินเพื่ออ้างอิงผ่าน {{secrets.NAME}} เก็บแบบเข้ารหัส",
+ "variablesTip": "จัดให้สำหรับ Skill, MCP และปลั๊กอินเพื่ออ้างอิงผ่าน {{vars.NAME}} เก็บเป็นข้อความธรรมดาสำหรับข้อมูลที่ไม่ละเอียดอ่อน",
+ "secretName": "ชื่อความลับ",
+ "variableName": "ชื่อตัวแปร",
+ "addSecret": "เพิ่มความลับ",
+ "addVariable": "เพิ่มตัวแปร",
+ "secretValue": "ค่าความลับ",
+ "variableValue": "ค่าตัวแปร",
+ "secretNameTip": "ชื่อที่ใช้อ้างอิงความลับนี้ ใช้ {{secrets.NAME}} ใน Skill และปลั๊กอิน",
+ "variableNameTip": "ชื่อที่ใช้อ้างอิงตัวแปรนี้ ใช้ {{vars.NAME}} ใน Skill และปลั๊กอิน",
+ "secretNameRequired": "ต้องระบุชื่อความลับ",
+ "secretNameDuplicate": "มีความลับชื่อนี้อยู่แล้ว",
+ "variableNameRequired": "ต้องระบุชื่อตัวแปร",
+ "variableNameDuplicate": "มีตัวแปรชื่อนี้อยู่แล้ว",
+ "noSecretConfigured": "ยังไม่ได้กำหนดค่าความลับ",
+ "noVariableConfigured": "ยังไม่ได้กำหนดค่าตัวแปร",
"agentGoToSetting": "ไปยังการตั้งค่า",
"kernelFault3": "สาเหตุทั่วไปและการแก้ไขปัญหา",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. reverse proxy ไม่ส่งต่อ WebSocket</b><br>หากคุณเข้าถึง SiYuan ผ่าน reverse proxy เช่น NGINX คุณต้องกำหนดค่าส่วนหัวการอัปเกรดโปรโตคอลสำหรับ <code>/ws</code> แยกต่างหาก มิฉะนั้นการจับมือ WebSocket จะล้มเหลว</p></div><div class=\"b3-typography\"><p><b>2. กระบวนการเคอร์เนลสิ้นสุดหรือขัดข้อง</b><br>ตรวจสอบให้แน่ใจว่าคอนเทนเนอร์หรือบริการยังทำงานอยู่และรีสตาร์ตหากจำเป็น คุณสามารถส่งออกบันทึกแบบเต็มได้ที่ [การตั้งค่า - เกี่ยวกับ - บันทึกระบบ]</p></div>",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 64f0e720cf..b21f6305be 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Gizli Anahtarlar ve Değişkenler",
+ "secrets": "Gizli Anahtarlar",
+ "variables": "Değişkenler",
+ "secretsTip": "Skill, MCP ve eklentilerin {{secrets.NAME}} aracılığıyla başvurması için sağlanır. Şifrelenmiş olarak saklanır",
+ "variablesTip": "Skill, MCP ve eklentilerin {{vars.NAME}} aracılığıyla başvurması için sağlanır. Hassas olmayan veriler için düz metin olarak saklanır",
+ "secretName": "Gizli anahtar adı",
+ "variableName": "Değişken adı",
+ "addSecret": "Gizli anahtar ekle",
+ "addVariable": "Değişken ekle",
+ "secretValue": "Gizli anahtar değeri",
+ "variableValue": "Değişken değeri",
+ "secretNameTip": "Bu gizli anahtara başvurmak için kullanılan ad, Skill ve eklentilerde {{secrets.NAME}} kullanın",
+ "variableNameTip": "Bu değişkene başvurmak için kullanılan ad, Skill ve eklentilerde {{vars.NAME}} kullanın",
+ "secretNameRequired": "Gizli anahtar adı zorunludur",
+ "secretNameDuplicate": "Bu adda bir gizli anahtar zaten var",
+ "variableNameRequired": "Değişken adı zorunludur",
+ "variableNameDuplicate": "Bu adda bir değişken zaten var",
+ "noSecretConfigured": "Yapılandırılmış gizli anahtar yok",
+ "noVariableConfigured": "Yapılandırılmış değişken yok",
"agentGoToSetting": "Ayarlara git",
"kernelFault3": "Yaygın nedenler ve sorun giderme",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Ters proxy WebSocket'i iletmıyor</b><br>SiYuan'a NGINX gibi bir ters proxy üzerinden erişiyorsanız, <code>/ws</code> için protokol yükseltme başlıklarını ayrıca yapılandırmanız gerekir, aksi takdirde WebSocket el sıkışması başarısız olur.</p></div><div class=\"b3-typography\"><p><b>2. Çekirdek süreci sonlandı veya çöktü</b><br>Kapsayıcının veya servisin hala çalıştığından emin olun ve gerekirse yeniden başlatın. Tam günlükleri [Ayarlar - Hakkında - Sistem günlüğü] bölümünde dışa aktarabilirsiniz.</p></div>",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 208bd6f3cd..e382289a2b 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "Секрети та змінні",
+ "secrets": "Секрети",
+ "variables": "Змінні",
+ "secretsTip": "Надаються Skill, MCP і плагінам для посилання через {{secrets.NAME}}. Зберігаються зашифрованими",
+ "variablesTip": "Надаються Skill, MCP і плагінам для посилання через {{vars.NAME}}. Зберігаються відкритим текстом для несекретних даних",
+ "secretName": "Назва секрету",
+ "variableName": "Назва змінної",
+ "addSecret": "Додати секрет",
+ "addVariable": "Додати змінну",
+ "secretValue": "Значення секрету",
+ "variableValue": "Значення змінної",
+ "secretNameTip": "Назва для посилання на цей секрет, використовуйте {{secrets.NAME}} у Skill і плагінах",
+ "variableNameTip": "Назва для посилання на цю змінну, використовуйте {{vars.NAME}} у Skill і плагінах",
+ "secretNameRequired": "Назва секрету обов'язкова",
+ "secretNameDuplicate": "Секрет з такою назвою вже існує",
+ "variableNameRequired": "Назва змінної обов'язкова",
+ "variableNameDuplicate": "Змінна з такою назвою вже існує",
+ "noSecretConfigured": "Секрети не налаштовані",
+ "noVariableConfigured": "Змінні не налаштовані",
"agentGoToSetting": "Перейти до налаштувань",
"kernelFault3": "Часті причини та усунення неполадок",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. Зворотний проксі не перенаправляє WebSocket</b><br>Якщо ви звертаєтесь до SiYuan через зворотний проксі, наприклад NGINX, потрібно окремо налаштувати заголовки оновлення протоколу для <code>/ws</code>, інакше рукостискання WebSocket завершиться невдачею.</p></div><div class=\"b3-typography\"><p><b>2. Процес ядра завершився або впав</b><br>Переконайтеся, що контейнер або служба все ще працюють, і за потреби перезапустіть їх. Повні журнали можна експортувати в [Налаштування - Про програму - Системний журнал].</p></div>",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 0266264652..50e7c39cc5 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "密钥和变量",
+ "secrets": "密钥",
+ "variables": "变量",
+ "secretsTip": "提供给 Skill、MCP 和插件通过 {{secrets.NAME}} 引用,加密存储",
+ "variablesTip": "提供给 Skill、MCP 和插件通过 {{vars.NAME}} 引用,明文存储非敏感数据",
+ "secretName": "密钥命名",
+ "variableName": "变量命名",
+ "addSecret": "新增密钥",
+ "addVariable": "新增变量",
+ "secretValue": "密钥值",
+ "variableValue": "变量值",
+ "secretNameTip": "用于引用此密钥的名称,在 Skill 和插件中使用 {{secrets.NAME}}",
+ "variableNameTip": "用于引用此变量的名称,在 Skill 和插件中使用 {{vars.NAME}}",
+ "secretNameRequired": "密钥名不能为空",
+ "secretNameDuplicate": "已存在同名密钥",
+ "variableNameRequired": "变量名不能为空",
+ "variableNameDuplicate": "已存在同名变量",
+ "noSecretConfigured": "暂无密钥",
+ "noVariableConfigured": "暂无变量",
"agentGoToSetting": "前往配置",
"kernelFault3": "常见原因与排查",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. 反向代理未转发 WebSocket</b><br>若通过 NGINX 等反向代理访问,必须为 <code>/ws</code> 单独配置协议升级头,否则 WebSocket 握手会失败。</p></div><div class=\"b3-typography\"><p><b>2. 内核进程已退出或崩溃</b><br>确认容器或服务仍在运行,必要时重启容器,完整日志可在 [设置 - 关于 - 系统日志] 中导出。</p></div>",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index c68250a55c..d63bf73aa9 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,23 @@
{
+ "secretsVariables": "金鑰和變數",
+ "secrets": "金鑰",
+ "variables": "變數",
+ "secretsTip": "提供給 Skill、MCP 和外掛透過 {{secrets.NAME}} 參照,加密儲存",
+ "variablesTip": "提供給 Skill、MCP 和外掛透過 {{vars.NAME}} 參照,明文儲存非敏感資料",
+ "secretName": "金鑰命名",
+ "variableName": "變數命名",
+ "addSecret": "新增金鑰",
+ "addVariable": "新增變數",
+ "secretValue": "金鑰值",
+ "variableValue": "變數值",
+ "secretNameTip": "用於參照此金鑰的名稱,在 Skill 和外掛中使用 {{secrets.NAME}}",
+ "variableNameTip": "用於參照此變數的名稱,在 Skill 和外掛中使用 {{vars.NAME}}",
+ "secretNameRequired": "金鑰名稱不能為空",
+ "secretNameDuplicate": "已存在同名金鑰",
+ "variableNameRequired": "變數名稱不能為空",
+ "variableNameDuplicate": "已存在同名變數",
+ "noSecretConfigured": "尚無金鑰",
+ "noVariableConfigured": "尚無變數",
"agentGoToSetting": "前往設定",
"kernelFault3": "常見原因與排查",
"kernelFault4": "<div class=\"b3-typography\"><p><b>1. 反向代理未轉發 WebSocket</b><br>若透過 NGINX 等反向代理存取,必須為 <code>/ws</code> 單獨設定協定升級標頭,否則 WebSocket 握手會失敗。</p></div><div class=\"b3-typography\"><p><b>2. 內核程序已結束或崩潰</b><br>確認容器或服務仍在運行,必要時重啟容器,完整日誌可在 [設定 - 關於 - 系統日誌] 中匯出。</p></div>",
diff --git a/app/src/config/setting/tabs.ts b/app/src/config/setting/tabs.ts
index be4fed08f7..d746edb52b 100644
--- a/app/src/config/setting/tabs.ts
+++ b/app/src/config/setting/tabs.ts
@@ -2,6 +2,7 @@ import {editorConfigApi} from "../tabs/editorRuntime";
import {fileConfigApi} from "../tabs/fileRuntime";
import {flashcardConfigApi} from "../tabs/flashcardRuntime";
import {aiConfigApi} from "../tabs/aiRuntime";
+import {secretsConfigApi} from "../tabs/secretsVariablesRuntime";
import {exportConfigApi} from "../tabs/exportRuntime";
import {searchConfigApi} from "../tabs/searchRuntime";
import {appearanceConfigApi} from "../tabs/appearanceRuntime";
@@ -18,6 +19,7 @@ import {registerEditorTab} from "../tabs/editorTab";
import {registerFileTab} from "../tabs/fileTab";
import {registerFlashcardTab} from "../tabs/flashcardTab";
import {registerAiTab} from "../tabs/aiTab";
+import {registerSecretsVariablesTab} from "../tabs/secretsVariablesTab";
import {registerExportTab} from "../tabs/exportTab";
import {registerSearchTab} from "../tabs/searchTab";
import {registerAppearanceTab} from "../tabs/appearanceTab";
@@ -68,6 +70,12 @@ const settingTabs = {
title: () => window.siyuan.languages.ai,
defaultSave: aiConfigApi.patch,
}, registerAiTab),
+ secretsVariables: setting.tab({
+ id: "secretsVariables",
+ icon: "iconSquareAsterisk",
+ title: () => window.siyuan.languages.secretsVariables,
+ defaultSave: secretsConfigApi.patch,
+ }, registerSecretsVariablesTab),
assets: setting.panel({
id: "assets",
icon: "iconImage",
diff --git a/app/src/config/tabs/secretsVariablesRuntime.ts b/app/src/config/tabs/secretsVariablesRuntime.ts
new file mode 100644
index 0000000000..239aa99149
--- /dev/null
+++ b/app/src/config/tabs/secretsVariablesRuntime.ts
@@ -0,0 +1,21 @@
+import {createConfigNamespaceApi} from "../util/namespaceApi";
+
+/** 密钥库 Tab 命名空间:设置面板注册项 save */
+export const secretsConfigApi = createConfigNamespaceApi<Config.ISecrets>({
+ namespace: "secrets",
+ getConfig: () => window.siyuan.config.secrets,
+ setConfig: (data) => {
+ window.siyuan.config.secrets = data;
+ },
+ apiPath: "/api/setting/setSecrets",
+});
+
+/** 变量库 Tab 命名空间:设置面板注册项 save */
+export const variablesConfigApi = createConfigNamespaceApi<Config.IVariables>({
+ namespace: "variables",
+ getConfig: () => window.siyuan.config.variables,
+ setConfig: (data) => {
+ window.siyuan.config.variables = data;
+ },
+ apiPath: "/api/setting/setVariables",
+});
diff --git a/app/src/config/tabs/secretsVariablesTab.ts b/app/src/config/tabs/secretsVariablesTab.ts
new file mode 100644
index 0000000000..04b6f123ab
--- /dev/null
+++ b/app/src/config/tabs/secretsVariablesTab.ts
@@ -0,0 +1,36 @@
+import type {SettingTabBuilder} from "../setting/builder";
+import {
+ genSecretsBlockHtml,
+ getSecretsBlockKeywords,
+ mountSecretsBlock,
+ genVariablesBlockHtml,
+ getVariablesBlockKeywords,
+ mountVariablesBlock,
+} from "./secretsVariablesUi";
+
+const registerSecretsGroup = (tab: SettingTabBuilder) => {
+ const group = tab.group("secrets", window.siyuan.languages.secrets);
+
+ group.slot({
+ key: "secrets",
+ keywords: getSecretsBlockKeywords(),
+ html: genSecretsBlockHtml,
+ afterMount: mountSecretsBlock,
+ });
+};
+
+const registerVariablesGroup = (tab: SettingTabBuilder) => {
+ const group = tab.group("variables", window.siyuan.languages.variables);
+
+ group.slot({
+ key: "variables",
+ keywords: getVariablesBlockKeywords(),
+ html: genVariablesBlockHtml,
+ afterMount: mountVariablesBlock,
+ });
+};
+
+export const registerSecretsVariablesTab = (tab: SettingTabBuilder) => {
+ registerSecretsGroup(tab);
+ registerVariablesGroup(tab);
+};
diff --git a/app/src/config/tabs/secretsVariablesUi.ts b/app/src/config/tabs/secretsVariablesUi.ts
new file mode 100644
index 0000000000..378b83d51a
--- /dev/null
+++ b/app/src/config/tabs/secretsVariablesUi.ts
@@ -0,0 +1,343 @@
+import {bindPasswordIconaToggle} from "../render/fragments";
+import {Dialog} from "../../dialog";
+import {confirmDialog} from "../../dialog/confirmDialog";
+import {showMessage} from "../../dialog/message";
+import {Constants} from "../../constants";
+import {isMobile} from "../../util/functions";
+import {secretsConfigApi} from "./secretsVariablesRuntime";
+import {variablesConfigApi} from "./secretsVariablesRuntime";
+
+interface NamedItem {
+ name: string;
+ value: string;
+}
+
+// region 密钥区块(Secrets)
+
+export const getSecretsBlockKeywords = (): string[] => [
+ window.siyuan.languages.secrets,
+ window.siyuan.languages.secretsTip,
+ window.siyuan.languages.addSecret,
+ window.siyuan.languages.secretName,
+ window.siyuan.languages.secretValue,
+ window.siyuan.languages.noSecretConfigured,
+];
+
+export const genSecretsBlockHtml = (): string => `<div class="b3-label config-item" id="secretsBlock">
+ <div class="config-name">${window.siyuan.languages.secrets}</div>
+ <div class="b3-label__text">${window.siyuan.languages.secretsTip}</div>
+ <div class="fn__hr--small"></div>
+ <div id="secretList"></div>
+ <div class="fn__hr"></div>
+ <div class="config-wrap">
+ <button class="b3-button b3-button--outline fn__flex-center fn__size200" data-type="addSecret">
+ <svg><use xlink:href="#iconAdd"></use></svg>
+ ${window.siyuan.languages.addSecret}
+ </button>
+ </div>
+</div>`;
+
+export const mountSecretsBlock = (root: HTMLElement) => {
+ const block = root.querySelector("#secretsBlock");
+ if (!block) {
+ return;
+ }
+ renderSecretList(root);
+
+ block.addEventListener("click", (event) => {
+ const target = event.target as HTMLElement;
+ const actionEl = target.closest<HTMLElement>("[data-type]");
+ const type = actionEl?.dataset.type;
+ if (type === "addSecret") {
+ openItemDialog({
+ root,
+ existingName: null,
+ kind: "secret",
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if (type === "editSecret") {
+ openItemDialog({
+ root,
+ existingName: getSecretName(actionEl),
+ kind: "secret",
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if (type === "deleteSecret") {
+ event.preventDefault();
+ event.stopPropagation();
+ const name = getSecretName(actionEl);
+ if (!name) {
+ return;
+ }
+ showDeleteConfirm(name, () => {
+ saveSecrets(root, window.siyuan.config.secrets.items.filter((item) => item.name !== name));
+ });
+ }
+ });
+};
+
+const renderSecretList = (root: HTMLElement) => {
+ const listEl = root.querySelector("#secretList");
+ if (!listEl) {
+ return;
+ }
+ renderNamedItemList({
+ listEl,
+ items: window.siyuan.config.secrets.items,
+ addType: "addSecret",
+ editType: "editSecret",
+ deleteType: "deleteSecret",
+ dataAttr: "data-secret-name",
+ emptyTextKey: window.siyuan.languages.noSecretConfigured,
+ });
+};
+
+const saveSecrets = (root: HTMLElement, items: Config.ISecret[]) => {
+ secretsConfigApi.patch("items", items, () => renderSecretList(root));
+};
+
+const getSecretName = (el: HTMLElement): string | undefined =>
+ el.closest<HTMLElement>("[data-secret-name]")?.dataset.secretName;
+
+// endregion
+
+// region 变量区块(Variables)
+
+export const getVariablesBlockKeywords = (): string[] => [
+ window.siyuan.languages.variables,
+ window.siyuan.languages.variablesTip,
+ window.siyuan.languages.addVariable,
+ window.siyuan.languages.variableName,
+ window.siyuan.languages.variableValue,
+ window.siyuan.languages.noVariableConfigured,
+];
+
+export const genVariablesBlockHtml = (): string => `<div class="b3-label config-item" id="variablesBlock">
+ <div class="config-name">${window.siyuan.languages.variables}</div>
+ <div class="b3-label__text">${window.siyuan.languages.variablesTip}</div>
+ <div class="fn__hr--small"></div>
+ <div id="variableList"></div>
+ <div class="fn__hr"></div>
+ <div class="config-wrap">
+ <button class="b3-button b3-button--outline fn__flex-center fn__size200" data-type="addVariable">
+ <svg><use xlink:href="#iconAdd"></use></svg>
+ ${window.siyuan.languages.addVariable}
+ </button>
+ </div>
+</div>`;
+
+export const mountVariablesBlock = (root: HTMLElement) => {
+ const block = root.querySelector("#variablesBlock");
+ if (!block) {
+ return;
+ }
+ renderVariableList(root);
+
+ block.addEventListener("click", (event) => {
+ const target = event.target as HTMLElement;
+ const actionEl = target.closest<HTMLElement>("[data-type]");
+ const type = actionEl?.dataset.type;
+ if (type === "addVariable") {
+ openItemDialog({
+ root,
+ existingName: null,
+ kind: "variable",
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if (type === "editVariable") {
+ openItemDialog({
+ root,
+ existingName: getVariableName(actionEl),
+ kind: "variable",
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if (type === "deleteVariable") {
+ event.preventDefault();
+ event.stopPropagation();
+ const name = getVariableName(actionEl);
+ if (!name) {
+ return;
+ }
+ showDeleteConfirm(name, () => {
+ saveVariables(root, window.siyuan.config.variables.items.filter((item) => item.name !== name));
+ });
+ }
+ });
+};
+
+const renderVariableList = (root: HTMLElement) => {
+ const listEl = root.querySelector("#variableList");
+ if (!listEl) {
+ return;
+ }
+ renderNamedItemList({
+ listEl,
+ items: window.siyuan.config.variables.items,
+ addType: "addVariable",
+ editType: "editVariable",
+ deleteType: "deleteVariable",
+ dataAttr: "data-variable-name",
+ emptyTextKey: window.siyuan.languages.noVariableConfigured,
+ });
+};
+
+const saveVariables = (root: HTMLElement, items: Config.IVariable[]) => {
+ variablesConfigApi.patch("items", items, () => renderVariableList(root));
+};
+
+const getVariableName = (el: HTMLElement): string | undefined =>
+ el.closest<HTMLElement>("[data-variable-name]")?.dataset.variableName;
+
+// endregion
+
+// region 共享渲染与弹窗
+
+interface RenderNamedItemListOptions {
+ listEl: Element;
+ items: NamedItem[];
+ addType: string;
+ editType: string;
+ deleteType: string;
+ dataAttr: string;
+ emptyTextKey: string;
+}
+
+const renderNamedItemList = (options: RenderNamedItemListOptions) => {
+ const {listEl, items, editType, deleteType, dataAttr, emptyTextKey} = options;
+ const hideActionClass = isMobile() ? "" : " b3-list-item--hide-action";
+ if (items.length === 0) {
+ listEl.innerHTML = `<div class="b3-label__text">${emptyTextKey}</div>`;
+ return;
+ }
+ const html = items.map((item) => {
+ return `<div class="b3-list-item b3-list-item--narrow${hideActionClass}" ${dataAttr}="${Lute.EscapeHTMLStr(item.name)}">
+ <span class="b3-list-item__text">${Lute.EscapeHTMLStr(item.name)}</span>
+ <span data-type="${deleteType}" class="b3-list-item__action b3-list-item__action--warning b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.delete}">
+ <svg><use xlink:href="#iconTrashcan"></use></svg>
+ </span>
+ <span data-type="${editType}" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.edit}">
+ <svg><use xlink:href="#iconSettings"></use></svg>
+ </span>
+</div>`;
+ }).join("");
+ listEl.innerHTML = `<div class="b3-list b3-list--border b3-list--background">${html}</div>`;
+};
+
+interface OpenItemDialogOptions {
+ root: HTMLElement;
+ existingName: string | null;
+ kind: "secret" | "variable";
+}
+
+const openItemDialog = (options: OpenItemDialogOptions) => {
+ const {root, existingName, kind} = options;
+ const isNew = !existingName;
+ const isSecret = kind === "secret";
+ const configItems: NamedItem[] = isSecret
+ ? window.siyuan.config.secrets.items
+ : window.siyuan.config.variables.items;
+ const existing = existingName ? configItems.find((item) => item.name === existingName) : undefined;
+ if (!isNew && !existing) {
+ return;
+ }
+ const initial: NamedItem = isNew ? {name: "", value: ""} : existing;
+
+ const titleKey = isNew
+ ? (isSecret ? window.siyuan.languages.addSecret : window.siyuan.languages.addVariable)
+ : (isSecret ? window.siyuan.languages.secrets : window.siyuan.languages.variables);
+ const valueKey = isSecret ? window.siyuan.languages.secretValue : window.siyuan.languages.variableValue;
+ const nameRequiredKey = isSecret
+ ? window.siyuan.languages.secretNameRequired
+ : window.siyuan.languages.variableNameRequired;
+ const nameDuplicateKey = isSecret
+ ? window.siyuan.languages.secretNameDuplicate
+ : window.siyuan.languages.variableNameDuplicate;
+
+ const valueInputHtml = isSecret
+ ? `<div class="b3-form__icona fn__block">
+ <input id="itemValue" type="password" class="b3-text-field b3-form__icona-input" spellcheck="false" value="${Lute.EscapeHTMLStr(initial.value)}">
+ <svg class="b3-form__icona-icon" data-action="togglePassword" style="user-select: none;">
+ <use xlink:href="#iconEye"></use>
+ </svg>
+</div>`
+ : `<input class="b3-text-field fn__block" id="itemValue" type="text" spellcheck="false" value="${Lute.EscapeHTMLStr(initial.value)}"/>`;
+
+ const dialog = new Dialog({
+ title: titleKey,
+ width: isMobile() ? "92vw" : "520px",
+ content: `<div class="b3-dialog__content">
+ <div class="b3-label b3-label--inner">
+ <div class="config-name">${isSecret ? window.siyuan.languages.secretName : window.siyuan.languages.variableName}</div>
+ <div class="b3-label__text">${isSecret ? window.siyuan.languages.secretNameTip : window.siyuan.languages.variableNameTip}</div>
+ <div class="fn__hr"></div>
+ <input class="b3-text-field fn__block" id="itemName" type="text" spellcheck="false" value="${Lute.EscapeHTMLStr(initial.name)}"/>
+ </div>
+ <div class="b3-label b3-label--inner">
+ <div class="config-name">${valueKey}</div>
+ <div class="fn__hr"></div>
+ ${valueInputHtml}
+ </div>
+</div>
+<div class="b3-dialog__action">
+ <button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
+ <button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
+</div>`,
+ });
+
+ dialog.element.setAttribute("data-key", Constants.DIALOG_AIPROVIDER);
+ if (isSecret) {
+ bindPasswordIconaToggle(dialog.element, "itemValue");
+ }
+ dialog.element.querySelector<HTMLInputElement>("#itemName").select();
+
+ const btns = dialog.element.querySelectorAll(".b3-dialog__action .b3-button");
+ btns[0].addEventListener("click", () => dialog.destroy());
+ btns[1].addEventListener("click", () => {
+ const next: NamedItem = {
+ ...initial,
+ name: dialog.element.querySelector<HTMLInputElement>("#itemName").value.trim(),
+ value: dialog.element.querySelector<HTMLInputElement>("#itemValue").value,
+ };
+ if (!next.name) {
+ showMessage(nameRequiredKey);
+ return;
+ }
+ if (configItems.some((item) => item.name === next.name && item.name !== existingName)) {
+ showMessage(nameDuplicateKey);
+ return;
+ }
+ const nextItems = isNew
+ ? [...configItems, next]
+ : configItems.map((item) => item.name !== existingName ? item : next);
+ if (isSecret) {
+ saveSecrets(root, nextItems);
+ } else {
+ saveVariables(root, nextItems);
+ }
+ dialog.destroy();
+ });
+};
+
+const showDeleteConfirm = (title: string, onConfirm: () => void) => {
+ confirmDialog(
+ window.siyuan.languages.deleteOpConfirm,
+ window.siyuan.languages.confirmDeleteTip.replace("${x}", Lute.EscapeHTMLStr(title)),
+ onConfirm,
+ undefined,
+ true,
+ );
+};
+
+// endregion
diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts
index 796db361c5..fd13e116c9 100644
--- a/app/src/types/config.d.ts
+++ b/app/src/types/config.d.ts
@@ -74,6 +74,11 @@ declare namespace Config {
*/
readonly: boolean;
repo: IRepo;
+ /**
+ * Global secrets store, referenced via {{secrets.NAME}} placeholders.
+ * 全局密钥库,通过 {{secrets.NAME}} 占位符引用
+ */
+ secrets: ISecrets;
search: ISearch;
/**
* Whether to display the changelog for this release version
@@ -89,6 +94,11 @@ declare namespace Config {
* Community user data (Encrypted)
*/
userData: string;
+ /**
+ * Global variables store, referenced via {{vars.NAME}} placeholders.
+ * 全局变量库,通过 {{vars.NAME}} 占位符引用
+ */
+ variables: IVariables;
}
/**
@@ -1431,6 +1441,38 @@ declare namespace Config {
enabledJS: boolean;
}
+ /**
+ * A named secret. The value is AES-encrypted at rest on the kernel side.
+ */
+ export interface ISecret {
+ name: string;
+ value: string;
+ }
+
+ /**
+ * Global secrets store. Referenced via {{secrets.NAME}} placeholders by the
+ * agent http_request tool and MCP server headers.
+ */
+ export interface ISecrets {
+ items: ISecret[];
+ }
+
+ /**
+ * A named variable. The value is stored in plain text (non-sensitive data).
+ */
+ export interface IVariable {
+ name: string;
+ value: string;
+ }
+
+ /**
+ * Global variables store. Referenced via {{vars.NAME}} placeholders by the
+ * agent http_request tool and MCP server headers.
+ */
+ export interface IVariables {
+ items: IVariable[];
+ }
+
/**
* SiYuan workspace content statistics
*/
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 99f7f6c872..ecce0c84f3 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -404,6 +404,8 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/setting/setEmoji", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setEmoji)
ginServer.Handle("POST", "/api/setting/setFlashcard", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setFlashcard)
ginServer.Handle("POST", "/api/setting/setAI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setAI)
+ ginServer.Handle("POST", "/api/setting/setSecrets", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setSecrets)
+ ginServer.Handle("POST", "/api/setting/setVariables", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setVariables)
ginServer.Handle("POST", "/api/setting/setBazaar", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setBazaar)
ginServer.Handle("POST", "/api/setting/setPublish", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setPublish)
ginServer.Handle("POST", "/api/setting/getPublish", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getPublish)
diff --git a/kernel/api/setting.go b/kernel/api/setting.go
index 69a53af6a2..71d327795e 100644
--- a/kernel/api/setting.go
+++ b/kernel/api/setting.go
@@ -206,6 +206,64 @@ func setAI(c *gin.Context) {
ret.Data = model.Conf.AI
}
+func setSecrets(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
+
+ param, err := gulu.JSON.MarshalJSON(arg)
+ if err != nil {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
+ }
+
+ secrets := &conf.Secrets{}
+ if err = gulu.JSON.UnmarshalJSON(param, secrets); err != nil {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
+ }
+
+ model.Conf.Secrets = secrets
+ model.Conf.Save()
+
+ ret.Data = model.Conf.Secrets
+}
+
+func setVariables(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
+
+ param, err := gulu.JSON.MarshalJSON(arg)
+ if err != nil {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
+ }
+
+ variables := &conf.Variables{}
+ if err = gulu.JSON.UnmarshalJSON(param, variables); err != nil {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
+ }
+
+ model.Conf.Variables = variables
+ model.Conf.Save()
+
+ ret.Data = model.Conf.Variables
+}
+
func setFlashcard(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/conf/secrets.go b/kernel/conf/secrets.go
new file mode 100644
index 0000000000..b7bd6b8ae0
--- /dev/null
+++ b/kernel/conf/secrets.go
@@ -0,0 +1,107 @@
+// SiYuan - Refactor your thinking
+// Copyright (c) 2020-present, b3log.org
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package conf
+
+import (
+ "encoding/hex"
+ "regexp"
+
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+// Secret 是一条命名密钥,Name 为引用名(如 weread_key),Value 在运行时为明文,落盘时由 Secrets.Encrypt 加密。
+type Secret struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+}
+
+// Secrets 是全局密钥库,脱离 AI 配置独立存在,供智能体 http_request 工具、MCP 服务 headers 等以
+// {{secret:名字}} 形式引用。落盘时 Value 经 AES 加密,运行时为明文。
+type Secrets struct {
+ Items []*Secret `json:"items"`
+}
+
+func NewSecrets() *Secrets {
+ return &Secrets{Items: []*Secret{}}
+}
+
+// Encrypt 把内存明文加密为密文,供 AppConf.Save() 序列化前调用。
+func (s *Secrets) Encrypt() {
+ if s == nil {
+ return
+ }
+ for _, item := range s.Items {
+ if item == nil || item.Value == "" {
+ continue
+ }
+ item.Value = util.AESEncrypt(item.Value)
+ }
+}
+
+// Decrypt 把密文解密回明文。util.AESDecrypt 返回的是 hex 文本,必须再做一次 hex.DecodeString
+// 才是真正的明文,照搬 conf.AI.DecryptAPIKeys 的双 hex 模式。
+func (s *Secrets) Decrypt() {
+ if s == nil {
+ return
+ }
+ for _, item := range s.Items {
+ if item == nil || item.Value == "" {
+ continue
+ }
+ dec := util.AESDecrypt(item.Value)
+ if dec == nil {
+ continue
+ }
+ if plain, err := hex.DecodeString(string(dec)); err == nil {
+ item.Value = string(plain)
+ }
+ }
+}
+
+// secretPlaceholder 匹配 {{secrets.NAME}} 形式的占位符,NAME 部分不含 } 字符。
+var secretPlaceholder = regexp.MustCompile(`\{\{secrets\.([^}]+)\}\}`)
+
+// Resolve 把字符串里的 {{secrets.NAME}} 占位符替换为对应明文密钥。
+// 找不到对应名字时保留原占位符不替换,便于调用方/LLM 发现尚未配置的密钥。
+// 必须在内存明文状态下(InitConf 解密后或 AppConf.Save 的 defer 还原后)调用。
+func (s *Secrets) Resolve(in string) string {
+ if s == nil {
+ return in
+ }
+ return secretPlaceholder.ReplaceAllStringFunc(in, func(match string) string {
+ sub := secretPlaceholder.FindStringSubmatch(match)
+ if len(sub) < 2 {
+ return match
+ }
+ name := sub[1]
+ for _, item := range s.Items {
+ if item != nil && item.Name == name {
+ return item.Value
+ }
+ }
+ return match
+ })
+}
+
+// ResolveSecretsVars 同时替换 {{secrets.NAME}} 与 {{vars.NAME}} 两种占位符,
+// 供智能体 http_request 工具、MCP 服务 headers 等统一消费密钥与变量。
+// 任一参数为 nil 时跳过其对应占位符的替换。
+func ResolveSecretsVars(secrets *Secrets, vars *Variables, in string) string {
+ in = secrets.Resolve(in)
+ in = vars.Resolve(in)
+ return in
+}
diff --git a/kernel/conf/variables.go b/kernel/conf/variables.go
new file mode 100644
index 0000000000..7613debaf6
--- /dev/null
+++ b/kernel/conf/variables.go
@@ -0,0 +1,59 @@
+// SiYuan - Refactor your thinking
+// Copyright (c) 2020-present, b3log.org
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package conf
+
+import "regexp"
+
+// Variable 是一条命名变量,Name 为引用名,Value 为明文存储(不加密),用于非敏感配置数据。
+type Variable struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+}
+
+// Variables 是全局变量库,与 Secrets 对应:Secrets 加密存储敏感数据,Variables 明文存储非敏感数据。
+// 两者以 {{vars.NAME}} 形式被智能体工具、MCP 服务等引用。
+type Variables struct {
+ Items []*Variable `json:"items"`
+}
+
+func NewVariables() *Variables {
+ return &Variables{Items: []*Variable{}}
+}
+
+// varPlaceholder 匹配 {{vars.NAME}} 形式的占位符,NAME 部分不含 } 字符。
+var varPlaceholder = regexp.MustCompile(`\{\{vars\.([^}]+)\}\}`)
+
+// Resolve 把字符串里的 {{vars.NAME}} 占位符替换为对应变量值。
+// 找不到对应名字时保留原占位符不替换,与 Secrets.Resolve 行为一致。
+func (v *Variables) Resolve(in string) string {
+ if v == nil {
+ return in
+ }
+ return varPlaceholder.ReplaceAllStringFunc(in, func(match string) string {
+ sub := varPlaceholder.FindStringSubmatch(match)
+ if len(sub) < 2 {
+ return match
+ }
+ name := sub[1]
+ for _, item := range v.Items {
+ if item != nil && item.Name == name {
+ return item.Value
+ }
+ }
+ return match
+ })
+}
diff --git a/kernel/mcp/client/mcp.go b/kernel/mcp/client/mcp.go
index 7059267980..9db56c4c57 100644
--- a/kernel/mcp/client/mcp.go
+++ b/kernel/mcp/client/mcp.go
@@ -30,6 +30,7 @@ import (
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/mcp/tools"
+ "github.com/siyuan-note/siyuan/kernel/model"
)
const (
@@ -70,7 +71,9 @@ type headerRoundTripper struct {
func (h *headerRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
clone := req.Clone(req.Context())
for k, v := range h.headers {
- clone.Header.Set(k, v)
+ // 对每个 header 值里的 {{secrets.NAME}}、{{vars.NAME}} 占位符插值,
+ // 使 MCP 服务的 Authorization 等头部可引用密钥/变量而无需明文存储。
+ clone.Header.Set(k, conf.ResolveSecretsVars(model.Conf.Secrets, model.Conf.Variables, v))
}
return h.base.RoundTrip(clone)
}
diff --git a/kernel/mcp/tools/http_request.go b/kernel/mcp/tools/http_request.go
index 5e737e7fc9..e762f279b5 100644
--- a/kernel/mcp/tools/http_request.go
+++ b/kernel/mcp/tools/http_request.go
@@ -19,6 +19,8 @@ package tools
import (
"fmt"
+ "github.com/siyuan-note/siyuan/kernel/conf"
+ "github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -66,6 +68,17 @@ func httpRequestHandler(args map[string]interface{}) (CallToolResult, error) {
}
body, _ := args["body"].(string)
+ // 对 url/headers/body 中的 {{secrets.NAME}}、{{vars.NAME}} 占位符插值,
+ // 密钥/变量明文只进入出站请求,不进入 LLM 上下文。
+ resolve := func(s string) string {
+ return conf.ResolveSecretsVars(model.Conf.Secrets, model.Conf.Variables, s)
+ }
+ rawURL = resolve(rawURL)
+ for k, v := range headers {
+ headers[k] = resolve(v)
+ }
+ body = resolve(body)
+
statusCode, contentType, text, err := util.HTTPRequest(action, rawURL, headers, body)
if err != nil {
return CallToolResult{
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 1a8155fa51..b753ca6c75 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -71,6 +71,8 @@ type AppConf struct {
Search *conf.Search `json:"search"` // 搜索配置
Flashcard *conf.Flashcard `json:"flashcard"` // 闪卡配置
AI *conf.AI `json:"ai"` // 人工智能配置
+ Secrets *conf.Secrets `json:"secrets"` // 全局密钥库
+ Variables *conf.Variables `json:"variables"` // 全局变量库
Bazaar *conf.Bazaar `json:"bazaar"` // 集市配置
Stat *conf.Stat `json:"stat"` // 统计
Api *conf.API `json:"api"` // API
@@ -139,6 +141,9 @@ func InitConf() {
if nil != Conf.AI {
Conf.AI.DecryptAPIKeys()
}
+ if nil != Conf.Secrets {
+ Conf.Secrets.Decrypt()
+ }
Conf.Save()
logging.LogInfof("migrated AI config [%s]", confPath)
}
@@ -152,6 +157,9 @@ func InitConf() {
if nil != Conf.AI {
Conf.AI.DecryptAPIKeys()
}
+ if nil != Conf.Secrets {
+ Conf.Secrets.Decrypt()
+ }
}
}
}
@@ -605,6 +613,14 @@ func InitConf() {
}
Conf.AI.Normalize()
+ if nil == Conf.Secrets {
+ Conf.Secrets = conf.NewSecrets()
+ }
+
+ if nil == Conf.Variables {
+ Conf.Variables = conf.NewVariables()
+ }
+
for _, p := range Conf.AI.Providers {
if p == nil || len(p.APIKey) == 0 {
continue
@@ -935,6 +951,11 @@ func (conf *AppConf) Save() {
defer Conf.AI.DecryptAPIKeys()
}
+ if nil != Conf.Secrets {
+ Conf.Secrets.Encrypt()
+ defer Conf.Secrets.Decrypt()
+ }
+
newData, _ := gulu.JSON.MarshalIndentJSON(Conf, "", " ")
confPath := filepath.Join(util.ConfDir, "conf.json")
oldData, err := filelock.ReadFile(confPath)
@@ -1127,6 +1148,8 @@ func HideConfSecret(c *AppConf) {
c.Publish = &conf.Publish{}
c.Repo = &conf.Repo{}
c.Sync = &conf.Sync{}
+ c.Secrets = &conf.Secrets{}
+ c.Variables = &conf.Variables{}
c.System.AppDir = ""
c.System.ConfDir = ""
c.System.DataDir = ""
diff --git a/kernel/plugin/api_secrets_vars.go b/kernel/plugin/api_secrets_vars.go
new file mode 100644
index 0000000000..eb59c88baa
--- /dev/null
+++ b/kernel/plugin/api_secrets_vars.go
@@ -0,0 +1,61 @@
+// SiYuan - Refactor your thinking
+// Copyright (c) 2020-present, b3log.org
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package plugin
+
+import (
+ "fmt"
+
+ "github.com/dop251/goja"
+ "github.com/samber/lo"
+ "github.com/siyuan-note/siyuan/kernel/model"
+)
+
+// injectSecretsVars adds siyuan.secrets and siyuan.vars to the plugin JS sandbox.
+// siyuan.secrets.resolve(tpl) 仅替换模板里的 {{secrets.NAME}} 占位符,
+// siyuan.vars.resolve(tpl) 仅替换 {{vars.NAME}}。两者各自只返回替换后的字符串,
+// 不向插件暴露密钥/变量清单。同步执行(纯内存操作,无 I/O)。
+func injectSecretsVars(p *KernelPlugin, rt *goja.Runtime, siyuan *goja.Object) (err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("injectSecretsVars: %v", r)
+ }
+ }()
+
+ secrets := rt.NewObject()
+ lo.Must0(secrets.Set("resolve", rt.ToValue(makeResolver(func(tpl string) string {
+ return model.Conf.Secrets.Resolve(tpl)
+ }))))
+ lo.Must0(siyuan.Set("secrets", secrets))
+
+ vars := rt.NewObject()
+ lo.Must0(vars.Set("resolve", rt.ToValue(makeResolver(func(tpl string) string {
+ return model.Conf.Variables.Resolve(tpl)
+ }))))
+ lo.Must0(siyuan.Set("vars", vars))
+
+ return
+}
+
+// makeResolver 构造一个 JS 可调用函数:接收模板字符串,返回经 resolver 替换后的结果。
+func makeResolver(resolver func(string) string) func(goja.FunctionCall, *goja.Runtime) goja.Value {
+ return func(call goja.FunctionCall, rt *goja.Runtime) goja.Value {
+ if len(call.Arguments) < 1 || !goja.IsString(call.Argument(0)) {
+ return rt.ToValue("")
+ }
+ return rt.ToValue(resolver(call.Argument(0).String()))
+ }
+}
diff --git a/kernel/plugin/sandbox.go b/kernel/plugin/sandbox.go
index b7761e135d..53405a6365 100644
--- a/kernel/plugin/sandbox.go
+++ b/kernel/plugin/sandbox.go
@@ -107,6 +107,7 @@ func EnableSiyuanModule(p *KernelPlugin, rt *goja.Runtime) (err error) {
lo.Must0(injectMcp(p, rt, siyuan))
lo.Must0(injectClient(p, rt, siyuan))
lo.Must0(injectServer(p, rt, siyuan))
+ lo.Must0(injectSecretsVars(p, rt, siyuan))
lo.Must0(ObjectFreeze(rt, siyuan))