mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Fix custom stickers/print paths
This commit is contained in:
@@ -627,9 +627,9 @@ namespace VRCX
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> SavePrintToFile(string url, string path, string fileName)
|
public async Task<bool> 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);
|
Directory.CreateDirectory(folder);
|
||||||
var filePath = Path.Combine(folder, MakeValidFileName(fileName));
|
var filePath = Path.Combine(folder, MakeValidFileName(fileName));
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
@@ -638,9 +638,9 @@ namespace VRCX
|
|||||||
return await ImageCache.SaveImageToFile(url, filePath);
|
return await ImageCache.SaveImageToFile(url, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> SaveStickerToFile(string url, string path, string fileName)
|
public async Task<bool> 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);
|
Directory.CreateDirectory(folder);
|
||||||
var filePath = Path.Combine(folder, MakeValidFileName(fileName));
|
var filePath = Path.Combine(folder, MakeValidFileName(fileName));
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e);
|
logger.Error(e);
|
||||||
return GetVRChatPhotosLocation();
|
return GetVRChatPhotosLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-17
@@ -7918,7 +7918,7 @@ speechSynthesis.getVoices();
|
|||||||
$app.data.overlayToast = await configRepository.getString(
|
$app.data.overlayToast = await configRepository.getString(
|
||||||
'VRCX_overlayToast',
|
'VRCX_overlayToast',
|
||||||
'Game Running'
|
'Game Running'
|
||||||
)
|
);
|
||||||
$app.data.minimalFeed = await configRepository.getBool(
|
$app.data.minimalFeed = await configRepository.getBool(
|
||||||
'VRCX_minimalFeed',
|
'VRCX_minimalFeed',
|
||||||
false
|
false
|
||||||
@@ -7946,7 +7946,7 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
// It's not necessary to store it in configRepo because it's rarely used.
|
// It's not necessary to store it in configRepo because it's rarely used.
|
||||||
$app.data.isTestTTSVisible = false;
|
$app.data.isTestTTSVisible = false;
|
||||||
|
|
||||||
$app.data.notificationTTSVoice = await configRepository.getString(
|
$app.data.notificationTTSVoice = await configRepository.getString(
|
||||||
'VRCX_notificationTTSVoice',
|
'VRCX_notificationTTSVoice',
|
||||||
'0'
|
'0'
|
||||||
@@ -8135,7 +8135,7 @@ speechSynthesis.getVoices();
|
|||||||
await configRepository.setString(
|
await configRepository.setString(
|
||||||
'VRCX_overlayToast',
|
'VRCX_overlayToast',
|
||||||
this.overlayToast
|
this.overlayToast
|
||||||
)
|
);
|
||||||
await configRepository.setBool(
|
await configRepository.setBool(
|
||||||
'VRCX_notificationTTSNickName',
|
'VRCX_notificationTTSNickName',
|
||||||
this.notificationTTSNickName
|
this.notificationTTSNickName
|
||||||
@@ -17773,15 +17773,20 @@ speechSynthesis.getVoices();
|
|||||||
var args = await API.call(`file/${fileId}`);
|
var args = await API.call(`file/${fileId}`);
|
||||||
var imageUrl = args.versions[1].file.url;
|
var imageUrl = args.versions[1].file.url;
|
||||||
var createdAt = args.versions[0].created_at;
|
var createdAt = args.versions[0].created_at;
|
||||||
var path = createdAt.slice(0, 7);
|
var monthFolder = createdAt.slice(0, 7);
|
||||||
var fileNameDate = createdAt
|
var fileNameDate = createdAt
|
||||||
.replace(/:/g, '-')
|
.replace(/:/g, '-')
|
||||||
.replace(/T/g, '_')
|
.replace(/T/g, '_')
|
||||||
.replace(/Z/g, '');
|
.replace(/Z/g, '');
|
||||||
var fileName = `${displayName}_${fileNameDate}_${fileId}.png`;
|
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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
var createdAt = this.getPrintLocalDate(args.json);
|
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 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) {
|
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) {
|
$app.methods.setUGCFolderPath = async function (path) {
|
||||||
await configRepository.setString(
|
await configRepository.setString('VRCX_userGeneratedContentPath', path);
|
||||||
'VRCX_userGeneratedContentPath',
|
|
||||||
path
|
|
||||||
);
|
|
||||||
this.ugcFolderPath = path;
|
this.ugcFolderPath = path;
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.resetUGCFolder = function () {
|
$app.methods.resetUGCFolder = function () {
|
||||||
this.setUGCFolderPath('');
|
this.setUGCFolderPath('');
|
||||||
}
|
};
|
||||||
|
|
||||||
$app.methods.openUGCFolder = async function () {
|
$app.methods.openUGCFolder = async function () {
|
||||||
await AppApi.OpenUGCPhotosFolder(this.ugcFolderPath);
|
await AppApi.OpenUGCPhotosFolder(this.ugcFolderPath);
|
||||||
@@ -20492,11 +20499,12 @@ speechSynthesis.getVoices();
|
|||||||
$app.methods.openUGCFolderSelector = async function () {
|
$app.methods.openUGCFolderSelector = async function () {
|
||||||
var D = this.userGeneratedContentDialog;
|
var D = this.userGeneratedContentDialog;
|
||||||
|
|
||||||
if(D.visible)
|
if (D.visible) return;
|
||||||
return;
|
|
||||||
|
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
var newUGCFolder = await AppApi.OpenFolderSelectorDialog(this.ugcFolderPath);
|
var newUGCFolder = await AppApi.OpenFolderSelectorDialog(
|
||||||
|
this.ugcFolderPath
|
||||||
|
);
|
||||||
D.visible = false;
|
D.visible = false;
|
||||||
|
|
||||||
await this.setUGCFolderPath(newUGCFolder);
|
await this.setUGCFolderPath(newUGCFolder);
|
||||||
|
|||||||
Reference in New Issue
Block a user