diff --git a/Dotnet/AppApi/AppApi.cs b/Dotnet/AppApi/AppApi.cs index f6fda847..69645d95 100644 --- a/Dotnet/AppApi/AppApi.cs +++ b/Dotnet/AppApi/AppApi.cs @@ -627,9 +627,9 @@ namespace VRCX return null; } - public async Task SavePrintToFile(string url, string path, string fileName) + public async Task SavePrintToFile(string url, string ugcFolderPath, string monthFolder, string fileName) { - var folder = Path.Combine(GetUGCPhotoLocation(), "Prints", MakeValidFileName(path)); + var folder = Path.Combine(GetUGCPhotoLocation(ugcFolderPath), "Prints", MakeValidFileName(monthFolder)); Directory.CreateDirectory(folder); var filePath = Path.Combine(folder, MakeValidFileName(fileName)); if (File.Exists(filePath)) @@ -638,9 +638,9 @@ namespace VRCX return await ImageCache.SaveImageToFile(url, filePath); } - public async Task SaveStickerToFile(string url, string path, string fileName) + public async Task SaveStickerToFile(string url, string ugcFolderPath, string monthFolder, string fileName) { - var folder = Path.Combine(GetUGCPhotoLocation(), "Stickers", MakeValidFileName(path)); + var folder = Path.Combine(GetUGCPhotoLocation(ugcFolderPath), "Stickers", MakeValidFileName(monthFolder)); Directory.CreateDirectory(folder); var filePath = Path.Combine(folder, MakeValidFileName(fileName)); if (File.Exists(filePath)) diff --git a/Dotnet/AppApi/Folders.cs b/Dotnet/AppApi/Folders.cs index 8fb6f5ea..ac30f5e3 100644 --- a/Dotnet/AppApi/Folders.cs +++ b/Dotnet/AppApi/Folders.cs @@ -79,7 +79,7 @@ namespace VRCX } catch (Exception e) { - Console.WriteLine(e); + logger.Error(e); return GetVRChatPhotosLocation(); } } diff --git a/html/src/app.js b/html/src/app.js index dbd18a5a..b8c749a4 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -7918,7 +7918,7 @@ speechSynthesis.getVoices(); $app.data.overlayToast = await configRepository.getString( 'VRCX_overlayToast', 'Game Running' - ) + ); $app.data.minimalFeed = await configRepository.getBool( 'VRCX_minimalFeed', false @@ -7946,7 +7946,7 @@ speechSynthesis.getVoices(); // It's not necessary to store it in configRepo because it's rarely used. $app.data.isTestTTSVisible = false; - + $app.data.notificationTTSVoice = await configRepository.getString( 'VRCX_notificationTTSVoice', '0' @@ -8135,7 +8135,7 @@ speechSynthesis.getVoices(); await configRepository.setString( 'VRCX_overlayToast', this.overlayToast - ) + ); await configRepository.setBool( 'VRCX_notificationTTSNickName', this.notificationTTSNickName @@ -17773,15 +17773,20 @@ speechSynthesis.getVoices(); var args = await API.call(`file/${fileId}`); var imageUrl = args.versions[1].file.url; var createdAt = args.versions[0].created_at; - var path = createdAt.slice(0, 7); + var monthFolder = createdAt.slice(0, 7); var fileNameDate = createdAt .replace(/:/g, '-') .replace(/T/g, '_') .replace(/Z/g, ''); var fileName = `${displayName}_${fileNameDate}_${fileId}.png`; - var status = await AppApi.SaveStickerToFile(imageUrl, path, fileName); + var status = await AppApi.SaveStickerToFile( + imageUrl, + this.ugcFolderPath, + monthFolder, + fileName + ); if (status) { - console.log(`Sticker saved to file: ${path}\\${fileName}`); + console.log(`Sticker saved to file: ${monthFolder}\\${fileName}`); } }; @@ -18011,11 +18016,16 @@ speechSynthesis.getVoices(); return; } var createdAt = this.getPrintLocalDate(args.json); - var path = createdAt.toISOString().slice(0, 7); + var monthFolder = createdAt.toISOString().slice(0, 7); var fileName = this.getPrintFileName(args.json); - var status = await AppApi.SavePrintToFile(imageUrl, path, fileName); + var status = await AppApi.SavePrintToFile( + imageUrl, + this.ugcFolderPath, + monthFolder, + fileName + ); if (status) { - console.log(`Print saved to file: ${path}\\${fileName}`); + console.log(`Print saved to file: ${monthFolder}\\${fileName}`); } }; @@ -20474,16 +20484,13 @@ speechSynthesis.getVoices(); }; $app.methods.setUGCFolderPath = async function (path) { - await configRepository.setString( - 'VRCX_userGeneratedContentPath', - path - ); + await configRepository.setString('VRCX_userGeneratedContentPath', path); this.ugcFolderPath = path; }; $app.methods.resetUGCFolder = function () { this.setUGCFolderPath(''); - } + }; $app.methods.openUGCFolder = async function () { await AppApi.OpenUGCPhotosFolder(this.ugcFolderPath); @@ -20492,11 +20499,12 @@ speechSynthesis.getVoices(); $app.methods.openUGCFolderSelector = async function () { var D = this.userGeneratedContentDialog; - if(D.visible) - return; + if (D.visible) return; D.visible = true; - var newUGCFolder = await AppApi.OpenFolderSelectorDialog(this.ugcFolderPath); + var newUGCFolder = await AppApi.OpenFolderSelectorDialog( + this.ugcFolderPath + ); D.visible = false; await this.setUGCFolderPath(newUGCFolder);