Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-09 09:28:09 +08:00
parent f8e49f4e13
commit 941e153a4b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
21 changed files with 176 additions and 16 deletions

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Temporäre Dateien bereinigen",
"clearTempFilesTip": "Bereinigen Sie temporäre Dateien, die während der Ausführung der Anwendung erstellt wurden, um Speicherplatz freizugeben",
"uploadFileTooLarge": "⚠\uFE0F الملف الذي تم رفعه [${x}] كبير جدًا [${y}],هل تؤكد المتابعة بالرفع?",
"recentDocsMaxListCount": "الحد الأقصى لعدد المستندات الحديثة المعروضة",
"recentDocsMaxListCountTip": "الحد الأقصى لعدد المستندات المدرجة في مربع حوار المستندات الحديثة",
@ -1716,6 +1718,8 @@
"272": "حقل غير مسمى",
"273": "لا تقم بإنشاء مساحة العمل في مسار جذر القسم، يرجى إنشاء مجلد جديد كمساحة عمل",
"274": "يحتوي هذا المجلد على ملفات أخرى، يرجى إنشاء مجلد جديد كمساحة عمل",
"275": "يتعذر فتح المستند الذي تم إنشاؤه بواسطة إصدار أحدث. يرجى الترقية إلى أحدث إصدار ثم المحاولة مرة أخرى"
"275": "يتعذر فتح المستند الذي تم إنشاؤه بواسطة إصدار أحدث. يرجى الترقية إلى أحدث إصدار ثم المحاولة مرة أخرى",
"276": "جارٍ تنظيف الملفات المؤقتة...",
"277": "اكتمل تنظيف الملفات المؤقتة، تم حذف [%d] ملفًا، تم تحرير [%s] من مساحة القرص"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Temporäre Dateien bereinigen",
"clearTempFilesTip": "Bereinigen Sie temporäre Dateien, die während der Ausführung der Anwendung erstellt wurden, um Speicherplatz freizugeben",
"uploadFileTooLarge": "⚠\uFE0F Die hochgeladene Datei [${x}] ist zu groß [${y}]. Sind Sie sicher, dass Sie den Upload fortsetzen möchten?",
"recentDocsMaxListCount": "Maximale Anzahl an aufgelisteten letzten Dokumenten",
"recentDocsMaxListCountTip": "Maximale Anzahl der Dokumente, die im Dialog der zuletzt verwendeten Dokumente aufgelistet werden",
@ -1716,6 +1718,8 @@
"272": "Unbenanntes Feld",
"273": "Erstellen Sie den Arbeitsbereich nicht im Stammverzeichnis der Partition, erstellen Sie bitte einen neuen Ordner als Arbeitsbereich",
"274": "Dieser Ordner enthält andere Dateien, erstellen Sie bitte einen neuen Ordner als Arbeitsbereich",
"275": "Dokumente, die mit einer neueren Version erstellt wurden, können nicht geöffnet werden. Bitte aktualisieren Sie auf die neueste Version und versuchen Sie es erneut"
"275": "Dokumente, die mit einer neueren Version erstellt wurden, können nicht geöffnet werden. Bitte aktualisieren Sie auf die neueste Version und versuchen Sie es erneut",
"276": "Temporäre Dateien werden bereinigt...",
"277": "Bereinigung der temporären Dateien abgeschlossen, [%d] Dateien entfernt, [%s] Festplattenspeicher freigegeben"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Clear temporary files",
"clearTempFilesTip": "Clear temporary files generated while the app is running to free up storage space",
"uploadFileTooLarge": "⚠\uFE0F The uploaded file [${x}] is too large [${y}]. Are you sure you want to continue uploading?",
"recentDocsMaxListCount": "Maximum number of recent documents listed",
"recentDocsMaxListCountTip": "Maximum number of documents listed in the Recent Documents dialog",
@ -1716,6 +1718,8 @@
"272": "Unnamed field",
"273": "Do not create the workspace in the partition root path, please create a new folder as the workspace",
"274": "This folder contains other files, please create a new folder as the workspace",
"275": "Cannot open documents created by a newer version. Please upgrade to the latest version and try again"
"275": "Cannot open documents created by a newer version. Please upgrade to the latest version and try again",
"276": "Cleaning temporary files...",
"277": "Temporary files cleaned, [%d] files removed, [%s] disk space freed"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Limpiar archivos temporales",
"clearTempFilesTip": "Limpia los archivos temporales generados durante la ejecución de la aplicación para liberar espacio de almacenamiento",
"uploadFileTooLarge": "⚠\uFE0F El archivo subido [${x}] es demasiado grande [${y}]¿estás seguro de que deseas continuar con la subida?",
"recentDocsMaxListCount": "Número máximo de documentos recientes listados",
"recentDocsMaxListCountTip": "Número máximo de documentos que se mostrarán en el cuadro de diálogo Documentos recientes",
@ -1716,6 +1718,8 @@
"272": "Campo sin nombre",
"273": "No cree el espacio de trabajo en la ruta raíz de la partición, cree una nueva carpeta como espacio de trabajo",
"274": "Esta carpeta contiene otros archivos, cree una nueva carpeta como espacio de trabajo",
"275": "No se puede abrir el documento creado con una versión más reciente. Actualiza a la última versión e inténtalo de nuevo"
"275": "No se puede abrir el documento creado con una versión más reciente. Actualiza a la última versión e inténtalo de nuevo",
"276": "Limpiando archivos temporales...",
"277": "Limpieza de archivos temporales completada, [%d] archivos eliminados, se liberaron [%s] de espacio en disco"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Effacer les fichiers temporaires",
"clearTempFilesTip": "Effacez les fichiers temporaires générés lors de l'exécution de l'application pour libérer de l'espace de stockage",
"uploadFileTooLarge": "⚠\uFE0F Le fichier envoyé [${x}] est trop volumineux [${y}]. Voulez-vous continuer l'envoi ?",
"recentDocsMaxListCount": "Nombre maximal de documents récents listés",
"recentDocsMaxListCountTip": "Nombre maximal de documents répertoriés dans la boîte de dialogue Documents récents",
@ -1716,6 +1718,8 @@
"272": "Champ sans nom",
"273": "Ne créez pas lespace de travail à la racine de la partition, créez un nouveau dossier comme espace de travail",
"274": "Ce dossier contient dautres fichiers, créez un nouveau dossier comme espace de travail",
"275": "Impossible d'ouvrir le document créé par une version plus récente. Veuillez mettre à jour vers la dernière version et réessayer"
"275": "Impossible d'ouvrir le document créé par une version plus récente. Veuillez mettre à jour vers la dernière version et réessayer",
"276": "Nettoyage des fichiers temporaires...",
"277": "Nettoyage des fichiers temporaires terminé, [%d] fichiers supprimés, [%s] d'espace disque libéré"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "ניקוי קבצים זמניים",
"clearTempFilesTip": "נקה קבצים זמניים שנוצרו במהלך הפעלת היישום כדי לפנות מקום אחסון",
"uploadFileTooLarge": "⚠\uFE0F הקובץ שהועלה [${x}] גדול מאוד [${y}],אשר האם להמשיך בהעלאה?",
"recentDocsMaxListCount": "מספר מקסימלי של מסמכים אחרונים ברשימה",
"recentDocsMaxListCountTip": "מספר המסמכים המקסימלי שיופיע בתיבת הדו-שיח של 'מסמכים אחרונים'",
@ -1716,6 +1718,8 @@
"272": "שדה ללא שם",
"273": "אל תיצור סביבת עבודה בנתיב השורש של המחיצה, צור תיקיה חדשה כסביבת עבודה",
"274": "התיקיה הזו מכילה קבצים נוספים, צור תיקיה חדשה כסביבת עבודה",
"275": "לא ניתן לפתוח את המסמך שנוצר בגרסה חדשה יותר. יש לעדכן לגרסה העדכנית ביותר ולנסות שוב"
"275": "לא ניתן לפתוח את המסמך שנוצר בגרסה חדשה יותר. יש לעדכן לגרסה העדכנית ביותר ולנסות שוב",
"276": "ניקוי קבצים זמניים...",
"277": "ניקוי הקבצים הזמניים הושלם, נמחקו [%d] קבצים, שוחררו [%s] מקום בדיסק"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Elimina file temporanei",
"clearTempFilesTip": "Elimina i file temporanei creati durante l'esecuzione dell'app per liberare spazio di archiviazione",
"uploadFileTooLarge": "⚠\uFE0F Il file caricato [${x}] è troppo grande [${y}]. Sei sicuro di voler continuare il caricamento?",
"recentDocsMaxListCount": "Numero massimo di documenti recenti elencati",
"recentDocsMaxListCountTip": "Numero massimo di documenti elencati nella finestra di dialogo Documenti recenti",
@ -1716,6 +1718,8 @@
"272": "Campo senza nome",
"273": "Non creare lo spazio di lavoro nella directory radice della partizione, crea una nuova cartella come spazio di lavoro",
"274": "Questa cartella contiene altri file, crea una nuova cartella come spazio di lavoro",
"275": "Impossibile aprire il documento creato con una versione più recente. Aggiorna all'ultima versione e riprova"
"275": "Impossibile aprire il documento creato con una versione più recente. Aggiorna all'ultima versione e riprova",
"276": "Pulizia dei file temporanei in corso...",
"277": "Pulizia dei file temporanei completata, [%d] file rimossi, liberati [%s] di spazio su disco"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "一時ファイルを削除",
"clearTempFilesTip": "アプリの実行中に生成された一時ファイルを削除して、ストレージ領域を解放します",
"uploadFileTooLarge": "⚠\uFE0F アップロードしたファイル [${x}] は [${y}] で大きすぎます。アップロードを続行しますか?",
"recentDocsMaxListCount": "最近のドキュメントの最大表示数",
"recentDocsMaxListCountTip": "最近のドキュメントダイアログに最大で表示されるドキュメント数",
@ -1716,6 +1718,8 @@
"272": "未命名フィールド",
"273": "パーティションのルートパスにワークスペースを作成しないでください。新しいフォルダーをワークスペースとして作成してください",
"274": "このフォルダーには他のファイルが含まれています。新しいフォルダーをワークスペースとして作成してください",
"275": "新しいバージョンで作成された文書を開くことができません。最新バージョンにアップデートしてから再試行してください"
"275": "新しいバージョンで作成された文書を開くことができません。最新バージョンにアップデートしてから再試行してください",
"276": "一時ファイルをクリーンアップしています...",
"277": "一時ファイルのクリーンアップが完了しました。[%d]件のファイルを削除し、合計で [%s] のディスク容量を解放しました"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "임시 파일 정리",
"clearTempFilesTip": "앱 실행 중 생성된 임시 파일을 정리하여 저장 공간을 확보합니다",
"uploadFileTooLarge": "⚠\uFE0F 업로드한 파일 [${x}]의 크기가 [${y}]로 너무 큽니다. 계속 업로드하시겠습니까?",
"recentDocsMaxListCount": "최근 문서 목록 최대 수",
"recentDocsMaxListCountTip": "최근 문서 대화상자에 최대 나열될 문서 수",
@ -1716,6 +1718,8 @@
"272": "이름 없는 필드",
"273": "파티션 루트 경로에 작업 공간을 생성하지 말고 새 폴더를 생성하여 작업 공간으로 사용하세요",
"274": "이 폴더에는 다른 파일이 포함되어 있습니다. 새 폴더를 생성하여 작업 공간으로 사용하세요",
"275": "더 높은 버전에서 생성된 문서는 열 수 없습니다. 최신 버전으로 업그레이드한 후 다시 시도해 주세요"
"275": "더 높은 버전에서 생성된 문서는 열 수 없습니다. 최신 버전으로 업그레이드한 후 다시 시도해 주세요",
"276": "임시 파일을 정리하는 중...",
"277": "임시 파일 정리 완료, [%d]개 파일이 삭제되어 총 [%s]의 디스크 공간이 확보되었습니다"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Wyczyść pliki tymczasowe",
"clearTempFilesTip": "Wyczyść pliki tymczasowe tworzone podczas działania aplikacji, aby zwolnić miejsce na dysku",
"uploadFileTooLarge": "⚠\uFE0F Przesłany plik [${x}] jest za duży [${y}]. Czy na pewno chcesz kontynuować przesyłanie?",
"recentDocsMaxListCount": "Maksymalna liczba wyświetlanych ostatnich dokumentów",
"recentDocsMaxListCountTip": "Maksymalna liczba dokumentów wyświetlanych w oknie dialogowym Ostatnie dokumenty",
@ -1716,6 +1718,8 @@
"272": "Nienazwane pole",
"273": "Nie twórz przestrzeni roboczej w katalogu głównym partycji, utwórz nowy folder jako przestrzeń roboczą",
"274": "Ten folder zawiera inne pliki, utwórz nowy folder jako przestrzeń roboczą",
"275": "Nie można otworzyć dokumentu utworzonego w nowszej wersji. Zaktualizuj program do najnowszej wersji i spróbuj ponownie"
"275": "Nie można otworzyć dokumentu utworzonego w nowszej wersji. Zaktualizuj program do najnowszej wersji i spróbuj ponownie",
"276": "Czyszczenie plików tymczasowych...",
"277": "Czyszczenie plików tymczasowych zakończone, usunięto [%d] plików, zwolniono [%s] miejsca na dysku"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Limpar arquivos temporários",
"clearTempFilesTip": "Limpe os arquivos temporários gerados durante a execução do aplicativo para liberar espaço de armazenamento",
"uploadFileTooLarge": "⚠\uFE0F O arquivo enviado [${x}] é muito grande [${y}]。 Tem certeza de que deseja continuar o upload?",
"recentDocsMaxListCount": "Número máximo de documentos recentes listados",
"recentDocsMaxListCountTip": "Número máximo de documentos listados na caixa de diálogo Documentos Recentes",
@ -1716,6 +1718,8 @@
"272": "Campo sem nome",
"273": "Não crie o espaço de trabalho na raiz da partição, crie uma nova pasta para o espaço de trabalho",
"274": "Esta pasta contém outros arquivos, crie uma nova pasta para o espaço de trabalho",
"275": "Não é possível abrir o documento criado por uma versão mais recente. Atualize para a versão mais recente e tente novamente"
"275": "Não é possível abrir o documento criado por uma versão mais recente. Atualize para a versão mais recente e tente novamente",
"276": "Limpando arquivos temporários...",
"277": "Limpeza de arquivos temporários concluída, [%d] arquivos removidos, [%s] de espaço em disco liberado"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Очистить временные файлы",
"clearTempFilesTip": "Очистите временные файлы, созданные при работе приложения, чтобы освободить место в хранилище",
"uploadFileTooLarge": "⚠\uFE0F Загруженный файл [${x}] очень большой [${y}]. Вы уверены, что хотите продолжить загрузку?",
"recentDocsMaxListCount": "Максимальное количество отображаемых последних документов",
"recentDocsMaxListCountTip": "Максимальное количество документов, которые будут перечислены в диалоге последних документов",
@ -1716,6 +1718,8 @@
"272": "Неименованное поле",
"273": "Не создавайте рабочее пространство в корневом каталоге раздела, создайте отдельную папку для рабочего пространства",
"274": "Эта папка содержит другие файлы, создайте отдельную папку для рабочего пространства",
"275": "Невозможно открыть документ, созданный в более новой версии. Пожалуйста, обновите приложение до последней версии и попробуйте снова"
"275": "Невозможно открыть документ, созданный в более новой версии. Пожалуйста, обновите приложение до последней версии и попробуйте снова",
"276": "Очистка временных файлов...",
"277": "Очистка временных файлов завершена, удалено [%d] файлов, освобождено [%s] дискового пространства"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "Geçici dosyaları temizle",
"clearTempFilesTip": "Uygulama çalışırken oluşan geçici dosyaları temizleyerek depolama alanını boşalt",
"uploadFileTooLarge": "⚠\uFE0F Yüklenen dosya [${x}], boyutu [${y}] kadar büyük. Yüklemeye devam etmek istediğinize emin misiniz?",
"recentDocsMaxListCount": "Son belgelerin listeleneceği maksimum sayı",
"recentDocsMaxListCountTip": "Son Belgeler iletişim kutusunda en fazla listelenecek belge sayısı",
@ -1716,6 +1718,8 @@
"272": "Adsız alan",
"273": "Çalışma alanını diskin kök dizinine oluşturma, yeni bir klasör oluştur ve onu çalışma alanı olarak kullan",
"274": "Bu klasör başka dosyalar içeriyor, lütfen yeni bir klasör oluştur ve onu çalışma alanı olarak kullan",
"275": "Daha yeni bir sürümde oluşturulmuş belgeler açılamıyor. Lütfen en son sürüme yükseltip tekrar deneyin"
"275": "Daha yeni bir sürümde oluşturulmuş belgeler açılamıyor. Lütfen en son sürüme yükseltip tekrar deneyin",
"276": "Geçici dosyalar temizleniyor...",
"277": "Geçici dosyalar temizlendi, [%d] dosya silindi, toplam [%s] boş alan açıldı"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "清理臨時檔案",
"clearTempFilesTip": "清理應用運行過程中產生的臨時檔案以釋放儲存空間",
"uploadFileTooLarge": "⚠\uFE0F 上傳的檔案 [${x}] 很大 [${y}],請確認是否繼續上傳?",
"recentDocsMaxListCount": "最近的文檔列出數量",
"recentDocsMaxListCountTip": "在最近的文檔對話框中最多列出文檔的數量",
@ -1716,6 +1718,8 @@
"272": "未命名欄位",
"273": "請勿在分區根路徑上建立工作空間,請新建一個資料夾作為工作空間",
"274": "該資料夾包含其他檔案,請新建一個資料夾作為工作空間",
"275": "無法打開由新版本建立的檔案,請升級到最新版本後再試"
"275": "無法打開由新版本建立的檔案,請升級到最新版本後再試",
"276": "正在清理臨時檔案...",
"277": "清理臨時檔案完畢,已刪除 [%d] 個檔案,共釋放 [%s] 磁碟空間"
}
}

