Save Instance Prints To File

This commit is contained in:
Natsumi
2024-11-17 10:11:52 +13:00
parent 7956e19a10
commit 78a6dfbfe1
10 changed files with 223 additions and 82 deletions

View File

@@ -5447,7 +5447,11 @@ speechSynthesis.getVoices();
}
}
this.lastLocation.playerList.forEach((ref1) => {
if (ref1.userId && !API.cachedUsers.has(ref1.userId)) {
if (
ref1.userId &&
typeof ref1.userId === 'string' &&
!API.cachedUsers.has(ref1.userId)
) {
API.getUser({ userId: ref1.userId });
}
});
@@ -8149,6 +8153,10 @@ speechSynthesis.getVoices();
'VRCX_StartAtWindowsStartup',
this.isStartAtWindowsStartup
);
await configRepository.setBool(
'VRCX_saveInstancePrints',
this.saveInstancePrints
);
VRCXStorage.Set(
'VRCX_StartAsMinimizedState',
this.isStartAsMinimizedState.toString()
@@ -17522,6 +17530,52 @@ speechSynthesis.getVoices();
}
});
API.getPrint = function (params) {
return this.call(`prints/${params.printId}`, {
method: 'GET'
}).then((json) => {
var args = {
json,
params
};
this.$emit('PRINT', args);
return args;
});
};
API.editPrint = function (params) {
return this.call(`prints/${params.printId}`, {
method: 'POST',
params
}).then((json) => {
var args = {
json,
params
};
this.$emit('PRINT:EDIT', args);
return args;
});
};
$app.data.saveInstancePrints = await configRepository.getBool(
'VRCX_saveInstancePrints',
false
);
$app.methods.trySavePrintToFile = async function (printId) {
var print = await API.getPrint({ printId });
var imageUrl = print.json?.files?.image;
if (!imageUrl) {
console.error('Print image URL is missing', print);
return;
}
var fileName = `${printId}.png`;
var status = await AppApi.SavePrintToFile(imageUrl, fileName);
if (status) {
console.log(`Print saved to file: ${fileName}`);
}
};
// #endregion
// #region | Emoji