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"
:index="item.index"
:class="{ notify: notifiedMenus.includes(item.index) }">
<i :class="item.icon" />
<i :class="item.icon"></i>
<template #title>
<span>{{ $t(item.tooltip) }}</span>
</template>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -178,7 +178,7 @@ export const useLocationStore = defineStore('Location', () => {
photonStore.photonLobbyJointime = new Map();
photonStore.photonLobbyActivePortals = new Map();
photonStore.photonEvent7List = new Map();
photonStore.photonLastEvent7List = '';
photonStore.photonLastEvent7List = 0;
photonStore.photonLastChatBoxMsg = new Map();
photonStore.moderationEventQueue = new Map();
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} image
*/

View File

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

View File

@@ -626,21 +626,25 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
distinguishCancelAndClose: true,
confirmButtonText: t('prompt.auto_clear_cache.ok'),
cancelButtonText: t('prompt.auto_clear_cache.cancel'),
inputValue: vrcxStore.clearVRCXCacheFrequency / 3600 / 2,
inputValue: (
vrcxStore.clearVRCXCacheFrequency /
3600 /
2
).toString(),
inputPattern: /\d+$/,
inputErrorMessage: t('prompt.auto_clear_cache.input_error'),
callback: async (action, instance) => {
if (
action === 'confirm' &&
instance.inputValue &&
!isNaN(instance.inputValue)
!isNaN(parseInt(instance.inputValue, 10))
) {
vrcxStore.clearVRCXCacheFrequency = Math.trunc(
Number(instance.inputValue) * 3600 * 2
parseInt(instance.inputValue, 10) * 3600 * 2
);
await configRepository.setString(
'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() {
const authStore = useAuthStore();
const userStore = useUserStore();
@@ -102,7 +109,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
if (--state.nextAppUpdateCheck <= 0) {
state.nextAppUpdateCheck = 3600; // 1hour
if (vrcxUpdaterStore.autoUpdateVRCX !== 'Off') {
vrcxUpdaterStore.checkForVRCXUpdate(uiStore.notifyMenu);
vrcxUpdaterStore.checkForVRCXUpdate();
}
}
if (--state.ipcTimeout <= 0) {
@@ -166,6 +173,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
nextGroupInstanceRefresh,
nextCurrentUserRefresh,
nextDiscordUpdate,
ipcTimeout,
updateLoop
};
});

View File

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

View File

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

View File

@@ -177,6 +177,37 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
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() {
if (
!currentVersion.value ||
@@ -223,44 +254,9 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
// update already downloaded
state.VRCXUpdateDialog.updatePendingIsLatest = true;
} else if (releaseName > currentVersion.value) {
let downloadUrl = '';
let hashString = '';
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;
}
}
const { downloadUrl, hashString, size } = getAssetOfInterest(
json.assets
);
if (!downloadUrl) {
return;
}
@@ -321,13 +317,13 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
return;
}
for (const release of json) {
for (const asset of release.assets) {
if (
(asset.content_type === 'application/x-msdownload' ||
asset.content_type === 'application/x-msdos-program') &&
asset.state === 'uploaded'
) {
if (release.prerelease) {
continue;
}
assetLoop: for (const asset of release.assets) {
if (asset.state === 'uploaded') {
releases.push(release);
break assetLoop;
}
}
}
@@ -376,37 +372,9 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
if (release.name !== state.VRCXUpdateDialog.release) {
continue;
}
let downloadUrl = '';
let hashString = '';
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;
}
}
const { downloadUrl, hashString, size } = getAssetOfInterest(
release.assets
);
if (!downloadUrl) {
return;
}