refactor: app.js (#1291)

* refactor: frontend

* Fix avatar gallery sort

* Update .NET dependencies

* Update npm dependencies

electron v37.1.0

* bulkRefreshFriends

* fix dark theme

* Remove crowdin

* Fix config.json dialog not updating

* VRCX log file fixes & add Cef log

* Remove SharedVariable, fix startup

* Revert init theme change

* Logging date not working? Fix WinformThemer designer error

* Add Cef request hander, no more escaping main page

* clean

* fix

* fix

* clean

* uh

* Apply thememode at startup, fixes random user colours

* Split database into files

* Instance info remove empty lines

* Open external VRC links with VRCX

* Electron fixes

* fix userdialog style

* ohhhh

* fix store

* fix store

* fix: load all group members after kicking a user

* fix: world dialog favorite button style

* fix: Clear VRCX Cache Timer input value

* clean

* Fix VR overlay

* Fix VR overlay 2

* Fix Discord discord rich presence for RPC worlds

* Clean up age verified user tags

* Fix playerList being occupied after program reload

* no `this`

* Fix login stuck loading

* writable: false

* Hide dialogs on logout

* add flush sync option

* rm LOGIN event

* rm LOGOUT event

* remove duplicate event listeners

* remove duplicate event listeners

* clean

* remove duplicate event listeners

* clean

* fix theme style

* fix t

* clearable

* clean

* fix ipcEvent

* Small changes

* Popcorn Palace support

* Remove checkActiveFriends

* Clean up

* Fix dragEnterCef

* Block API requests when not logged in

* Clear state on login & logout

* Fix worldDialog instances not updating

* use <script setup>

* Fix avatar change event, CheckGameRunning at startup

* Fix image dragging

* fix

* Remove PWI

* fix updateLoop

* add webpack-dev-server to dev environment

* rm unnecessary chunks

* use <script setup>

* webpack-dev-server changes

* use <script setup>

* use <script setup>

* Fix UGC text size

* Split login event

* t

* use <script setup>

* fix

* Update .gitignore and enable checkJs in jsconfig

* fix i18n t

* use <script setup>

* use <script setup>

* clean

* global types

* fix

* use checkJs for debugging

* Add watchState for login watchers

* fix .vue template

* type fixes

* rm Vue.filter

* Cef v138.0.170, VC++ 2022

* Settings fixes

* Remove 'USER:CURRENT'

* clean up 2FA callbacks

* remove userApply

* rm i18n import

* notification handling to use notification store methods

* refactor favorite handling to use favorite store methods and clean up event emissions

* refactor moderation handling to use dedicated functions for player moderation events

* refactor friend handling to use dedicated functions for friend events

* Fix program startup, move lang init

* Fix friend state

* Fix status change error

* Fix user notes diff

* fix

* rm group event

* rm auth event

* rm avatar event

* clean

* clean

* getUser

* getFriends

* getFavoriteWorlds, getFavoriteAvatars

* AvatarGalleryUpload btn style & package.json update

* Fix friend requests

* Apply user

* Apply world

* Fix note diff

* Fix VR overlay

* Fixes

* Update build scripts

* Apply avatar

* Apply instance

* Apply group

* update hidden VRC+ badge

* Fix sameInstance "private"

* fix 502/504 API errors

* fix 502/504 API errors

* clean

* Fix friend in same instance on orange showing twice in friends list

* Add back in broken friend state repair methods

* add types

---------

Co-authored-by: Natsumi <cmcooper123@hotmail.com>
This commit is contained in:
pa
2025-07-14 12:00:08 +09:00
committed by GitHub
parent 952fd77ed5
commit f4f78bb5ec
323 changed files with 47745 additions and 43326 deletions

View File

@@ -1,29 +1,27 @@
// #region | API: Favorite
import { request } from '../service/request';
import { useFavoriteStore, useUserStore } from '../stores';
function getCurrentUserId() {
return useUserStore().currentUser.id;
}
const favoriteReq = {
getFavoriteLimits() {
return window.API.call('auth/user/favoritelimits', {
return request('auth/user/favoritelimits', {
method: 'GET'
}).then((json) => {
const args = {
json
};
window.API.$emit('FAVORITE:LIMITS', args);
return args;
});
},
/**
* @param {{
* n: number,
* offset: number,
* type: string,
* tag: string
* }} params
* @return { Promise<{json: any, params}> }
* @type {import('../types/favorite').getFavorites}
*/
getFavorites(params) {
return window.API.call('favorites', {
return request('favorites', {
method: 'GET',
params
}).then((json) => {
@@ -31,7 +29,6 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:LIST', args);
return args;
});
},
@@ -45,7 +42,7 @@ const favoriteReq = {
* @return { Promise<{json: any, params}> }
*/
addFavorite(params) {
return window.API.call('favorites', {
return request('favorites', {
method: 'POST',
params
}).then((json) => {
@@ -53,7 +50,7 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:ADD', args);
useFavoriteStore().handleFavoriteAdd(args);
return args;
});
},
@@ -63,14 +60,14 @@ const favoriteReq = {
* @return { Promise<{json: any, params}> }
*/
deleteFavorite(params) {
return window.API.call(`favorites/${params.objectId}`, {
return request(`favorites/${params.objectId}`, {
method: 'DELETE'
}).then((json) => {
const args = {
json,
params
};
window.API.$emit('FAVORITE:DELETE', args);
useFavoriteStore().handleFavoriteDelete(args);
return args;
});
},
@@ -80,7 +77,7 @@ const favoriteReq = {
* @return { Promise<{json: any, params}> }
*/
getFavoriteGroups(params) {
return window.API.call('favorite/groups', {
return request('favorite/groups', {
method: 'GET',
params
}).then((json) => {
@@ -88,7 +85,6 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:GROUP:LIST', args);
return args;
});
},
@@ -99,8 +95,8 @@ const favoriteReq = {
* @return { Promise<{json: any, params}> }
*/
saveFavoriteGroup(params) {
return window.API.call(
`favorite/group/${params.type}/${params.group}/${window.API.currentUser.id}`,
return request(
`favorite/group/${params.type}/${params.group}/${getCurrentUserId()}`,
{
method: 'PUT',
params
@@ -110,7 +106,6 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:GROUP:SAVE', args);
return args;
});
},
@@ -123,8 +118,8 @@ const favoriteReq = {
* @return { Promise<{json: any, params}> }
*/
clearFavoriteGroup(params) {
return window.API.call(
`favorite/group/${params.type}/${params.group}/${window.API.currentUser.id}`,
return request(
`favorite/group/${params.type}/${params.group}/${getCurrentUserId()}`,
{
method: 'DELETE',
params
@@ -134,20 +129,16 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:GROUP:CLEAR', args);
useFavoriteStore().handleFavoriteGroupClear(args);
return args;
});
},
/**
* @param {{
* n: number,
* offset: number
* }} params
* @return { Promise<{json: any, params}> }
* @type {import('../types/favorite').getFavoriteWorlds}
*/
getFavoriteWorlds(params) {
return window.API.call('worlds/favorites', {
return request('worlds/favorites', {
method: 'GET',
params
}).then((json) => {
@@ -155,20 +146,15 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:WORLD:LIST', args);
return args;
});
},
/**
* @param {{
* n: number,
* offset: number
* }} params
* @return { Promise<{json: any, params}> }
* @type {import('../types/favorite').getFavoriteAvatars}
*/
getFavoriteAvatars(params) {
return window.API.call('avatars/favorites', {
return request('avatars/favorites', {
method: 'GET',
params
}).then((json) => {
@@ -176,12 +162,9 @@ const favoriteReq = {
json,
params
};
window.API.$emit('FAVORITE:AVATAR:LIST', args);
return args;
});
}
};
// #endregion
export default favoriteReq;