Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Feb 6, 2025
2 parents 1b3173d + c4669b4 commit 56cbedc
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Install pnpm: `npm install -g [email protected]`

Set the Electron mirror environment variable and install Electron:

* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v33.3.2 -D`
* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v33.4.0 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@v33.3.2 -D`
* `pnpm install electron@v33.4.0 -D`

NPM mirror:

Expand All @@ -28,7 +28,7 @@ NPM mirror:

On the desktop, go to the app folder to run:

* `pnpm install electron@v33.3.2 -D`
* `pnpm install electron@v33.4.0 -D`
* `pnpm run dev`
* `pnpm run start`

Expand Down
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

* macOS/Linux:
```
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v33.3.2 -D
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v33.4.0 -D
```
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@v33.3.2 -D`
* `pnpm install electron@v33.4.0 -D`

NPM 镜像:

Expand All @@ -30,7 +30,7 @@ NPM 镜像:

桌面端进入 app 文件夹运行:

* `pnpm install electron@v33.3.2 -D`
* `pnpm install electron@v33.4.0 -D`
* `pnpm run dev`
* `pnpm run start`

Expand Down
3 changes: 2 additions & 1 deletion app/appearance/langs/ar_SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 قد يقوم Microsoft Defender بحذف النواة عن طريق الخطأ، وحذف البيانات وتقليل الأداء بشكل كبير. يُوصى بإضافة مسار التثبيت ومسار مساحة العمل الخاصة بـ SiYuan إلى قائمة الاستثناءات<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">إضافة</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">تجاهل</button>",
"253": "جارٍ ضغط الملف [%s]، يرجى الانتظار...",
"254": "[Region ID] معرّف المنطقة غير صحيح، يرجى الرجوع إلى وثائق مزود خدمة S3 لتكوين معرّف المنطقة",
"255": "قام الموقع المستهدف بتمكين حماية الروابط المباشرة، لذلك لا يمكن تنزيل [%d] من الموارد"
"255": "قام الموقع المستهدف بتمكين حماية الروابط المباشرة، لذلك لا يمكن تنزيل [%d] من الموارد",
"256": "المسار المحدد [%s] يحتوي على مسار مساحة عمل رئيسي [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender kann fälschlicherweise den Kernel löschen, Daten löschen und die Leistung erheblich verringern. Es wird empfohlen, den SiYuan-Installationspfad und den Arbeitsbereichspfad zur Ausschlussliste hinzuzufügen<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Hinzufügen</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignorieren</button>",
"253": "Datei [%s] wird komprimiert, bitte warten...",
"254": "[Region ID] Falsche Regions-ID, bitte konsultieren Sie die Dokumentation des S3-Dienstanbieters zur Konfiguration der Regions-ID",
"255": "Die Zielseite hat den Hotlink-Schutz aktiviert, daher ist es nicht möglich, [%d] Ressourcen herunterzuladen"
"255": "Die Zielseite hat den Hotlink-Schutz aktiviert, daher ist es nicht möglich, [%d] Ressourcen herunterzuladen",
"256": "Der angegebene Pfad [%s] hat einen übergeordneten Arbeitsbereichspfad [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender may mistakenly delete the kernel, delete data, and significantly reduce performance. It is recommended to add the SiYuan installation path and workspace path to the exclusion list<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Add</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignore</button>",
"253": "Compressing file [%s], please wait...",
"254": "[Region ID] Incorrect Region ID, please refer to the S3 service provider's documentation to configure the Region ID",
"255": "The target site has enabled hotlink protection, so it is not possible to download [%d] resources"
"255": "The target site has enabled hotlink protection, so it is not possible to download [%d] resources",
"256": "The specified path [%s] has a parent workspace path [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender puede eliminar por error el núcleo, eliminar datos y reducir significativamente el rendimiento. Se recomienda agregar la ruta de instalación y el espacio de trabajo de SiYuan a la lista de exclusiones<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Agregar</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignorar</button>",
"253": "Comprimiendo el archivo [%s], por favor espere...",
"254": "[Region ID] ID de región incorrecto, por favor consulte la documentación del proveedor de servicios S3 para configurar el ID de región",
"255": "El sitio de destino ha activado la protección contra hotlinking, por lo que no es posible descargar [%d] recursos"
"255": "El sitio de destino ha activado la protección contra hotlinking, por lo que no es posible descargar [%d] recursos",
"256": "La ruta especificada [%s] tiene una ruta de espacio de trabajo padre [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender peut supprimer par erreur le noyau, supprimer des données et réduire considérablement les performances. Il est recommandé d'ajouter le chemin d'installation et l'espace de travail de SiYuan à la liste des exclusions<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Ajouter</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignorer</button>",
"253": "Compression du fichier [%s], veuillez patienter...",
"254": "[Region ID] ID de région incorrect, veuillez consulter la documentation du fournisseur de services S3 pour configurer l'ID de région",
"255": "Le site cible a activé la protection contre le hotlinking, il est donc impossible de télécharger [%d] ressources"
"255": "Le site cible a activé la protection contre le hotlinking, il est donc impossible de télécharger [%d] ressources",
"256": "Le chemin spécifié [%s] contient un chemin d'espace de travail parent [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/he_IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender עלול למחוק בטעות את הליבה, למחוק נתונים ולהפחית משמעותית את הביצועים. מומלץ להוסיף את נתיב ההתקנה ונתיב סביבת העבודה של SiYuan לרשימת החריגים<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">הוסף</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">התעלם</button>",
"253": "דוחס את הקובץ [%s], אנא המתן...",
"254": "[Region ID] מזהה האזור שגוי, אנא עיין בתיעוד ספק שירותי S3 כדי להגדיר את מזהה האזור",
"255": "האתר היעד הפעיל הגנה על קישורים חמים, ולכן לא ניתן להוריד [%d] משאבים"
"255": "האתר היעד הפעיל הגנה על קישורים חמים, ולכן לא ניתן להוריד [%d] משאבים",
"256": "הנתיב שצוין [%s] מכיל נתיב מרחב עבודה אב [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender potrebbe eliminare erroneamente il kernel, eliminare i dati e ridurre significativamente le prestazioni. Si consiglia di aggiungere il percorso di installazione e lo spazio di lavoro di SiYuan all'elenco delle esclusioni<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Aggiungi</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignora</button>",
"253": "Compressione del file [%s], attendere prego...",
"254": "[Region ID] ID regione non corretto, si prega di consultare la documentazione del fornitore di servizi S3 per configurare l'ID regione",
"255": "Il sito di destinazione ha abilitato la protezione hotlink, quindi non è possibile scaricare [%d] risorse"
"255": "Il sito di destinazione ha abilitato la protezione hotlink, quindi non è possibile scaricare [%d] risorse",
"256": "Il percorso specificato [%s] ha un percorso di spazio di lavoro padre [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender は、カーネルを誤って削除したり、データを削除したり、パフォーマンスを大幅に低下させたりする可能性があります。SiYuan のインストールパスとワークスペースパスを除外リストに追加することをお勧めします<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">追加</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">無視</button>",
"253": "ファイル [%s] を圧縮しています、お待ちください...",
"254": "[Region ID] リージョンIDが正しくありません。S3サービスプロバイダーのドキュメントを参照してリージョンIDを設定してください",
"255": "ターゲットサイトはホットリンク保護を有効にしているため、[%d] 個のリソースをダウンロードできません"
"255": "ターゲットサイトはホットリンク保護を有効にしているため、[%d] 個のリソースをダウンロードできません",
"256": "指定されたパス [%s] の親にワークスペースパス [%s] が存在します"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender może błędnie usunąć jądro, usunąć dane i znacznie obniżyć wydajność. Zaleca się dodanie ścieżki instalacji i przestrzeni roboczej SiYuan do listy wykluczeń<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Dodaj</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Ignoruj</button>",
"253": "Kompresja pliku [%s], proszę czekać...",
"254": "[Region ID] Nieprawidłowy identyfikator regionu, proszę zapoznać się z dokumentacją dostawcy usług S3 w celu skonfigurowania identyfikatora regionu",
"255": "Docelowa strona włączyła ochronę przed hotlinkowaniem, [%d] zasobów nie można pobrać"
"255": "Docelowa strona włączyła ochronę przed hotlinkowaniem, [%d] zasobów nie można pobrać",
"256": "Określona ścieżka [%s] ma nadrzędną ścieżkę przestrzeni roboczej [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender может ошибочно удалить ядро, удалить данные и значительно снизить производительность. Рекомендуется добавить путь установки и рабочее пространство SiYuan в список исключений<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">Добавить</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">Игнорировать</button>",
"253": "Сжатие файла [%s], пожалуйста, подождите...",
"254": "[Region ID] Неправильный идентификатор региона, пожалуйста, обратитесь к документации поставщика услуг S3 для настройки идентификатора региона",
"255": "Целевой сайт включил защиту от хотлинков, [%d] ресурсов невозможно скачать"
"255": "Целевой сайт включил защиту от хотлинков, [%d] ресурсов невозможно скачать",
"256": "Указанный путь [%s] имеет родительский путь рабочей области [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/zh_CHT.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender 可能會誤殺內核、誤刪數據和嚴重降低運行性能,建議將思源安裝路徑和工作空間路徑添加到排除列表<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">添加</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">忽略</button>",
"253": "正在壓縮文件 [%s],請稍等...",
"254": "[Region ID] 不正確,請參考 S3 服務提供商的文檔配置地域 ID",
"255": "目標站點啟用了防盜鏈,[%d] 個資源無法下載"
"255": "目標站點啟用了防盜鏈,[%d] 個資源無法下載",
"256": "指定的路徑 [%s] 父級存在工作空間路徑 [%s]"
}
}
3 changes: 2 additions & 1 deletion app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@
"252": "\uD83D\uDEA8 Microsoft Defender 可能会误杀内核、误删数据和严重降低运行性能,建议将思源安装路径和工作空间路径添加到排除列表<span class=\"fn__space\"></span><button id=\"addMicrosoftDefenderExclusion\" class=\"b3-button\">添加</button><span class=\"fn__space\"></span><button id=\"ignoreAddMicrosoftDefenderExclusion\" class=\"b3-button b3-button--white\">忽略</button>",
"253": "正在压缩文件 [%s],请稍等...",
"254": "[Region ID] 不正确,请参考 S3 服务提供商的文档配置地域 ID",
"255": "目标站点启用了防盗链,[%d] 个资源无法下载"
"255": "目标站点启用了防盗链,[%d] 个资源无法下载",
"256": "指定的路径 [%s] 父级存在工作空间路径 [%s]"
}
}
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"dayjs": "^1.11.5",
"electron": "33.3.2",
"electron": "33.4.0",
"electron-builder": "25.1.8",
"encoding": "^0.1.13",
"esbuild-loader": "^3.0.1",
Expand Down
16 changes: 8 additions & 8 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions kernel/api/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ func setWorkspaceDir(c *gin.Context) {
}
}

// 检查路径是否在已有的工作空间路径中
pathIsWorkspace := util.IsWorkspaceDir(path)
if !pathIsWorkspace {
for p := filepath.Dir(path); "" != p; p = filepath.Dir(p) {
if util.IsWorkspaceDir(p) {
ret.Code = -1
ret.Msg = fmt.Sprintf(model.Conf.Language(256), path, p)
ret.Data = map[string]interface{}{"closeTimeout": 7000}
return
}
}
}

workspacePaths, err := util.ReadWorkspacePaths()
if err != nil {
ret.Code = -1
Expand Down
10 changes: 10 additions & 0 deletions kernel/util/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,13 @@ func GetAbsPathInWorkspace(relPath string) (string, error) {
func IsAbsPathInWorkspace(absPath string) bool {
return IsSubPath(WorkspaceDir, absPath)
}

// IsWorkspaceDir 判断指定目录是否是工作空间目录。
func IsWorkspaceDir(dir string) bool {
conf := filepath.Join(dir, "conf", "conf.json")
data, err := os.ReadFile(conf)
if nil != err {
return false
}
return strings.Contains(string(data), "kernelVersion")
}

0 comments on commit 56cbedc

Please sign in to comment.