mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 22:03:50 +02:00
Toggle self invite/open in-game
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
v-if="!isGameRunning || isLinux || gameLogDisabled"
|
||||
v-if="!canOpenInstanceInGame()"
|
||||
placement="top"
|
||||
:content="t('dialog.user.info.self_invite_tooltip')"
|
||||
:disabled="hideTooltips">
|
||||
@@ -18,9 +18,8 @@
|
||||
import { instanceRequest } from '../api';
|
||||
import { checkCanInviteSelf, parseLocation } from '../shared/utils';
|
||||
import { useAppearanceSettingsStore } from '../stores/settings/appearance';
|
||||
import { useGameStore } from '../stores/game';
|
||||
import { useLaunchStore } from '../stores/launch';
|
||||
import { useAdvancedSettingsStore } from '../stores/settings/advanced';
|
||||
import { useInviteStore } from '../stores/invite';
|
||||
|
||||
const props = defineProps({
|
||||
location: String,
|
||||
@@ -30,17 +29,14 @@
|
||||
const { t } = useI18n();
|
||||
|
||||
const { hideTooltips } = storeToRefs(useAppearanceSettingsStore());
|
||||
const { isGameRunning } = storeToRefs(useGameStore());
|
||||
const { gameLogDisabled } = storeToRefs(useAdvancedSettingsStore());
|
||||
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const isVisible = computed(() => checkCanInviteSelf(props.location));
|
||||
|
||||
const isLinux = computed(() => LINUX);
|
||||
|
||||
function confirmInvite() {
|
||||
const L = parseLocation(props.location);
|
||||
if (!L.isRealInstance) {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
@click="showInviteDialog(launchDialog.location)">
|
||||
{{ t('dialog.launch.invite') }}
|
||||
</el-button>
|
||||
<template v-if="isGameRunning">
|
||||
<template v-if="canOpenInstanceInGame()">
|
||||
<el-button
|
||||
type="default"
|
||||
size="small"
|
||||
@@ -106,7 +106,7 @@
|
||||
import {
|
||||
useAppearanceSettingsStore,
|
||||
useFriendStore,
|
||||
useGameStore,
|
||||
useInviteStore,
|
||||
useInstanceStore,
|
||||
useLaunchStore,
|
||||
useLocationStore
|
||||
@@ -122,7 +122,7 @@
|
||||
const { launchGame, tryOpenInstanceInVrc } = useLaunchStore();
|
||||
const { launchDialogData } = storeToRefs(useLaunchStore());
|
||||
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
||||
const { isGameRunning } = storeToRefs(useGameStore());
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
|
||||
const launchDialogRef = ref(null);
|
||||
|
||||
|
||||
@@ -410,12 +410,28 @@
|
||||
@click="showInviteDialog(newInstanceDialog.location)"
|
||||
>{{ t('dialog.new_instance.invite') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
<template v-if="canOpenInstanceInGame()">
|
||||
<el-button
|
||||
type="default"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleAttachGame(newInstanceDialog.location, newInstanceDialog.shortName)">
|
||||
{{ t('dialog.new_instance.open_ingame') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button type="primary" size="small" @click="handleCreateNewInstance">{{
|
||||
@@ -439,12 +455,28 @@
|
||||
@click="showInviteDialog(newInstanceDialog.location)"
|
||||
>{{ t('dialog.new_instance.invite') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
<template v-if="canOpenInstanceInGame()">
|
||||
<el-button
|
||||
type="default"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleAttachGame(newInstanceDialog.location, newInstanceDialog.shortName)">
|
||||
{{ t('dialog.new_instance.open_ingame') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
|
||||
>{{ t('dialog.new_instance.launch') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
<InviteDialog :invite-dialog="inviteDialog" @closeInviteDialog="closeInviteDialog" />
|
||||
</safe-dialog>
|
||||
@@ -472,7 +504,8 @@
|
||||
useInstanceStore,
|
||||
useLaunchStore,
|
||||
useLocationStore,
|
||||
useUserStore
|
||||
useUserStore,
|
||||
useInviteStore
|
||||
} from '../../stores';
|
||||
import InviteDialog from './InviteDialog/InviteDialog.vue';
|
||||
|
||||
@@ -494,6 +527,8 @@
|
||||
const { showLaunchDialog } = useLaunchStore();
|
||||
const { createNewInstance } = useInstanceStore();
|
||||
const { currentUser } = storeToRefs(useUserStore());
|
||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
|
||||
const newInstanceDialogRef = ref(null);
|
||||
|
||||
@@ -573,6 +608,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
function handleAttachGame(location, shortName) {
|
||||
tryOpenInstanceInVrc(location, shortName);
|
||||
closeInviteDialog();
|
||||
}
|
||||
|
||||
async function initNewInstanceDialog(tag) {
|
||||
if (!isRealInstance(tag)) {
|
||||
return;
|
||||
|
||||
@@ -233,8 +233,8 @@
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-message" command="New Instance and Self Invite">
|
||||
{{
|
||||
isGameRunning
|
||||
? t('dialog.world.actions.new_instance_and_open_in_vrchat')
|
||||
canOpenInstanceInGame()
|
||||
? t('dialog.world.actions.new_instance_and_open_ingame')
|
||||
: t('dialog.world.actions.new_instance_and_self_invite')
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
@@ -826,7 +826,7 @@
|
||||
const { worldDialog, cachedWorlds } = storeToRefs(useWorldStore());
|
||||
const { showWorldDialog } = useWorldStore();
|
||||
const { lastLocation } = storeToRefs(useLocationStore());
|
||||
const { newInstanceSelfInvite } = useInviteStore();
|
||||
const { newInstanceSelfInvite, canOpenInstanceInGame } = useInviteStore();
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
||||
const { instanceJoinHistory } = storeToRefs(useInstanceStore());
|
||||
|
||||
@@ -569,6 +569,10 @@
|
||||
"header": "Automatically Manage Cache When Closing VRChat",
|
||||
"description": "Auto delete old versions from cache"
|
||||
},
|
||||
"self_invite": {
|
||||
"header": "Self Invite",
|
||||
"description": "Self invite instead of opening instance in VRChat"
|
||||
},
|
||||
"save_instance_prints_to_file": {
|
||||
"header": "Save Instance Prints To File",
|
||||
"header_tooltip": "Requires \"--enable-sdk-log-levels\" VRC launch option",
|
||||
@@ -907,7 +911,7 @@
|
||||
"share": "Share",
|
||||
"new_instance": "New Instance",
|
||||
"new_instance_and_self_invite": "New Instance and Self Invite",
|
||||
"new_instance_and_open_in_vrchat": "New Instance and Open in VRChat",
|
||||
"new_instance_and_open_ingame": "New Instance and Open In-game",
|
||||
"make_home": "Make Home",
|
||||
"reset_home": "Reset Home",
|
||||
"show_previous_instances": "Show Previous Instances",
|
||||
@@ -1222,7 +1226,8 @@
|
||||
"normal": "Normal",
|
||||
"group": "Group",
|
||||
"legacy": "Legacy",
|
||||
"roles": "Roles"
|
||||
"roles": "Roles",
|
||||
"open_ingame": "Open in-game"
|
||||
},
|
||||
"launch_options": {
|
||||
"header": "VRChat Launch Options",
|
||||
@@ -1324,7 +1329,7 @@
|
||||
"info": "Info",
|
||||
"invite": "Invite",
|
||||
"launch": "Launch",
|
||||
"open_ingame": "Open in Game"
|
||||
"open_ingame": "Open in-game"
|
||||
},
|
||||
"export_friends_list": {
|
||||
"header": "Export Friends List",
|
||||
|
||||
@@ -7,11 +7,13 @@ import { parseLocation } from '../shared/utils';
|
||||
import { useInstanceStore } from './instance';
|
||||
import { useGameStore } from './game';
|
||||
import { useLaunchStore } from './launch';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
|
||||
export const useInviteStore = defineStore('Invite', () => {
|
||||
const instanceStore = useInstanceStore();
|
||||
const gameStore = useGameStore();
|
||||
const launchStore = useLaunchStore();
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
const state = reactive({
|
||||
editInviteMessageDialog: {
|
||||
visible: false,
|
||||
@@ -111,7 +113,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
/**
|
||||
*
|
||||
* @param {string} messageType
|
||||
* @param {string} inviteMessage
|
||||
* @param {any} inviteMessage
|
||||
*/
|
||||
function showEditInviteMessageDialog(messageType, inviteMessage) {
|
||||
const D = state.editInviteMessageDialog;
|
||||
@@ -149,6 +151,14 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
});
|
||||
}
|
||||
|
||||
function canOpenInstanceInGame() {
|
||||
return (
|
||||
!LINUX &&
|
||||
gameStore.isGameRunning &&
|
||||
!advancedSettingsStore.selfInviteOverride
|
||||
);
|
||||
}
|
||||
|
||||
function newInstanceSelfInvite(worldId) {
|
||||
instanceStore.createNewInstance(worldId).then((args) => {
|
||||
const location = args?.json?.location;
|
||||
@@ -164,7 +174,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
if (!L.isRealInstance) {
|
||||
return;
|
||||
}
|
||||
if (gameStore.isGameRunning && !LINUX) {
|
||||
if (canOpenInstanceInGame()) {
|
||||
const secureOrShortName =
|
||||
args.json.shortName || args.json.secureName;
|
||||
launchStore.tryOpenInstanceInVrc(location, secureOrShortName);
|
||||
@@ -194,6 +204,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
inviteRequestResponseMessageTable,
|
||||
showEditInviteMessageDialog,
|
||||
refreshInviteMessageTableData,
|
||||
newInstanceSelfInvite
|
||||
newInstanceSelfInvite,
|
||||
canOpenInstanceInGame
|
||||
};
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash: false,
|
||||
vrcQuitFix: true,
|
||||
autoSweepVRChatCache: false,
|
||||
selfInviteOverride: false,
|
||||
saveInstancePrints: false,
|
||||
cropInstancePrints: false,
|
||||
saveInstanceStickers: false,
|
||||
@@ -53,6 +54,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
@@ -80,6 +82,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
configRepository.getBool('VRCX_relaunchVRChatAfterCrash', false),
|
||||
configRepository.getBool('VRCX_vrcQuitFix', true),
|
||||
configRepository.getBool('VRCX_autoSweepVRChatCache', false),
|
||||
configRepository.getBool('VRCX_selfInviteOverride', false),
|
||||
configRepository.getBool('VRCX_saveInstancePrints', false),
|
||||
configRepository.getBool('VRCX_cropInstancePrints', false),
|
||||
configRepository.getBool('VRCX_saveInstanceStickers', false),
|
||||
@@ -120,6 +123,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
state.relaunchVRChatAfterCrash = relaunchVRChatAfterCrash;
|
||||
state.vrcQuitFix = vrcQuitFix;
|
||||
state.autoSweepVRChatCache = autoSweepVRChatCache;
|
||||
state.selfInviteOverride = selfInviteOverride;
|
||||
state.saveInstancePrints = saveInstancePrints;
|
||||
state.cropInstancePrints = cropInstancePrints;
|
||||
state.saveInstanceStickers = saveInstanceStickers;
|
||||
@@ -166,6 +170,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
);
|
||||
const vrcQuitFix = computed(() => state.vrcQuitFix);
|
||||
const autoSweepVRChatCache = computed(() => state.autoSweepVRChatCache);
|
||||
const selfInviteOverride = computed(() => state.selfInviteOverride);
|
||||
const saveInstancePrints = computed(() => state.saveInstancePrints);
|
||||
const cropInstancePrints = computed(() => state.cropInstancePrints);
|
||||
const saveInstanceStickers = computed(() => state.saveInstanceStickers);
|
||||
@@ -243,6 +248,13 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
state.autoSweepVRChatCache
|
||||
);
|
||||
}
|
||||
function setSelfInviteOverride() {
|
||||
state.selfInviteOverride = !state.selfInviteOverride;
|
||||
configRepository.setBool(
|
||||
'VRCX_selfInviteOverride',
|
||||
state.selfInviteOverride
|
||||
);
|
||||
}
|
||||
function setSaveInstancePrints() {
|
||||
state.saveInstancePrints = !state.saveInstancePrints;
|
||||
configRepository.setBool(
|
||||
@@ -692,6 +704,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
@@ -722,6 +735,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
setRelaunchVRChatAfterCrash,
|
||||
setVrcQuitFix,
|
||||
setAutoSweepVRChatCache,
|
||||
setSelfInviteOverride,
|
||||
setSaveInstancePrints,
|
||||
setCropInstancePrints,
|
||||
setSaveInstanceStickers,
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
<el-tooltip placement="left" :disabled="hideTooltips">
|
||||
<template #content>
|
||||
{{
|
||||
isGameRunning
|
||||
? $t('dialog.world.actions.new_instance_and_open_in_vrchat')
|
||||
canOpenInstanceInGame()
|
||||
? $t('dialog.world.actions.new_instance_and_open_ingame')
|
||||
: $t('dialog.world.actions.new_instance_and_self_invite')
|
||||
}}
|
||||
</template>
|
||||
@@ -160,6 +160,7 @@
|
||||
const { newInstanceSelfInvite } = useInviteStore();
|
||||
const { shiftHeld } = storeToRefs(useUiStore());
|
||||
const { isGameRunning } = storeToRefs(useGameStore());
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
|
||||
const isSelected = computed({
|
||||
get: () => props.favorite.$selected,
|
||||
|
||||
@@ -1478,6 +1478,15 @@
|
||||
setAutoSweepVRChatCache();
|
||||
saveOpenVROption();
|
||||
" />
|
||||
<span class="sub-header">{{ t('view.settings.advanced.advanced.self_invite.header') }}</span>
|
||||
<simple-switch
|
||||
:label="t('view.settings.advanced.advanced.self_invite.description')"
|
||||
:value="selfInviteOverride"
|
||||
:long-label="true"
|
||||
@change="
|
||||
setSelfInviteOverride();
|
||||
saveOpenVROption();
|
||||
" />
|
||||
<!--//- Advanced | Disable local world database-->
|
||||
</div>
|
||||
|
||||
@@ -2118,6 +2127,7 @@
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
@@ -2144,6 +2154,7 @@
|
||||
setRelaunchVRChatAfterCrash,
|
||||
setVrcQuitFix,
|
||||
setAutoSweepVRChatCache,
|
||||
setSelfInviteOverride,
|
||||
setSaveInstancePrints,
|
||||
setCropInstancePrints,
|
||||
setSaveInstanceStickers,
|
||||
|
||||
Reference in New Issue
Block a user