fix: debug with type error checks

This commit is contained in:
pa
2025-07-16 11:04:54 +09:00
committed by Natsumi
parent 6d693e278c
commit 39381de29e
16 changed files with 188 additions and 105 deletions

View File

@@ -274,7 +274,7 @@
:type="avatarDialog.isBlocked ? 'danger' : 'default'"
icon="el-icon-more"
circle></el-button>
<el-dropdown-menu v-slot="dropdown">
<el-dropdown-menu>
<el-dropdown-item icon="el-icon-refresh" command="Refresh">{{
t('dialog.avatar.actions.refresh')
}}</el-dropdown-item>
@@ -481,7 +481,7 @@
icon="el-icon-s-order"
size="mini"
circle></el-button>
<el-dropdown-menu v-slot="dropdown">
<el-dropdown-menu>
<el-dropdown-item @click.native="copyAvatarId(avatarDialog.id)">{{
t('dialog.avatar.info.copy_id')
}}</el-dropdown-item>
@@ -793,7 +793,7 @@
showSetAvatarTagsDialog(D.id);
break;
case 'Change Styles and Author Tags':
showSetAvatarStylesDialog(D.id);
showSetAvatarStylesDialog();
break;
case 'Download Unity Package':
openExternalLink(replaceVrcPackageUrl(avatarDialog.value.ref.unityPackageUrl));
@@ -1126,8 +1126,8 @@
});
return;
}
miscRequest.getFileAnalysis({ fileId, version, variant, avatarId }).then((args) => {
if (!avatarDialog.value.visible || avatarDialog.value.id !== args.params.avatarId) {
miscRequest.getFileAnalysis({ fileId, version, variant }).then((args) => {
if (!avatarDialog.value.visible || avatarDialog.value.id !== avatarId) {
return;
}
const ref = args.json;
@@ -1242,8 +1242,9 @@
function onFileChangeAvatarGallery(e) {
const clearFile = function () {
if (document.querySelector('#AvatarGalleryUploadButton')) {
document.querySelector('#AvatarGalleryUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#AvatarGalleryUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -1270,16 +1271,16 @@
const r = new FileReader();
r.onload = function () {
avatarDialog.value.galleryLoading = true;
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
avatarRequest
.uploadAvatarGalleryImage(base64Body, avatarDialog.value.id)
.then((args) => {
.then(async (args) => {
$message({
message: t('message.avatar_gallery.uploaded'),
type: 'success'
});
console.log(args);
avatarDialog.value.galleryImages = getAvatarGallery(avatarDialog.value.id);
avatarDialog.value.galleryImages = await getAvatarGallery(avatarDialog.value.id);
return args;
})
.finally(() => {
@@ -1323,12 +1324,12 @@
} else {
moveArrayItem(fileIds, index, index + 1);
}
avatarRequest.setAvatarGalleryOrder(fileIds).then((args) => {
avatarRequest.setAvatarGalleryOrder(fileIds).then(async (args) => {
$message({
message: t('message.avatar_gallery.reordered'),
type: 'success'
});
avatarDialog.value.galleryImages = getAvatarGallery(avatarDialog.value.id);
avatarDialog.value.galleryImages = await getAvatarGallery(avatarDialog.value.id);
return args;
});
}

View File

@@ -113,8 +113,9 @@
function onFileChangeAvatarImage(e) {
const clearFile = function () {
if (document.querySelector('#AvatarImageUploadButton')) {
document.querySelector('#AvatarImageUploadButton').value = '';
const fileInput = /** @type{HTMLInputElement} */ (document.querySelector('#AvatarImageUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -145,10 +146,10 @@
const r = new FileReader();
r.onload = async function (file) {
try {
const base64File = await resizeImageToFitLimits(btoa(r.result));
const base64File = await resizeImageToFitLimits(btoa(r.result.toString()));
// 10MB
const fileMd5 = await genMd5(base64File);
const fileSizeInBytes = parseInt(file.total, 10);
const fileSizeInBytes = parseInt(file.total.toString(), 10);
const base64SignatureFile = await genSig(base64File);
const signatureMd5 = await genMd5(base64SignatureFile);
const signatureSizeInBytes = parseInt(await genLength(base64SignatureFile), 10);
@@ -237,7 +238,7 @@
if (json.status !== 200) {
changeAvatarImageDialogLoading.value = false;
$throw('Avatar image upload failed', json, params.url);
$throw(json.status, 'Avatar image upload failed', params.url);
}
const args = {
json,
@@ -290,7 +291,7 @@
if (json.status !== 200) {
changeAvatarImageDialogLoading.value = false;
$throw('Avatar image upload failed', json, params.url);
$throw(json.status, 'Avatar image upload failed', params.url);
}
const args = {
json,

View File

@@ -557,8 +557,9 @@
function onFileChangeGallery(e) {
const clearFile = function () {
if (document.querySelector('#GalleryUploadButton')) {
document.querySelector('#GalleryUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#GalleryUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -584,7 +585,7 @@
}
const r = new FileReader();
r.onload = function () {
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
vrcPlusImageRequest.uploadGalleryImage(base64Body).then((args) => {
handleGalleryImageAdd(args);
proxy.$message({
@@ -655,8 +656,9 @@
function onFileChangeVRCPlusIcon(e) {
const clearFile = function () {
if (document.querySelector('#VRCPlusIconUploadButton')) {
document.querySelector('#VRCPlusIconUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#VRCPlusIconUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -682,7 +684,7 @@
}
const r = new FileReader();
r.onload = function () {
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
vrcPlusIconRequest.uploadVRCPlusIcon(base64Body).then((args) => {
if (Object.keys(VRCPlusIconsTable.value).length !== 0) {
VRCPlusIconsTable.value.unshift(args.json);
@@ -777,8 +779,9 @@
function onFileChangeEmoji(e) {
const clearFile = function () {
if (document.querySelector('#EmojiUploadButton')) {
document.querySelector('#EmojiUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#EmojiUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -818,10 +821,10 @@
if (emojiAnimLoopPingPong.value) {
params.loopStyle = 'pingpong';
}
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
vrcPlusImageRequest.uploadEmoji(base64Body, params).then((args) => {
if (Object.keys(emojiTable).length !== 0) {
emojiTable.unshift(args.json);
if (Object.keys(emojiTable.value).length !== 0) {
emojiTable.value.unshift(args.json);
}
proxy.$message({
message: t('message.emoji.uploaded'),
@@ -873,8 +876,9 @@
function onFileChangeSticker(e) {
const clearFile = function () {
if (document.querySelector('#StickerUploadButton')) {
document.querySelector('#StickerUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#StickerUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -904,7 +908,7 @@
tag: 'sticker',
maskTag: 'square'
};
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
vrcPlusImageRequest.uploadSticker(base64Body, params).then((args) => {
handleStickerAdd(args);
proxy.$message({
@@ -939,8 +943,9 @@
function onFileChangePrint(e) {
const clearFile = function () {
if (document.querySelector('#PrintUploadButton')) {
document.querySelector('#PrintUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#PrintUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -975,7 +980,7 @@
// worldId: '',
timestamp
};
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
const cropWhiteBorder = printCropBorder.value;
vrcPlusImageRequest.uploadPrint(base64Body, cropWhiteBorder, params).then((args) => {
proxy.$message({

View File

@@ -84,8 +84,9 @@
function onFileChangeGallery(e) {
const clearFile = function () {
if (document.querySelector('#GalleryUploadButton')) {
document.querySelector('#GalleryUploadButton').value = '';
const fileInput = /** @type{HTMLInputElement} */ (document.querySelector('#GalleryUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -111,7 +112,7 @@
}
const r = new FileReader();
r.onload = function () {
const base64Body = btoa(r.result);
const base64Body = btoa(r.result.toString());
vrcPlusImageRequest.uploadGalleryImage(base64Body).then((args) => {
handleGalleryImageAdd(args);
$message({

View File

@@ -90,7 +90,7 @@
watch(
() => VRCXUpdateDialog,
(newVal) => {
if (newVal.visible) {
if (newVal.value.visible) {
nextTick(() => {
adjustDialogZ(VRCXUpdateDialogRef.value.$el);
});