View file

@ -1,4 +1,6 @@
{
"clearTempFiles": "清理临时文件",
"clearTempFilesTip": "清理应用运行过程中产生的临时文件以释放存储空间",
"uploadFileTooLarge": "⚠\uFE0F 上传的文件 [${x}] 很大 [${y}],请确认是否继续上传?",
"recentDocsMaxListCount": "最近的文档最大数量",
"recentDocsMaxListCountTip": "最近的文档对话框中列出文档的最大数量",
@ -1716,6 +1718,8 @@
"272": "未命名字段",
"273": "请勿在分区根路径上创建工作空间,请新建一个文件夹作为工作空间",
"274": "该文件夹包含了其他文件,请新建一个文件夹作为工作空间",
"275": "无法打开新版本创建的文档,请升级到最新版本后再试"
"275": "无法打开新版本创建的文档,请升级到最新版本后再试",
"276": "正在清理临时文件...",
"277": "清理临时文件完毕,已删除 [%d] 个文件,共释放 [%s] 磁盘空间"
}
}

View file

@ -186,6 +186,16 @@ export const about = {
<svg><use xlink:href="#iconRefresh"></use></svg>${window.siyuan.languages.rebuildDataIndex}
</button>
</div>
<div class="fn__flex b3-label config__item">
<div class="fn__flex-1">
${window.siyuan.languages.clearTempFiles}
<div class="b3-label__text">${window.siyuan.languages.clearTempFilesTip}</div>
</div>
<div class="fn__space"></div>
<button id="clearTempFiles" class="b3-button b3-button--outline fn__size200 fn__flex-center">
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.purge}
</button>
</div>
<div class="fn__flex b3-label config__item">
<div class="fn__flex-1">
${window.siyuan.languages.systemLog}
@ -270,6 +280,9 @@ ${checkUpdateHTML}
about.element.querySelector("#rebuildDataIndex").addEventListener("click", () => {
fetchPost("/api/system/rebuildDataIndex", {}, () => {});
});
about.element.querySelector("#clearTempFiles").addEventListener("click", () => {
fetchPost("/api/system/clearTempFiles", {}, () => {});
});
about.element.querySelector("#exportLog").addEventListener("click", () => {
fetchPost("/api/system/exportLog", {}, (response) => {
openByMobile(response.data.zip);

View file

@ -104,7 +104,7 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
"downloadLatestVer", "safeQuit", "directConnection", "siyuanNote", "key", "password", "copied", "resetRepoTip",
"autoDownloadUpdatePkg", "autoDownloadUpdatePkgTip", "networkProxy", "keyPlaceholder", "initRepoKeyTip",
"dataRepoPurge", "dataRepoPurgeTip", "dataRepoAutoPurgeIndexRetentionDays", "dataRepoAutoPurgeRetentionIndexesDaily",
"vacuumDataIndex", "vacuumDataIndexTip", "rebuildDataIndex", "rebuildDataIndexTip"]),
"vacuumDataIndex", "vacuumDataIndexTip", "clearTempFiles", "clearTempFilesTip", "rebuildDataIndex", "rebuildDataIndexTip"]),
];
const inputElement = element.querySelector(".b3-form__icon input") as HTMLInputElement;
if (!isPhablet()) {

View file

@ -120,6 +120,14 @@ export const initAbout = () => {
</button>
<div class="b3-label__text">${window.siyuan.languages.rebuildDataIndexTip}</div>
</div>
<div class="b3-label">
${window.siyuan.languages.clearTempFiles}
<div class="fn__hr"></div>
<button class="b3-button b3-button--outline fn__block" id="clearTempFiles">
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.clearTempFiles}
</button>
<div class="b3-label__text">${window.siyuan.languages.clearTempFilesTip}</div>
</div>
<div class="b3-label">
${window.siyuan.languages.systemLog}
<div class="fn__hr"></div>
@ -319,6 +327,11 @@ export const initAbout = () => {
event.preventDefault();
event.stopPropagation();
break;
} else if (target.id === "clearTempFiles") {
fetchPost("/api/system/clearTempFiles", {}, () => {});
event.preventDefault();
event.stopPropagation();
break;
} else if (target.id === "exportLog") {
fetchPost("/api/system/exportLog", {}, (response) => {
openByMobile(response.data.zip);

View file

@ -68,6 +68,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)
ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)
ginServer.Handle("POST", "/api/system/vacuumDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, vacuumDataIndex)
ginServer.Handle("POST", "/api/system/clearTempFiles", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, clearTempFiles)
ginServer.Handle("POST", "/api/system/rebuildDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, rebuildDataIndex)
ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorage) // TODO 请使用 /api/storage/setLocalStorageVal该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/16664#issuecomment-3694774305

View file

@ -35,6 +35,13 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func clearTempFiles(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
model.ClearTempFiles()
}
func vacuumDataIndex(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -684,6 +684,72 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
return
}
func ClearTempFiles() {
var count int
var size int64
msgId := util.PushMsg(Conf.Language(276), 30*1000)
defer func() {
msg := fmt.Sprintf(Conf.Language(277), count, humanize.BytesCustomCeil(uint64(size), 2))
util.PushUpdateMsg(msgId, msg, 7000)
}()
bazaarTmp := filepath.Join(util.TempDir, "bazaar")
clearTempDir(bazaarTmp, &count, &size)
exportTmp := filepath.Join(util.TempDir, "export")
clearTempDir(exportTmp, &count, &size)
importTmp := filepath.Join(util.TempDir, "import")
clearTempDir(importTmp, &count, &size)
convertTmp := filepath.Join(util.TempDir, "convert")
clearTempDir(convertTmp, &count, &size)
osTmp := filepath.Join(util.TempDir, "os")
clearTempDir(osTmp, &count, &size)
base64Tmp := filepath.Join(util.TempDir, "base64")
clearTempDir(base64Tmp, &count, &size)
installTmp := filepath.Join(util.TempDir, "install")
clearTempDir(installTmp, &count, &size)
thumbnailsTmp := filepath.Join(util.TempDir, "thumbnails")
clearTempDir(thumbnailsTmp, &count, &size)
}
func clearTempDir(dir string, count *int, size *int64) {
entries, err := os.ReadDir(dir)
if err != nil {
return
}
for _, entry := range entries {
entryPath := filepath.Join(dir, entry.Name())
info, err := os.Stat(entryPath)
if err != nil {
continue
}
if info.IsDir() {
clearTempDir(entryPath, count, size)
} else {
if err := os.Remove(entryPath); err != nil {
continue
}
*count++
*size += info.Size()
}
}
if util.IsEmptyDir(dir) {
os.Remove(dir)
}
return
}
func VacuumDataIndex() {
util.PushEndlessProgress(Conf.language(270))
defer util.PushClearProgress()