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
+31 -13
View File
@@ -429,7 +429,7 @@ speechSynthesis.getVoices();
var req = webApiService var req = webApiService
.execute(init) .execute(init)
.catch((err) => { .catch((err) => {
this.$throw(0, err); this.$throw(0, err, endpoint);
}) })
.then((response) => { .then((response) => {
try { try {
@@ -440,7 +440,7 @@ speechSynthesis.getVoices();
return response; return response;
} catch (e) {} } catch (e) {}
if (response.status === 200) { if (response.status === 200) {
this.$throw(0, 'Invalid JSON response'); this.$throw(0, 'Invalid JSON response', endpoint);
} }
if ( if (
response.status === 429 && response.status === 429 &&
@@ -540,7 +540,7 @@ speechSynthesis.getVoices();
endpoint endpoint
); );
} }
this.$throw(status, data); this.$throw(status, data, endpoint);
return data; return data;
}); });
if (init.method === 'GET') { if (init.method === 'GET') {
@@ -628,7 +628,7 @@ speechSynthesis.getVoices();
}; };
// FIXME : extra를 없애줘 // FIXME : extra를 없애줘
API.$throw = function (code, error, extra) { API.$throw = function (code, error, endpoint) {
var text = []; var text = [];
if (code > 0) { if (code > 0) {
var status = this.statusCodes[code]; var status = this.statusCodes[code];
@@ -641,8 +641,8 @@ speechSynthesis.getVoices();
if (typeof error !== 'undefined') { if (typeof error !== 'undefined') {
text.push(JSON.stringify(error)); text.push(JSON.stringify(error));
} }
if (typeof extra !== 'undefined') { if (typeof endpoint !== 'undefined') {
text.push(JSON.stringify(extra)); text.push(JSON.stringify(endpoint));
} }
text = text.map((s) => escapeTag(s)).join('<br>'); text = text.map((s) => escapeTag(s)).join('<br>');
if (text.length) { if (text.length) {
@@ -1782,6 +1782,7 @@ speechSynthesis.getVoices();
hideContentFilterSettings: false, hideContentFilterSettings: false,
homeLocation: '', homeLocation: '',
id: '', id: '',
isBoopingEnabled: false,
isFriend: false, isFriend: false,
last_activity: '', last_activity: '',
last_login: '', last_login: '',
@@ -3567,7 +3568,10 @@ speechSynthesis.getVoices();
// JANK: create image url from fileId // JANK: create image url from fileId
json.imageUrl = `https://api.vrchat.cloud/api/1/file/${json.details.emojiId}/${json.details.emojiVersion}`; 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 // JANK: get emoji name from emojiId
json.message = `${json.senderUsername} Booped you! with ${$app.getEmojiName(json.details.emojiId)}`; json.message = `${json.senderUsername} Booped you! with ${$app.getEmojiName(json.details.emojiId)}`;
} else { } else {
@@ -22807,7 +22811,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) { if (json.status !== 200) {
$app.avatarDialog.loading = false; $app.avatarDialog.loading = false;
$app.changeAvatarImageDialogLoading = false; $app.changeAvatarImageDialogLoading = false;
this.$throw('Avatar image upload failed', json); this.$throw('Avatar image upload failed', json, params.url);
} }
var args = { var args = {
json, json,
@@ -22904,7 +22908,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) { if (json.status !== 200) {
$app.avatarDialog.loading = false; $app.avatarDialog.loading = false;
$app.changeAvatarImageDialogLoading = false; $app.changeAvatarImageDialogLoading = false;
this.$throw('Avatar image upload failed', json); this.$throw('Avatar image upload failed', json, params.url);
} }
var args = { var args = {
json, json,
@@ -23142,7 +23146,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) { if (json.status !== 200) {
$app.worldDialog.loading = false; $app.worldDialog.loading = false;
$app.changeWorldImageDialogLoading = false; $app.changeWorldImageDialogLoading = false;
this.$throw('World image upload failed', json); this.$throw('World image upload failed', json, params.url);
} }
var args = { var args = {
json, json,
@@ -23239,7 +23243,7 @@ speechSynthesis.getVoices();
if (json.status !== 200) { if (json.status !== 200) {
$app.worldDialog.loading = false; $app.worldDialog.loading = false;
$app.changeWorldImageDialogLoading = false; $app.changeWorldImageDialogLoading = false;
this.$throw('World image upload failed', json); this.$throw('World image upload failed', json, params.url);
} }
var args = { var args = {
json, json,
@@ -23313,7 +23317,7 @@ speechSynthesis.getVoices();
}); });
$app.displayPreviousImages('Avatar', 'Change'); $app.displayPreviousImages('Avatar', 'Change');
} else { } 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'); $app.displayPreviousImages('World', 'Change');
} else { } 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 // #endregion
// #region | App: Previous Instances User Dialog // #region | App: Previous Instances User Dialog
@@ -32716,11 +32728,17 @@ speechSynthesis.getVoices();
}; };
$app.methods.getEmojiValue = function (emojiName) { $app.methods.getEmojiValue = function (emojiName) {
if (!emojiName) {
return '';
}
return `vrchat_${emojiName.replace(/ /g, '_').toLowerCase()}`; return `vrchat_${emojiName.replace(/ /g, '_').toLowerCase()}`;
}; };
$app.methods.getEmojiName = function (emojiValue) { $app.methods.getEmojiName = function (emojiValue) {
// uppercase first letter of each word // uppercase first letter of each word
if (!emojiValue) {
return '';
}
return emojiValue return emojiValue
.replace('vrchat_', '') .replace('vrchat_', '')
.replace(/_/g, ' ') .replace(/_/g, ' ')
+7 -2
View File
@@ -468,7 +468,12 @@ html
.x-friend-item(@click="toggleAvatarCopying") .x-friend-item(@click="toggleAvatarCopying")
.detail .detail
span.name {{ $t('dialog.user.info.avatar_cloning') }} 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') }} span.extra(v-else style="color:#F56C6C") {{ $t('dialog.user.info.avatar_cloning_deny') }}
template(v-else) template(v-else)
.x-friend-item(style="cursor:default") .x-friend-item(style="cursor:default")
@@ -3332,7 +3337,7 @@ html
span(v-text="emojiName") span(v-text="emojiName")
template(#footer) template(#footer)
el-button(size="small" @click="sendBoopDialog.visible = false") {{ $t('dialog.boop_dialog.cancel') }} 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") //- 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")
+1
View File
@@ -616,6 +616,7 @@
"friended": "Friended", "friended": "Friended",
"unfriended": "Unfriended", "unfriended": "Unfriended",
"avatar_cloning": "Avatar Cloning", "avatar_cloning": "Avatar Cloning",
"booping": "Booping",
"avatar_cloning_allow": "Allowed", "avatar_cloning_allow": "Allowed",
"avatar_cloning_deny": "Deny", "avatar_cloning_deny": "Deny",
"home_location": "Home World", "home_location": "Home World",