Fix empty boop, add boop toggle

This commit is contained in:
Natsumi
2024-06-08 08:44:26 +12:00
parent f8b6396e04
commit 7f3e6f6250
3 changed files with 39 additions and 15 deletions

View File

@@ -429,7 +429,7 @@ speechSynthesis.getVoices();
var req = webApiService
.execute(init)
.catch((err) => {
this.$throw(0, err);
this.$throw(0, err, endpoint);
})
.then((response) => {
try {
@@ -440,7 +440,7 @@ speechSynthesis.getVoices();
return response;
} catch (e) {}
if (response.status === 200) {
this.$throw(0, 'Invalid JSON response');
this.$throw(0, 'Invalid JSON response', endpoint);
}
if (
response.status === 429 &&
@@ -540,7 +540,7 @@ speechSynthesis.getVoices();
endpoint
);
}
this.$throw(status, data);
this.$throw(status, data, endpoint);
return data;
});
if (init.method === 'GET') {
@@ -628,7 +628,7 @@ speechSynthesis.getVoices();
};
// FIXME : extra를 없애줘
API.$throw = function (code, error, extra) {
API.$throw = function (code, error, endpoint) {
var text = [];
if (code > 0) {
var status = this.statusCodes[code];
@@ -641,8 +641,8 @@ speechSynthesis.getVoices();
if (typeof error !== 'undefined') {
text.push(JSON.stringify(error));
}
if (typeof extra !== 'undefined') {
text.push(JSON.stringify(extra));
if (typeof endpoint !== 'undefined') {
text.push(JSON.stringify(endpoint));
}
text = text.map((s) => escapeTag(s)).join('<br>');
if (text.length) {
@@ -1782,6 +1782,7 @@ speechSynthesis.getVoices();
hideContentFilterSettings: false,
homeLocation: '',
id: '',
isBoopingEnabled: false,
isFriend: false,
last_activity: '',
last_login: '',
@@ -3567,7 +3568,10 @@ speechSynthesis.getVoices();
// JANK: create image url from fileId
json.imageUrl = `https://api.vrchat.cloud/api/1/file/${json.details.emojiId}/${json.details.emojiVersion}`;
}
if (!json.details?.emojiId?.startsWith('file_')) {
if (!json.details?.emojiId) {
json.message = `${json.senderUsername} Booped you! with nothing`;
} else if (!json.details.emojiId.startsWith('file_')) {
// JANK: get emoji name from emojiId
json.message = `${json.senderUsername} Booped you! with ${$app.getEmojiName(json.details.emojiId)}`;
} else {
@@ -22807,7 +22811,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) {
$app.avatarDialog.loading = false;
$app.changeAvatarImageDialogLoading = false;
this.$throw('Avatar image upload failed', json);
this.$throw('Avatar image upload failed', json, params.url);
}
var args = {
json,
@@ -22904,7 +22908,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) {
$app.avatarDialog.loading = false;
$app.changeAvatarImageDialogLoading = false;
this.$throw('Avatar image upload failed', json);
this.$throw('Avatar image upload failed', json, params.url);
}
var args = {
json,
@@ -23142,7 +23146,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) {
$app.worldDialog.loading = false;
$app.changeWorldImageDialogLoading = false;
this.$throw('World image upload failed', json);
this.$throw('World image upload failed', json, params.url);
}
var args = {
json,
@@ -23239,7 +23243,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) {
$app.worldDialog.loading = false;
$app.changeWorldImageDialogLoading = false;
this.$throw('World image upload failed', json);
this.$throw('World image upload failed', json, params.url);
}
var args = {
json,
@@ -23313,7 +23317,7 @@ speechSynthesis.getVoices();
});
$app.displayPreviousImages('Avatar', 'Change');
} else {
this.$throw(0, 'Avatar image change failed');
this.$throw(0, 'Avatar image change failed', args.params.imageUrl);
}
});
@@ -23342,7 +23346,7 @@ speechSynthesis.getVoices();
});
$app.displayPreviousImages('World', 'Change');
} else {
this.$throw(0, 'World image change failed');
this.$throw(0, 'World image change failed', args.params.imageUrl);
}
});
@@ -26106,6 +26110,14 @@ speechSynthesis.getVoices();
});
};
$app.methods.toggleAllowBooping = function () {
API.saveCurrentUser({
isBoopingEnabled: !API.currentUser.isBoopingEnabled
}).then((args) => {
return args;
});
};
// #endregion
// #region | App: Previous Instances User Dialog
@@ -32716,11 +32728,17 @@ speechSynthesis.getVoices();
};
$app.methods.getEmojiValue = function (emojiName) {
if (!emojiName) {
return '';
}
return `vrchat_${emojiName.replace(/ /g, '_').toLowerCase()}`;
};
$app.methods.getEmojiName = function (emojiValue) {
// uppercase first letter of each word
if (!emojiValue) {
return '';
}
return emojiValue
.replace('vrchat_', '')
.replace(/_/g, ' ')

View File

@@ -468,7 +468,12 @@ html
.x-friend-item(@click="toggleAvatarCopying")
.detail
span.name {{ $t('dialog.user.info.avatar_cloning') }}
span.extra(v-if="userDialog.ref.allowAvatarCopying" style="color:#67C23A") {{ $t('dialog.user.info.avatar_cloning_allow') }}
span.extra(v-if="API.currentUser.allowAvatarCopying" style="color:#67C23A") {{ $t('dialog.user.info.avatar_cloning_allow') }}
span.extra(v-else style="color:#F56C6C") {{ $t('dialog.user.info.avatar_cloning_deny') }}
.x-friend-item(@click="toggleAllowBooping")
.detail
span.name {{ $t('dialog.user.info.booping') }}
span.extra(v-if="API.currentUser.isBoopingEnabled" style="color:#67C23A") {{ $t('dialog.user.info.avatar_cloning_allow') }}
span.extra(v-else style="color:#F56C6C") {{ $t('dialog.user.info.avatar_cloning_deny') }}
template(v-else)
.x-friend-item(style="cursor:default")
@@ -3332,7 +3337,7 @@ html
span(v-text="emojiName")
template(#footer)
el-button(size="small" @click="sendBoopDialog.visible = false") {{ $t('dialog.boop_dialog.cancel') }}
el-button(size="small" @click="sendBoop" :disabled="!sendBoopDialog.userId || !sendBoopDialog.fileId") {{ $t('dialog.boop_dialog.send') }}
el-button(size="small" @click="sendBoop" :disabled="!sendBoopDialog.userId") {{ $t('dialog.boop_dialog.send') }}
//- el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="templateDialog" :visible.sync="templateDialog.visible" :title="$t('dialog.template_dialog.header')" width="450px")

View File

@@ -616,6 +616,7 @@
"friended": "Friended",
"unfriended": "Unfriended",
"avatar_cloning": "Avatar Cloning",
"booping": "Booping",
"avatar_cloning_allow": "Allowed",
"avatar_cloning_deny": "Deny",
"home_location": "Home World",