eslint fix

This commit is contained in:
pa
2026-03-10 22:42:22 +09:00
parent 699bf620e5
commit 4877010006
124 changed files with 980 additions and 1121 deletions

View File

@@ -65,9 +65,7 @@ export async function runHandleAutoLoginFlow({
if (AppDebug.errorNoty) {
toast.dismiss(AppDebug.errorNoty);
}
AppDebug.errorNoty = toast.error(
t('message.auth.auto_login_failed')
);
AppDebug.errorNoty = toast.error(t('message.auth.auto_login_failed'));
console.error('Failed to login automatically.', err);
} finally {
authStore.setAttemptingAutoLogin(false);

View File

@@ -129,11 +129,7 @@ export function showAvatarDialog(avatarId, options = {}) {
.then((args) => {
const ref = applyAvatar(args.json);
D.ref = ref;
uiStore.setDialogCrumbLabel(
'avatar',
D.id,
D.ref?.name || D.id
);
uiStore.setDialogCrumbLabel('avatar', D.id, D.ref?.name || D.id);
avatarStore.getAvatarGallery(avatarId);
avatarStore.updateVRChatAvatarCache();
if (/quest/.test(ref.tags)) {
@@ -333,8 +329,7 @@ export async function lookupAvatars(type, search) {
const length =
avatarProviderStore.avatarRemoteDatabaseProviderList.length;
for (let i = 0; i < length; ++i) {
const url =
avatarProviderStore.avatarRemoteDatabaseProviderList[i];
const url = avatarProviderStore.avatarRemoteDatabaseProviderList[i];
const avatarArray = await lookupAvatarsByAuthor(url, search);
avatarArray.forEach((avatar) => {
if (!avatars.has(avatar.id)) {
@@ -362,10 +357,7 @@ export async function lookupAvatarByImageFileId(authorId, fileId) {
}
for (const providerUrl of avatarProviderStore.avatarRemoteDatabaseProviderList) {
const avatarArray = await lookupAvatarsByAuthor(
providerUrl,
authorId
);
const avatarArray = await lookupAvatarsByAuthor(providerUrl, authorId);
for (const avatar of avatarArray) {
if (extractFileId(avatar.imageUrl) === fileId) {
return avatar.id;
@@ -595,9 +587,7 @@ export async function showAvatarAuthorDialog(
}
if (!avatarId) {
if (ownerUserId === refUserId) {
toast.warning(
t('message.avatar_lookup.private_or_not_found')
);
toast.warning(t('message.avatar_lookup.private_or_not_found'));
} else {
toast.warning(t('message.avatar_lookup.not_found'));
showUserDialog(avatarInfo.ownerId);

View File

@@ -326,8 +326,7 @@ export async function applyFavorite(type, objectId) {
}
} else {
// try fetch from local world favorites
const world =
await database.getCachedWorldById(objectId);
const world = await database.getCachedWorldById(objectId);
if (world) {
ctx.ref = world;
ctx.name = world.name;
@@ -356,8 +355,7 @@ export async function applyFavorite(type, objectId) {
}
} else {
// try fetch from local avatar history
const avatar =
await database.getCachedAvatarById(objectId);
const avatar = await database.getCachedAvatarById(objectId);
if (avatar) {
ctx.ref = avatar;
ctx.name = avatar.name;
@@ -392,14 +390,17 @@ export function refreshFavorites() {
return;
}
favoriteStore.isFavoriteLoading = true;
queryRequest.fetch('favoriteLimits').then((args) => {
favoriteStore.favoriteLimits = {
...favoriteStore.favoriteLimits,
...args.json
};
}).catch((err) => {
console.error(err);
});
queryRequest
.fetch('favoriteLimits')
.then((args) => {
favoriteStore.favoriteLimits = {
...favoriteStore.favoriteLimits,
...args.json
};
})
.catch((err) => {
console.error(err);
});
let newFavoriteSortOrder = [];
processBulk({
fn: (params) => favoriteRequest.getFavorites(params),
@@ -516,7 +517,11 @@ export function sortLocalAvatarFavorites() {
const favoriteStore = useFavoriteStore();
const appearanceSettingsStore = useAppearanceSettingsStore();
if (!appearanceSettingsStore.sortFavorites) {
for (let i = 0; i < favoriteStore.localAvatarFavoriteGroups.length; ++i) {
for (
let i = 0;
i < favoriteStore.localAvatarFavoriteGroups.length;
++i
) {
const group = favoriteStore.localAvatarFavoriteGroups[i];
if (favoriteStore.localAvatarFavorites[group]) {
favoriteStore.localAvatarFavorites[group].sort(compareByName);
@@ -532,7 +537,11 @@ export function sortLocalWorldFavorites() {
const favoriteStore = useFavoriteStore();
const appearanceSettingsStore = useAppearanceSettingsStore();
if (!appearanceSettingsStore.sortFavorites) {
for (let i = 0; i < favoriteStore.localWorldFavoriteGroups.length; ++i) {
for (
let i = 0;
i < favoriteStore.localWorldFavoriteGroups.length;
++i
) {
const group = favoriteStore.localWorldFavoriteGroups[i];
if (favoriteStore.localWorldFavorites[group]) {
favoriteStore.localWorldFavorites[group].sort(compareByName);
@@ -604,10 +613,17 @@ export function removeLocalWorldFavorite(worldId, group) {
let worldInFavorites = false;
for (i = 0; i < favoriteStore.localWorldFavoriteGroups.length; ++i) {
const groupName = favoriteStore.localWorldFavoriteGroups[i];
if (!favoriteStore.localWorldFavorites[groupName] || group === groupName) {
if (
!favoriteStore.localWorldFavorites[groupName] ||
group === groupName
) {
continue;
}
for (let j = 0; j < favoriteStore.localWorldFavorites[groupName].length; ++j) {
for (
let j = 0;
j < favoriteStore.localWorldFavorites[groupName].length;
++j
) {
const id = favoriteStore.localWorldFavorites[groupName][j].id;
if (id === worldId) {
worldInFavorites = true;
@@ -704,7 +720,8 @@ export function renameLocalWorldFavoriteGroup(newName, group) {
);
return;
}
favoriteStore.localWorldFavorites[newName] = favoriteStore.localWorldFavorites[group];
favoriteStore.localWorldFavorites[newName] =
favoriteStore.localWorldFavorites[group];
delete favoriteStore.localWorldFavorites[group];
database.renameWorldFavoriteGroup(newName, group);
@@ -794,10 +811,17 @@ export function removeLocalAvatarFavorite(avatarId, group) {
let avatarInFavorites = false;
for (i = 0; i < favoriteStore.localAvatarFavoriteGroups.length; ++i) {
const groupName = favoriteStore.localAvatarFavoriteGroups[i];
if (!favoriteStore.localAvatarFavorites[groupName] || group === groupName) {
if (
!favoriteStore.localAvatarFavorites[groupName] ||
group === groupName
) {
continue;
}
for (let j = 0; j < favoriteStore.localAvatarFavorites[groupName].length; ++j) {
for (
let j = 0;
j < favoriteStore.localAvatarFavorites[groupName].length;
++j
) {
const id = favoriteStore.localAvatarFavorites[groupName][j].id;
if (id === avatarId) {
avatarInFavorites = true;
@@ -854,8 +878,13 @@ export function deleteLocalAvatarFavoriteGroup(group) {
if (!favoriteStore.localAvatarFavorites[groupName]) {
continue;
}
for (let j = 0; j < favoriteStore.localAvatarFavorites[groupName].length; ++j) {
const avatarId = favoriteStore.localAvatarFavorites[groupName][j].id;
for (
let j = 0;
j < favoriteStore.localAvatarFavorites[groupName].length;
++j
) {
const avatarId =
favoriteStore.localAvatarFavorites[groupName][j].id;
if (avatarIdRemoveList.has(avatarId)) {
avatarIdRemoveList.delete(avatarId);
break;
@@ -872,7 +901,10 @@ export function deleteLocalAvatarFavoriteGroup(group) {
++i
) {
const groupName = favoriteStore.localAvatarFavoriteGroups[i];
if (!favoriteStore.localAvatarFavorites[groupName] || group === groupName) {
if (
!favoriteStore.localAvatarFavorites[groupName] ||
group === groupName
) {
continue loop;
}
for (
@@ -880,7 +912,8 @@ export function deleteLocalAvatarFavoriteGroup(group) {
j < favoriteStore.localAvatarFavorites[groupName].length;
++j
) {
const avatarId = favoriteStore.localAvatarFavorites[groupName][j].id;
const avatarId =
favoriteStore.localAvatarFavorites[groupName][j].id;
if (id === avatarId) {
avatarInFavorites = true;
break loop;
@@ -961,7 +994,8 @@ export function renameLocalAvatarFavoriteGroup(newName, group) {
);
return;
}
favoriteStore.localAvatarFavorites[newName] = favoriteStore.localAvatarFavorites[group];
favoriteStore.localAvatarFavorites[newName] =
favoriteStore.localAvatarFavorites[group];
delete favoriteStore.localAvatarFavorites[group];
database.renameAvatarFavoriteGroup(newName, group);
@@ -1038,10 +1072,7 @@ export async function checkInvalidLocalAvatars(
});
await new Promise((resolve) => setTimeout(resolve, 500));
} catch (err) {
console.error(
`Failed to fetch avatar ${favorite.id}:`,
err
);
console.error(`Failed to fetch avatar ${favorite.id}:`, err);
result.invalid++;
result.invalidIds.push(favorite.id);
}
@@ -1075,9 +1106,7 @@ export async function removeInvalidLocalAvatars(avatarIds, targetGroup = null) {
}
for (const avatarId of avatarIds) {
const index = favoriteGroup.findIndex(
(fav) => fav.id === avatarId
);
const index = favoriteGroup.findIndex((fav) => fav.id === avatarId);
if (index !== -1) {
removeLocalAvatarFavorite(avatarId, group);
result.removed++;
@@ -1210,16 +1239,14 @@ export function renameLocalFriendFavoriteGroup(newName, group) {
);
return;
}
favoriteStore.localFriendFavorites[newName] = favoriteStore.localFriendFavorites[group];
favoriteStore.localFriendFavorites[newName] =
favoriteStore.localFriendFavorites[group];
delete favoriteStore.localFriendFavorites[group];
database.renameFriendFavoriteGroup(newName, group);
const oldKey = `local:${group}`;
const idx =
generalSettingsStore.localFavoriteFriendsGroups.indexOf(oldKey);
const idx = generalSettingsStore.localFavoriteFriendsGroups.indexOf(oldKey);
if (idx !== -1) {
const updated = [
...generalSettingsStore.localFavoriteFriendsGroups
];
const updated = [...generalSettingsStore.localFavoriteFriendsGroups];
updated[idx] = `local:${newName}`;
generalSettingsStore.setLocalFavoriteFriendsGroups(updated);
}

View File

@@ -205,9 +205,7 @@ export function updateFriendship(ref) {
};
friendLogTable.value.data.push(friendLogHistoryDisplayName);
database.addFriendLogHistory(friendLogHistoryDisplayName);
notificationStore.queueFriendLogNoty(
friendLogHistoryDisplayName
);
notificationStore.queueFriendLogNoty(friendLogHistoryDisplayName);
sharedFeedStore.addEntry(friendLogHistoryDisplayName);
const friendLogCurrent = {
userId: ref.id,
@@ -321,7 +319,10 @@ export function updateUserCurrentStatus(ref) {
friendStore.updateOnlineFriendCounter();
if (appearanceSettingsStore.randomUserColours) {
getNameColour(userStore.currentUser.id, appearanceSettingsStore.isDarkMode).then((colour) => {
getNameColour(
userStore.currentUser.id,
appearanceSettingsStore.isDarkMode
).then((colour) => {
userStore.setCurrentUserColour(colour);
});
}

View File

@@ -150,8 +150,7 @@ export function runCheckIfGameCrashedFlow() {
// check if relaunched less than 2mins ago (prevent crash loop)
if (
gameStore.state.lastCrashedTime &&
new Date().getTime() -
gameStore.state.lastCrashedTime.getTime() <
new Date().getTime() - gameStore.state.lastCrashedTime.getTime() <
120_000
) {
console.log('VRChat was recently crashed, not relaunching');
@@ -211,13 +210,9 @@ export async function runCheckVRChatDebugLoggingFlow() {
return;
}
try {
const loggingEnabled = await gameStore.getVRChatRegistryKey(
'LOGGING_ENABLED'
);
if (
loggingEnabled === null ||
typeof loggingEnabled === 'undefined'
) {
const loggingEnabled =
await gameStore.getVRChatRegistryKey('LOGGING_ENABLED');
if (loggingEnabled === null || typeof loggingEnabled === 'undefined') {
// key not found
return;
}

View File

@@ -14,7 +14,10 @@ import {
import { i18n } from '../plugins/i18n';
import { AppDebug } from '../services/appConfig';
import { database } from '../services/database';
import { runLastLocationResetFlow, runUpdateCurrentUserLocationFlow } from './locationCoordinator';
import {
runLastLocationResetFlow,
runUpdateCurrentUserLocationFlow
} from './locationCoordinator';
import { getGroupName } from '../shared/utils';
import { userRequest } from '../api';
import { watchState } from '../services/watchState';
@@ -94,10 +97,7 @@ export async function tryLoadPlayerList() {
joinTime: Date.parse(ctx.created_at),
lastAvatar: ''
};
locationStore.lastLocation.playerList.set(
ctx.userId,
userMap
);
locationStore.lastLocation.playerList.set(ctx.userId, userMap);
if (friendStore.friends.has(ctx.userId)) {
locationStore.lastLocation.friendList.set(
ctx.userId,
@@ -133,7 +133,6 @@ export async function tryLoadPlayerList() {
/**
* Core game log entry processor. Dispatches game log events to the
* appropriate stores based on type.
*
* @param {object} gameLog
* @param {string} location
*/
@@ -160,10 +159,8 @@ export function addGameLogEntry(gameLog, location) {
let userId = String(gameLog.userId || '');
if (!userId && gameLog.displayName) {
userId =
findUserByDisplayName(
userStore.cachedUsers,
gameLog.displayName
)?.id ?? '';
findUserByDisplayName(userStore.cachedUsers, gameLog.displayName)
?.id ?? '';
}
switch (gameLog.type) {
case 'location-destination':
@@ -213,10 +210,7 @@ export function addGameLogEntry(gameLog, location) {
instanceStore.applyWorldDialogInstances();
instanceStore.applyGroupDialogInstances();
}
instanceStore.addInstanceJoinHistory(
gameLog.location,
gameLog.dt
);
instanceStore.addInstanceJoinHistory(gameLog.location, gameLog.dt);
const L = parseLocation(gameLog.location);
entry = createLocationEntry(
gameLog.dt,
@@ -282,7 +276,9 @@ export function addGameLogEntry(gameLog, location) {
const time = dayjs(gameLog.dt) - ref1.joinTime;
locationStore.lastLocation.playerList.delete(userId);
locationStore.lastLocation.friendList.delete(userId);
gameLogStore.state.lastLocationAvatarList.delete(gameLog.displayName);
gameLogStore.state.lastLocationAvatarList.delete(
gameLog.displayName
);
photonStore.photonLobbyAvatars.delete(userId);
vrStore.updateVRLastLocation();
instanceStore.getCurrentInstanceUserList();
@@ -499,7 +495,6 @@ export function addGameLogEntry(gameLog, location) {
/**
* Parses raw game log JSON and delegates to addGameLogEntry.
* Called from C# / updateLoop.
*
* @param {string} json
*/
export function addGameLogEvent(json) {
@@ -533,7 +528,6 @@ export async function getGameLogTable() {
/**
* Fetches all game log entries since dateTill and processes them.
*
* @param {string} dateTill
*/
async function updateGameLog(dateTill) {

View File

@@ -67,11 +67,7 @@ export function applyGroup(json) {
} else {
if (groupStore.currentUserGroups.has(ref.id)) {
// compare group props
if (
ref.ownerId &&
json.ownerId &&
ref.ownerId !== json.ownerId
) {
if (ref.ownerId && json.ownerId && ref.ownerId !== json.ownerId) {
// owner changed
groupOwnerChange(json, ref.ownerId, json.ownerId);
}
@@ -172,8 +168,7 @@ export function applyGroupMember(json) {
id: json.groupId,
memberVisibility: json.visibility,
isRepresenting: json.isRepresenting,
isSubscribedToAnnouncements:
json.isSubscribedToAnnouncements,
isSubscribedToAnnouncements: json.isSubscribedToAnnouncements,
joinedAt: json.joinedAt,
roleIds: json.roleIds,
membershipStatus: json.membershipStatus
@@ -258,9 +253,7 @@ function groupRoleChange(ref, oldRoles, newRoles, oldRoleIds, newRoleIds) {
for (const roleId of oldRoleIds) {
if (!newRoleIds.includes(roleId)) {
let roleName = '';
const role = oldRoles.find(
(fineRole) => fineRole.id === roleId
);
const role = oldRoles.find((fineRole) => fineRole.id === roleId);
if (role) {
roleName = role.name;
}
@@ -345,11 +338,7 @@ export function showGroupDialog(groupId, options = {}) {
const ref = args.ref || applyGroup(args.json);
if (groupId === ref.id) {
D.ref = ref;
uiStore.setDialogCrumbLabel(
'group',
D.id,
D.ref?.name || D.id
);
uiStore.setDialogCrumbLabel('group', D.id, D.ref?.name || D.id);
D.inGroup = ref.membershipStatus === 'member';
D.ownerDisplayName = ref.ownerId;
D.visible = true;
@@ -447,7 +436,10 @@ export function getGroupDialogGroup(groupId, existingRef) {
if (groupStore.groupDialog.id === args.params.groupId) {
D.calendar = args.json.results;
for (const event of D.calendar) {
Object.assign(event, groupStore.applyGroupEvent(event));
Object.assign(
event,
groupStore.applyGroupEvent(event)
);
// fetch again for isFollowing
queryRequest
.fetch('groupCalendarEvent', {
@@ -457,7 +449,9 @@ export function getGroupDialogGroup(groupId, existingRef) {
.then((args) => {
Object.assign(
event,
groupStore.applyGroupEvent(args.json)
groupStore.applyGroupEvent(
args.json
)
);
});
}
@@ -516,13 +510,11 @@ export function onGroupJoined(groupId) {
name: '',
iconUrl: ''
});
groupRequest
.getGroup({ groupId, includeRoles: true })
.then((args) => {
applyGroup(args.json);
saveCurrentUserGroups();
return args;
});
groupRequest.getGroup({ groupId, includeRoles: true }).then((args) => {
applyGroup(args.json);
saveCurrentUserGroups();
return args;
});
}
}
@@ -541,7 +533,10 @@ export async function onGroupLeft(groupId) {
);
return;
}
if (groupStore.groupDialog.visible && groupStore.groupDialog.id === groupId) {
if (
groupStore.groupDialog.visible &&
groupStore.groupDialog.id === groupId
) {
showGroupDialog(groupId);
}
if (groupStore.currentUserGroups.has(groupId)) {
@@ -615,10 +610,7 @@ export async function loadCurrentUserGroups(userId, groups) {
const promises = groups.map(async (groupId) => {
const groupRef = groupStore.cachedGroups.get(groupId);
if (
typeof groupRef !== 'undefined' &&
groupRef.roles?.length > 0
) {
if (typeof groupRef !== 'undefined' && groupRef.roles?.length > 0) {
return;
}
@@ -814,9 +806,7 @@ export function handleGroupRepresented(args) {
const D = userStore.userDialog;
const json = args.json;
D.representedGroup = json;
D.representedGroup.$thumbnailUrl = convertFileUrlToImageUrl(
json.iconUrl
);
D.representedGroup.$thumbnailUrl = convertFileUrlToImageUrl(json.iconUrl);
if (!json || !json.isRepresenting) {
D.isRepresentedGroupLoading = false;
}
@@ -887,7 +877,11 @@ export function handleGroupMemberProps(args) {
break;
}
}
for (i = 0; i < groupStore.groupDialog.memberSearchResults.length; ++i) {
for (
i = 0;
i < groupStore.groupDialog.memberSearchResults.length;
++i
) {
member = groupStore.groupDialog.memberSearchResults[i];
if (member.userId === args.json.userId) {
Object.assign(member, applyGroupMember(args.json));

View File

@@ -68,7 +68,10 @@ export function runUpdateCurrentUserLocationFlow() {
}
}
export async function runSetCurrentUserLocationFlow(location, travelingToLocation) {
export async function runSetCurrentUserLocationFlow(
location,
travelingToLocation
) {
const userStore = useUserStore();
const instanceStore = useInstanceStore();
const notificationStore = useNotificationStore();
@@ -147,7 +150,9 @@ export function runLastLocationResetFlow(gameLogDate) {
}
const dateTimeStamp = Date.parse(dateTime);
photonStore.resetLocationPhotonState();
const playerList = Array.from(locationStore.lastLocation.playerList.values());
const playerList = Array.from(
locationStore.lastLocation.playerList.values()
);
const dataBaseEntries = [];
for (const ref of playerList) {
const entry = {
@@ -162,7 +167,10 @@ export function runLastLocationResetFlow(gameLogDate) {
gameLogStore.addGameLog(entry);
}
database.addGamelogJoinLeaveBulk(dataBaseEntries);
if (locationStore.lastLocation.date !== null && locationStore.lastLocation.date > 0) {
if (
locationStore.lastLocation.date !== null &&
locationStore.lastLocation.date > 0
) {
const update = {
time: dateTimeStamp - locationStore.lastLocation.date,
created_at: new Date(locationStore.lastLocation.date).toJSON()

View File

@@ -34,10 +34,7 @@ export async function runRefreshPlayerModerationsFlow() {
moderationStore.deleteExpiredPlayerModerations();
})
.catch((error) => {
console.error(
'Failed to load player/avatar moderations:',
error
);
console.error('Failed to load player/avatar moderations:', error);
})
.finally(() => {
moderationStore.playerModerationTable.loading = false;

View File

@@ -223,9 +223,7 @@ export async function runHandleUserUpdateFlow(
avatarName: ''
};
try {
avatarInfo = await getAvatarName(
currentAvatarImageUrl
);
avatarInfo = await getAvatarName(currentAvatarImageUrl);
} catch (err) {
console.log(err);
}