Fix Linux window state, small fixes

This commit is contained in:
Natsumi
2025-08-12 16:16:05 +12:00
parent 4255d58c3a
commit 6c8a87d3cb
14 changed files with 122 additions and 131 deletions

View File

@@ -28,7 +28,7 @@
:key="item.index" :key="item.index"
:index="item.index" :index="item.index"
:class="{ notify: notifiedMenus.includes(item.index) }"> :class="{ notify: notifiedMenus.includes(item.index) }">
<i :class="item.icon" /> <i :class="item.icon"></i>
<template #title> <template #title>
<span>{{ $t(item.tooltip) }}</span> <span>{{ $t(item.tooltip) }}</span>
</template> </template>

View File

@@ -136,8 +136,9 @@
size="mini" size="mini"
class="name" class="name"
:class="userDialog.ref.$trustClass" :class="userDialog.ref.$trustClass"
style="margin-right: 5px; margin-top: 5px" style="margin-right: 5px; margin-top: 5px">
v-text="userDialog.ref.$trustLevel"></el-tag> {{ userDialog.ref.$trustLevel }}
</el-tag>
<el-tag <el-tag
v-if="userDialog.isFriend && userDialog.friend" v-if="userDialog.isFriend && userDialog.friend"
type="info" type="info"
@@ -239,7 +240,8 @@
'border-color': userDialog.ref.$customTagColour 'border-color': userDialog.ref.$customTagColour
}" }"
style="margin-right: 5px; margin-top: 5px" style="margin-right: 5px; margin-top: 5px"
v-text="userDialog.ref.$customTag"></el-tag> >{{ userDialog.ref.$customTag }}</el-tag
>
<br /> <br />
<el-tooltip <el-tooltip
v-show="!userDialog.loading" v-show="!userDialog.loading"
@@ -1521,8 +1523,8 @@
<el-dropdown-item <el-dropdown-item
v-for="(item, key) in userDialogWorldSortingOptions" v-for="(item, key) in userDialogWorldSortingOptions"
:key="key" :key="key"
@click.native="setUserDialogWorldSorting(item)" @click.native="setUserDialogWorldSorting(item)">
v-text="t(item.name)"> {{ t(item.name) }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -1543,8 +1545,8 @@
<el-dropdown-item <el-dropdown-item
v-for="(item, key) in userDialogWorldOrderOptions" v-for="(item, key) in userDialogWorldOrderOptions"
:key="key" :key="key"
@click.native="setUserDialogWorldOrder(item)" @click.native="setUserDialogWorldOrder(item)">
v-text="t(item.name)"> {{ t(item.name) }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -1669,13 +1671,11 @@
></span> ></span>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item @click.native="changeUserDialogAvatarSorting('name')">
@click.native="changeUserDialogAvatarSorting('name')" {{ t('dialog.user.avatars.sort_by_name') }}
v-text="t('dialog.user.avatars.sort_by_name')">
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item @click.native="changeUserDialogAvatarSorting('update')">
@click.native="changeUserDialogAvatarSorting('update')" {{ t('dialog.user.avatars.sort_by_update') }}
v-text="t('dialog.user.avatars.sort_by_update')">
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -1695,17 +1695,14 @@
></span> ></span>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item @click.native="userDialog.avatarReleaseStatus = 'all'">
@click.native="userDialog.avatarReleaseStatus = 'all'" {{ t('dialog.user.avatars.all') }}
v-text="t('dialog.user.avatars.all')">
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item @click.native="userDialog.avatarReleaseStatus = 'public'">
@click.native="userDialog.avatarReleaseStatus = 'public'" {{ t('dialog.user.avatars.public') }}
v-text="t('dialog.user.avatars.public')">
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item @click.native="userDialog.avatarReleaseStatus = 'private'">
@click.native="userDialog.avatarReleaseStatus = 'private'" {{ t('dialog.user.avatars.private') }}
v-text="t('dialog.user.avatars.private')">
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>

View File

@@ -14,7 +14,7 @@ class WebApiService {
} }
/** /**
* @param {string} options * @param {any} options
* @returns {Promise<{status: number, data?: string}>} * @returns {Promise<{status: number, data?: string}>}
*/ */
async execute(options) { async execute(options) {

View File

@@ -458,9 +458,6 @@ async function getBundleDateSize(ref) {
if (!fileId || !version) { if (!fileId || !version) {
continue; continue;
} }
console.log(
`Fetching bundle size for ${platform} - fileId: ${fileId}, version: ${version}, variant: ${variant}`
);
const args = await miscRequest.getFileAnalysis({ const args = await miscRequest.getFileAnalysis({
fileId, fileId,
version, version,

View File

@@ -36,7 +36,7 @@ export const useGameStore = defineStore('Game', () => {
const state = reactive({ const state = reactive({
lastCrashedTime: null, lastCrashedTime: null,
VRChatUsedCacheSize: '', VRChatUsedCacheSize: '',
VRChatTotalCacheSize: '', VRChatTotalCacheSize: 0,
VRChatCacheSizeLoading: false, VRChatCacheSizeLoading: false,
isGameRunning: false, isGameRunning: false,
isGameNoVR: true, isGameNoVR: true,
@@ -132,7 +132,7 @@ export const useGameStore = defineStore('Game', () => {
// check if relaunched less than 2mins ago (prvent crash loop) // check if relaunched less than 2mins ago (prvent crash loop)
if ( if (
state.lastCrashedTime && state.lastCrashedTime &&
new Date() - state.lastCrashedTime < 120_000 new Date().getTime() - state.lastCrashedTime.getTime() < 120_000
) { ) {
console.log('VRChat was recently crashed, not relaunching'); console.log('VRChat was recently crashed, not relaunching');
return; return;
@@ -200,7 +200,7 @@ export const useGameStore = defineStore('Game', () => {
userStore.currentUser.$previousAvatarSwapTime = Date.now(); userStore.currentUser.$previousAvatarSwapTime = Date.now();
} else { } else {
await configRepository.setBool('isGameNoVR', state.isGameNoVR); await configRepository.setBool('isGameNoVR', state.isGameNoVR);
userStore.currentUser.$online_for = ''; userStore.currentUser.$online_for = 0;
userStore.currentUser.$offline_for = Date.now(); userStore.currentUser.$offline_for = Date.now();
instanceStore.removeAllQueuedInstances(); instanceStore.removeAllQueuedInstances();
autoVRChatCacheManagement(); autoVRChatCacheManagement();

View File

@@ -366,7 +366,7 @@ export const useGroupStore = defineStore('Group', () => {
/** /**
* *
* @param {{ groupId: string }} params * @param {{ groupId: string }} params
* @return { Promise<{json: any, params}> } * @return { Promise<{posts: any, params}> }
*/ */
async function getAllGroupPosts(params) { async function getAllGroupPosts(params) {
const n = 100; const n = 100;

View File

@@ -178,7 +178,7 @@ export const useLocationStore = defineStore('Location', () => {
photonStore.photonLobbyJointime = new Map(); photonStore.photonLobbyJointime = new Map();
photonStore.photonLobbyActivePortals = new Map(); photonStore.photonLobbyActivePortals = new Map();
photonStore.photonEvent7List = new Map(); photonStore.photonEvent7List = new Map();
photonStore.photonLastEvent7List = ''; photonStore.photonLastEvent7List = 0;
photonStore.photonLastChatBoxMsg = new Map(); photonStore.photonLastChatBoxMsg = new Map();
photonStore.moderationEventQueue = new Map(); photonStore.moderationEventQueue = new Map();
if (photonStore.photonEventTable.data.length > 0) { if (photonStore.photonEventTable.data.length > 0) {

View File

@@ -1225,7 +1225,7 @@ export const useNotificationStore = defineStore('Notification', () => {
/** /**
* *
* @param {string} noty * @param {any} noty
* @param {string} message * @param {string} message
* @param {string} image * @param {string} image
*/ */

View File

@@ -137,7 +137,7 @@ export const usePhotonStore = defineStore('Photon', () => {
photonLobbyJointime: new Map(), photonLobbyJointime: new Map(),
photonLobbyActivePortals: new Map(), photonLobbyActivePortals: new Map(),
photonEvent7List: new Map(), photonEvent7List: new Map(),
photonLastEvent7List: '', photonLastEvent7List: 0,
photonLastChatBoxMsg: new Map() photonLastChatBoxMsg: new Map()
}); });
@@ -204,7 +204,7 @@ export const usePhotonStore = defineStore('Photon', () => {
} }
}); });
const photonLobbyActivePortal = computed({ const photonLobbyActivePortals = computed({
get: () => state.photonLobbyActivePortals, get: () => state.photonLobbyActivePortals,
set: (value) => { set: (value) => {
state.photonLobbyActivePortals = value; state.photonLobbyActivePortals = value;
@@ -232,6 +232,13 @@ export const usePhotonStore = defineStore('Photon', () => {
} }
}); });
const moderationEventQueue = computed({
get: () => state.moderationEventQueue,
set: (value) => {
state.moderationEventQueue = value;
}
});
async function initPhotonStates() { async function initPhotonStates() {
const [ const [
photonEventOverlay, photonEventOverlay,
@@ -261,7 +268,7 @@ export const usePhotonStore = defineStore('Photon', () => {
configRepository.getInt('VRCX_photonLobbyTimeoutThreshold', 6000), configRepository.getInt('VRCX_photonLobbyTimeoutThreshold', 6000),
configRepository.getString( configRepository.getString(
'VRCX_photonOverlayMessageTimeout', 'VRCX_photonOverlayMessageTimeout',
6000 (6000).toString()
), ),
configRepository.getString('VRCX_photonEventTypeFilter', '[]'), configRepository.getString('VRCX_photonEventTypeFilter', '[]'),
configRepository.getString('VRCX_chatboxUserBlacklist') configRepository.getString('VRCX_chatboxUserBlacklist')
@@ -316,7 +323,7 @@ export const usePhotonStore = defineStore('Photon', () => {
state.photonLobbyTimeoutThreshold = value; state.photonLobbyTimeoutThreshold = value;
configRepository.setString( configRepository.setString(
'VRCX_photonLobbyTimeoutThreshold', 'VRCX_photonLobbyTimeoutThreshold',
value value.toString()
); );
} }
}); });
@@ -326,7 +333,7 @@ export const usePhotonStore = defineStore('Photon', () => {
state.photonOverlayMessageTimeout = value; state.photonOverlayMessageTimeout = value;
configRepository.setString( configRepository.setString(
'VRCX_photonOverlayMessageTimeout', 'VRCX_photonOverlayMessageTimeout',
value value.toString()
); );
} }
}); });
@@ -1909,10 +1916,11 @@ export const usePhotonStore = defineStore('Photon', () => {
photonLobbyLastModeration, photonLobbyLastModeration,
photonLobbyTimeout, photonLobbyTimeout,
photonLobbyJointime, photonLobbyJointime,
photonLobbyActivePortal, photonLobbyActivePortals,
photonEvent7List, photonEvent7List,
photonLastEvent7List, photonLastEvent7List,
photonLastChatBoxMsg, photonLastChatBoxMsg,
moderationEventQueue,
setPhotonLoggingEnabled, setPhotonLoggingEnabled,
setPhotonEventOverlay, setPhotonEventOverlay,

View File

@@ -626,21 +626,25 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
confirmButtonText: t('prompt.auto_clear_cache.ok'), confirmButtonText: t('prompt.auto_clear_cache.ok'),
cancelButtonText: t('prompt.auto_clear_cache.cancel'), cancelButtonText: t('prompt.auto_clear_cache.cancel'),
inputValue: vrcxStore.clearVRCXCacheFrequency / 3600 / 2, inputValue: (
vrcxStore.clearVRCXCacheFrequency /
3600 /
2
).toString(),
inputPattern: /\d+$/, inputPattern: /\d+$/,
inputErrorMessage: t('prompt.auto_clear_cache.input_error'), inputErrorMessage: t('prompt.auto_clear_cache.input_error'),
callback: async (action, instance) => { callback: async (action, instance) => {
if ( if (
action === 'confirm' && action === 'confirm' &&
instance.inputValue && instance.inputValue &&
!isNaN(instance.inputValue) !isNaN(parseInt(instance.inputValue, 10))
) { ) {
vrcxStore.clearVRCXCacheFrequency = Math.trunc( vrcxStore.clearVRCXCacheFrequency = Math.trunc(
Number(instance.inputValue) * 3600 * 2 parseInt(instance.inputValue, 10) * 3600 * 2
); );
await configRepository.setString( await configRepository.setString(
'VRCX_clearVRCXCacheFrequency', 'VRCX_clearVRCXCacheFrequency',
vrcxStore.clearVRCXCacheFrequency vrcxStore.clearVRCXCacheFrequency.toString()
); );
} }
} }

View File

@@ -63,6 +63,13 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
} }
}); });
const ipcTimeout = computed({
get: () => state.ipcTimeout,
set: (value) => {
state.ipcTimeout = value;
}
});
async function updateLoop() { async function updateLoop() {
const authStore = useAuthStore(); const authStore = useAuthStore();
const userStore = useUserStore(); const userStore = useUserStore();
@@ -102,7 +109,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
if (--state.nextAppUpdateCheck <= 0) { if (--state.nextAppUpdateCheck <= 0) {
state.nextAppUpdateCheck = 3600; // 1hour state.nextAppUpdateCheck = 3600; // 1hour
if (vrcxUpdaterStore.autoUpdateVRCX !== 'Off') { if (vrcxUpdaterStore.autoUpdateVRCX !== 'Off') {
vrcxUpdaterStore.checkForVRCXUpdate(uiStore.notifyMenu); vrcxUpdaterStore.checkForVRCXUpdate();
} }
} }
if (--state.ipcTimeout <= 0) { if (--state.ipcTimeout <= 0) {
@@ -166,6 +173,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
nextGroupInstanceRefresh, nextGroupInstanceRefresh,
nextCurrentUserRefresh, nextCurrentUserRefresh,
nextDiscordUpdate, nextDiscordUpdate,
ipcTimeout,
updateLoop updateLoop
}; };
}); });

View File

@@ -224,11 +224,13 @@ export const useUserStore = defineStore('User', () => {
fileCreatedAt: '' fileCreatedAt: ''
}, },
representedGroup: { representedGroup: {
bannerId: '',
bannerUrl: '', bannerUrl: '',
description: '', description: '',
discriminator: '', discriminator: '',
groupId: '', groupId: '',
iconUrl: '', iconUrl: '',
id: '',
isRepresenting: false, isRepresenting: false,
memberCount: 0, memberCount: 0,
memberVisibility: '', memberVisibility: '',
@@ -236,7 +238,8 @@ export const useUserStore = defineStore('User', () => {
ownerId: '', ownerId: '',
privacy: '', privacy: '',
shortCode: '', shortCode: '',
$thumbnailUrl: '' $thumbnailUrl: '',
$memberId: ''
}, },
isRepresentedGroupLoading: false, isRepresentedGroupLoading: false,
joinCount: 0, joinCount: 0,
@@ -775,10 +778,12 @@ export const useUserStore = defineStore('User', () => {
}; };
D.isRepresentedGroupLoading = true; D.isRepresentedGroupLoading = true;
D.representedGroup = { D.representedGroup = {
bannerId: '',
bannerUrl: '', bannerUrl: '',
description: '', description: '',
discriminator: '', discriminator: '',
groupId: '', groupId: '',
id: '',
iconUrl: '', iconUrl: '',
isRepresenting: false, isRepresenting: false,
memberCount: 0, memberCount: 0,
@@ -787,7 +792,8 @@ export const useUserStore = defineStore('User', () => {
ownerId: '', ownerId: '',
privacy: '', privacy: '',
shortCode: '', shortCode: '',
$thumbnailUrl: '' $thumbnailUrl: '',
$memberId: ''
}; };
D.lastSeen = ''; D.lastSeen = '';
D.joinCount = 0; D.joinCount = 0;

View File

@@ -82,8 +82,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
debounce(saveVRCXWindowOption, 300)(); debounce(saveVRCXWindowOption, 300)();
}); });
window.electron.onWindowStateChange((event, state) => { window.electron.onWindowStateChange((event, newState) => {
state.windowState = state; state.windowState = newState.windowState;
debounce(saveVRCXWindowOption, 300)(); debounce(saveVRCXWindowOption, 300)();
}); });
@@ -121,10 +121,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
); );
} }
state.proxyServer = await VRCXStorage.Get('VRCX_ProxyServer'); state.proxyServer = await VRCXStorage.Get('VRCX_ProxyServer');
state.locationX = await VRCXStorage.Get('VRCX_LocationX'); state.locationX = parseInt(await VRCXStorage.Get('VRCX_LocationX'), 10);
state.locationY = await VRCXStorage.Get('VRCX_LocationY'); state.locationY = parseInt(await VRCXStorage.Get('VRCX_LocationY'), 10);
state.sizeWidth = await VRCXStorage.Get('VRCX_SizeWidth'); state.sizeWidth = parseInt(await VRCXStorage.Get('VRCX_SizeWidth'), 10);
state.sizeHeight = await VRCXStorage.Get('VRCX_SizeHeight'); state.sizeHeight = parseInt(
await VRCXStorage.Get('VRCX_SizeHeight'),
10
);
state.windowState = await VRCXStorage.Get('VRCX_WindowState'); state.windowState = await VRCXStorage.Get('VRCX_WindowState');
state.maxTableSize = await configRepository.getInt( state.maxTableSize = await configRepository.getInt(
@@ -381,10 +384,10 @@ export const useVrcxStore = defineStore('Vrcx', () => {
async function saveVRCXWindowOption() { async function saveVRCXWindowOption() {
if (LINUX) { if (LINUX) {
VRCXStorage.Set('VRCX_LocationX', state.locationX); VRCXStorage.Set('VRCX_LocationX', state.locationX.toString());
VRCXStorage.Set('VRCX_LocationY', state.locationY); VRCXStorage.Set('VRCX_LocationY', state.locationY.toString());
VRCXStorage.Set('VRCX_SizeWidth', state.sizeWidth); VRCXStorage.Set('VRCX_SizeWidth', state.sizeWidth.toString());
VRCXStorage.Set('VRCX_SizeHeight', state.sizeHeight); VRCXStorage.Set('VRCX_SizeHeight', state.sizeHeight.toString());
VRCXStorage.Set('VRCX_WindowState', state.windowState); VRCXStorage.Set('VRCX_WindowState', state.windowState);
VRCXStorage.Flush(); VRCXStorage.Flush();
} }

View File

@@ -177,6 +177,37 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
await configRepository.setString('VRCX_id', state.vrcxId); await configRepository.setString('VRCX_id', state.vrcxId);
} }
} }
function getAssetOfInterest(assets) {
let downloadUrl = '';
let hashString = '';
let size = 0;
for (const asset of assets) {
if (asset.state !== 'uploaded') {
continue;
}
if (
!LINUX &&
(asset.content_type === 'application/x-msdownload' ||
asset.content_type === 'application/x-msdos-program')
) {
downloadUrl = asset.browser_download_url;
if (asset.digest && asset.digest.startsWith('sha256:')) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
if (LINUX && asset.content_type === 'application/octet-stream') {
downloadUrl = asset.browser_download_url;
if (asset.digest && asset.digest.startsWith('sha256:')) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
}
return { downloadUrl, hashString, size };
}
async function checkForVRCXUpdate() { async function checkForVRCXUpdate() {
if ( if (
!currentVersion.value || !currentVersion.value ||
@@ -223,44 +254,9 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
// update already downloaded // update already downloaded
state.VRCXUpdateDialog.updatePendingIsLatest = true; state.VRCXUpdateDialog.updatePendingIsLatest = true;
} else if (releaseName > currentVersion.value) { } else if (releaseName > currentVersion.value) {
let downloadUrl = ''; const { downloadUrl, hashString, size } = getAssetOfInterest(
let hashString = ''; json.assets
let size = 0; );
for (const asset of json.assets) {
if (asset.state !== 'uploaded') {
continue;
}
if (
!LINUX &&
(asset.content_type === 'application/x-msdownload' ||
asset.content_type ===
'application/x-msdos-program')
) {
downloadUrl = asset.browser_download_url;
if (
asset.digest &&
asset.digest.startsWith('sha256:')
) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
if (
LINUX &&
asset.content_type === 'application/octet-stream'
) {
downloadUrl = asset.browser_download_url;
if (
asset.digest &&
asset.digest.startsWith('sha256:')
) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
}
if (!downloadUrl) { if (!downloadUrl) {
return; return;
} }
@@ -321,13 +317,13 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
return; return;
} }
for (const release of json) { for (const release of json) {
for (const asset of release.assets) { if (release.prerelease) {
if ( continue;
(asset.content_type === 'application/x-msdownload' || }
asset.content_type === 'application/x-msdos-program') && assetLoop: for (const asset of release.assets) {
asset.state === 'uploaded' if (asset.state === 'uploaded') {
) {
releases.push(release); releases.push(release);
break assetLoop;
} }
} }
} }
@@ -376,37 +372,9 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
if (release.name !== state.VRCXUpdateDialog.release) { if (release.name !== state.VRCXUpdateDialog.release) {
continue; continue;
} }
let downloadUrl = ''; const { downloadUrl, hashString, size } = getAssetOfInterest(
let hashString = ''; release.assets
let size = 0; );
for (const asset of release.assets) {
if (asset.state !== 'uploaded') {
continue;
}
if (
WINDOWS &&
(asset.content_type === 'application/x-msdownload' ||
asset.content_type === 'application/x-msdos-program')
) {
downloadUrl = asset.browser_download_url;
if (asset.digest && asset.digest.startsWith('sha256:')) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
if (
LINUX &&
asset.content_type === 'application/octet-stream'
) {
downloadUrl = asset.browser_download_url;
if (asset.digest && asset.digest.startsWith('sha256:')) {
hashString = asset.digest.replace('sha256:', '');
}
size = asset.size;
continue;
}
}
if (!downloadUrl) { if (!downloadUrl) {
return; return;
} }