mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Small fixes, fix open instance game crash
This commit is contained in:
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
|||||||
"lokalise.i18n-ally",
|
"lokalise.i18n-ally",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"lllllllqw.jsdoc",
|
"lllllllqw.jsdoc"
|
||||||
"mgmcdermott.vscode-language-babel"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ div.x-friend-list
|
|||||||
.el-tag.el-tag--info {
|
.el-tag.el-tag--info {
|
||||||
background-color: $--theme-bg-5;
|
background-color: $--theme-bg-5;
|
||||||
border-color: $--theme-border-2;
|
border-color: $--theme-border-2;
|
||||||
color: $--theme-info;
|
color: $--theme-text-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tag.el-tag--warning {
|
.el-tag.el-tag--warning {
|
||||||
|
|||||||
@@ -7,16 +7,22 @@
|
|||||||
<el-button v-show="isVisible" @click="confirmInvite" size="small" :icon="Message" circle />
|
<el-button v-show="isVisible" @click="confirmInvite" size="small" :icon="Message" circle />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')">
|
<el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')">
|
||||||
<el-button @click="openInstance" size="small" :icon="Message" circle />
|
<el-button v-if="isOpeningInstance" size="small" circle>
|
||||||
|
<el-icon class="is-loading">
|
||||||
|
<Loading />
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button v-else @click="openInstance" size="small" :icon="Message" circle />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { Message } from '@element-plus/icons-vue';
|
import { Loading, Message } from '@element-plus/icons-vue';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { instanceRequest } from '../api';
|
import { instanceRequest } from '../api';
|
||||||
import { checkCanInviteSelf, parseLocation } from '../shared/utils';
|
import { checkCanInviteSelf, parseLocation } from '../shared/utils';
|
||||||
import { useInviteStore, useLaunchStore } from '../stores';
|
import { useInviteStore, useLaunchStore } from '../stores';
|
||||||
@@ -31,6 +37,8 @@
|
|||||||
const { canOpenInstanceInGame } = useInviteStore();
|
const { canOpenInstanceInGame } = useInviteStore();
|
||||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||||
|
|
||||||
|
const { isOpeningInstance } = storeToRefs(useLaunchStore());
|
||||||
|
|
||||||
const isVisible = computed(() => checkCanInviteSelf(props.location));
|
const isVisible = computed(() => checkCanInviteSelf(props.location));
|
||||||
|
|
||||||
function confirmInvite() {
|
function confirmInvite() {
|
||||||
|
|||||||
@@ -531,10 +531,9 @@
|
|||||||
const { currentUserGroups } = storeToRefs(useGroupStore());
|
const { currentUserGroups } = storeToRefs(useGroupStore());
|
||||||
const { cachedGroups, handleGroupPermissions } = useGroupStore();
|
const { cachedGroups, handleGroupPermissions } = useGroupStore();
|
||||||
const { lastLocation } = storeToRefs(useLocationStore());
|
const { lastLocation } = storeToRefs(useLocationStore());
|
||||||
const { showLaunchDialog } = useLaunchStore();
|
const { showLaunchDialog, tryOpenInstanceInVrc } = useLaunchStore();
|
||||||
const { createNewInstance } = useInstanceStore();
|
const { createNewInstance } = useInstanceStore();
|
||||||
const { currentUser } = storeToRefs(useUserStore());
|
const { currentUser } = storeToRefs(useUserStore());
|
||||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
|
||||||
const { canOpenInstanceInGame } = useInviteStore();
|
const { canOpenInstanceInGame } = useInviteStore();
|
||||||
|
|
||||||
const newInstanceDialogIndex = ref(2000);
|
const newInstanceDialogIndex = ref(2000);
|
||||||
|
|||||||
+32
-11
@@ -9,6 +9,7 @@ import { parseLocation } from '../shared/utils';
|
|||||||
export const useLaunchStore = defineStore('Launch', () => {
|
export const useLaunchStore = defineStore('Launch', () => {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isLaunchOptionsDialogVisible: false,
|
isLaunchOptionsDialogVisible: false,
|
||||||
|
isOpeningInstance: false,
|
||||||
launchDialogData: {
|
launchDialogData: {
|
||||||
visible: false,
|
visible: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -24,6 +25,13 @@ export const useLaunchStore = defineStore('Launch', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isOpeningInstance = computed({
|
||||||
|
get: () => state.isOpeningInstance,
|
||||||
|
set: (value) => {
|
||||||
|
state.isOpeningInstance = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const launchDialogData = computed({
|
const launchDialogData = computed({
|
||||||
get: () => state.launchDialogData,
|
get: () => state.launchDialogData,
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
@@ -102,9 +110,14 @@ export const useLaunchStore = defineStore('Launch', () => {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function tryOpenInstanceInVrc(location, shortName) {
|
async function tryOpenInstanceInVrc(location, shortName) {
|
||||||
const launchUrl = await getLaunchUrl(location, shortName);
|
if (state.isOpeningInstance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.isOpeningInstance = true;
|
||||||
|
let launchUrl = '';
|
||||||
let result = false;
|
let result = false;
|
||||||
try {
|
try {
|
||||||
|
launchUrl = await getLaunchUrl(location, shortName);
|
||||||
result = await AppApi.TryOpenInstanceInVrc(launchUrl);
|
result = await AppApi.TryOpenInstanceInVrc(launchUrl);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -117,17 +130,24 @@ export const useLaunchStore = defineStore('Launch', () => {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
// self invite fallback
|
// self invite fallback
|
||||||
const L = parseLocation(location);
|
try {
|
||||||
await instanceRequest.selfInvite({
|
const L = parseLocation(location);
|
||||||
instanceId: L.instanceId,
|
await instanceRequest.selfInvite({
|
||||||
worldId: L.worldId,
|
instanceId: L.instanceId,
|
||||||
shortName
|
worldId: L.worldId,
|
||||||
});
|
shortName
|
||||||
ElMessage({
|
});
|
||||||
message: 'Self invite sent',
|
ElMessage({
|
||||||
type: 'success'
|
message: 'Self invite sent',
|
||||||
});
|
type: 'success'
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
state.isOpeningInstance = false;
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,6 +212,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
|||||||
state,
|
state,
|
||||||
|
|
||||||
isLaunchOptionsDialogVisible,
|
isLaunchOptionsDialogVisible,
|
||||||
|
isOpeningInstance,
|
||||||
launchDialogData,
|
launchDialogData,
|
||||||
showLaunchOptions,
|
showLaunchOptions,
|
||||||
showLaunchDialog,
|
showLaunchDialog,
|
||||||
|
|||||||
Reference in New Issue
Block a user