Self invite on launch dialog

This commit is contained in:
Natsumi
2025-09-04 19:27:46 +12:00
parent b0d56000b1
commit 5c569ff8cd
2 changed files with 48 additions and 2 deletions

View File

@@ -83,6 +83,13 @@
</el-button>
</template>
<template v-else>
<el-button
type="default"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="selfInvite(launchDialog.location, launchDialog.shortName)">
{{ t('dialog.launch.self_invite') }}
</el-button>
<el-button
type="primary"
size="small"
@@ -109,7 +116,8 @@
useInviteStore,
useInstanceStore,
useLaunchStore,
useLocationStore
useLocationStore,
useGameStore
} from '../../stores';
import InviteDialog from './InviteDialog/InviteDialog.vue';
@@ -123,6 +131,7 @@
const { launchDialogData } = storeToRefs(useLaunchStore());
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { canOpenInstanceInGame } = useInviteStore();
const { isGameRunning } = storeToRefs(useGameStore());
const launchDialogRef = ref(null);
@@ -197,6 +206,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 +227,25 @@
tryOpenInstanceInVrc(location, shortName);
isVisible.value = false;
}
function selfInvite(location, shortName) {
const L = parseLocation(location);
if (!L.isRealInstance) {
return;
}
instanceRequest
.selfInvite({
instanceId: L.instanceId,
worldId: L.worldId,
shortName
})
.then((args) => {
proxy.$message({
message: 'Self invite sent',
type: 'success'
});
return args;
});
}
function getConfig() {
configRepository.getBool('launchAsDesktop').then((value) => (launchDialog.value.desktop = value));
}

View File

@@ -1329,7 +1329,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",