Add self invite to launch dialog

This commit is contained in:
Natsumi
2025-09-03 01:44:03 +12:00
parent 489e084a33
commit 4801cfad58
3 changed files with 40 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
<template>
<safe-dialog ref="launchDialogRef" :visible.sync="isVisible" :title="t('dialog.launch.header')" width="450px">
<safe-dialog ref="launchDialogRef" :visible.sync="isVisible" :title="t('dialog.launch.header')" width="500px">
<el-form :model="launchDialog" label-width="100px">
<el-form-item :label="t('dialog.launch.url')">
<el-input
@@ -67,6 +67,13 @@
{{ t('dialog.launch.invite') }}
</el-button>
<template v-if="isGameRunning">
<el-button
type="default"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="handleSelfInvite(launchDialog.location, launchDialog.shortName)">
{{ t('dialog.launch.self_invite') }}
</el-button>
<el-button
type="default"
size="small"
@@ -197,6 +204,20 @@
});
}
function handleLaunchGame(location, shortName, desktop) {
if (isGameRunning.value) {
proxy.$confirm(t('dialog.launch.game_running_warning'), t('dialog.launch.header'), {
confirmButtonText: t('dialog.launch.confirm_yes'),
cancelButtonText: t('dialog.launch.confirm_no'),
type: 'warning',
callback: (action) => {
if (action === 'confirm') {
launchGame(location, shortName, desktop);
isVisible.value = false;
}
}
});
return;
}
launchGame(location, shortName, desktop);
isVisible.value = false;
}
@@ -204,6 +225,18 @@
tryOpenInstanceInVrc(location, shortName);
isVisible.value = false;
}
async function handleSelfInvite(location, shortName) {
const L = parseLocation(location);
await instanceRequest.selfInvite({
instanceId: L.instanceId,
worldId: L.worldId,
shortName
});
proxy.$message({
message: 'Self invite sent',
type: 'success'
});
}
function getConfig() {
configRepository.getBool('launchAsDesktop').then((value) => (launchDialog.value.desktop = value));
}

View File

@@ -1324,7 +1324,11 @@
"info": "Info",
"invite": "Invite",
"launch": "Launch",
"open_ingame": "Open in Game"
"open_ingame": "Open in Game",
"self_invite": "Self Invite",
"game_running_warning": "Are you sure you want to launch a second VRChat instance?",
"confirm_yes": "Yes",
"confirm_no": "No"
},
"export_friends_list": {
"header": "Export Friends List",

View File

@@ -111,7 +111,7 @@ export const useInviteStore = defineStore('Invite', () => {
/**
*
* @param {string} messageType
* @param {string} inviteMessage
* @param {any} inviteMessage
*/
function showEditInviteMessageDialog(messageType, inviteMessage) {
const D = state.editInviteMessageDialog;