diff --git a/src/api/friend.js b/src/api/friend.js index 7a52ebdf..ebfc3559 100644 --- a/src/api/friend.js +++ b/src/api/friend.js @@ -49,7 +49,7 @@ const friendReq = { json, params }; - window.API.$emit('FRIEND:REQUEST:CANCEL', args); + // window.API.$emit('FRIEND:REQUEST:CANCEL', args); return args; }); }, diff --git a/src/api/image.js b/src/api/image.js index a9ba2a4b..7aff5915 100644 --- a/src/api/image.js +++ b/src/api/image.js @@ -14,7 +14,7 @@ const imageReq = { method: 'PUT' }); window.$app.avatarDialog.loading = false; - window.$app.changeAvatarImageDialogLoading = false; + // window.$app.changeAvatarImageDialogLoading = false; }, async uploadAvatarImage(params, fileId) { @@ -28,14 +28,15 @@ const imageReq = { params, fileId }; - window.API.$emit('AVATARIMAGE:INIT', args); + // window.API.$emit('AVATARIMAGE:INIT', args); return args; }); } catch (err) { console.error(err); - window.API.uploadAvatarFailCleanup(fileId); + imageReq.uploadAvatarFailCleanup(fileId); + throw err; } - return void 0; + // return void 0; }, async uploadAvatarImageFileStart(params) { @@ -50,12 +51,12 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:FILESTART', args); + // window.API.$emit('AVATARIMAGE:FILESTART', args); return args; }); } catch (err) { console.error(err); - window.API.uploadAvatarFailCleanup(params.fileId); + imageReq.uploadAvatarFailCleanup(params.fileId); } return void 0; }, @@ -75,7 +76,7 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:FILEFINISH', args); + // window.API.$emit('AVATARIMAGE:FILEFINISH', args); return args; }); }, @@ -92,12 +93,12 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:SIGSTART', args); + // window.API.$emit('AVATARIMAGE:SIGSTART', args); return args; }); } catch (err) { console.error(err); - window.API.uploadAvatarFailCleanup(params.fileId); + imageReq.uploadAvatarFailCleanup(params.fileId); } return void 0; }, @@ -117,7 +118,7 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:SIGFINISH', args); + // window.API.$emit('AVATARIMAGE:SIGFINISH', args); return args; }); }, @@ -131,7 +132,7 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:SET', args); + // window.API.$emit('AVATARIMAGE:SET', args); window.API.$emit('AVATAR', args); return args; }); @@ -152,7 +153,7 @@ const imageReq = { method: 'PUT' }); window.$app.worldDialog.loading = false; - window.$app.changeWorldImageDialogLoading = false; + // window.$app.changeWorldImageDialogLoading = false; }, async uploadWorldImage(params, fileId) { @@ -166,12 +167,12 @@ const imageReq = { params, fileId }; - window.API.$emit('WORLDIMAGE:INIT', args); + // window.API.$emit('WORLDIMAGE:INIT', args); return args; }); } catch (err) { console.error(err); - window.API.uploadWorldFailCleanup(fileId); + imageReq.uploadWorldFailCleanup(fileId); } return void 0; }, @@ -188,12 +189,12 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:FILESTART', args); + // window.API.$emit('WORLDIMAGE:FILESTART', args); return args; }); } catch (err) { console.error(err); - window.API.uploadWorldFailCleanup(params.fileId); + imageReq.uploadWorldFailCleanup(params.fileId); } return void 0; }, @@ -213,7 +214,7 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:FILEFINISH', args); + // window.API.$emit('WORLDIMAGE:FILEFINISH', args); return args; }); }, @@ -230,12 +231,12 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:SIGSTART', args); + // window.API.$emit('WORLDIMAGE:SIGSTART', args); return args; }); } catch (err) { console.error(err); - window.API.uploadWorldFailCleanup(params.fileId); + imageReq.uploadWorldFailCleanup(params.fileId); } return void 0; }, @@ -255,7 +256,7 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:SIGFINISH', args); + // window.API.$emit('WORLDIMAGE:SIGFINISH', args); return args; }); }, @@ -269,7 +270,7 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:SET', args); + // window.API.$emit('WORLDIMAGE:SET', args); window.API.$emit('WORLD', args); return args; }); @@ -283,7 +284,7 @@ const imageReq = { json, params }; - window.API.$emit('AVATARIMAGE:GET', args); + // window.API.$emit('AVATARIMAGE:GET', args); return args; }); }, @@ -297,7 +298,7 @@ const imageReq = { json, params }; - window.API.$emit('WORLDIMAGE:GET', args); + // window.API.$emit('WORLDIMAGE:GET', args); return args; }); } diff --git a/src/api/misc.js b/src/api/misc.js index 1736fea6..fe26a2c9 100644 --- a/src/api/misc.js +++ b/src/api/misc.js @@ -19,7 +19,7 @@ const miscReq = { json, params }; - window.API.$emit('NOTE', args); + // window.API.$emit('NOTE', args); return args; }); }, @@ -46,7 +46,7 @@ const miscReq = { json, params }; - window.API.$emit('FEEDBACK:REPORT:USER', args); + // window.API.$emit('FEEDBACK:REPORT:USER', args); return args; }); }, @@ -81,7 +81,7 @@ const miscReq = { const args = { json }; - window.API.$emit('VRCCREDITS', args); + // window.API.$emit('VRCCREDITS', args); return args; }); }, @@ -170,10 +170,43 @@ const miscReq = { json, params }; - window.API.$emit('BADGE:UPDATE', args); + // window.API.$emit('BADGE:UPDATE', args); + return args; + }); + }, + + getVisits() { + return window.API.call('visits', { + method: 'GET' + }).then((json) => { + const args = { + json + }; + // window.API.$emit('VISITS', args); return args; }); } + + // /** + // * @params {{ + // userId: string, + // emojiId: string + // }} params + // * @returns {Promise<{json: any, params}>} + // */ + // sendBoop(params) { + // return window.API.call(`users/${params.userId}/boop`, { + // method: 'POST', + // params + // }).then((json) => { + // const args = { + // json, + // params + // }; + // this.$emit('BOOP:SEND', args); + // return args; + // }); + // } }; export default miscReq; diff --git a/src/api/notification.js b/src/api/notification.js index 50bd283f..8387d834 100644 --- a/src/api/notification.js +++ b/src/api/notification.js @@ -265,7 +265,8 @@ const notificationReq = { notificationId } }; - window.API.$emit('NOTIFICATION:V2:HIDE', args); + // useless + // window.API.$emit('NOTIFICATION:V2:HIDE', args); return args; }); } diff --git a/src/api/playerModeration.js b/src/api/playerModeration.js index 0e87b9aa..a28aa020 100644 --- a/src/api/playerModeration.js +++ b/src/api/playerModeration.js @@ -27,7 +27,7 @@ const playerModerationReq = { json, params }; - window.API.$emit('PLAYER-MODERATION:SEND', args); + // window.API.$emit('PLAYER-MODERATION:SEND', args); return args; }); }, diff --git a/src/api/user.js b/src/api/user.js index be73d9a6..769c15dc 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -126,7 +126,33 @@ const userReq = { json, params }; - window.API.$emit('USER:FEEDBACK', args); + // window.API.$emit('USER:FEEDBACK', args); + return args; + }); + }, + + /** + * @typedef {{ + * status: 'active' | 'offline' | 'busy' | 'ask me' | 'join me', + * statusDescription: string + * }} SaveCurrentUserParameters + */ + + /** + * Updates current user's status. + * @param params {SaveCurrentUserParameters} new status to be set + * @returns {Promise<{json: any, params}>} + */ + saveCurrentUser(params) { + return window.API.call(`users/${window.API.currentUser.id}`, { + method: 'PUT', + params + }).then((json) => { + var args = { + json, + params + }; + window.API.$emit('USER:CURRENT:SAVE', args); return args; }); } diff --git a/src/api/vrcPlusImage.js b/src/api/vrcPlusImage.js index ad08429e..fc32e1d1 100644 --- a/src/api/vrcPlusImage.js +++ b/src/api/vrcPlusImage.js @@ -56,7 +56,7 @@ const vrcPlusImageReq = { json, printId }; - window.API.$emit('PRINT:DELETE', args); + // window.API.$emit('PRINT:DELETE', args); return args; }); }, diff --git a/src/app.js b/src/app.js index 0baa0e3b..1ed42975 100644 --- a/src/app.js +++ b/src/app.js @@ -53,6 +53,21 @@ import { vrcPlusImageRequest, groupRequest } from './api'; +import { userDialogGroupSortingOptions } from './composables/user/constants/userDialogGroupSortingOptions'; +import { + getPrintFileName, + getPrintLocalDate, + languageClass +} from './composables/user/utils'; +import { + compareUnityVersion, + getPlatformInfo, + storeAvatarImage +} from './composables/avatar/utils'; + +import { displayLocation } from './composables/instance/utils'; + +import LoginPage from './views/Login/Login.vue'; // tabs import ModerationTab from './views/Moderation/Moderation.vue'; @@ -61,6 +76,13 @@ import SideBar from './views/SideBar/SideBar.vue'; import NavMenu from './components/NavMenu.vue'; import FriendListTab from './views/FriendList/FriendList.vue'; import FavoritesTab from './views/Favorites/Favorites.vue'; +import FriendLogTab from './views/FriendLog/FriendLog.vue'; +import GameLogTab from './views/GameLog/GameLog.vue'; +import NotificationTab from './views/Notifications/Notification.vue'; +import FeedTab from './views/Feed/Feed.vue'; +import SearchTab from './views/Search/Search.vue'; +import ProfileTab from './views/Profile/Profile.vue'; +import PlayerListTab from './views/PlayerList/PlayerList.vue'; // components import SimpleSwitch from './components/SimpleSwitch.vue'; @@ -72,13 +94,13 @@ import PreviousInstancesInfoDialog from './components/dialogs/PreviousInstancesD import FriendImportDialog from './views/Favorites/dialogs/FriendImportDialog.vue'; import WorldImportDialog from './views/Favorites/dialogs/WorldImportDialog.vue'; import AvatarImportDialog from './views/Favorites/dialogs/AvatarImportDialog.vue'; -import LaunchDialog from './components/LaunchDialog.vue'; -import PreviousInstancesUserDialog from './components/dialogs/PreviousInstancesDialog/PreviousInstancesUserDialog.vue'; +import LaunchDialog from './components/dialogs/LaunchDialog.vue'; import ChooseFavoriteGroupDialog from './components/dialogs/ChooseFavoriteGroupDialog.vue'; import ExportFriendsListDialog from './views/Profile/dialogs/ExportFriendsListDialog.vue'; import ExportAvatarsListDialog from './views/Profile/dialogs/ExportAvatarsListDialog.vue'; +import UserDialog from './components/dialogs/UserDialog/UserDialog.vue'; import GroupDialog from './components/dialogs/GroupDialog/GroupDialog.vue'; -import InviteGroupDialog from './components/dialogs/GroupDialog/InviteGroupDialog.vue'; +import InviteGroupDialog from './components/dialogs/InviteGroupDialog.vue'; import AvatarDialog from './components/dialogs/AvatarDialog/AvatarDialog.vue'; import FeedFiltersDialog from './views/Settings/dialogs/FeedFiltersDialog.vue'; import LaunchOptionsDialog from './views/Settings/dialogs/LaunchOptionsDialog.vue'; @@ -96,6 +118,20 @@ import AvatarProviderDialog from './views/Settings/dialogs/AvatarProviderDialog. import RegistryBackupDialog from './views/Settings/dialogs/RegistryBackupDialog.vue'; import PrimaryPasswordDialog from './views/Settings/dialogs/PrimaryPasswordDialog.vue'; import ChatboxBlacklistDialog from './views/PlayerList/dialogs/ChatboxBlacklistDialog.vue'; +import FullscreenImageDialog from './components/dialogs/FullscreenImageDialog.vue'; + +import SafeDialog from './components/dialogs/SafeDialog.vue'; + +import { hasGroupPermission } from './composables/group/utils'; +import { isRealInstance, parseLocation } from './composables/instance/utils'; +import { + checkVRChatCache, + convertFileUrlToImageUrl, + deleteVRChatCache, + extractFileId, + extractFileVersion, + getAvailablePlatforms +} from './composables/shared/utils'; // main app classes import _sharedFeed from './classes/sharedFeed.js'; @@ -107,7 +143,6 @@ import _apiLogin from './classes/apiLogin.js'; import _currentUser from './classes/currentUser.js'; import _updateLoop from './classes/updateLoop.js'; import _discordRpc from './classes/discordRpc.js'; -import _booping from './classes/booping.js'; import _vrcxUpdater from './classes/vrcxUpdater.js'; import _gameLog from './classes/gameLog.js'; import _gameRealtimeLogging from './classes/gameRealtimeLogging.js'; @@ -197,7 +232,6 @@ console.log(`isLinux: ${LINUX}`); currentUser: new _currentUser($app, API, $t), updateLoop: new _updateLoop($app, API, $t), discordRpc: new _discordRpc($app, API, $t), - booping: new _booping($app, API, $t), vrcxUpdater: new _vrcxUpdater($app, API, $t), gameLog: new _gameLog($app, API, $t), gameRealtimeLogging: new _gameRealtimeLogging($app, API, $t), @@ -232,14 +266,22 @@ console.log(`isLinux: ${LINUX}`); }, watch: {}, components: { + LoginPage, // tabs ModerationTab, ChartsTab, FriendListTab, FavoritesTab, + NotificationTab, + SearchTab, // - others SideBar, NavMenu, + FriendLogTab, + GameLogTab, + FeedTab, + ProfileTab, + PlayerListTab, // components // - common @@ -251,7 +293,7 @@ console.log(`isLinux: ${LINUX}`); // - dialogs // - previous instances PreviousInstancesInfoDialog, - PreviousInstancesUserDialog, + UserDialog, // - world WorldDialog, // - group @@ -287,7 +329,8 @@ console.log(`isLinux: ${LINUX}`); NotificationPositionDialog, AvatarProviderDialog, RegistryBackupDialog, - PrimaryPasswordDialog + PrimaryPasswordDialog, + FullscreenImageDialog }, provide() { return { @@ -302,20 +345,17 @@ console.log(`isLinux: ${LINUX}`); showFullscreenImageDialog: this.showFullscreenImageDialog, statusClass: this.statusClass, openExternalLink: this.openExternalLink, - beforeDialogClose: this.beforeDialogClose, - dialogMouseDown: this.dialogMouseDown, - dialogMouseUp: this.dialogMouseUp, showWorldDialog: this.showWorldDialog, showAvatarDialog: this.showAvatarDialog, showPreviousInstancesInfoDialog: this.showPreviousInstancesInfoDialog, - showInviteDialog: this.showInviteDialog, showLaunchDialog: this.showLaunchDialog, showFavoriteDialog: this.showFavoriteDialog, displayPreviousImages: this.displayPreviousImages, languageClass: this.languageClass, showGroupDialog: this.showGroupDialog, - showGallerySelectDialog: this.showGallerySelectDialog + showGallerySelectDialog: this.showGallerySelectDialog, + showGalleryDialog: this.showGalleryDialog }; }, el: '#root', @@ -476,6 +516,8 @@ console.log(`isLinux: ${LINUX}`); Vue.use(DataTables); + Vue.component('safe-dialog', SafeDialog); + dayjs.extend(duration); dayjs.extend(utc); dayjs.extend(timezone); @@ -628,12 +670,12 @@ console.log(`isLinux: ${LINUX}`); API.applyPresenceLocation = function (ref) { var presence = ref.presence; - if ($utils.isRealInstance(presence.world)) { + if (isRealInstance(presence.world)) { ref.$locationTag = `${presence.world}:${presence.instance}`; } else { ref.$locationTag = presence.world; } - if ($utils.isRealInstance(presence.travelingToWorld)) { + if (isRealInstance(presence.travelingToWorld)) { ref.$travelingToLocation = `${presence.travelingToWorld}:${presence.travelingToInstance}`; } else { ref.$travelingToLocation = presence.travelingToWorld; @@ -672,16 +714,16 @@ console.log(`isLinux: ${LINUX}`); API.applyUser = function (json) { var ref = this.cachedUsers.get(json.id); if (typeof json.statusDescription !== 'undefined') { - json.statusDescription = $app.replaceBioSymbols( + json.statusDescription = $utils.replaceBioSymbols( json.statusDescription ); json.statusDescription = $app.removeEmojis(json.statusDescription); } if (typeof json.bio !== 'undefined') { - json.bio = $app.replaceBioSymbols(json.bio); + json.bio = $utils.replaceBioSymbols(json.bio); } if (typeof json.note !== 'undefined') { - json.note = $app.replaceBioSymbols(json.note); + json.note = $utils.replaceBioSymbols(json.note); } if (json.currentAvatarImageUrl === $app.robotUrl) { delete json.currentAvatarImageUrl; @@ -761,7 +803,7 @@ console.log(`isLinux: ${LINUX}`); ref.$online_for = player.joinTime; } if (ref.location === 'traveling') { - ref.$location = $utils.parseLocation(ref.travelingToLocation); + ref.$location = parseLocation(ref.travelingToLocation); if ( !this.currentTravelers.has(ref.id) && ref.travelingToLocation @@ -776,7 +818,7 @@ console.log(`isLinux: ${LINUX}`); $app.onPlayerTraveling(travelRef); } } else { - ref.$location = $utils.parseLocation(ref.location); + ref.$location = parseLocation(ref.location); if (this.currentTravelers.has(ref.id)) { this.currentTravelers.delete(ref.id); $app.sharedFeed.pendingUpdate = true; @@ -818,7 +860,7 @@ console.log(`isLinux: ${LINUX}`); this.applyUserLanguage(ref); // traveling if (ref.location === 'traveling') { - ref.$location = $utils.parseLocation(ref.travelingToLocation); + ref.$location = parseLocation(ref.travelingToLocation); if (!this.currentTravelers.has(ref.id)) { var travelRef = { created_at: new Date().toJSON(), @@ -830,7 +872,7 @@ console.log(`isLinux: ${LINUX}`); $app.onPlayerTraveling(travelRef); } } else { - ref.$location = $utils.parseLocation(ref.location); + ref.$location = parseLocation(ref.location); if (this.currentTravelers.has(ref.id)) { this.currentTravelers.delete(ref.id); $app.sharedFeed.pendingUpdate = true; @@ -981,7 +1023,7 @@ console.log(`isLinux: ${LINUX}`); // If the user happens to be offline or the api is just being dumb, we assume that the user logged into VRCX is different than the one in-game and return the gameLog location. // This is really dumb. if (presenceLocation === gameLogLocation) { - const L = $utils.parseLocation(presenceLocation); + const L = parseLocation(presenceLocation); return L.worldId; } @@ -996,15 +1038,15 @@ console.log(`isLinux: ${LINUX}`); userLocation ); - if ($utils.isRealInstance(userLocation)) { + if (isRealInstance(userLocation)) { console.warn('PWI: returning user location', userLocation); - const L = $utils.parseLocation(userLocation); + const L = parseLocation(userLocation); return L.worldId; } - if ($utils.isRealInstance(gameLogLocation)) { + if (isRealInstance(gameLogLocation)) { console.warn(`PWI: returning gamelog location: `, gameLogLocation); - const L = $utils.parseLocation(gameLogLocation); + const L = parseLocation(gameLogLocation); return L.worldId; } @@ -1065,8 +1107,8 @@ console.log(`isLinux: ${LINUX}`); Object.assign(ref, json); } ref.$isLabs = ref.tags.includes('system_labs'); - ref.name = $app.replaceBioSymbols(ref.name); - ref.description = $app.replaceBioSymbols(ref.description); + ref.name = $utils.replaceBioSymbols(ref.name); + ref.description = $utils.replaceBioSymbols(ref.description); return ref; }; @@ -1129,7 +1171,7 @@ console.log(`isLinux: ${LINUX}`); } else { Object.assign(ref, json); } - ref.$location = $utils.parseLocation(ref.location); + ref.$location = parseLocation(ref.location); if (json.world?.id) { worldRequest .getCachedWorld({ @@ -1425,8 +1467,8 @@ console.log(`isLinux: ${LINUX}`); ref.unityPackages = unityPackages; } } - ref.name = $app.replaceBioSymbols(ref.name); - ref.description = $app.replaceBioSymbols(ref.description); + ref.name = $utils.replaceBioSymbols(ref.name); + ref.description = $utils.replaceBioSymbols(ref.description); return ref; }; @@ -2189,7 +2231,6 @@ console.log(`isLinux: ${LINUX}`); }; API.refreshFavoriteItems = function () { - // TODO: maybe...... var types = { world: [0, favoriteRequest.getFavoriteWorlds], avatar: [0, favoriteRequest.getFavoriteAvatars] @@ -2468,25 +2509,6 @@ console.log(`isLinux: ${LINUX}`); }); }; - // #endregion - // #region | API: Visit - - // no wrapper - API.getVisits = function () { - return this.call('visits', { - method: 'GET' - }).then((json) => { - var args = { - json - }; - this.$emit('VISITS', args); - return args; - }); - }; - - // #endregion - // API - // #endregion // #region | Misc @@ -2819,18 +2841,6 @@ console.log(`isLinux: ${LINUX}`); }).show(); }; - $app.data.isExportFriendsListDialogVisible = false; - - $app.methods.showExportFriendsListDialog = function () { - this.isExportFriendsListDialogVisible = true; - }; - - $app.data.isExportAvatarsListDialogVisible = false; - - $app.methods.showExportAvatarsListDialog = function () { - this.isExportAvatarsListDialogVisible = true; - }; - API.$on('USER:2FA', function () { AppApi.FocusWindow(); $app.promptTOTP(); @@ -3364,7 +3374,7 @@ console.log(`isLinux: ${LINUX}`); fromGetCurrentUser && ctx.state !== 'online' && typeof ref !== 'undefined' && - $utils.isRealInstance(ref.location) + isRealInstance(ref.location) ) { if (this.debugFriendState) { console.log( @@ -3569,7 +3579,7 @@ console.log(`isLinux: ${LINUX}`); $app.methods.getWorldName = async function (location) { var worldName = ''; try { - var L = $utils.parseLocation(location); + var L = parseLocation(location); if (L.isRealInstance && L.worldId) { var args = await worldRequest.getCachedWorld({ worldId: L.worldId @@ -3589,7 +3599,7 @@ console.log(`isLinux: ${LINUX}`); var groupName = ''; var groupId = data; if (!data.startsWith('grp_')) { - var L = $utils.parseLocation(data); + var L = parseLocation(data); groupId = L.groupId; if (!L.groupId) { return ''; @@ -3626,14 +3636,6 @@ console.log(`isLinux: ${LINUX}`); } }; - // ascending - var compareByName = function (a, b) { - if (typeof a.name !== 'string' || typeof b.name !== 'string') { - return 0; - } - return a.name.localeCompare(b.name); - }; - // ascending var compareByDisplayName = function (a, b) { if ( @@ -3645,25 +3647,6 @@ console.log(`isLinux: ${LINUX}`); return a.displayName.localeCompare(b.displayName); }; - // descending - var compareByUpdatedAt = function (a, b) { - if ( - typeof a.updated_at !== 'string' || - typeof b.updated_at !== 'string' - ) { - return 0; - } - var A = a.updated_at.toUpperCase(); - var B = b.updated_at.toUpperCase(); - if (A < B) { - return 1; - } - if (A > B) { - return -1; - } - return 0; - }; - var compareByMemberCount = function (a, b) { if ( typeof a.memberCount !== 'number' || @@ -3828,7 +3811,7 @@ console.log(`isLinux: ${LINUX}`); for (const sortMethod of sortMethods) { switch (sortMethod) { case 'Sort Alphabetically': - sorts.push(compareByName); + sorts.push($utils.compareByName); break; case 'Sort Private to Bottom': sorts.push(compareByPrivate); @@ -4125,7 +4108,7 @@ console.log(`isLinux: ${LINUX}`); } else if (B && !A) { return 1; } - return compareByName(a, b); + return $utils.compareByName(a, b); }); if (results.length > 4) { results.length = 4; @@ -4676,154 +4659,6 @@ console.log(`isLinux: ${LINUX}`); return regrouped; }; - /** - * Function that format the differences between two strings with HTML tags - * markerStartTag and markerEndTag are optional, if emitted, the differences will be highlighted with yellow and underlined. - * @param {*} s1 - * @param {*} s2 - * @param {*} markerStartTag - * @param {*} markerEndTag - * @returns An array that contains both the string 1 and string 2, which the differences are formatted with HTML tags - */ - $app.methods.formatDifference = function getWordDifferences( - oldString, - newString, - markerAddition = '{{text}}', - markerDeletion = '{{text}}' - ) { - [oldString, newString] = [oldString, newString].map((s) => - s - .replaceAll(/&/g, '&') - .replaceAll(//g, '>') - .replaceAll(/"/g, '"') - .replaceAll(/'/g, ''') - .replaceAll(/\n/g, '
') - ); - - const oldWords = oldString - .split(/\s+/) - .flatMap((word) => word.split(/(
)/)); - const newWords = newString - .split(/\s+/) - .flatMap((word) => word.split(/(
)/)); - - function findLongestMatch(oldStart, oldEnd, newStart, newEnd) { - let bestOldStart = oldStart; - let bestNewStart = newStart; - let bestSize = 0; - - const lookup = new Map(); - for (let i = oldStart; i < oldEnd; i++) { - const word = oldWords[i]; - if (!lookup.has(word)) lookup.set(word, []); - lookup.get(word).push(i); - } - - for (let j = newStart; j < newEnd; j++) { - const word = newWords[j]; - if (!lookup.has(word)) continue; - - for (const i of lookup.get(word)) { - let size = 0; - while ( - i + size < oldEnd && - j + size < newEnd && - oldWords[i + size] === newWords[j + size] - ) { - size++; - } - if (size > bestSize) { - bestOldStart = i; - bestNewStart = j; - bestSize = size; - } - } - } - - return { - oldStart: bestOldStart, - newStart: bestNewStart, - size: bestSize - }; - } - - function buildDiff(oldStart, oldEnd, newStart, newEnd) { - const result = []; - const match = findLongestMatch(oldStart, oldEnd, newStart, newEnd); - - if (match.size > 0) { - // Handle differences before the match - if (oldStart < match.oldStart || newStart < match.newStart) { - result.push( - ...buildDiff( - oldStart, - match.oldStart, - newStart, - match.newStart - ) - ); - } - - // Add the matched words - result.push( - oldWords - .slice(match.oldStart, match.oldStart + match.size) - .join(' ') - ); - - // Handle differences after the match - if ( - match.oldStart + match.size < oldEnd || - match.newStart + match.size < newEnd - ) { - result.push( - ...buildDiff( - match.oldStart + match.size, - oldEnd, - match.newStart + match.size, - newEnd - ) - ); - } - } else { - function build(words, start, end, pattern) { - let r = []; - let ts = words - .slice(start, end) - .filter((w) => w.length > 0) - .join(' ') - .split('
'); - for (let i = 0; i < ts.length; i++) { - if (i > 0) r.push('
'); - if (ts[i].length < 1) continue; - r.push(pattern.replace('{{text}}', ts[i])); - } - return r; - } - - // Add deletions - if (oldStart < oldEnd) - result.push( - ...build(oldWords, oldStart, oldEnd, markerDeletion) - ); - - // Add insertions - if (newStart < newEnd) - result.push( - ...build(newWords, newStart, newEnd, markerAddition) - ); - } - - return result; - } - - return buildDiff(0, oldWords.length, 0, newWords.length) - .join(' ') - .replace(/
[ ]+
/g, '

') - .replace(/
/g, '
'); - }; - // #endregion // #region | App: gameLog @@ -5143,7 +4978,7 @@ console.log(`isLinux: ${LINUX}`); return; } - var $location = $utils.parseLocation(this.lastLocation.location); + var $location = parseLocation(this.lastLocation.location); var instanceType = $location.accessType; if (instanceType === 'group') { if ($location.groupAccessType === 'members') { @@ -5175,19 +5010,21 @@ console.log(`isLinux: ${LINUX}`); return; } - API.saveCurrentUser({ - status: newStatus - }).then(() => { - var text = `Status automaticly changed to ${newStatus}`; - if (this.errorNoty) { - this.errorNoty.close(); - } - this.errorNoty = new Noty({ - type: 'info', - text - }).show(); - console.log(text); - }); + userRequest + .saveCurrentUser({ + status: newStatus + }) + .then(() => { + var text = `Status automaticly changed to ${newStatus}`; + if (this.errorNoty) { + this.errorNoty.close(); + } + this.errorNoty = new Noty({ + type: 'info', + text + }).show(); + console.log(text); + }); }; $app.methods.lookupUser = async function (ref) { @@ -5214,8 +5051,8 @@ console.log(`isLinux: ${LINUX}`); return; } } - this.$refs.searchTab.currentName = '0'; - this.menuActiveIndex = 'search'; + // this.$refs.searchTab.currentName = '0'; + // this.menuActiveIndex = 'search'; }; // #endregion @@ -5223,96 +5060,29 @@ console.log(`isLinux: ${LINUX}`); $app.data.searchText = ''; $app.data.searchUserResults = []; - $app.data.searchUserParams = {}; - $app.data.searchWorldResults = []; - $app.data.searchWorldOption = ''; - $app.data.searchWorldParams = {}; - $app.data.searchAvatarResults = []; - $app.data.searchAvatarPage = []; - $app.data.searchAvatarPageNum = 0; - $app.data.searchAvatarFilter = ''; - $app.data.searchAvatarSort = ''; - $app.data.searchAvatarFilterRemote = ''; - $app.data.searchGroupResults = []; - $app.data.searchGroupParams = {}; - $app.data.isSearchUserLoading = false; - $app.data.isSearchWorldLoading = false; - $app.data.isSearchAvatarLoading = false; - $app.data.isSearchGroupLoading = false; API.$on('LOGIN', function () { $app.searchText = ''; $app.searchUserResults = []; - $app.searchUserParams = {}; - $app.searchWorldResults = []; - $app.searchWorldOption = ''; - $app.searchWorldParams = {}; - $app.searchAvatarResults = []; - $app.searchAvatarPage = []; - $app.searchAvatarPageNum = 0; - $app.searchAvatarFilter = ''; - $app.searchAvatarSort = ''; - $app.searchAvatarFilterRemote = ''; - $app.searchGroupResults = []; - $app.searchGroupParams = {}; - $app.isSearchUserLoading = false; - $app.isSearchWorldLoading = false; - $app.isSearchAvatarLoading = false; }); $app.methods.clearSearch = function () { this.searchText = ''; - this.searchUserParams = {}; - this.searchWorldParams = {}; this.searchUserResults = []; - this.searchWorldResults = []; - this.searchAvatarResults = []; - this.searchAvatarPage = []; - this.searchAvatarPageNum = 0; - this.searchGroupParams = {}; - this.searchGroupResults = []; - }; - - $app.methods.search = function () { - switch (this.$refs.searchTab.currentName) { - case '0': - this.searchUser(); - break; - case '1': - this.searchWorld({}); - break; - case '2': - this.searchAvatar(); - break; - case '3': - this.searchGroup(); - break; - } }; $app.methods.searchUserByDisplayName = async function (displayName) { - this.searchUserParams = { + const params = { n: 10, offset: 0, fuzzy: false, search: displayName }; - await this.moreSearchUser(); + await this.moreSearchUser(null, params); }; - $app.methods.searchUser = async function () { - this.searchUserParams = { - n: 10, - offset: 0, - search: this.searchText, - customFields: this.searchUserByBio ? 'bio' : 'displayName', - sort: this.searchUserSortByLastLoggedIn ? 'last_login' : 'relevance' - }; - await this.moreSearchUser(); - }; - - $app.methods.moreSearchUser = async function (go) { - var params = this.searchUserParams; + $app.methods.moreSearchUser = async function (go, params) { + // var params = this.searchUserParams; if (go) { params.offset += params.n * go; if (params.offset < 0) { @@ -5338,268 +5108,6 @@ console.log(`isLinux: ${LINUX}`); }); }; - $app.data.searchWorldLabs = false; - - $app.data.searchUserByBio = false; - $app.data.searchUserSortByLastLoggedIn = false; - - $app.methods.searchWorld = function (ref) { - this.searchWorldOption = ''; - var params = { - n: 10, - offset: 0 - }; - switch (ref.sortHeading) { - case 'featured': - params.sort = 'order'; - params.featured = 'true'; - break; - case 'trending': - params.sort = 'popularity'; - params.featured = 'false'; - break; - case 'updated': - params.sort = 'updated'; - break; - case 'created': - params.sort = 'created'; - break; - case 'publication': - params.sort = 'publicationDate'; - break; - case 'shuffle': - params.sort = 'shuffle'; - break; - case 'active': - this.searchWorldOption = 'active'; - break; - case 'recent': - this.searchWorldOption = 'recent'; - break; - case 'favorite': - this.searchWorldOption = 'favorites'; - break; - case 'labs': - params.sort = 'labsPublicationDate'; - break; - case 'heat': - params.sort = 'heat'; - params.featured = 'false'; - break; - default: - params.sort = 'relevance'; - params.search = this.replaceBioSymbols(this.searchText); - break; - } - params.order = ref.sortOrder || 'descending'; - if (ref.sortOwnership === 'mine') { - params.user = 'me'; - params.releaseStatus = 'all'; - } - if (ref.tag) { - params.tag = ref.tag; - } - if (!this.searchWorldLabs) { - if (params.tag) { - params.tag += ',system_approved'; - } else { - params.tag = 'system_approved'; - } - } - // TODO: option.platform - this.searchWorldParams = params; - this.moreSearchWorld(); - }; - - $app.methods.moreSearchWorld = function (go) { - var params = this.searchWorldParams; - if (go) { - params.offset += params.n * go; - if (params.offset < 0) { - params.offset = 0; - } - } - this.isSearchWorldLoading = true; - worldRequest - .getWorlds(params, this.searchWorldOption) - .finally(() => { - this.isSearchWorldLoading = false; - }) - .then((args) => { - var map = new Map(); - for (var json of args.json) { - var ref = API.cachedWorlds.get(json.id); - if (typeof ref !== 'undefined') { - map.set(ref.id, ref); - } - } - this.searchWorldResults = Array.from(map.values()); - return args; - }); - }; - - $app.methods.searchAvatar = async function () { - this.isSearchAvatarLoading = true; - if (!this.searchAvatarFilter) { - this.searchAvatarFilter = 'all'; - } - if (!this.searchAvatarSort) { - this.searchAvatarSort = 'name'; - } - if (!this.searchAvatarFilterRemote) { - this.searchAvatarFilterRemote = 'all'; - } - if (this.searchAvatarFilterRemote !== 'local') { - this.searchAvatarSort = 'name'; - } - var avatars = new Map(); - var query = this.searchText.toUpperCase(); - if (!query) { - for (var ref of API.cachedAvatars.values()) { - switch (this.searchAvatarFilter) { - case 'all': - avatars.set(ref.id, ref); - break; - case 'public': - if (ref.releaseStatus === 'public') { - avatars.set(ref.id, ref); - } - break; - case 'private': - if (ref.releaseStatus === 'private') { - avatars.set(ref.id, ref); - } - break; - } - } - this.isSearchAvatarLoading = false; - } else { - if ( - this.searchAvatarFilterRemote === 'all' || - this.searchAvatarFilterRemote === 'local' - ) { - for (var ref of API.cachedAvatars.values()) { - var match = ref.name.toUpperCase().includes(query); - if (!match && ref.description) { - match = ref.description.toUpperCase().includes(query); - } - if (!match && ref.authorName) { - match = ref.authorName.toUpperCase().includes(query); - } - if (match) { - switch (this.searchAvatarFilter) { - case 'all': - avatars.set(ref.id, ref); - break; - case 'public': - if (ref.releaseStatus === 'public') { - avatars.set(ref.id, ref); - } - break; - case 'private': - if (ref.releaseStatus === 'private') { - avatars.set(ref.id, ref); - } - break; - } - } - } - } - if ( - (this.searchAvatarFilterRemote === 'all' || - this.searchAvatarFilterRemote === 'remote') && - this.avatarRemoteDatabase && - query.length >= 3 - ) { - var data = await this.lookupAvatars('search', query); - if (data && typeof data === 'object') { - data.forEach((avatar) => { - avatars.set(avatar.id, avatar); - }); - } - } - this.isSearchAvatarLoading = false; - } - var avatarsArray = Array.from(avatars.values()); - if (this.searchAvatarFilterRemote === 'local') { - switch (this.searchAvatarSort) { - case 'updated': - avatarsArray.sort(compareByUpdatedAt); - break; - case 'created': - avatarsArray.sort($utils.compareByCreatedAt); - break; - case 'name': - avatarsArray.sort(compareByName); - break; - } - } - this.searchAvatarPageNum = 0; - this.searchAvatarResults = avatarsArray; - this.searchAvatarPage = avatarsArray.slice(0, 10); - }; - - $app.methods.moreSearchAvatar = function (n) { - if (n === -1) { - this.searchAvatarPageNum--; - var offset = this.searchAvatarPageNum * 10; - } - if (n === 1) { - this.searchAvatarPageNum++; - var offset = this.searchAvatarPageNum * 10; - } - this.searchAvatarPage = this.searchAvatarResults.slice( - offset, - offset + 10 - ); - }; - - $app.methods.searchGroup = async function () { - this.searchGroupParams = { - n: 10, - offset: 0, - query: this.replaceBioSymbols(this.searchText) - }; - await this.moreSearchGroup(); - }; - - $app.methods.moreSearchGroup = async function (go) { - var params = this.searchGroupParams; - if (go) { - params.offset += params.n * go; - if (params.offset < 0) { - params.offset = 0; - } - } - this.isSearchGroupLoading = true; - await groupRequest - .groupSearch(params) - .finally(() => { - this.isSearchGroupLoading = false; - }) - .then((args) => { - // API.$on('GROUP:SEARCH', function (args) { - for (const json of args.json) { - API.$emit('GROUP', { - json, - params: { - groupId: json.id - } - }); - } - // }); - var map = new Map(); - for (var json of args.json) { - var ref = API.cachedGroups.get(json.id); - if (typeof ref !== 'undefined') { - map.set(ref.id, ref); - } - } - this.searchGroupResults = Array.from(map.values()); - return args; - }); - }; - // #endregion // #region | App: Favorite @@ -5833,7 +5341,7 @@ console.log(`isLinux: ${LINUX}`); $app.computed.favoriteFriends = function () { if (this.sortFavoriteFriends) { this.sortFavoriteFriends = false; - this.favoriteFriendsSorted.sort(compareByName); + this.favoriteFriendsSorted.sort($utils.compareByName); } if (this.sortFavorites) { return this.favoriteFriends_; @@ -5859,7 +5367,7 @@ console.log(`isLinux: ${LINUX}`); $app.computed.favoriteWorlds = function () { if (this.sortFavoriteWorlds) { this.sortFavoriteWorlds = false; - this.favoriteWorldsSorted.sort(compareByName); + this.favoriteWorldsSorted.sort($utils.compareByName); } if (this.sortFavorites) { return this.favoriteWorlds_; @@ -5870,7 +5378,7 @@ console.log(`isLinux: ${LINUX}`); $app.computed.favoriteAvatars = function () { if (this.sortFavoriteAvatars) { this.sortFavoriteAvatars = false; - this.favoriteAvatarsSorted.sort(compareByName); + this.favoriteAvatarsSorted.sort($utils.compareByName); } if (this.sortFavorites) { return this.favoriteAvatars_; @@ -5942,36 +5450,6 @@ console.log(`isLinux: ${LINUX}`); $app.deleteFriendship(args.params.userId); }); - API.$on('FRIEND:REQUEST', function (args) { - var ref = this.cachedUsers.get(args.params.userId); - if (typeof ref === 'undefined') { - return; - } - var friendLogHistory = { - created_at: new Date().toJSON(), - type: 'FriendRequest', - userId: ref.id, - displayName: ref.displayName - }; - $app.friendLogTable.data.push(friendLogHistory); - database.addFriendLogHistory(friendLogHistory); - }); - - API.$on('FRIEND:REQUEST:CANCEL', function (args) { - var ref = this.cachedUsers.get(args.params.userId); - if (typeof ref === 'undefined') { - return; - } - var friendLogHistory = { - created_at: new Date().toJSON(), - type: 'CancelFriendRequest', - userId: ref.id, - displayName: ref.displayName - }; - $app.friendLogTable.data.push(friendLogHistory); - database.addFriendLogHistory(friendLogHistory); - }); - $app.data.friendLogInitStatus = false; $app.data.notificationInitStatus = false; @@ -6251,24 +5729,6 @@ console.log(`isLinux: ${LINUX}`); ctx.trustLevel = ref.$trustLevel; }; - $app.methods.deleteFriendLog = function (row) { - $app.removeFromArray(this.friendLogTable.data, row); - database.deleteFriendLogHistory(row.rowId); - }; - - $app.methods.deleteFriendLogPrompt = function (row) { - this.$confirm('Continue? Delete Log', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - this.deleteFriendLog(row); - } - } - }); - }; - // #endregion // #region | App: Moderation @@ -6375,7 +5835,7 @@ console.log(`isLinux: ${LINUX}`); return; } - var L = $utils.parseLocation(currentLocation); + var L = parseLocation(currentLocation); worldRequest .getCachedWorld({ worldId: L.worldId @@ -6458,125 +5918,6 @@ console.log(`isLinux: ${LINUX}`); } }); - $app.methods.acceptFriendRequestNotification = function (row) { - // FIXME: 메시지 수정 - this.$confirm('Continue? Accept Friend Request', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - notificationRequest.acceptFriendRequestNotification({ - notificationId: row.id - }); - } - } - }); - }; - - $app.methods.hideNotification = function (row) { - if (row.type === 'ignoredFriendRequest') { - friendRequest.deleteHiddenFriendRequest( - { - notificationId: row.id - }, - row.senderUserId - ); - } else { - notificationRequest.hideNotification({ - notificationId: row.id - }); - } - }; - - $app.methods.hideNotificationPrompt = function (row) { - this.$confirm(`Continue? Decline ${row.type}`, 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - this.hideNotification(row); - } - } - }); - }; - - $app.methods.deleteNotificationLog = function (row) { - $app.removeFromArray(this.notificationTable.data, row); - if ( - row.type !== 'friendRequest' && - row.type !== 'ignoredFriendRequest' - ) { - database.deleteNotification(row.id); - } - }; - - $app.methods.deleteNotificationLogPrompt = function (row) { - this.$confirm(`Continue? Delete ${row.type}`, 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - this.deleteNotificationLog(row); - } - } - }); - }; - - $app.methods.acceptRequestInvite = function (row) { - this.$confirm('Continue? Send Invite', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - var currentLocation = this.lastLocation.location; - if (this.lastLocation.location === 'traveling') { - currentLocation = this.lastLocationDestination; - } - var L = $utils.parseLocation(currentLocation); - worldRequest - .getCachedWorld({ - worldId: L.worldId - }) - .then((args) => { - notificationRequest - .sendInvite( - { - instanceId: L.tag, - worldId: L.tag, - worldName: args.ref.name, - rsvp: true - }, - row.senderUserId - ) - .then((_args) => { - this.$message('Invite sent'); - notificationRequest.hideNotification({ - notificationId: row.id - }); - return _args; - }); - }); - } - } - }); - }; - - // Save Table Filters - $app.methods.saveTableFilters = async function () { - await configRepository.setString( - 'VRCX_friendLogTableFilters', - JSON.stringify(this.friendLogTable.filters[0].value) - ); - await configRepository.setString( - 'VRCX_notificationTableFilters', - JSON.stringify(this.notificationTable.filters[0].value) - ); - }; - $app.data.feedTable.filter = JSON.parse( await configRepository.getString('VRCX_feedTableFilters', '[]') ); @@ -6616,9 +5957,6 @@ console.log(`isLinux: ${LINUX}`); // #endregion // #region | App: Profile + Settings - $app.data.configTreeData = []; - $app.data.currentUserTreeData = []; - $app.data.currentUserFeedbackData = []; $app.data.pastDisplayNameTable = { data: [], tableProps: { @@ -6672,14 +6010,6 @@ console.log(`isLinux: ${LINUX}`); layout: 'table', visible: false }; - $app.data.socialStatusHistoryTable = { - data: [], - tableProps: { - stripe: true, - size: 'mini' - }, - layout: 'table' - }; $app.data.currentInstanceUserList = { data: [], tableProps: { @@ -8036,7 +7366,7 @@ console.log(`isLinux: ${LINUX}`); 'wrld_74970324-58e8-4239-a17b-2c59dfdf00db', 'wrld_266523e8-9161-40da-acd0-6bd82e075833' ]; - var L = $utils.parseLocation(location); + var L = parseLocation(location); if (rpcWorlds.includes(L.worldId)) { return true; } @@ -8081,7 +7411,6 @@ console.log(`isLinux: ${LINUX}`); }; API.$on('LOGIN', function () { - $app.currentUserTreeData = []; $app.pastDisplayNameTable.data = []; }); @@ -8091,31 +7420,6 @@ console.log(`isLinux: ${LINUX}`); } }); - API.$on('VISITS', function (args) { - $app.visits = args.json; - }); - - $app.methods.resetHome = function () { - this.$confirm('Continue? Reset Home', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - API.saveCurrentUser({ - homeLocation: '' - }).then((args) => { - this.$message({ - message: 'Home world has been reset', - type: 'success' - }); - return args; - }); - } - } - }); - }; - $app.methods.updateOpenVR = function () { if ( this.openVR && @@ -8199,16 +7503,6 @@ console.log(`isLinux: ${LINUX}`); speechSynthesis.speak(tts); }; - $app.methods.refreshConfigTreeData = async function () { - await API.getConfig(); - this.configTreeData = $utils.buildTreeData(API.cachedConfig); - }; - - $app.methods.refreshCurrentUserTreeData = async function () { - await API.getCurrentUser(); - this.currentUserTreeData = $utils.buildTreeData(API.currentUser); - }; - $app.methods.directAccessPaste = function () { AppApi.GetClipboard().then((clipboard) => { if (!this.directAccessParse(clipboard.trim())) { @@ -8426,8 +7720,9 @@ console.log(`isLinux: ${LINUX}`); name: $t('dialog.user.worlds.order.descending'), value: 'descending' }, + // because userDialogGroupSortingOptions, just i18n key groupSorting: { - name: $t('dialog.user.groups.sorting.alphabetical'), + name: 'dialog.user.groups.sorting.alphabetical', value: 'alphabetical' }, avatarSorting: 'update', @@ -8466,33 +7761,6 @@ console.log(`isLinux: ${LINUX}`); dateFriendedInfo: [] }; - $app.methods.setUserDialogWorldSorting = async function (sortOrder) { - var D = this.userDialog; - if (D.worldSorting === sortOrder) { - return; - } - D.worldSorting = sortOrder; - await this.refreshUserDialogWorlds(); - }; - - $app.methods.setUserDialogWorldOrder = async function (order) { - var D = this.userDialog; - if (D.worldOrder === order) { - return; - } - D.worldOrder = order; - await this.refreshUserDialogWorlds(); - }; - - $app.methods.setUserDialogGroupSorting = async function (sortOrder) { - var D = this.userDialog; - if (D.groupSorting === sortOrder) { - return; - } - D.groupSorting = sortOrder; - await this.sortCurrentUserGroups(); - }; - API.$on('LOGOUT', function () { $app.userDialog.visible = false; }); @@ -8546,18 +7814,6 @@ console.log(`isLinux: ${LINUX}`); D.outgoingRequest = json.outgoingRequest; }); - API.$on('FRIEND:REQUEST', function (args) { - var D = $app.userDialog; - if (D.visible === false || D.id !== args.params.userId) { - return; - } - if (args.json.success) { - D.isFriend = true; - } else { - D.outgoingRequest = true; - } - }); - API.$on('FRIEND:REQUEST:CANCEL', function (args) { var D = $app.userDialog; if (D.visible === false || D.id !== args.params.userId) { @@ -8688,7 +7944,6 @@ console.log(`isLinux: ${LINUX}`); if (!userId) { return; } - this.$nextTick(() => $app.adjustDialogZ(this.$refs.userDialog.$el)); const D = this.userDialog; D.id = userId; D.treeData = []; @@ -8748,7 +8003,6 @@ console.log(`isLinux: ${LINUX}`); D.dateFriended = ''; D.unFriended = false; D.dateFriendedInfo = []; - this.userDialogGroupEditMode = false; if (userId === API.currentUser.id) { this.getWorldName(API.currentUser.homeLocation).then( (worldName) => { @@ -8809,64 +8063,6 @@ console.log(`isLinux: ${LINUX}`); } this.applyUserDialogLocation(true); - // init last acitve tab data - if (this.$refs.userDialogTabs.currentName === '0') { - this.userDialogLastActiveTab = $t( - 'dialog.user.info.header' - ); - } else if ( - this.$refs.userDialogTabs.currentName === '1' - ) { - this.userDialogLastActiveTab = $t( - 'dialog.user.groups.header' - ); - if (this.userDialogLastGroup !== userId) { - this.userDialogLastGroup = userId; - this.getUserGroups(userId); - } - } else if ( - this.$refs.userDialogTabs.currentName === '2' - ) { - this.userDialogLastActiveTab = $t( - 'dialog.user.worlds.header' - ); - this.setUserDialogWorlds(userId); - if (this.userDialogLastWorld !== userId) { - this.userDialogLastWorld = userId; - this.refreshUserDialogWorlds(); - } - } else if ( - this.$refs.userDialogTabs.currentName === '3' - ) { - this.userDialogLastActiveTab = $t( - 'dialog.user.favorite_worlds.header' - ); - if (this.userDialogLastFavoriteWorld !== userId) { - this.userDialogLastFavoriteWorld = userId; - this.getUserFavoriteWorlds(userId); - } - } else if ( - this.$refs.userDialogTabs.currentName === '4' - ) { - this.userDialogLastActiveTab = $t( - 'dialog.user.avatars.header' - ); - this.setUserDialogAvatars(userId); - this.userDialogLastAvatar = userId; - if (userId === API.currentUser.id) { - this.refreshUserDialogAvatars(); - } - this.setUserDialogAvatarsRemote(userId); - } else if ( - this.$refs.userDialogTabs.currentName === '5' - ) { - this.userDialogLastActiveTab = $t( - 'dialog.user.json.header' - ); - this.refreshUserDialogTreeData(); - } - // init last acitve tab data - end - if (args.cache) { userRequest.getUser(args.params); } @@ -8952,7 +8148,7 @@ console.log(`isLinux: ${LINUX}`); .then((args1) => { D.representedGroup = args1.json; D.representedGroup.$thumbnailUrl = - this.getSmallThumbnailUrl( + convertFileUrlToImageUrl( args1.json.iconUrl ); if (!args1.json || !args1.json.isRepresenting) { @@ -8973,7 +8169,7 @@ console.log(`isLinux: ${LINUX}`); if (!D.visible) { return; } - var L = $utils.parseLocation(D.ref.$location.tag); + var L = parseLocation(D.ref.$location.tag); if (updateInstanceOccupants && L.isRealInstance) { instanceRequest.getInstance({ worldId: L.worldId, @@ -9340,7 +8536,7 @@ console.log(`isLinux: ${LINUX}`); bundleSizes: [], lastUpdated: '' }; - var L = $utils.parseLocation(instanceId); + var L = parseLocation(instanceId); this.currentInstanceLocation = L; worldRequest .getWorld({ @@ -9348,7 +8544,7 @@ console.log(`isLinux: ${LINUX}`); }) .then((args) => { this.currentInstanceWorld.ref = args.ref; - var { isPC, isQuest, isIos } = $utils.getAvailablePlatforms( + var { isPC, isQuest, isIos } = getAvailablePlatforms( args.ref.unityPackages ); this.currentInstanceWorld.isPC = isPC; @@ -9360,7 +8556,7 @@ console.log(`isLinux: ${LINUX}`); ); this.currentInstanceWorld.focusViewDisabled = args.ref?.tags.includes('feature_focus_view_disabled'); - $utils.checkVRChatCache(args.ref).then((cacheInfo) => { + checkVRChatCache(args.ref).then((cacheInfo) => { if (cacheInfo.Item1 > 0) { this.currentInstanceWorld.inCache = true; this.currentInstanceWorld.cacheSize = `${( @@ -9380,13 +8576,13 @@ console.log(`isLinux: ${LINUX}`); }) .then((args) => { this.currentInstanceWorld.ref = args.ref; - var { isPC, isQuest, isIos } = $utils.getAvailablePlatforms( + var { isPC, isQuest, isIos } = getAvailablePlatforms( args.ref.unityPackages ); this.currentInstanceWorld.isPC = isPC; this.currentInstanceWorld.isQuest = isQuest; this.currentInstanceWorld.isIos = isIos; - $utils.checkVRChatCache(args.ref).then((cacheInfo) => { + checkVRChatCache(args.ref).then((cacheInfo) => { if (cacheInfo.Item1 > 0) { this.currentInstanceWorld.inCache = true; this.currentInstanceWorld.cacheSize = `${( @@ -9396,12 +8592,12 @@ console.log(`isLinux: ${LINUX}`); }); }); } - if ($utils.isRealInstance(instanceId)) { + if (isRealInstance(instanceId)) { var ref = API.cachedInstances.get(instanceId); if (typeof ref !== 'undefined') { this.currentInstanceWorld.instance = ref; } else { - var L = $utils.parseLocation(instanceId); + var L = parseLocation(instanceId); if (L.isRealInstance) { instanceRequest .getInstance({ @@ -9416,75 +8612,12 @@ console.log(`isLinux: ${LINUX}`); } }; - $app.methods.selectCurrentInstanceRow = function (val) { - if (val === null) { - return; - } - var ref = val.ref; - if (ref.id) { - this.showUserDialog(ref.id); - } else { - this.lookupUser(ref); - } - }; - $app.methods.updateTimers = function () { for (var $timer of $timers) { $timer.update(); } }; - $app.methods.setUserDialogWorlds = function (userId) { - var worlds = []; - for (var ref of API.cachedWorlds.values()) { - if (ref.authorId === userId) { - worlds.push(ref); - } - } - $app.userDialog.worlds = worlds; - }; - - $app.methods.setUserDialogAvatars = function (userId) { - var avatars = new Set(); - this.userDialogAvatars.forEach((avatar) => { - avatars.add(avatar.id, avatar); - }); - for (var ref of API.cachedAvatars.values()) { - if (ref.authorId === userId && !avatars.has(ref.id)) { - this.userDialog.avatars.push(ref); - } - } - this.sortUserDialogAvatars(this.userDialog.avatars); - }; - - $app.methods.setUserDialogAvatarsRemote = async function (userId) { - if (this.avatarRemoteDatabase && userId !== API.currentUser.id) { - this.userDialog.isAvatarsLoading = true; - var data = await this.lookupAvatars('authorId', userId); - var avatars = new Set(); - this.userDialogAvatars.forEach((avatar) => { - avatars.add(avatar.id, avatar); - }); - if (data && typeof data === 'object') { - data.forEach((avatar) => { - if (avatar.id && !avatars.has(avatar.id)) { - if (avatar.authorId === userId) { - this.userDialog.avatars.push(avatar); - } else { - console.error( - `Avatar authorId mismatch for ${avatar.id} - ${avatar.name}` - ); - } - } - }); - } - this.userDialog.avatarSorting = 'name'; - this.userDialog.avatarReleaseStatus = 'all'; - this.userDialog.isAvatarsLoading = false; - } - this.sortUserDialogAvatars(this.userDialog.avatars); - }; - $app.methods.lookupAvatars = async function (type, search) { var avatars = new Map(); if (type === 'search') { @@ -9554,7 +8687,7 @@ console.log(`isLinux: ${LINUX}`); var url = this.avatarRemoteDatabaseProviderList[i]; var avatarArray = await this.lookupAvatarsByAuthor(url, authorId); for (var avatar of avatarArray) { - if ($utils.extractFileId(avatar.imageUrl) === fileId) { + if (extractFileId(avatar.imageUrl) === fileId) { return avatar.id; } } @@ -9614,63 +8747,13 @@ console.log(`isLinux: ${LINUX}`); $app.methods.sortUserDialogAvatars = function (array) { var D = this.userDialog; if (D.avatarSorting === 'update') { - array.sort(compareByUpdatedAt); + array.sort($utils.compareByUpdatedAt); } else { - array.sort(compareByName); + array.sort($utils.compareByName); } D.avatars = array; }; - $app.methods.refreshUserDialogWorlds = function () { - var D = this.userDialog; - if (D.isWorldsLoading) { - return; - } - D.isWorldsLoading = true; - var params = { - n: 50, - offset: 0, - sort: this.userDialog.worldSorting.value, - order: this.userDialog.worldOrder.value, - // user: 'friends', - userId: D.id, - releaseStatus: 'public' - }; - if (params.userId === API.currentUser.id) { - params.user = 'me'; - params.releaseStatus = 'all'; - } - var map = new Map(); - for (var ref of API.cachedWorlds.values()) { - if ( - ref.authorId === D.id && - (ref.authorId === API.currentUser.id || - ref.releaseStatus === 'public') - ) { - API.cachedWorlds.delete(ref.id); - } - } - API.bulk({ - fn: worldRequest.getWorlds, - N: -1, - params, - handle: (args) => { - for (var json of args.json) { - var $ref = API.cachedWorlds.get(json.id); - if (typeof $ref !== 'undefined') { - map.set($ref.id, $ref); - } - } - }, - done: () => { - if (D.id === params.userId) { - this.setUserDialogWorlds(D.id); - } - D.isWorldsLoading = false; - } - }); - }; - $app.methods.refreshUserDialogAvatars = function (fileId) { var D = this.userDialog; if (D.isAvatarsLoading) { @@ -9715,7 +8798,7 @@ console.log(`isLinux: ${LINUX}`); if (fileId) { D.loading = false; for (let ref of array) { - if ($utils.extractFileId(ref.imageUrl) === fileId) { + if (extractFileId(ref.imageUrl) === fileId) { this.showAvatarDialog(ref.id); return; } @@ -9729,254 +8812,6 @@ console.log(`isLinux: ${LINUX}`); }); }; - var performUserDialogCommand = (command, userId) => { - switch (command) { - case 'Delete Favorite': - favoriteRequest.deleteFavorite({ - objectId: userId - }); - break; - case 'Accept Friend Request': - var key = API.getFriendRequest(userId); - if (key === '') { - friendRequest.sendFriendRequest({ - userId - }); - } else { - notificationRequest.acceptFriendRequestNotification({ - notificationId: key - }); - } - break; - case 'Decline Friend Request': - var key = API.getFriendRequest(userId); - if (key === '') { - friendRequest.cancelFriendRequest({ - userId - }); - } else { - notificationRequest.hideNotification({ - notificationId: key - }); - } - break; - case 'Cancel Friend Request': - friendRequest.cancelFriendRequest({ - userId - }); - break; - case 'Send Friend Request': - friendRequest.sendFriendRequest({ - userId - }); - break; - case 'Moderation Unblock': - playerModerationRequest.deletePlayerModeration({ - moderated: userId, - type: 'block' - }); - break; - case 'Moderation Block': - playerModerationRequest.sendPlayerModeration({ - moderated: userId, - type: 'block' - }); - break; - case 'Moderation Unmute': - playerModerationRequest.deletePlayerModeration({ - moderated: userId, - type: 'mute' - }); - break; - case 'Moderation Mute': - playerModerationRequest.sendPlayerModeration({ - moderated: userId, - type: 'mute' - }); - break; - case 'Moderation Enable Avatar Interaction': - playerModerationRequest.deletePlayerModeration({ - moderated: userId, - type: 'interactOff' - }); - break; - case 'Moderation Disable Avatar Interaction': - playerModerationRequest.sendPlayerModeration({ - moderated: userId, - type: 'interactOff' - }); - break; - case 'Moderation Enable Chatbox': - playerModerationRequest.deletePlayerModeration({ - moderated: userId, - type: 'muteChat' - }); - break; - case 'Moderation Disable Chatbox': - playerModerationRequest.sendPlayerModeration({ - moderated: userId, - type: 'muteChat' - }); - break; - case 'Report Hacking': - $app.reportUserForHacking(userId); - break; - case 'Unfriend': - friendRequest.deleteFriend({ - userId - }); - break; - } - }; - - $app.methods.userDialogCommand = function (command) { - var D = this.userDialog; - if (D.visible === false) { - return; - } - if (command === 'Refresh') { - this.showUserDialog(D.id); - } else if (command === 'Share') { - this.copyUserURL(D.id); - } else if (command === 'Add Favorite') { - this.showFavoriteDialog('friend', D.id); - } else if (command === 'Edit Social Status') { - this.showSocialStatusDialog(); - } else if (command === 'Edit Language') { - this.showLanguageDialog(); - } else if (command === 'Edit Bio') { - this.showBioDialog(); - } else if (command === 'Edit Pronouns') { - this.showPronounsDialog(); - } else if (command === 'Logout') { - this.logout(); - } else if (command === 'Request Invite') { - notificationRequest - .sendRequestInvite( - { - platform: 'standalonewindows' - }, - D.id - ) - .then((args) => { - this.$message('Request invite sent'); - return args; - }); - } else if (command === 'Invite Message') { - var L = $utils.parseLocation(this.lastLocation.location); - worldRequest - .getCachedWorld({ - worldId: L.worldId - }) - .then((args) => { - this.showSendInviteDialog( - { - instanceId: this.lastLocation.location, - worldId: this.lastLocation.location, - worldName: args.ref.name - }, - D.id - ); - }); - } else if (command === 'Request Invite Message') { - this.showSendInviteRequestDialog( - { - platform: 'standalonewindows' - }, - D.id - ); - } else if (command === 'Invite') { - var currentLocation = this.lastLocation.location; - if (this.lastLocation.location === 'traveling') { - currentLocation = this.lastLocationDestination; - } - var L = $utils.parseLocation(currentLocation); - worldRequest - .getCachedWorld({ - worldId: L.worldId - }) - .then((args) => { - notificationRequest - .sendInvite( - { - instanceId: L.tag, - worldId: L.tag, - worldName: args.ref.name - }, - D.id - ) - .then((_args) => { - this.$message('Invite sent'); - return _args; - }); - }); - } else if (command === 'Show Avatar Author') { - var { currentAvatarImageUrl } = D.ref; - this.showAvatarAuthorDialog( - D.id, - D.$avatarInfo.ownerId, - currentAvatarImageUrl - ); - } else if (command === 'Show Fallback Avatar Details') { - var { fallbackAvatar } = D.ref; - if (fallbackAvatar) { - this.showAvatarDialog(fallbackAvatar); - } else { - this.$message({ - message: 'No fallback avatar set', - type: 'error' - }); - } - } else if (command === 'Previous Images') { - this.displayPreviousImages('User', 'Display'); - } else if (command === 'Previous Instances') { - this.showPreviousInstancesUserDialog(D.ref); - } else if (command === 'Manage Gallery') { - this.showGalleryDialog(); - } else if (command === 'Invite To Group') { - this.showInviteGroupDialog('', D.id); - } else if (command === 'Send Boop') { - this.showSendBoopDialog(D.id); - } else if (command === 'Hide Avatar') { - if (D.isHideAvatar) { - this.setPlayerModeration(D.id, 0); - } else { - this.setPlayerModeration(D.id, 4); - } - } else if (command === 'Show Avatar') { - if (D.isShowAvatar) { - this.setPlayerModeration(D.id, 0); - } else { - this.setPlayerModeration(D.id, 5); - } - } else { - const i18nPreFix = 'dialog.user.actions.'; - const formattedCommand = command.toLowerCase().replace(/ /g, '_'); - const displayCommandText = $t( - `${i18nPreFix}${formattedCommand}` - ).includes('i18nPreFix') - ? command - : $t(`${i18nPreFix}${formattedCommand}`); - - this.$confirm( - $t('confirm.message', { - command: displayCommandText - }), - $t('confirm.title'), - { - confirmButtonText: $t('confirm.confirm_button'), - cancelButtonText: $t('confirm.cancel_button'), - type: 'info', - callback: (action) => { - if (action === 'confirm') { - performUserDialogCommand(command, D.id); - } - } - } - ); - } - }; - $app.methods.refreshUserDialogTreeData = function () { var D = this.userDialog; if (D.id === API.currentUser.id) { @@ -9990,25 +8825,6 @@ console.log(`isLinux: ${LINUX}`); D.treeData = $utils.buildTreeData(D.ref); }; - $app.methods.changeUserDialogAvatarSorting = function (sortOption) { - const D = this.userDialog; - D.avatarSorting = sortOption; - this.sortUserDialogAvatars(D.avatars); - }; - - $app.computed.userDialogAvatars = function () { - var { avatars, avatarReleaseStatus } = this.userDialog; - if ( - avatarReleaseStatus === 'public' || - avatarReleaseStatus === 'private' - ) { - return avatars.filter( - (avatar) => avatar.releaseStatus === avatarReleaseStatus - ); - } - return avatars; - }; - // #endregion // #region | App: World Dialog @@ -10056,7 +8872,7 @@ console.log(`isLinux: ${LINUX}`); D.focusViewDisabled = ref.tags?.includes('feature_focus_view_disabled'); $app.applyWorldDialogInstances(); for (var room of D.rooms) { - if ($utils.isRealInstance(room.tag)) { + if (isRealInstance(room.tag)) { instanceRequest.getInstance({ worldId: D.id, instanceId: room.id @@ -10081,7 +8897,7 @@ console.log(`isLinux: ${LINUX}`); ) { continue; } - if (!$utils.compareUnityVersion(unityPackage.unitySortNumber)) { + if (!compareUnityVersion(unityPackage.unitySortNumber)) { continue; } @@ -10090,8 +8906,8 @@ console.log(`isLinux: ${LINUX}`); continue; } var assetUrl = unityPackage.assetUrl; - var fileId = $utils.extractFileId(assetUrl); - var fileVersion = parseInt($utils.extractFileVersion(assetUrl), 10); + var fileId = extractFileId(assetUrl); + var fileVersion = parseInt(extractFileVersion(assetUrl), 10); if (!fileId) { continue; } @@ -10171,7 +8987,7 @@ console.log(`isLinux: ${LINUX}`); $app.methods.showWorldDialog = function (tag, shortName) { const D = this.worldDialog; - const L = $utils.parseLocation(tag); + const L = parseLocation(tag); if (L.worldId === '') { return; } @@ -10198,7 +9014,7 @@ console.log(`isLinux: ${LINUX}`); D.isIos = false; D.hasPersistData = false; D.memo = ''; - var LL = $utils.parseLocation(this.lastLocation.location); + var LL = parseLocation(this.lastLocation.location); var currentWorldMatch = false; if (LL.worldId === D.id) { currentWorldMatch = true; @@ -10246,7 +9062,7 @@ console.log(`isLinux: ${LINUX}`); D.id ); } - var { isPC, isQuest, isIos } = $utils.getAvailablePlatforms( + var { isPC, isQuest, isIos } = getAvailablePlatforms( args.ref.unityPackages ); D.avatarScalingDisabled = args.ref?.tags.includes( @@ -10394,7 +9210,7 @@ console.log(`isLinux: ${LINUX}`); for (var instance of Object.values(instances)) { // due to references on callback of API.getUser() // this should be block scope variable - const L = $utils.parseLocation(`${D.id}:${instance.id}`); + const L = parseLocation(`${D.id}:${instance.id}`); instance.location = L.tag; if (!L.shortName) { L.shortName = instance.shortName; @@ -10579,7 +9395,7 @@ console.log(`isLinux: ${LINUX}`); for (var instance of Object.values(instances)) { // due to references on callback of API.getUser() // this should be block scope variable - const L = $utils.parseLocation(instance.tag); + const L = parseLocation(instance.tag); instance.location = instance.tag; instance.$location = L; if (instance.friendCount === 0) { @@ -10597,7 +9413,7 @@ console.log(`isLinux: ${LINUX}`); var ref = API.cachedInstances.get(room.tag); if (typeof ref !== 'undefined') { room.ref = ref; - } else if ($utils.isRealInstance(room.tag)) { + } else if (isRealInstance(room.tag)) { instanceRequest.getInstance({ worldId: room.$location.worldId, instanceId: room.$location.instanceId @@ -10667,7 +9483,7 @@ console.log(`isLinux: ${LINUX}`); return; } // self invite - var L = $utils.parseLocation(location); + var L = parseLocation(location); if (!L.isRealInstance) { return; } @@ -10773,13 +9589,13 @@ console.log(`isLinux: ${LINUX}`); if (/quest/.test(ref.tags)) { D.isQuestFallback = true; } - var { isPC, isQuest, isIos } = $utils.getAvailablePlatforms( + var { isPC, isQuest, isIos } = getAvailablePlatforms( args.ref.unityPackages ); D.isPC = isPC; D.isQuest = isQuest; D.isIos = isIos; - D.platformInfo = $utils.getPlatformInfo(args.ref.unityPackages); + D.platformInfo = getPlatformInfo(args.ref.unityPackages); for (let i = ref.unityPackages.length - 1; i > -1; i--) { var unityPackage = ref.unityPackages[i]; if (unityPackage.variant === 'impostor') { @@ -10841,7 +9657,7 @@ console.log(`isLinux: ${LINUX}`); $app.methods.checkAvatarCache = function (fileId) { var avatarId = ''; for (var ref of API.cachedAvatars.values()) { - if ($utils.extractFileId(ref.imageUrl) === fileId) { + if (extractFileId(ref.imageUrl) === fileId) { avatarId = ref.id; } } @@ -10864,7 +9680,7 @@ console.log(`isLinux: ${LINUX}`); ownerUserId, currentAvatarImageUrl ) { - var fileId = $utils.extractFileId(currentAvatarImageUrl); + var fileId = extractFileId(currentAvatarImageUrl); if (!fileId) { this.$message({ message: 'Sorry, the author is unknown', @@ -10965,277 +9781,6 @@ console.log(`isLinux: ${LINUX}`); $app.updateFavoriteDialog(args.params.objectId); }); - // #endregion - // #region | App: Invite Dialog - - $app.data.inviteDialog = { - visible: false, - loading: false, - worldId: '', - worldName: '', - userIds: [], - friendsInInstance: [] - }; - - API.$on('LOGOUT', function () { - $app.inviteDialog.visible = false; - }); - - $app.methods.addFriendsInInstanceToInvite = function () { - var D = this.inviteDialog; - for (var friend of D.friendsInInstance) { - if (!D.userIds.includes(friend.id)) { - D.userIds.push(friend.id); - } - } - }; - - $app.methods.addFavoriteFriendsToInvite = function () { - var D = this.inviteDialog; - for (var friend of this.vipFriends) { - if (!D.userIds.includes(friend.id)) { - D.userIds.push(friend.id); - } - } - }; - - $app.methods.addSelfToInvite = function () { - var D = this.inviteDialog; - if (!D.userIds.includes(API.currentUser.id)) { - D.userIds.push(API.currentUser.id); - } - }; - - $app.methods.sendInvite = function () { - this.$confirm('Continue? Invite', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - var D = this.inviteDialog; - if (action !== 'confirm' || D.loading === true) { - return; - } - D.loading = true; - var inviteLoop = () => { - if (D.userIds.length > 0) { - var receiverUserId = D.userIds.shift(); - if (receiverUserId === API.currentUser.id) { - // can't invite self!? - var L = $utils.parseLocation(D.worldId); - instanceRequest - .selfInvite({ - instanceId: L.instanceId, - worldId: L.worldId - }) - .finally(inviteLoop); - } else { - notificationRequest - .sendInvite( - { - instanceId: D.worldId, - worldId: D.worldId, - worldName: D.worldName - }, - receiverUserId - ) - .finally(inviteLoop); - } - } else { - D.loading = false; - D.visible = false; - this.$message({ - message: 'Invite sent', - type: 'success' - }); - } - }; - inviteLoop(); - } - }); - }; - - $app.methods.showInviteDialog = function (tag) { - if (!$utils.isRealInstance(tag)) { - return; - } - this.$nextTick(() => $app.adjustDialogZ(this.$refs.inviteDialog.$el)); - var L = $utils.parseLocation(tag); - worldRequest - .getCachedWorld({ - worldId: L.worldId - }) - .then((args) => { - var D = this.inviteDialog; - D.userIds = []; - D.worldId = L.tag; - D.worldName = args.ref.name; - D.friendsInInstance = []; - var friendsInCurrentInstance = this.lastLocation.friendList; - for (var friend of friendsInCurrentInstance.values()) { - var ctx = this.friends.get(friend.userId); - if (typeof ctx.ref === 'undefined') { - continue; - } - D.friendsInInstance.push(ctx); - } - D.visible = true; - }); - }; - - // #endregion - // #region | App: Social Status Dialog - - $app.data.socialStatusDialog = { - visible: false, - loading: false, - status: '', - statusDescription: '' - }; - - API.$on('LOGOUT', function () { - $app.socialStatusDialog.visible = false; - }); - - $app.methods.saveSocialStatus = function () { - var D = this.socialStatusDialog; - if (D.loading) { - return; - } - D.loading = true; - API.saveCurrentUser({ - status: D.status, - statusDescription: D.statusDescription - }) - .finally(() => { - D.loading = false; - }) - .then((args) => { - D.visible = false; - this.$message({ - message: 'Status updated', - type: 'success' - }); - return args; - }); - }; - - $app.methods.showSocialStatusDialog = function () { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.socialStatusDialog.$el) - ); - var D = this.socialStatusDialog; - var { statusHistory } = API.currentUser; - var statusHistoryArray = []; - for (var i = 0; i < statusHistory.length; ++i) { - var addStatus = { - no: i + 1, - status: statusHistory[i] - }; - statusHistoryArray.push(addStatus); - } - this.socialStatusHistoryTable.data = statusHistoryArray; - D.status = API.currentUser.status; - D.statusDescription = API.currentUser.statusDescription; - D.visible = true; - }; - - $app.methods.setSocialStatusFromHistory = function (val) { - if (val === null) { - return; - } - var D = this.socialStatusDialog; - D.statusDescription = val.status; - }; - - // #endregion - - // #region | App: Bio Dialog - - $app.data.bioDialog = { - visible: false, - loading: false, - bio: '', - bioLinks: [] - }; - - API.$on('LOGOUT', function () { - $app.bioDialog.visible = false; - }); - - $app.methods.saveBio = function () { - var D = this.bioDialog; - if (D.loading) { - return; - } - D.loading = true; - API.saveCurrentUser({ - bio: D.bio, - bioLinks: D.bioLinks - }) - .finally(() => { - D.loading = false; - }) - .then((args) => { - D.visible = false; - this.$message({ - message: 'Bio updated', - type: 'success' - }); - return args; - }); - }; - - $app.methods.showBioDialog = function () { - this.$nextTick(() => $app.adjustDialogZ(this.$refs.bioDialog.$el)); - var D = this.bioDialog; - D.bio = API.currentUser.bio; - D.bioLinks = API.currentUser.bioLinks.slice(); - D.visible = true; - }; - - // #endregion - // #region | App: Pronouns Dialog - - $app.data.pronounsDialog = { - visible: false, - loading: false, - pronouns: '' - }; - - API.$on('LOGOUT', function () { - $app.pronounsDialog.visible = false; - }); - - $app.methods.savePronouns = function () { - var D = this.pronounsDialog; - if (D.loading) { - return; - } - D.loading = true; - API.saveCurrentUser({ - pronouns: D.pronouns - }) - .finally(() => { - D.loading = false; - }) - .then((args) => { - D.visible = false; - this.$message({ - message: 'Pronouns updated', - type: 'success' - }); - return args; - }); - }; - - $app.methods.showPronounsDialog = function () { - this.$nextTick(() => $app.adjustDialogZ(this.$refs.pronounsDialog.$el)); - var D = this.pronounsDialog; - D.pronouns = API.currentUser.pronouns; - D.visible = true; - }; - // #endregion // #region | App: New Instance Dialog @@ -11345,10 +9890,7 @@ console.log(`isLinux: ${LINUX}`); if ( D.ageGate && type === 'group' && - $utils.hasGroupPermission( - D.groupRef, - 'group-instance-age-gated-create' - ) + hasGroupPermission(D.groupRef, 'group-instance-age-gated-create') ) { params.ageGate = true; } @@ -11370,15 +9912,17 @@ console.log(`isLinux: ${LINUX}`); if (action !== 'confirm') { return; } - API.saveCurrentUser({ - homeLocation: tag - }).then((args) => { - this.$message({ - message: 'Home world updated', - type: 'success' + userRequest + .saveCurrentUser({ + homeLocation: tag + }) + .then((args) => { + this.$message({ + message: 'Home world updated', + type: 'success' + }); + return args; }); - return args; - }); } }); }; @@ -11440,7 +9984,7 @@ console.log(`isLinux: ${LINUX}`); shortName, desktopMode ) { - var L = $utils.parseLocation(location); + var L = parseLocation(location); var args = []; if ( shortName && @@ -11540,46 +10084,6 @@ console.log(`isLinux: ${LINUX}`); document.getElementById('copy_to_clipboard').remove(); }; - $app.methods.copyUserId = function (userId) { - this.$message({ - message: 'User ID copied to clipboard', - type: 'success' - }); - this.copyToClipboard(userId); - }; - - $app.methods.copyUserURL = function (userId) { - this.$message({ - message: 'User URL copied to clipboard', - type: 'success' - }); - this.copyToClipboard(`https://vrchat.com/home/user/${userId}`); - }; - - $app.methods.copyUserDisplayName = function (displayName) { - this.$message({ - message: 'User DisplayName copied to clipboard', - type: 'success' - }); - this.copyToClipboard(displayName); - }; - - $app.methods.copyImageUrl = function (imageUrl) { - this.$message({ - message: 'ImageUrl copied to clipboard', - type: 'success' - }); - this.copyToClipboard(imageUrl); - }; - - $app.methods.copyText = function (text) { - this.$message({ - message: 'Text copied to clipboard', - type: 'success' - }); - this.copyToClipboard(text); - }; - $app.methods.copyLink = function (text) { this.$message({ message: 'Link copied to clipboard', @@ -11611,104 +10115,6 @@ console.log(`isLinux: ${LINUX}`); } }); - $app.methods.setVRCPlusIcon = function (fileId) { - if (!API.currentUser.$isVRCPlus) { - this.$message({ - message: 'VRCPlus required', - type: 'error' - }); - return; - } - var userIcon = ''; - if (fileId) { - userIcon = `${API.endpointDomain}/file/${fileId}/1`; - } - if (userIcon === API.currentUser.userIcon) { - return; - } - API.saveCurrentUser({ - userIcon - }).then((args) => { - this.$message({ - message: 'Icon changed', - type: 'success' - }); - return args; - }); - }; - - $app.methods.deleteVRCPlusIcon = function (fileId) { - vrcPlusIconRequest.deleteFile(fileId).then((args) => { - API.$emit('VRCPLUSICON:DELETE', args); - return args; - }); - }; - - API.$on('VRCPLUSICON:DELETE', function (args) { - var array = $app.VRCPlusIconsTable; - var { length } = array; - for (var i = 0; i < length; ++i) { - if (args.fileId === array[i].id) { - array.splice(i, 1); - break; - } - } - }); - - $app.methods.compareCurrentVRCPlusIcon = function (userIcon) { - var currentUserIcon = $utils.extractFileId(API.currentUser.userIcon); - if (userIcon === currentUserIcon) { - return true; - } - return false; - }; - - $app.methods.onFileChangeVRCPlusIcon = function (e) { - var clearFile = function () { - if (document.querySelector('#VRCPlusIconUploadButton')) { - document.querySelector('#VRCPlusIconUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if (!files.length) { - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - var r = new FileReader(); - r.onload = function () { - var base64Body = btoa(r.result); - vrcPlusIconRequest.uploadVRCPlusIcon(base64Body).then((args) => { - $app.$message({ - message: $t('message.icon.uploaded'), - type: 'success' - }); - return args; - }); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - $app.methods.displayVRCPlusIconUpload = function () { - document.getElementById('VRCPlusIconUploadButton').click(); - }; - API.$on('VRCPLUSICON:ADD', function (args) { if (Object.keys($app.VRCPlusIconsTable).length !== 0) { $app.VRCPlusIconsTable.unshift(args.json); @@ -11747,7 +10153,6 @@ console.log(`isLinux: ${LINUX}`); }; $app.methods.clearInviteImageUpload = function () { - this.clearImageGallerySelect(); var buttonList = document.querySelectorAll('.inviteImageUploadButton'); buttonList.forEach((button) => (button.value = '')); this.uploadImage = ''; @@ -11764,17 +10169,6 @@ console.log(`isLinux: ${LINUX}`); return '-'; }; - $app.methods.userOnlineForTimestamp = function (ctx) { - if (ctx.ref.state === 'online' && ctx.ref.$online_for) { - return ctx.ref.$online_for; - } else if (ctx.ref.state === 'active' && ctx.ref.$active_for) { - return ctx.ref.$active_for; - } else if (ctx.ref.$offline_for) { - return ctx.ref.$offline_for; - } - return 0; - }; - // #endregion // #region | App: Invite Messages @@ -11793,10 +10187,6 @@ console.log(`isLinux: ${LINUX}`); API.refreshInviteMessageTableData = inviteMessagesRequest.refreshInviteMessageTableData; - $app.methods.refreshInviteMessageTable = function (messageType) { - inviteMessagesRequest.refreshInviteMessageTableData(messageType); - }; - API.$on('INVITE:MESSAGE', function (args) { $app.inviteMessageTable.data = args.json; }); @@ -11834,601 +10224,6 @@ console.log(`isLinux: ${LINUX}`); D.messageType = messageType; }; - // #endregion - // #region | App: Edit and Send Invite Response Message Dialog - - $app.data.editAndSendInviteResponseDialog = { - visible: false, - inviteMessage: {}, - messageType: '', - newMessage: '' - }; - - $app.methods.showEditAndSendInviteResponseDialog = function ( - messageType, - inviteMessage - ) { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.editAndSendInviteResponseDialog.$el) - ); - this.editAndSendInviteResponseDialog = { - newMessage: inviteMessage.message, - visible: true, - messageType, - inviteMessage - }; - }; - - $app.methods.saveEditAndSendInviteResponse = async function () { - var D = this.editAndSendInviteResponseDialog; - D.visible = false; - var messageType = D.messageType; - var slot = D.inviteMessage.slot; - if (D.inviteMessage.message !== D.newMessage) { - var params = { - message: D.newMessage - }; - await inviteMessagesRequest - .editInviteMessage(params, messageType, slot) - .catch((err) => { - throw err; - }) - .then((args) => { - API.$emit(`INVITE:${messageType.toUpperCase()}`, args); - if (args.json[slot].message === D.inviteMessage.message) { - this.$message({ - message: - "VRChat API didn't update message, try again", - type: 'error' - }); - throw new Error( - "VRChat API didn't update message, try again" - ); - } else { - this.$message('Invite message updated'); - } - return args; - }); - } - var I = this.sendInviteResponseDialog; - var params = { - responseSlot: slot, - rsvp: true - }; - if ($app.uploadImage) { - notificationRequest - .sendInviteResponsePhoto(params, I.invite.id) - .catch((err) => { - throw err; - }) - .then((args) => { - notificationRequest.hideNotification({ - notificationId: I.invite.id - }); - this.$message({ - message: 'Invite response message sent', - type: 'success' - }); - this.sendInviteResponseDialogVisible = false; - this.sendInviteRequestResponseDialogVisible = false; - return args; - }); - } else { - notificationRequest - .sendInviteResponse(params, I.invite.id) - .catch((err) => { - throw err; - }) - .then((args) => { - notificationRequest.hideNotification({ - notificationId: I.invite.id - }); - this.$message({ - message: 'Invite response message sent', - type: 'success' - }); - this.sendInviteResponseDialogVisible = false; - this.sendInviteRequestResponseDialogVisible = false; - return args; - }); - } - }; - - $app.methods.cancelEditAndSendInviteResponse = function () { - this.editAndSendInviteResponseDialog.visible = false; - }; - - $app.data.sendInviteResponseDialog = { - message: '', - messageSlot: 0, - invite: {} - }; - - $app.data.sendInviteResponseDialogVisible = false; - - $app.data.sendInviteResponseConfirmDialog = { - visible: false - }; - - API.$on('LOGIN', function () { - $app.sendInviteResponseDialogVisible = false; - $app.sendInviteResponseConfirmDialog.visible = false; - }); - - $app.methods.showSendInviteResponseDialog = function (invite) { - this.sendInviteResponseDialog = { - invite - }; - inviteMessagesRequest.refreshInviteMessageTableData('response'); - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteResponseDialog.$el) - ); - this.clearInviteImageUpload(); - this.sendInviteResponseDialogVisible = true; - }; - - $app.methods.showSendInviteResponseConfirmDialog = function (val) { - if ( - this.editAndSendInviteResponseDialog.visible === true || - val === null - ) { - return; - } - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteResponseConfirmDialog.$el) - ); - this.sendInviteResponseConfirmDialog.visible = true; - this.sendInviteResponseDialog.messageSlot = val.slot; - }; - - $app.methods.cancelSendInviteResponse = function () { - this.sendInviteResponseDialogVisible = false; - }; - - $app.methods.cancelInviteResponseConfirm = function () { - this.sendInviteResponseConfirmDialog.visible = false; - }; - - $app.methods.sendInviteResponseConfirm = function () { - var D = this.sendInviteResponseDialog; - var params = { - responseSlot: D.messageSlot, - rsvp: true - }; - if ($app.uploadImage) { - notificationRequest - .sendInviteResponsePhoto(params, D.invite.id, D.messageType) - .catch((err) => { - throw err; - }) - .then((args) => { - notificationRequest.hideNotification({ - notificationId: D.invite.id - }); - this.$message({ - message: 'Invite response photo message sent', - type: 'success' - }); - return args; - }); - } else { - notificationRequest - .sendInviteResponse(params, D.invite.id, D.messageType) - .catch((err) => { - throw err; - }) - .then((args) => { - notificationRequest.hideNotification({ - notificationId: D.invite.id - }); - this.$message({ - message: 'Invite response message sent', - type: 'success' - }); - return args; - }); - } - this.sendInviteResponseDialogVisible = false; - this.sendInviteRequestResponseDialogVisible = false; - this.sendInviteResponseConfirmDialog.visible = false; - }; - - // #endregion - // #region | App: Invite Request Response Message Dialog - - $app.data.sendInviteRequestResponseDialogVisible = false; - - $app.methods.cancelSendInviteRequestResponse = function () { - this.sendInviteRequestResponseDialogVisible = false; - }; - - API.$on('LOGIN', function () { - $app.sendInviteRequestResponseDialogVisible = false; - $app.showSendInviteResponseConfirmDialog.visible = false; - }); - - $app.methods.showSendInviteRequestResponseDialog = function (invite) { - this.sendInviteResponseDialog = { - invite - }; - inviteMessagesRequest.refreshInviteMessageTableData('requestResponse'); - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteRequestResponseDialog.$el) - ); - this.clearInviteImageUpload(); - this.sendInviteRequestResponseDialogVisible = true; - }; - - // #endregion - // #region | App: Invite Message Dialog - - $app.data.editAndSendInviteDialog = { - visible: false, - messageType: '', - newMessage: '', - inviteMessage: {} - }; - - $app.methods.showEditAndSendInviteDialog = function ( - messageType, - inviteMessage - ) { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.editAndSendInviteDialog.$el) - ); - this.editAndSendInviteDialog = { - newMessage: inviteMessage.message, - visible: true, - messageType, - inviteMessage - }; - }; - - $app.methods.saveEditAndSendInvite = async function () { - var D = this.editAndSendInviteDialog; - D.visible = false; - var messageType = D.messageType; - var slot = D.inviteMessage.slot; - if (D.inviteMessage.message !== D.newMessage) { - var params = { - message: D.newMessage - }; - await inviteMessagesRequest - .editInviteMessage(params, messageType, slot) - .catch((err) => { - throw err; - }) - .then((args) => { - API.$emit(`INVITE:${messageType.toUpperCase()}`, args); - if (args.json[slot].message === D.inviteMessage.message) { - this.$message({ - message: - "VRChat API didn't update message, try again", - type: 'error' - }); - throw new Error( - "VRChat API didn't update message, try again" - ); - } else { - this.$message('Invite message updated'); - } - return args; - }); - } - var I = this.sendInviteDialog; - var J = this.inviteDialog; - if (J.visible) { - var inviteLoop = () => { - if (J.userIds.length > 0) { - var receiverUserId = J.userIds.shift(); - if (receiverUserId === API.currentUser.id) { - // can't invite self!? - var L = $utils.parseLocation(J.worldId); - instanceRequest - .selfInvite({ - instanceId: L.instanceId, - worldId: L.worldId - }) - .finally(inviteLoop); - } else if ($app.uploadImage) { - notificationRequest - .sendInvitePhoto( - { - instanceId: J.worldId, - worldId: J.worldId, - worldName: J.worldName, - messageSlot: slot - }, - receiverUserId - ) - .finally(inviteLoop); - } else { - notificationRequest - .sendInvite( - { - instanceId: J.worldId, - worldId: J.worldId, - worldName: J.worldName, - messageSlot: slot - }, - receiverUserId - ) - .finally(inviteLoop); - } - } else { - J.loading = false; - J.visible = false; - this.$message({ - message: 'Invite sent', - type: 'success' - }); - } - }; - inviteLoop(); - } else if (I.messageType === 'invite') { - I.params.messageSlot = slot; - if ($app.uploadImage) { - notificationRequest - .sendInvitePhoto(I.params, I.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Invite photo message sent', - type: 'success' - }); - return args; - }); - } else { - notificationRequest - .sendInvite(I.params, I.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Invite message sent', - type: 'success' - }); - return args; - }); - } - } else if (I.messageType === 'requestInvite') { - I.params.requestSlot = slot; - if ($app.uploadImage) { - notificationRequest - .sendRequestInvitePhoto(I.params, I.userId) - .catch((err) => { - this.clearInviteImageUpload(); - throw err; - }) - .then((args) => { - this.$message({ - message: 'Request invite photo message sent', - type: 'success' - }); - return args; - }); - } else { - notificationRequest - .sendRequestInvite(I.params, I.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Request invite message sent', - type: 'success' - }); - return args; - }); - } - } - this.sendInviteDialogVisible = false; - this.sendInviteRequestDialogVisible = false; - }; - - $app.methods.cancelEditAndSendInvite = function () { - this.editAndSendInviteDialog.visible = false; - }; - - $app.data.sendInviteDialog = { - message: '', - messageSlot: 0, - userId: '', - messageType: '', - params: {} - }; - - $app.data.sendInviteDialogVisible = false; - - $app.data.sendInviteConfirmDialog = { - visible: false - }; - - API.$on('LOGIN', function () { - $app.sendInviteDialogVisible = false; - $app.sendInviteConfirmDialog.visible = false; - }); - - $app.methods.showSendInviteDialog = function (params, userId) { - this.sendInviteDialog = { - params, - userId, - messageType: 'invite' - }; - inviteMessagesRequest.refreshInviteMessageTableData('message'); - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteDialog.$el) - ); - this.clearInviteImageUpload(); - this.sendInviteDialogVisible = true; - }; - - $app.methods.showSendInviteConfirmDialog = function (val) { - if (this.editAndSendInviteDialog.visible === true || val === null) { - return; - } - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteConfirmDialog.$el) - ); - this.sendInviteConfirmDialog.visible = true; - this.sendInviteDialog.messageSlot = val.slot; - }; - - $app.methods.cancelSendInvite = function () { - this.sendInviteDialogVisible = false; - }; - - $app.methods.cancelInviteConfirm = function () { - this.sendInviteConfirmDialog.visible = false; - }; - - $app.methods.sendInviteConfirm = function () { - var D = this.sendInviteDialog; - var J = this.inviteDialog; - if (J.visible) { - var inviteLoop = () => { - if (J.userIds.length > 0) { - var receiverUserId = J.userIds.shift(); - if (receiverUserId === API.currentUser.id) { - // can't invite self!? - var L = $utils.parseLocation(J.worldId); - instanceRequest - .selfInvite({ - instanceId: L.instanceId, - worldId: L.worldId - }) - .finally(inviteLoop); - } else if ($app.uploadImage) { - notificationRequest - .sendInvitePhoto( - { - instanceId: J.worldId, - worldId: J.worldId, - worldName: J.worldName, - messageSlot: D.messageSlot - }, - receiverUserId - ) - .finally(inviteLoop); - } else { - notificationRequest - .sendInvite( - { - instanceId: J.worldId, - worldId: J.worldId, - worldName: J.worldName, - messageSlot: D.messageSlot - }, - receiverUserId - ) - .finally(inviteLoop); - } - } else { - J.loading = false; - J.visible = false; - this.$message({ - message: 'Invite message sent', - type: 'success' - }); - } - }; - inviteLoop(); - } else if (D.messageType === 'invite') { - D.params.messageSlot = D.messageSlot; - if ($app.uploadImage) { - notificationRequest - .sendInvitePhoto(D.params, D.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Invite photo message sent', - type: 'success' - }); - return args; - }); - } else { - notificationRequest - .sendInvite(D.params, D.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Invite message sent', - type: 'success' - }); - return args; - }); - } - } else if (D.messageType === 'requestInvite') { - D.params.requestSlot = D.messageSlot; - if ($app.uploadImage) { - notificationRequest - .sendRequestInvitePhoto(D.params, D.userId) - .catch((err) => { - this.clearInviteImageUpload(); - throw err; - }) - .then((args) => { - this.$message({ - message: 'Request invite photo message sent', - type: 'success' - }); - return args; - }); - } else { - notificationRequest - .sendRequestInvite(D.params, D.userId) - .catch((err) => { - throw err; - }) - .then((args) => { - this.$message({ - message: 'Request invite message sent', - type: 'success' - }); - return args; - }); - } - } - this.sendInviteDialogVisible = false; - this.sendInviteRequestDialogVisible = false; - this.sendInviteConfirmDialog.visible = false; - }; - - // #endregion - // #region | App: Invite Request Message Dialog - - $app.data.sendInviteRequestDialogVisible = false; - - $app.methods.cancelSendInviteRequest = function () { - this.sendInviteRequestDialogVisible = false; - }; - - API.$on('LOGIN', function () { - $app.sendInviteRequestDialogVisible = false; - $app.showSendInviteConfirmDialog.visible = false; - }); - - $app.methods.showSendInviteRequestDialog = function (params, userId) { - this.sendInviteDialog = { - params, - userId, - messageType: 'requestInvite' - }; - inviteMessagesRequest.refreshInviteMessageTableData('request'); - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendInviteRequestDialog.$el) - ); - this.clearInviteImageUpload(); - this.sendInviteRequestDialogVisible = true; - }; - // #endregion // #region | App: Friends List @@ -12531,528 +10326,8 @@ console.log(`isLinux: ${LINUX}`); /* eslint-enable require-atomic-updates */ }; - $app.methods.genMd5 = async function (file) { - var response = await AppApi.MD5File(file); - return response; - }; - - $app.methods.resizeImageToFitLimits = async function (file) { - var response = await AppApi.ResizeImageToFitLimits(file); - return response; - }; - - $app.methods.genSig = async function (file) { - var response = await AppApi.SignFile(file); - return response; - }; - - $app.methods.genLength = async function (file) { - var response = await AppApi.FileLength(file); - return response; - }; - - // Upload avatar image - - $app.methods.onFileChangeAvatarImage = function (e) { - var clearFile = function () { - if (document.querySelector('#AvatarImageUploadButton')) { - document.querySelector('#AvatarImageUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if ( - !files.length || - !this.avatarDialog.visible || - this.avatarDialog.loading - ) { - clearFile(); - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - this.avatarDialog.loading = true; - this.changeAvatarImageDialogLoading = true; - var r = new FileReader(); - r.onload = async function (file) { - var base64File = await $app.resizeImageToFitLimits(btoa(r.result)); - // 10MB - var fileMd5 = await $app.genMd5(base64File); - var fileSizeInBytes = parseInt(file.total, 10); - var base64SignatureFile = await $app.genSig(base64File); - var signatureMd5 = await $app.genMd5(base64SignatureFile); - var signatureSizeInBytes = parseInt( - await $app.genLength(base64SignatureFile), - 10 - ); - var avatarId = $app.avatarDialog.id; - var { imageUrl } = $app.avatarDialog.ref; - var fileId = $utils.extractFileId(imageUrl); - if (!fileId) { - $app.$message({ - message: $t('message.avatar.image_invalid'), - type: 'error' - }); - clearFile(); - return; - } - $app.avatarImage = { - base64File, - fileMd5, - base64SignatureFile, - signatureMd5, - fileId, - avatarId - }; - var params = { - fileMd5, - fileSizeInBytes, - signatureMd5, - signatureSizeInBytes - }; - imageRequest.uploadAvatarImage(params, fileId); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - API.$on('AVATARIMAGE:INIT', function (args) { - var fileId = args.json.id; - var fileVersion = - args.json.versions[args.json.versions.length - 1].version; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadAvatarImageFileStart(params); - }); - - API.$on('AVATARIMAGE:FILESTART', function (args) { - var { url } = args.json; - var { fileId, fileVersion } = args.params; - var params = { - url, - fileId, - fileVersion - }; - this.uploadAvatarImageFileAWS(params); - }); - - API.uploadAvatarImageFileAWS = function (params) { - return webApiService - .execute({ - url: params.url, - uploadFilePUT: true, - fileData: $app.avatarImage.base64File, - fileMIME: 'image/png', - headers: { - 'Content-MD5': $app.avatarImage.fileMd5 - } - }) - .then((json) => { - if (json.status !== 200) { - $app.avatarDialog.loading = false; - $app.changeAvatarImageDialogLoading = false; - this.$throw('Avatar image upload failed', json, params.url); - } - var args = { - json, - params - }; - this.$emit('AVATARIMAGE:FILEAWS', args); - return args; - }); - }; - - API.$on('AVATARIMAGE:FILEAWS', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadAvatarImageFileFinish(params); - }); - - API.$on('AVATARIMAGE:FILEFINISH', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadAvatarImageSigStart(params); - }); - - API.$on('AVATARIMAGE:SIGSTART', function (args) { - var { url } = args.json; - var { fileId, fileVersion } = args.params; - var params = { - url, - fileId, - fileVersion - }; - this.uploadAvatarImageSigAWS(params); - }); - - API.uploadAvatarImageSigAWS = function (params) { - return webApiService - .execute({ - url: params.url, - uploadFilePUT: true, - fileData: $app.avatarImage.base64SignatureFile, - fileMIME: 'application/x-rsync-signature', - headers: { - 'Content-MD5': $app.avatarImage.signatureMd5 - } - }) - .then((json) => { - if (json.status !== 200) { - $app.avatarDialog.loading = false; - $app.changeAvatarImageDialogLoading = false; - this.$throw('Avatar image upload failed', json, params.url); - } - var args = { - json, - params - }; - this.$emit('AVATARIMAGE:SIGAWS', args); - return args; - }); - }; - - API.$on('AVATARIMAGE:SIGAWS', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadAvatarImageSigFinish(params); - }); - - API.$on('AVATARIMAGE:SIGFINISH', function (args) { - var { fileId, fileVersion } = args.params; - var parmas = { - id: $app.avatarImage.avatarId, - imageUrl: `${API.endpointDomain}/file/${fileId}/${fileVersion}/file` - }; - imageRequest.setAvatarImage(parmas); - }); - - // Upload world image - - $app.methods.onFileChangeWorldImage = function (e) { - var clearFile = function () { - if (document.querySelector('#WorldImageUploadButton')) { - document.querySelector('#WorldImageUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if ( - !files.length || - !this.worldDialog.visible || - this.worldDialog.loading - ) { - clearFile(); - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - this.worldDialog.loading = true; - this.changeWorldImageDialogLoading = true; - var r = new FileReader(); - r.onload = async function (file) { - var base64File = await $app.resizeImageToFitLimits(btoa(r.result)); - // 10MB - var fileMd5 = await $app.genMd5(base64File); - var fileSizeInBytes = parseInt(file.total, 10); - var base64SignatureFile = await $app.genSig(base64File); - var signatureMd5 = await $app.genMd5(base64SignatureFile); - var signatureSizeInBytes = parseInt( - await $app.genLength(base64SignatureFile), - 10 - ); - var worldId = $app.worldDialog.id; - var { imageUrl } = $app.worldDialog.ref; - var fileId = $utils.extractFileId(imageUrl); - if (!fileId) { - $app.$message({ - message: $t('message.world.image_invalid'), - type: 'error' - }); - clearFile(); - return; - } - $app.worldImage = { - base64File, - fileMd5, - base64SignatureFile, - signatureMd5, - fileId, - worldId - }; - var params = { - fileMd5, - fileSizeInBytes, - signatureMd5, - signatureSizeInBytes - }; - imageRequest.uploadWorldImage(params, fileId); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - API.$on('WORLDIMAGE:INIT', function (args) { - var fileId = args.json.id; - var fileVersion = - args.json.versions[args.json.versions.length - 1].version; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadWorldImageFileStart(params); - }); - - API.$on('WORLDIMAGE:FILESTART', function (args) { - var { url } = args.json; - var { fileId, fileVersion } = args.params; - var params = { - url, - fileId, - fileVersion - }; - this.uploadWorldImageFileAWS(params); - }); - - API.uploadWorldImageFileAWS = function (params) { - return webApiService - .execute({ - url: params.url, - uploadFilePUT: true, - fileData: $app.worldImage.base64File, - fileMIME: 'image/png', - headers: { - 'Content-MD5': $app.worldImage.fileMd5 - } - }) - .then((json) => { - if (json.status !== 200) { - $app.worldDialog.loading = false; - $app.changeWorldImageDialogLoading = false; - this.$throw('World image upload failed', json, params.url); - } - var args = { - json, - params - }; - this.$emit('WORLDIMAGE:FILEAWS', args); - return args; - }); - }; - - API.$on('WORLDIMAGE:FILEAWS', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadWorldImageFileFinish(params); - }); - - API.$on('WORLDIMAGE:FILEFINISH', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadWorldImageSigStart(params); - }); - - API.$on('WORLDIMAGE:SIGSTART', function (args) { - var { url } = args.json; - var { fileId, fileVersion } = args.params; - var params = { - url, - fileId, - fileVersion - }; - this.uploadWorldImageSigAWS(params); - }); - - API.uploadWorldImageSigAWS = function (params) { - return webApiService - .execute({ - url: params.url, - uploadFilePUT: true, - fileData: $app.worldImage.base64SignatureFile, - fileMIME: 'application/x-rsync-signature', - headers: { - 'Content-MD5': $app.worldImage.signatureMd5 - } - }) - .then((json) => { - if (json.status !== 200) { - $app.worldDialog.loading = false; - $app.changeWorldImageDialogLoading = false; - this.$throw('World image upload failed', json, params.url); - } - var args = { - json, - params - }; - this.$emit('WORLDIMAGE:SIGAWS', args); - return args; - }); - }; - - API.$on('WORLDIMAGE:SIGAWS', function (args) { - var { fileId, fileVersion } = args.params; - var params = { - fileId, - fileVersion - }; - imageRequest.uploadWorldImageSigFinish(params); - }); - - API.$on('WORLDIMAGE:SIGFINISH', function (args) { - var { fileId, fileVersion } = args.params; - var parmas = { - id: $app.worldImage.worldId, - imageUrl: `${API.endpointDomain}/file/${fileId}/${fileVersion}/file` - }; - imageRequest.setWorldImage(parmas); - }); - - API.$on('AVATARIMAGE:SET', function (args) { - $app.avatarDialog.loading = false; - $app.changeAvatarImageDialogLoading = false; - if (args.json.imageUrl === args.params.imageUrl) { - $app.$message({ - message: $t('message.avatar.image_changed'), - type: 'success' - }); - $app.displayPreviousImages('Avatar', 'Change'); - } else { - this.$throw(0, 'Avatar image change failed', args.params.imageUrl); - } - }); - - API.$on('WORLDIMAGE:SET', function (args) { - $app.worldDialog.loading = false; - $app.changeWorldImageDialogLoading = false; - if (args.json.imageUrl === args.params.imageUrl) { - $app.$message({ - message: $t('message.world.image_changed'), - type: 'success' - }); - $app.displayPreviousImages('World', 'Change'); - } else { - this.$throw(0, 'World image change failed', args.params.imageUrl); - } - }); - // Set avatar/world image - $app.methods.displayPreviousImages = function (type, command) { - this.previousImagesTableFileId = ''; - this.previousImagesTable = []; - var imageUrl = ''; - if (type === 'Avatar') { - var { imageUrl } = this.avatarDialog.ref; - } else if (type === 'World') { - var { imageUrl } = this.worldDialog.ref; - } else if (type === 'User') { - imageUrl = this.userDialog.ref.currentAvatarImageUrl; - } - var fileId = $utils.extractFileId(imageUrl); - if (!fileId) { - return; - } - var params = { - fileId - }; - if (command === 'Display') { - this.previousImagesDialogVisible = true; - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.previousImagesDialog.$el) - ); - } - if (type === 'Avatar') { - if (command === 'Change') { - this.changeAvatarImageDialogVisible = true; - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.changeAvatarImageDialog.$el) - ); - } - imageRequest.getAvatarImages(params).then((args) => { - this.previousImagesTableFileId = args.json.id; - var images = []; - args.json.versions.forEach((item) => { - if (!item.deleted) { - images.unshift(item); - } - }); - this.checkPreviousImageAvailable(images); - }); - } else if (type === 'World') { - if (command === 'Change') { - this.changeWorldImageDialogVisible = true; - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.changeWorldImageDialog.$el) - ); - } - imageRequest.getWorldImages(params).then((args) => { - this.previousImagesTableFileId = args.json.id; - var images = []; - args.json.versions.forEach((item) => { - if (!item.deleted) { - images.unshift(item); - } - }); - this.checkPreviousImageAvailable(images); - }); - } else if (type === 'User') { - imageRequest.getAvatarImages(params).then((args) => { - this.previousImagesTableFileId = args.json.id; - var images = []; - args.json.versions.forEach((item) => { - if (!item.deleted) { - images.unshift(item); - } - }); - this.checkPreviousImageAvailable(images); - }); - } - }; - $app.methods.checkPreviousImageAvailable = async function (images) { this.previousImagesTable = []; for (var image of images) { @@ -13070,139 +10345,20 @@ console.log(`isLinux: ${LINUX}`); } }; + // todo: userdialog $app.data.previousImagesDialogVisible = false; - $app.data.changeAvatarImageDialogVisible = false; - $app.data.changeAvatarImageDialogLoading = false; - $app.data.changeWorldImageDialogVisible = false; - $app.data.changeWorldImageDialogLoading = false; $app.data.previousImagesTable = []; - $app.data.previousImagesFileId = ''; API.$on('LOGIN', function () { $app.previousImagesTable = []; - $app.previousImagesDialogVisible = false; }); - API.$on('AVATARIMAGE:GET', function (args) { - $app.storeAvatarImage(args); - }); - - $app.methods.storeAvatarImage = function (args) { - var refCreatedAt = args.json.versions[0]; - var fileCreatedAt = refCreatedAt.created_at; - var fileId = args.params.fileId; - var avatarName = ''; - var imageName = args.json.name; - var avatarNameRegex = /Avatar - (.*) - Image -/gi.exec(imageName); - if (avatarNameRegex) { - avatarName = this.replaceBioSymbols(avatarNameRegex[1]); - } - var ownerId = args.json.ownerId; - var avatarInfo = { - ownerId, - avatarName, - fileCreatedAt - }; - API.cachedAvatarNames.set(fileId, avatarInfo); - return avatarInfo; - }; - - $app.methods.setAvatarImage = function (image) { - this.changeAvatarImageDialogLoading = true; - var parmas = { - id: this.avatarDialog.id, - imageUrl: `${API.endpointDomain}/file/${this.previousImagesTableFileId}/${image.version}/file` - }; - imageRequest.setAvatarImage(parmas).finally(() => { - this.changeAvatarImageDialogLoading = false; - this.changeAvatarImageDialogVisible = false; - }); - }; - - $app.methods.uploadAvatarImage = function () { - document.getElementById('AvatarImageUploadButton').click(); - }; - - // images.pug line 63, useless now - // $app.methods.deleteAvatarImage = function () { - // this.changeAvatarImageDialogLoading = true; - // var parmas = { - // fileId: this.previousImagesTableFileId, - // version: this.previousImagesTable[0].version - // }; - // vrcPlusIconRequest - // .deleteFileVersion(parmas) - // .then((args) => { - // this.previousImagesTableFileId = args.json.id; - // var images = []; - // args.json.versions.forEach((item) => { - // if (!item.deleted) { - // images.unshift(item); - // } - // }); - // this.checkPreviousImageAvailable(images); - // }) - // .finally(() => { - // this.changeAvatarImageDialogLoading = false; - // }); - // }; - - $app.methods.setWorldImage = function (image) { - this.changeWorldImageDialogLoading = true; - var parmas = { - id: this.worldDialog.id, - imageUrl: `${API.endpointDomain}/file/${this.previousImagesTableFileId}/${image.version}/file` - }; - imageRequest.setWorldImage(parmas).finally(() => { - this.changeWorldImageDialogLoading = false; - this.changeWorldImageDialogVisible = false; - }); - }; - - $app.methods.uploadWorldImage = function () { - document.getElementById('WorldImageUploadButton').click(); - }; - - // images.pug line 63 - // $app.methods.deleteWorldImage = function () { - // this.changeWorldImageDialogLoading = true; - // var parmas = { - // fileId: this.previousImagesTableFileId, - // version: this.previousImagesTable[0].version - // }; - // vrcPlusIconRequest - // .deleteFileVersion(parmas) - // .then((args) => { - // this.previousImagesTableFileId = args.json.id; - // var images = []; - // args.json.versions.forEach((item) => { - // if (!item.deleted) { - // images.unshift(item); - // } - // }); - // this.checkPreviousImageAvailable(images); - // }) - // .finally(() => { - // this.changeWorldImageDialogLoading = false; - // }); - // }; - - $app.methods.compareCurrentImage = function (image) { - if ( - `${API.endpointDomain}/file/${this.previousImagesTableFileId}/${image.version}/file` === - this.avatarDialog.ref.imageUrl - ) { - return true; - } - return false; - }; - // Avatar names API.cachedAvatarNames = new Map(); $app.methods.getAvatarName = async function (imageUrl) { - var fileId = $utils.extractFileId(imageUrl); + var fileId = extractFileId(imageUrl); if (!fileId) { return { ownerId: '', @@ -13213,58 +10369,7 @@ console.log(`isLinux: ${LINUX}`); return API.cachedAvatarNames.get(fileId); } var args = await imageRequest.getAvatarImages({ fileId }); - return this.storeAvatarImage(args); - }; - - $app.data.discordNamesDialogVisible = false; - - $app.methods.showDiscordNamesDialog = function () { - this.discordNamesDialogVisible = true; - }; - - // userDialog world/avatar tab click - - $app.data.userDialogLastActiveTab = ''; - $app.data.userDialogLastAvatar = ''; - $app.data.userDialogLastWorld = ''; - $app.data.userDialogLastFavoriteWorld = ''; - $app.data.userDialogLastGroup = ''; - - $app.methods.userDialogTabClick = function (obj) { - var userId = this.userDialog.id; - if (this.userDialogLastActiveTab === obj.label) { - return; - } - if (obj.label === $t('dialog.user.groups.header')) { - if (this.userDialogLastGroup !== userId) { - this.userDialogLastGroup = userId; - this.getUserGroups(userId); - } - } else if (obj.label === $t('dialog.user.avatars.header')) { - this.setUserDialogAvatars(userId); - if (this.userDialogLastAvatar !== userId) { - this.userDialogLastAvatar = userId; - if (userId === API.currentUser.id) { - this.refreshUserDialogAvatars(); - } else { - this.setUserDialogAvatarsRemote(userId); - } - } - } else if (obj.label === $t('dialog.user.worlds.header')) { - this.setUserDialogWorlds(userId); - if (this.userDialogLastWorld !== userId) { - this.userDialogLastWorld = userId; - this.refreshUserDialogWorlds(); - } - } else if (obj.label === $t('dialog.user.favorite_worlds.header')) { - if (this.userDialogLastFavoriteWorld !== userId) { - this.userDialogLastFavoriteWorld = userId; - this.getUserFavoriteWorlds(userId); - } - } else if (obj.label === $t('dialog.user.json.header')) { - this.refreshUserDialogTreeData(); - } - this.userDialogLastActiveTab = obj.label; + return storeAvatarImage(args); }; // VRChat Config JSON @@ -13334,7 +10439,7 @@ console.log(`isLinux: ${LINUX}`); $app.methods.processScreenshot = async function (path) { var newPath = path; if (this.screenshotHelper) { - var location = $utils.parseLocation(this.lastLocation.location); + var location = parseLocation(this.lastLocation.location); var metadata = { application: 'VRCX', version: 1, @@ -13447,7 +10552,7 @@ console.log(`isLinux: ${LINUX}`); D.cacheSize = 0; D.cacheLocked = false; D.cachePath = ''; - $utils.checkVRChatCache(D.ref).then((cacheInfo) => { + checkVRChatCache(D.ref).then((cacheInfo) => { if (cacheInfo.Item1 > 0) { D.inCache = true; D.cacheSize = `${(cacheInfo.Item1 / 1048576).toFixed( @@ -13467,7 +10572,7 @@ console.log(`isLinux: ${LINUX}`); D.cacheSize = 0; D.cacheLocked = false; D.cachePath = ''; - $utils.checkVRChatCache(D.ref).then((cacheInfo) => { + checkVRChatCache(D.ref).then((cacheInfo) => { if (cacheInfo.Item1 > 0) { D.inCache = true; D.cacheSize = `${(cacheInfo.Item1 / 1048576).toFixed( @@ -13491,7 +10596,7 @@ console.log(`isLinux: ${LINUX}`); }; $app.methods.deleteVRChatCache = async function (ref) { - await $utils.deleteVRChatCache(ref); + await deleteVRChatCache(ref); this.getVRChatCacheSize(); this.updateVRChatWorldCache(); this.updateVRChatAvatarCache(); @@ -13517,7 +10622,7 @@ console.log(`isLinux: ${LINUX}`); } var { location } = this.lastLocation; AppApi.VrcClosedGracefully().then((result) => { - if (result || !$utils.isRealInstance(location)) { + if (result || !isRealInstance(location)) { return; } // wait a bit for SteamVR to potentially close before deciding to relaunch @@ -13568,90 +10673,6 @@ console.log(`isLinux: ${LINUX}`); this.VRChatCacheSizeLoading = false; }; - $app.methods.getBundleLocation = async function (input) { - var assetUrl = input; - var variant = ''; - if (assetUrl) { - // continue - } else if ( - this.avatarDialog.visible && - this.avatarDialog.ref.unityPackages.length > 0 - ) { - var unityPackages = this.avatarDialog.ref.unityPackages; - for (let i = unityPackages.length - 1; i > -1; i--) { - var unityPackage = unityPackages[i]; - if ( - unityPackage.variant && - unityPackage.variant !== 'standard' && - unityPackage.variant !== 'security' - ) { - continue; - } - if ( - unityPackage.platform === 'standalonewindows' && - $utils.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - if (unityPackage.variant !== 'standard') { - variant = unityPackage.variant; - } - break; - } - } - } else if ( - this.avatarDialog.visible && - this.avatarDialog.ref.assetUrl - ) { - assetUrl = this.avatarDialog.ref.assetUrl; - } else if ( - this.worldDialog.visible && - this.worldDialog.ref.unityPackages.length > 0 - ) { - var unityPackages = this.worldDialog.ref.unityPackages; - for (let i = unityPackages.length - 1; i > -1; i--) { - var unityPackage = unityPackages[i]; - if ( - unityPackage.platform === 'standalonewindows' && - $utils.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - break; - } - } - } else if (this.worldDialog.visible && this.worldDialog.ref.assetUrl) { - assetUrl = this.worldDialog.ref.assetUrl; - } - if (!assetUrl) { - return null; - } - var fileId = $utils.extractFileId(assetUrl); - var fileVersion = parseInt($utils.extractFileVersion(assetUrl), 10); - var variantVersion = parseInt( - $utils.extractVariantVersion(assetUrl), - 10 - ); - var assetLocation = await AssetBundleManager.GetVRChatCacheFullLocation( - fileId, - fileVersion, - variant, - variantVersion - ); - var cacheInfo = await AssetBundleManager.CheckVRChatCache( - fileId, - fileVersion, - variant, - variantVersion - ); - var inCache = false; - if (cacheInfo.Item1 > 0) { - inCache = true; - } - console.log(`InCache: ${inCache}`); - var fullAssetLocation = `${assetLocation}\\__data`; - console.log(fullAssetLocation); - return fullAssetLocation; - }; - // Parse User URL $app.methods.parseUserUrl = function (user) { @@ -13664,151 +10685,8 @@ console.log(`isLinux: ${LINUX}`); return void 0; }; - // Parse Avatar URL - - $app.methods.parseAvatarUrl = function (avatar) { - var url = new URL(avatar); - var urlPath = url.pathname; - if (urlPath.substring(5, 13) === '/avatar/') { - var avatarId = urlPath.substring(13); - return avatarId; - } - return void 0; - }; - - // userDialog Favorite Worlds - - $app.data.userFavoriteWorlds = []; - - $app.methods.getUserFavoriteWorlds = async function (userId) { - this.userDialog.isFavoriteWorldsLoading = true; - if (typeof this.$refs.favoriteWorlds !== 'undefined') { - this.$refs.favoriteWorlds.currentName = '0'; // select first tab - } - this.userFavoriteWorlds = []; - var worldLists = []; - var params = { - ownerId: userId, - n: 100 - }; - var json = await API.call('favorite/groups', { - method: 'GET', - params - }); - for (var i = 0; i < json.length; ++i) { - var list = json[i]; - if (list.type !== 'world') { - continue; - } - var params = { - n: 100, - offset: 0, - userId, - tag: list.name - }; - try { - var args = await favoriteRequest.getFavoriteWorlds(params); - worldLists.push([list.displayName, list.visibility, args.json]); - } catch (err) {} - } - this.userFavoriteWorlds = worldLists; - this.userDialog.isFavoriteWorldsLoading = false; - }; - - $app.methods.userFavoriteWorldsStatus = function (visibility) { - var style = {}; - if (visibility === 'public') { - style.green = true; - } else if (visibility === 'friends') { - style.blue = true; - } else { - style.red = true; - } - return style; - }; - - // TODO: launch, invite, refresh, etc. buttons, better to split into one component - $app.methods.refreshInstancePlayerCount = function (instance) { - var L = $utils.parseLocation(instance); - if (L.isRealInstance) { - instanceRequest.getInstance({ - worldId: L.worldId, - instanceId: L.instanceId - }); - } - }; - // userDialog Groups - $app.data.userGroups = { - groups: [], - ownGroups: [], - mutualGroups: [], - remainingGroups: [] - }; - - $app.methods.getUserGroups = async function (userId) { - this.userDialog.isGroupsLoading = true; - this.userGroups = { - groups: [], - ownGroups: [], - mutualGroups: [], - remainingGroups: [] - }; - var args = await groupRequest.getGroups({ userId }); - if (userId !== this.userDialog.id) { - this.userDialog.isGroupsLoading = false; - return; - } - if (userId === API.currentUser.id) { - // update current user groups - API.currentUserGroups.clear(); - args.json.forEach((group) => { - var ref = API.applyGroup(group); - if (!API.currentUserGroups.has(group.id)) { - API.currentUserGroups.set(group.id, ref); - } - }); - this.saveCurrentUserGroups(); - } - this.userGroups.groups = args.json; - for (var i = 0; i < args.json.length; ++i) { - var group = args.json[i]; - if (!group?.id) { - console.error('getUserGroups, group ID is missing', group); - continue; - } - if (group.ownerId === userId) { - this.userGroups.ownGroups.unshift(group); - } - if (userId === API.currentUser.id) { - // skip mutual groups for current user - if (group.ownerId !== userId) { - this.userGroups.remainingGroups.unshift(group); - } - continue; - } - if (group.mutualGroup) { - this.userGroups.mutualGroups.unshift(group); - } - if (!group.mutualGroup && group.ownerId !== userId) { - this.userGroups.remainingGroups.unshift(group); - } - } - if (userId === API.currentUser.id) { - this.userDialog.groupSorting = - this.userDialogGroupSortingOptions.inGame; - } else if ( - this.userDialog.groupSorting === - this.userDialogGroupSortingOptions.inGame - ) { - this.userDialog.groupSorting = - this.userDialogGroupSortingOptions.alphabetical; - } - await this.sortCurrentUserGroups(); - this.userDialog.isGroupsLoading = false; - }; - $app.data.inGameGroupOrder = []; $app.methods.getVRChatRegistryKey = async function (key) { @@ -13833,21 +10711,6 @@ console.log(`isLinux: ${LINUX}`); } }; - $app.methods.sortGroupsByInGame = function (a, b) { - var aIndex = this.inGameGroupOrder.indexOf(a?.id); - var bIndex = this.inGameGroupOrder.indexOf(b?.id); - if (aIndex === -1 && bIndex === -1) { - return 0; - } - if (aIndex === -1) { - return 1; - } - if (bIndex === -1) { - return -1; - } - return aIndex - bIndex; - }; - $app.methods.sortGroupInstancesByInGame = function (a, b) { var aIndex = this.inGameGroupOrder.indexOf(a?.group?.id); var bIndex = this.inGameGroupOrder.indexOf(b?.group?.id); @@ -13863,99 +10726,6 @@ console.log(`isLinux: ${LINUX}`); return aIndex - bIndex; }; - $app.methods.sortCurrentUserGroups = async function () { - var D = this.userDialog; - var sortMethod = function () {}; - - switch (D.groupSorting.value) { - case 'alphabetical': - sortMethod = compareByName; - break; - case 'members': - sortMethod = compareByMemberCount; - break; - case 'inGame': - sortMethod = this.sortGroupsByInGame; - await this.updateInGameGroupOrder(); - break; - } - - this.userGroups.ownGroups.sort(sortMethod); - this.userGroups.mutualGroups.sort(sortMethod); - this.userGroups.remainingGroups.sort(sortMethod); - }; - - $app.data.userDialogGroupEditMode = false; - $app.data.userDialogGroupEditGroups = []; - - $app.methods.editModeCurrentUserGroups = async function () { - await this.updateInGameGroupOrder(); - this.userDialogGroupEditGroups = Array.from( - API.currentUserGroups.values() - ); - this.userDialogGroupEditGroups.sort(this.sortGroupsByInGame); - this.userDialogGroupEditMode = true; - }; - - $app.methods.exitEditModeCurrentUserGroups = async function () { - this.userDialogGroupEditMode = false; - this.userDialogGroupEditGroups = []; - await this.sortCurrentUserGroups(); - }; - - $app.methods.moveGroupUp = function (groupId) { - var index = this.inGameGroupOrder.indexOf(groupId); - if (index > 0) { - this.inGameGroupOrder.splice(index, 1); - this.inGameGroupOrder.splice(index - 1, 0, groupId); - this.saveInGameGroupOrder(); - } - }; - - $app.methods.moveGroupDown = function (groupId) { - var index = this.inGameGroupOrder.indexOf(groupId); - if (index < this.inGameGroupOrder.length - 1) { - this.inGameGroupOrder.splice(index, 1); - this.inGameGroupOrder.splice(index + 1, 0, groupId); - this.saveInGameGroupOrder(); - } - }; - - $app.methods.moveGroupTop = function (groupId) { - var index = this.inGameGroupOrder.indexOf(groupId); - if (index > 0) { - this.inGameGroupOrder.splice(index, 1); - this.inGameGroupOrder.unshift(groupId); - this.saveInGameGroupOrder(); - } - }; - - $app.methods.moveGroupBottom = function (groupId) { - var index = this.inGameGroupOrder.indexOf(groupId); - if (index < this.inGameGroupOrder.length - 1) { - this.inGameGroupOrder.splice(index, 1); - this.inGameGroupOrder.push(groupId); - this.saveInGameGroupOrder(); - } - }; - - $app.methods.saveInGameGroupOrder = async function () { - this.userDialogGroupEditGroups.sort(this.sortGroupsByInGame); - try { - await AppApi.SetVRChatRegistryKey( - `VRC_GROUP_ORDER_${API.currentUser.id}`, - JSON.stringify(this.inGameGroupOrder), - 3 - ); - } catch (err) { - console.error(err); - this.$message({ - message: 'Failed to save in-game group order', - type: 'error' - }); - } - }; - // #endregion // #region | Gallery @@ -13972,7 +10742,6 @@ console.log(`isLinux: ${LINUX}`); }); $app.methods.showGalleryDialog = function (pageNum) { - this.$nextTick(() => $app.adjustDialogZ(this.$refs.galleryDialog.$el)); this.galleryDialogVisible = true; this.refreshGalleryTable(); this.refreshVRCPlusIconsTable(); @@ -14007,106 +10776,6 @@ console.log(`isLinux: ${LINUX}`); } }); - $app.methods.setProfilePicOverride = function (fileId) { - if (!API.currentUser.$isVRCPlus) { - this.$message({ - message: 'VRCPlus required', - type: 'error' - }); - return; - } - var profilePicOverride = ''; - if (fileId) { - profilePicOverride = `${API.endpointDomain}/file/${fileId}/1`; - } - if (profilePicOverride === API.currentUser.profilePicOverride) { - return; - } - API.saveCurrentUser({ - profilePicOverride - }).then((args) => { - this.$message({ - message: 'Profile picture changed', - type: 'success' - }); - return args; - }); - }; - - $app.methods.deleteGalleryImage = function (fileId) { - vrcPlusIconRequest.deleteFile(fileId).then((args) => { - API.$emit('GALLERYIMAGE:DELETE', args); - return args; - }); - }; - - API.$on('GALLERYIMAGE:DELETE', function (args) { - var array = $app.galleryTable; - var { length } = array; - for (var i = 0; i < length; ++i) { - if (args.fileId === array[i].id) { - array.splice(i, 1); - break; - } - } - }); - - $app.methods.compareCurrentProfilePic = function (fileId) { - var currentProfilePicOverride = $utils.extractFileId( - API.currentUser.profilePicOverride - ); - if (fileId === currentProfilePicOverride) { - return true; - } - return false; - }; - - $app.methods.onFileChangeGallery = function (e) { - var clearFile = function () { - if (document.querySelector('#GalleryUploadButton')) { - document.querySelector('#GalleryUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if (!files.length) { - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - var r = new FileReader(); - r.onload = function () { - var base64Body = btoa(r.result); - vrcPlusImageRequest.uploadGalleryImage(base64Body).then((args) => { - $app.$message({ - message: $t('message.gallery.uploaded'), - type: 'success' - }); - return args; - }); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - $app.methods.displayGalleryUpload = function () { - document.getElementById('GalleryUploadButton').click(); - }; - API.$on('GALLERYIMAGE:ADD', function (args) { if (Object.keys($app.galleryTable).length !== 0) { $app.galleryTable.unshift(args.json); @@ -14135,72 +10804,6 @@ console.log(`isLinux: ${LINUX}`); } }); - $app.methods.deleteSticker = function (fileId) { - vrcPlusIconRequest.deleteFile(fileId).then((args) => { - API.$emit('STICKER:DELETE', args); - return args; - }); - }; - - API.$on('STICKER:DELETE', function (args) { - var array = $app.stickerTable; - var { length } = array; - for (var i = 0; i < length; ++i) { - if (args.fileId === array[i].id) { - array.splice(i, 1); - break; - } - } - }); - - $app.methods.onFileChangeSticker = function (e) { - var clearFile = function () { - if (document.querySelector('#StickerUploadButton')) { - document.querySelector('#StickerUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if (!files.length) { - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - var r = new FileReader(); - r.onload = function () { - var params = { - tag: 'sticker', - maskTag: 'square' - }; - var base64Body = btoa(r.result); - vrcPlusImageRequest - .uploadSticker(base64Body, params) - .then((args) => { - $app.$message({ - message: $t('message.sticker.uploaded'), - type: 'success' - }); - return args; - }); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - $app.methods.displayStickerUpload = function () { document.getElementById('StickerUploadButton').click(); }; @@ -14301,88 +10904,9 @@ console.log(`isLinux: ${LINUX}`); $app.galleryDialogPrintsLoading = false; }); - $app.methods.deletePrint = function (printId) { - vrcPlusImageRequest.deletePrint(printId); - }; - - API.$on('PRINT:DELETE', function (args) { - var array = $app.printTable; - var { length } = array; - for (var i = 0; i < length; ++i) { - if (args.printId === array[i].id) { - array.splice(i, 1); - break; - } - } - }); - $app.data.printUploadNote = ''; $app.data.printCropBorder = true; - $app.methods.onFileChangePrint = function (e) { - var clearFile = function () { - if (document.querySelector('#PrintUploadButton')) { - document.querySelector('#PrintUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if (!files.length) { - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - var r = new FileReader(); - r.onload = function () { - var date = new Date(); - // why the fuck isn't this UTC - date.setMinutes(date.getMinutes() - date.getTimezoneOffset()); - var timestamp = date.toISOString().slice(0, 19); - var params = { - note: $app.printUploadNote, - // worldId: '', - timestamp - }; - var base64Body = btoa(r.result); - var cropWhiteBorder = $app.printCropBorder; - vrcPlusImageRequest - .uploadPrint(base64Body, cropWhiteBorder, params) - .then((args) => { - $app.$message({ - message: $t('message.print.uploaded'), - type: 'success' - }); - return args; - }); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - $app.methods.displayPrintUpload = function () { - document.getElementById('PrintUploadButton').click(); - }; - - API.$on('PRINT:ADD', function (args) { - if (Object.keys($app.printTable).length !== 0) { - $app.printTable.unshift(args.json); - } - }); - $app.data.saveInstancePrints = await configRepository.getBool( 'VRCX_saveInstancePrints', false @@ -14398,41 +10922,6 @@ console.log(`isLinux: ${LINUX}`); false ); - $app.methods.getPrintLocalDate = function (print) { - if (print.createdAt) { - var createdAt = new Date(print.createdAt); - // cursed convert to local time - createdAt.setMinutes( - createdAt.getMinutes() - createdAt.getTimezoneOffset() - ); - return createdAt; - } - if (print.timestamp) { - var createdAt = new Date(print.timestamp); - return createdAt; - } - - var createdAt = new Date(); - // cursed convert to local time - createdAt.setMinutes( - createdAt.getMinutes() - createdAt.getTimezoneOffset() - ); - return createdAt; - }; - - $app.methods.getPrintFileName = function (print) { - var authorName = print.authorName; - // fileDate format: 2024-11-03_16-14-25.757 - var createdAt = this.getPrintLocalDate(print); - var fileNameDate = createdAt - .toISOString() - .replace(/:/g, '-') - .replace(/T/g, '_') - .replace(/Z/g, ''); - var fileName = `${authorName}_${fileNameDate}_${print.id}.png`; - return fileName; - }; - $app.data.printCache = []; $app.data.printQueue = []; $app.data.printQueueWorker = undefined; @@ -14466,7 +10955,7 @@ console.log(`isLinux: ${LINUX}`); return; } var print = args.json; - var createdAt = this.getPrintLocalDate(print); + var createdAt = getPrintLocalDate(print); try { var owner = await userRequest.getCachedUser({ userId: print.ownerId @@ -14478,7 +10967,7 @@ console.log(`isLinux: ${LINUX}`); console.error(err); } var monthFolder = createdAt.toISOString().slice(0, 7); - var fileName = this.getPrintFileName(print); + var fileName = getPrintFileName(print); var filePath = await AppApi.SavePrintToFile( imageUrl, this.ugcFolderPath, @@ -14523,231 +11012,15 @@ console.log(`isLinux: ${LINUX}`); } }); - $app.methods.deleteEmoji = function (fileId) { - vrcPlusIconRequest.deleteFile(fileId).then((args) => { - API.$emit('EMOJI:DELETE', args); - return args; - }); - }; - - API.$on('EMOJI:DELETE', function (args) { - var array = $app.emojiTable; - var { length } = array; - for (var i = 0; i < length; ++i) { - if (args.fileId === array[i].id) { - array.splice(i, 1); - break; - } - } - }); - - $app.methods.onFileChangeEmoji = function (e) { - var clearFile = function () { - if (document.querySelector('#EmojiUploadButton')) { - document.querySelector('#EmojiUploadButton').value = ''; - } - }; - var files = e.target.files || e.dataTransfer.files; - if (!files.length) { - return; - } - if (files[0].size >= 100000000) { - // 100MB - $app.$message({ - message: $t('message.file.too_large'), - type: 'error' - }); - clearFile(); - return; - } - if (!files[0].type.match(/image.*/)) { - $app.$message({ - message: $t('message.file.not_image'), - type: 'error' - }); - clearFile(); - return; - } - // set Emoji settings from fileName - this.parseEmojiFileName(files[0].name); - var r = new FileReader(); - r.onload = function () { - var params = { - tag: $app.emojiAnimType ? 'emojianimated' : 'emoji', - animationStyle: $app.emojiAnimationStyle.toLowerCase(), - maskTag: 'square' - }; - if ($app.emojiAnimType) { - params.frames = $app.emojiAnimFrameCount; - params.framesOverTime = $app.emojiAnimFps; - } - if ($app.emojiAnimLoopPingPong) { - params.loopStyle = 'pingpong'; - } - var base64Body = btoa(r.result); - vrcPlusImageRequest.uploadEmoji(base64Body, params).then((args) => { - $app.$message({ - message: $t('message.emoji.uploaded'), - type: 'success' - }); - return args; - }); - }; - r.readAsBinaryString(files[0]); - clearFile(); - }; - - $app.methods.displayEmojiUpload = function () { - document.getElementById('EmojiUploadButton').click(); - }; - API.$on('EMOJI:ADD', function (args) { if (Object.keys($app.emojiTable).length !== 0) { $app.emojiTable.unshift(args.json); } }); - $app.data.emojiAnimFps = 15; - $app.data.emojiAnimFrameCount = 4; - $app.data.emojiAnimType = false; - $app.data.emojiAnimationStyle = 'Stop'; - $app.data.emojiAnimLoopPingPong = false; - $app.data.emojiAnimationStyleUrl = - 'https://assets.vrchat.com/www/images/emoji-previews/'; - $app.data.emojiAnimationStyleList = { - Aura: 'Preview_B2-Aura.gif', - Bats: 'Preview_B2-Fall_Bats.gif', - Bees: 'Preview_B2-Bees.gif', - Bounce: 'Preview_B2-Bounce.gif', - Cloud: 'Preview_B2-Cloud.gif', - Confetti: 'Preview_B2-Winter_Confetti.gif', - Crying: 'Preview_B2-Crying.gif', - Dislike: 'Preview_B2-Dislike.gif', - Fire: 'Preview_B2-Fire.gif', - Idea: 'Preview_B2-Idea.gif', - Lasers: 'Preview_B2-Lasers.gif', - Like: 'Preview_B2-Like.gif', - Magnet: 'Preview_B2-Magnet.gif', - Mistletoe: 'Preview_B2-Winter_Mistletoe.gif', - Money: 'Preview_B2-Money.gif', - Noise: 'Preview_B2-Noise.gif', - Orbit: 'Preview_B2-Orbit.gif', - Pizza: 'Preview_B2-Pizza.gif', - Rain: 'Preview_B2-Rain.gif', - Rotate: 'Preview_B2-Rotate.gif', - Shake: 'Preview_B2-Shake.gif', - Snow: 'Preview_B2-Spin.gif', - Snowball: 'Preview_B2-Winter_Snowball.gif', - Spin: 'Preview_B2-Spin.gif', - Splash: 'Preview_B2-SummerSplash.gif', - Stop: 'Preview_B2-Stop.gif', - ZZZ: 'Preview_B2-ZZZ.gif' - }; - - $app.methods.generateEmojiStyle = function ( - url, - fps, - frameCount, - loopStyle - ) { - let framesPerLine = 2; - if (frameCount > 4) framesPerLine = 4; - if (frameCount > 16) framesPerLine = 8; - const animationDurationMs = (1000 / fps) * frameCount; - const frameSize = 1024 / framesPerLine; - const scale = 100 / (frameSize / 200); - const animStyle = loopStyle === 'pingpong' ? 'alternate' : 'none'; - const style = ` - transform: scale(${scale / 100}); - transform-origin: top left; - width: ${frameSize}px; - height: ${frameSize}px; - background: url('${url}') 0 0; - animation: ${animationDurationMs}ms steps(1) 0s infinite ${animStyle} running animated-emoji-${frameCount}; - `; - return style; - }; - - $app.methods.getEmojiFileName = function (emoji) { - if (emoji.frames) { - var loopStyle = emoji.loopStyle || 'linear'; - return `${emoji.name}_${emoji.animationStyle}animationStyle_${emoji.frames}frames_${emoji.framesOverTime}fps_${loopStyle}loopStyle.png`; - } else { - return `${emoji.name}_${emoji.animationStyle}animationStyle.png`; - } - }; - - $app.methods.parseEmojiFileName = function (fileName) { - // remove file extension - fileName = fileName.replace(/\.[^/.]+$/, ''); - var array = fileName.split('_'); - for (var i = 0; i < array.length; ++i) { - var value = array[i]; - if (value.endsWith('animationStyle')) { - this.emojiAnimType = false; - this.emojiAnimationStyle = value - .replace('animationStyle', '') - .toLowerCase(); - } - if (value.endsWith('frames')) { - this.emojiAnimType = true; - this.emojiAnimFrameCount = parseInt( - value.replace('frames', '') - ); - } - if (value.endsWith('fps')) { - this.emojiAnimFps = parseInt(value.replace('fps', '')); - } - if (value.endsWith('loopStyle')) { - this.emojiAnimLoopPingPong = value === 'pingpong'; - } - } - }; - // #endregion // #region Misc - $app.methods.replaceBioSymbols = function (text) { - if (!text) { - return ''; - } - var symbolList = { - '@': '@', - '#': '#', - $: '$', - '%': '%', - '&': '&', - '=': '=', - '+': '+', - '/': '⁄', - '\\': '\', - ';': ';', - ':': '˸', - ',': '‚', - '?': '?', - '!': 'ǃ', - '"': '"', - '<': '≺', - '>': '≻', - '.': '․', - '^': '^', - '{': '{', - '}': '}', - '[': '[', - ']': ']', - '(': '(', - ')': ')', - '|': '|', - '*': '∗' - }; - var newText = text; - for (var key in symbolList) { - var regex = new RegExp(symbolList[key], 'g'); - newText = newText.replace(regex, key); - } - return newText.replace(/ {1,}/g, ' ').trimRight(); - }; - $app.methods.removeEmojis = function (text) { if (!text) { return ''; @@ -14762,7 +11035,7 @@ console.log(`isLinux: ${LINUX}`); }; $app.methods.checkCanInvite = function (location) { - var L = $utils.parseLocation(location); + var L = parseLocation(location); var instance = API.cachedInstances.get(location); if (instance?.closedAt) { return false; @@ -14784,7 +11057,7 @@ console.log(`isLinux: ${LINUX}`); }; $app.methods.checkCanInviteSelf = function (location) { - var L = $utils.parseLocation(location); + var L = parseLocation(location); var instance = API.cachedInstances.get(location); if (instance?.closedAt) { return false; @@ -14828,7 +11101,7 @@ console.log(`isLinux: ${LINUX}`); (this.displayVRCPlusIconsAsAvatar && user.userIcon) ) { if (isIcon) { - return $utils.convertFileUrlToImageUrl(user.userIcon); + return convertFileUrlToImageUrl(user.userIcon); } return user.userIcon; } @@ -14859,9 +11132,7 @@ console.log(`isLinux: ${LINUX}`); } if (user.currentAvatarImageUrl) { if (isIcon) { - return $utils.convertFileUrlToImageUrl( - user.currentAvatarImageUrl - ); + return convertFileUrlToImageUrl(user.currentAvatarImageUrl); } return user.currentAvatarImageUrl; } @@ -15293,53 +11564,16 @@ console.log(`isLinux: ${LINUX}`); } }; - $app.methods.toggleAvatarCopying = function () { - API.saveCurrentUser({ - allowAvatarCopying: !API.currentUser.allowAvatarCopying - }).then((args) => { - return args; - }); - }; - $app.methods.toggleAllowBooping = function () { - API.saveCurrentUser({ - isBoopingEnabled: !API.currentUser.isBoopingEnabled - }).then((args) => { - return args; - }); + userRequest + .saveCurrentUser({ + isBoopingEnabled: !API.currentUser.isBoopingEnabled + }) + .then((args) => { + return args; + }); }; - // #endregion - // #region | App: Previous Instances User Dialog - - $app.data.previousInstancesUserDialog = { - visible: false, - openFlg: false, - userRef: {} - }; - - $app.methods.showPreviousInstancesUserDialog = function (userRef) { - var D = this.previousInstancesUserDialog; - D.userRef = userRef; - D.visible = true; - // trigger watcher - D.openFlg = true; - this.$nextTick(() => (D.openFlg = false)); - }; - - // no place use this - // $app.methods.getDisplayNameFromUserId = function (userId) { - // var displayName = userId; - // var ref = API.cachedUsers.get(userId); - // if ( - // typeof ref !== 'undefined' && - // typeof ref.displayName !== 'undefined' - // ) { - // displayName = ref.displayName; - // } - // return displayName; - // }; - // #endregion // #region | App: Previous Instances Info Dialog @@ -15463,28 +11697,6 @@ console.log(`isLinux: ${LINUX}`); this.loginForm.websocket = ''; }; - $app.data.mouseDownClass = []; - $app.data.mouseUpClass = []; - $app.methods.dialogMouseDown = function (e) { - this.mouseDownClass = [...e.target.classList]; - }; - $app.methods.dialogMouseUp = function (e) { - this.mouseUpClass = [...e.target.classList]; - }; - $app.methods.beforeDialogClose = function (done) { - if ( - this.mouseDownClass.includes('el-dialog__wrapper') && - this.mouseUpClass.includes('el-dialog__wrapper') - ) { - done(); - } else if ( - this.mouseDownClass.includes('el-dialog__close') && - this.mouseUpClass.includes('el-dialog__close') - ) { - done(); - } - }; - $app.methods.getNameColour = async function (userId) { var hue = await AppApi.GetColourFromUserID(userId); return this.HueToHex(hue); @@ -15566,23 +11778,6 @@ console.log(`isLinux: ${LINUX}`); return `#${decColor.toString(16).substr(1)}`; }; - $app.methods.isFriendOnline = function (friend) { - if ( - typeof friend === 'undefined' || - typeof friend.ref === 'undefined' - ) { - return false; - } - if (friend.state === 'online') { - return true; - } - if (friend.state !== 'online' && friend.ref.location !== 'private') { - // wat - return true; - } - return false; - }; - $app.methods.onPlayerTraveling = function (ref) { if ( !this.isGameRunning || @@ -15611,7 +11806,7 @@ console.log(`isLinux: ${LINUX}`); // update cached user with both gameLog and API locations var currentLocation = API.currentUser.$locationTag; - var L = $utils.parseLocation(currentLocation); + var L = parseLocation(currentLocation); if (L.isTraveling) { currentLocation = API.currentUser.$travelingToLocation; } @@ -15634,7 +11829,7 @@ console.log(`isLinux: ${LINUX}`); ref.$online_for = API.currentUser.$online_for; ref.$offline_for = API.currentUser.$offline_for; - ref.$location = $utils.parseLocation(currentLocation); + ref.$location = parseLocation(currentLocation); if (!this.isGameRunning || this.gameLogDisabled) { ref.$location_at = API.currentUser.$location_at; ref.$travelingToTime = API.currentUser.$travelingToTime; @@ -15677,9 +11872,9 @@ console.log(`isLinux: ${LINUX}`); this.lastLocationDestination = ''; this.lastLocationDestinationTime = 0; - if ($utils.isRealInstance(location)) { + if (isRealInstance(location)) { var dt = new Date().toJSON(); - var L = $utils.parseLocation(location); + var L = parseLocation(location); this.lastLocation.location = location; this.lastLocation.date = dt; @@ -15861,64 +12056,6 @@ console.log(`isLinux: ${LINUX}`); this.friendImportDialogVisible = true; }; - // #endregion - // #region | App: user dialog notes - - API.$on('NOTE', function (args) { - var note = ''; - var targetUserId = ''; - if (typeof args.json !== 'undefined') { - note = $app.replaceBioSymbols(args.json.note); - } - if (typeof args.params !== 'undefined') { - targetUserId = args.params.targetUserId; - } - if (targetUserId === $app.userDialog.id) { - if (note === args.params.note) { - $app.userDialog.noteSaving = false; - $app.userDialog.note = note; - } else { - // response is cached sadge :< - userRequest.getUser({ userId: targetUserId }); - } - } - var ref = API.cachedUsers.get(targetUserId); - if (typeof ref !== 'undefined') { - ref.note = note; - } - }); - - $app.methods.checkNote = function (ref, note) { - if (ref.note !== note) { - this.addNote(ref.id, note); - } - }; - - $app.methods.cleanNote = function (note) { - // remove newlines because they aren't supported - $app.userDialog.note = note.replace(/[\r\n]/g, ''); - }; - - $app.methods.addNote = function (userId, note) { - if (this.userDialog.id === userId) { - this.userDialog.noteSaving = true; - } - return miscRequest.saveNote({ - targetUserId: userId, - note - }); - }; - - $app.methods.deleteNote = function (userId) { - if (this.userDialog.id === userId) { - this.userDialog.noteSaving = true; - } - return miscRequest.saveNote({ - targetUserId: userId, - note: '' - }); - }; - // #endregion // #region | App: note export @@ -16277,7 +12414,7 @@ console.log(`isLinux: ${LINUX}`); for (var i = 0; i < this.localWorldFavoriteGroups.length; ++i) { var group = this.localWorldFavoriteGroups[i]; if (this.localWorldFavorites[group]) { - this.localWorldFavorites[group].sort(compareByName); + this.localWorldFavorites[group].sort($utils.compareByName); } } } @@ -16608,7 +12745,7 @@ console.log(`isLinux: ${LINUX}`); for (var i = 0; i < this.localAvatarFavoriteGroups.length; ++i) { var group = this.localAvatarFavoriteGroups[i]; if (this.localAvatarFavorites[group]) { - this.localAvatarFavorites[group].sort(compareByName); + this.localAvatarFavorites[group].sort($utils.compareByName); } } } @@ -16735,20 +12872,6 @@ console.log(`isLinux: ${LINUX}`); // #endregion // #region | App: ChatBox Blacklist - $app.data.chatboxBlacklistDialog = { - visible: false, - loading: false - }; - - $app.methods.showChatboxBlacklistDialog = function () { - // TODO:adjust z-index - // this.$nextTick(() => - // $app.adjustDialogZ(this.$refs.chatboxBlacklistDialog.$el) - // ); - const D = this.chatboxBlacklistDialog; - D.visible = true; - }; - $app.methods.checkChatboxBlacklist = function (msg) { for (var i = 0; i < this.chatboxBlacklist.length; ++i) { if (msg.includes(this.chatboxBlacklist[i])) { @@ -16788,21 +12911,6 @@ console.log(`isLinux: ${LINUX}`); ); }; - $app.methods.addChatboxUserBlacklist = async function (user) { - this.chatboxUserBlacklist.set(user.id, user.displayName); - await this.saveChatboxUserBlacklist(); - this.getCurrentInstanceUserList(); - }; - - $app.methods.deleteChatboxUserBlacklist = async function (userId) { - this.chatboxUserBlacklist.delete(userId); - await this.saveChatboxUserBlacklist(); - this.getCurrentInstanceUserList(); - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.chatboxBlacklistDialog.$el) - ); - }; - // #endregion // #region | App: Instance queuing @@ -16844,7 +12952,7 @@ console.log(`isLinux: ${LINUX}`); return; } if (!API.queuedInstances.has(instanceId)) { - var L = $utils.parseLocation(instanceId); + var L = parseLocation(instanceId); if (L.isRealInstance) { instanceRequest .getInstance({ @@ -16871,24 +12979,20 @@ console.log(`isLinux: ${LINUX}`); ref.$msgBox.close(); API.queuedInstances.delete(instanceId); } - var L = $utils.parseLocation(instanceId); + var L = parseLocation(instanceId); var group = API.cachedGroups.get(L.groupId); var groupName = group?.name ?? ''; var worldName = ref?.$worldName ?? ''; - var displayLocation = $app.displayLocation( - instanceId, - worldName, - groupName - ); + const location = displayLocation(instanceId, worldName, groupName); this.$message({ - message: `Instance ready to join ${displayLocation}`, + message: `Instance ready to join ${location}`, type: 'success' }); var noty = { created_at: new Date().toJSON(), type: 'group.queueReady', imageUrl: group?.iconUrl, - message: `Instance ready to join ${displayLocation}`, + message: `Instance ready to join ${location}`, location: instanceId, groupName, worldName @@ -16939,12 +13043,12 @@ console.log(`isLinux: ${LINUX}`); if (!ref.$worldName) { ref.$worldName = await this.getWorldName(instanceId); } - var displayLocation = this.displayLocation( + const location = displayLocation( instanceId, ref.$worldName, ref.$groupName ); - ref.$msgBox.message = `You are in position ${ref.position} of ${ref.queueSize} in the queue for ${displayLocation} `; + ref.$msgBox.message = `You are in position ${ref.position} of ${ref.queueSize} in the queue for ${location} `; API.queuedInstances.set(instanceId, ref); // workerTimers.setTimeout(this.instanceQueueTimeout, 3600000); }; @@ -16959,46 +13063,6 @@ console.log(`isLinux: ${LINUX}`); // #endregion - $app.methods.sendNotificationResponse = function ( - notificationId, - responses, - responseType - ) { - if (!Array.isArray(responses) || responses.length === 0) { - return null; - } - var responseData = ''; - for (var i = 0; i < responses.length; i++) { - if (responses[i].type === responseType) { - responseData = responses[i].data; - break; - } - } - return notificationRequest.sendNotificationResponse({ - notificationId, - responseType, - responseData - }); - }; - - $app.methods.openNotificationLink = function (link) { - if (!link) { - return; - } - var data = link.split(':'); - if (!data.length) { - return; - } - switch (data[0]) { - case 'group': - this.showGroupDialog(data[1]); - break; - case 'user': - this.showUserDialog(data[1]); - break; - } - }; - $app.methods.checkVRChatDebugLogging = async function () { if (this.gameLogDisabled) { return; @@ -17041,77 +13105,12 @@ console.log(`isLinux: ${LINUX}`); } }; - $app.methods.downloadAndSaveImage = async function (url, fileName) { - if (!url) { - return; - } - this.$message({ - message: 'Downloading image...', - type: 'info' - }); - try { - var response = await webApiService.execute({ - url, - method: 'GET' - }); - if ( - response.status !== 200 || - !response.data.startsWith('data:image/png') - ) { - throw new Error(`Error: ${response.data}`); - } - var link = document.createElement('a'); - link.href = response.data; - var fileId = $utils.extractFileId(url); - if (!fileName && fileId) { - fileName = `${fileId}.png`; - } - if (!fileName) { - fileName = `${url.split('/').pop()}.png`; - } - if (!fileName) { - fileName = 'image.png'; - } - link.setAttribute('download', fileName); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } catch { - new Noty({ - type: 'error', - text: $app.escapeTag(`Failed to download image. ${url}`) - }).show(); - } - }; - - $app.methods.setPlayerModeration = function (userId, type) { - var D = this.userDialog; - AppApi.SetVRChatUserModeration(API.currentUser.id, userId, type).then( - (result) => { - if (result) { - if (type === 4) { - D.isShowAvatar = false; - D.isHideAvatar = true; - } else if (type === 5) { - D.isShowAvatar = true; - D.isHideAvatar = false; - } else { - D.isShowAvatar = false; - D.isHideAvatar = false; - } - } else { - $app.$message({ - message: $t('message.avatar.change_moderation_failed'), - type: 'error' - }); - } - } - ); - }; - // #endregion // #region | App: Language + $app.data.userDialogWorldSortingOptions = {}; + $app.data.userDialogWorldOrderOptions = {}; + $app.methods.applyUserDialogSortingStrings = function () { this.userDialogWorldSortingOptions = { name: { @@ -17146,21 +13145,6 @@ console.log(`isLinux: ${LINUX}`); value: 'ascending' } }; - - this.userDialogGroupSortingOptions = { - alphabetical: { - name: $t('dialog.user.groups.sorting.alphabetical'), - value: 'alphabetical' - }, - members: { - name: $t('dialog.user.groups.sorting.members'), - value: 'members' - }, - inGame: { - name: $t('dialog.user.groups.sorting.in_game'), - value: 'inGame' - } - }; }; $app.data.groupDialogSortingOptions = {}; @@ -17203,7 +13187,7 @@ console.log(`isLinux: ${LINUX}`); this.userDialog.worldOrder = this.userDialogWorldOrderOptions.descending; this.userDialog.groupSorting = - this.userDialogGroupSortingOptions.alphabetical; + userDialogGroupSortingOptions.alphabetical; this.groupDialog.memberFilter = this.groupDialogFilterOptions.everyone; this.groupDialog.memberSortOrder = @@ -17247,15 +13231,6 @@ console.log(`isLinux: ${LINUX}`); // #endregion // #region | App: Random unsorted app methods, data structs, API functions, and an API feedback/file analysis event - API.$on('USER:FEEDBACK', function (args) { - if (args.params.userId === this.currentUser.id) { - $app.currentUserFeedbackData = $utils.buildTreeData(args.json); - } - }); - - $app.methods.getCurrentUserFeedback = function () { - return userRequest.getUserFeedback({ userId: API.currentUser.id }); - }; $app.data.changeLogDialog = { visible: false, @@ -17268,44 +13243,6 @@ console.log(`isLinux: ${LINUX}`); this.checkForVRCXUpdate(); }; - $app.data.gallerySelectDialog = { - visible: false, - selectedFileId: '', - selectedImageUrl: '' - }; - - $app.methods.showGallerySelectDialog = function () { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.gallerySelectDialog.$el) - ); - var D = this.gallerySelectDialog; - D.visible = true; - this.refreshGalleryTable(); - }; - - $app.methods.selectImageGallerySelect = function (imageUrl, fileId) { - var D = this.gallerySelectDialog; - D.selectedFileId = fileId; - D.selectedImageUrl = imageUrl; - D.visible = false; - console.log(imageUrl, fileId); - }; - - $app.methods.clearImageGallerySelect = function () { - var D = this.gallerySelectDialog; - D.selectedFileId = ''; - D.selectedImageUrl = ''; - }; - - $app.methods.reportUserForHacking = function (userId) { - miscRequest.reportUser({ - userId, - contentType: 'user', - reason: 'behavior-hacking', - type: 'report' - }); - }; - $app.methods.changeLogRemoveLinks = function (text) { return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1'); }; @@ -17327,10 +13264,7 @@ console.log(`isLinux: ${LINUX}`); if (!imageUrl) { return; } - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.fullscreenImageDialog.$el) - ); - var D = this.fullscreenImageDialog; + const D = this.fullscreenImageDialog; D.imageUrl = imageUrl; D.fileName = fileName; D.visible = true; @@ -17419,17 +13353,6 @@ console.log(`isLinux: ${LINUX}`); }); }; - // #endregion - // #region | VRChat Credits - - API.$on('VRCCREDITS', function (args) { - this.currentUser.$vrchatcredits = args.json?.balance; - }); - - $app.methods.getVRChatCredits = function () { - miscRequest.getVRChatCredits(); - }; - // #endregion // #region | Close instance @@ -17531,39 +13454,6 @@ console.log(`isLinux: ${LINUX}`); $app.data.ossDialog = false; - // #region | App: Badges - - API.$on('BADGE:UPDATE', function (args) { - if (args.json) { - $app.$message({ - message: $t('message.badge.updated'), - type: 'success' - }); - } - }); - - $app.methods.toggleBadgeVisibility = function (badge) { - if (badge.hidden) { - badge.showcased = false; - } - miscRequest.updateBadge({ - badgeId: badge.badgeId, - hidden: badge.hidden, - showcased: badge.showcased - }); - }; - - $app.methods.toggleBadgeShowcased = function (badge) { - if (badge.showcased) { - badge.hidden = false; - } - miscRequest.updateBadge({ - badgeId: badge.badgeId, - hidden: badge.hidden, - showcased: badge.showcased - }); - }; - $app.methods.isLinux = function () { return LINUX; }; @@ -17613,12 +13503,7 @@ console.log(`isLinux: ${LINUX}`); ); }; - $app.methods.getSmallThumbnailUrl = function (url) { - return $utils.convertFileUrlToImageUrl(url); - }; - // #endregion - // #region | Tab Props $app.computed.moderationTabBind = function () { @@ -17766,283 +13651,173 @@ console.log(`isLinux: ${LINUX}`); }; }; - $app.computed.friendImportDialogBind = function () { + $app.computed.friendLogTabBind = function () { return { - 'friend-import-dialog-visible': this.friendImportDialogVisible, - 'friend-import-dialog-input': this.friendImportDialogInput + menuActiveIndex: this.menuActiveIndex, + friendLogTable: this.friendLogTable, + shiftHeld: this.shiftHeld }; }; - $app.computed.friendImportDialogEvent = function () { + $app.computed.gameLogTabBind = function () { return { - 'update:friend-import-dialog-visible': (event) => - (this.friendImportDialogVisible = event), - 'update:friend-import-dialog-input': (event) => - (this.friendImportDialogInput = event) + menuActiveIndex: this.menuActiveIndex, + gameLogTable: this.gameLogTable, + shiftHeld: this.shiftHeld, + hideTooltips: this.hideTooltips }; }; - $app.computed.worldImportDialogBind = function () { + $app.computed.gameLogTabEvent = function () { return { - 'world-import-dialog-visible': this.worldImportDialogVisible, - 'world-import-dialog-input': this.worldImportDialogInput, - 'get-local-world-favorite-group-length': - this.getLocalWorldFavoriteGroupLength, - 'local-world-favorite-groups': this.localWorldFavoriteGroups - }; - }; - - $app.computed.worldImportDialogEvent = function () { - return { - 'update:world-import-dialog-visible': (event) => - (this.worldImportDialogVisible = event), - 'update:world-import-dialog-input': (event) => - (this.worldImportDialogInput = event), - 'add-local-world-favorite': this.addLocalWorldFavorite - }; - }; - - $app.computed.avatarImportDialogBind = function () { - return { - 'avatar-import-dialog-visible': this.avatarImportDialogVisible, - 'avatar-import-dialog-input': this.avatarImportDialogInput, - 'get-local-avatar-favorite-group-length': - this.getLocalAvatarFavoriteGroupLength, - 'local-avatar-favorite-groups': this.localAvatarFavoriteGroups - }; - }; - - $app.computed.avatarImportDialogEvent = function () { - return { - 'update:avatar-import-dialog-visible': (event) => - (this.avatarImportDialogVisible = event), - 'update:avatar-import-dialog-input': (event) => - (this.avatarImportDialogInput = event), - 'add-local-avatar-favorite': this.addLocalAvatarFavorite - }; - }; - - $app.computed.launchDialogBind = function () { - return { - 'check-can-invite': this.checkCanInvite, - 'launch-dialog-data': this.launchDialogData, - 'hide-tooltips': this.hideTooltips - }; - }; - - $app.computed.launchDialogEvent = function () { - return { - 'update:launch-dialog-data': (event) => - (this.launchDialogData = event), - 'launch-game': this.launchGame - }; - }; - - $app.computed.favoriteDialogBind = function () { - return { - 'favorite-dialog': this.favoriteDialog, - 'local-avatar-favorite-groups': this.localAvatarFavoriteGroups, - 'local-world-favorite-groups': this.localWorldFavoriteGroups, - 'has-local-world-favorite': this.hasLocalWorldFavorite, - 'get-local-world-favorite-group-length': - this.getLocalWorldFavoriteGroupLength, - 'has-local-avatar-favorite': this.hasLocalAvatarFavorite, - 'get-local-avatar-favorite-group-length': - this.getLocalAvatarFavoriteGroupLength - }; - }; - - $app.computed.favoriteDialogEvent = function () { - return { - 'update:favorite-dialog': (val) => { - this.favoriteDialog = val; - }, - 'add-local-world-favorite': this.addLocalWorldFavorite, - 'remove-local-world-favorite': this.removeLocalWorldFavorite, - 'add-local-avatar-favorite': this.addLocalAvatarFavorite, - 'remove-local-avatar-favorite': this.removeLocalAvatarFavorite, - 'delete-favorite-no-confirm': this.deleteFavoriteNoConfirm - }; - }; - - $app.computed.exportFriendsListDialogBind = function () { - return { - friends: this.friends, - 'is-export-friends-list-dialog-visible': - this.isExportFriendsListDialogVisible - }; - }; - - $app.computed.exportFriendsListDialogEvent = function () { - return { - 'update:is-export-friends-list-dialog-visible': (val) => { - this.isExportFriendsListDialogVisible = val; - } - }; - }; - - $app.computed.exportAvatarsListDialogBind = function () { - return { - 'is-export-avatars-list-dialog-visible': - this.isExportAvatarsListDialogVisible - }; - }; - - $app.computed.exportAvatarsListDialogEvent = function () { - return { - 'update:is-export-avatars-list-dialog-visible': (val) => { - this.isExportAvatarsListDialogVisible = val; - } - }; - }; - - $app.computed.previousInstancesUserDialogBind = function () { - return { - 'previous-instances-user-dialog': this.previousInstancesUserDialog, - 'shift-held': this.shiftHeld - }; - }; - - $app.computed.previousInstancesUserDialogEvent = function () { - return { - 'update:previous-instances-user-dialog': (val) => { - this.previousInstancesUserDialog = val; - } - }; - }; - - $app.computed.previousInstancesInfoDialogBind = function () { - return { - visible: this.previousInstancesInfoDialogVisible, - 'instance-id': this.previousInstancesInfoDialogInstanceId, - 'game-log-is-friend': this.gameLogIsFriend, - 'game-log-is-favorite': this.gameLogIsFavorite, - 'lookup-user': this.lookupUser, - 'is-dark-mode': this.isDarkMode - }; - }; - - $app.computed.previousInstancesInfoDialogEvent = function () { - return { - 'update:visible': (val) => { - this.previousInstancesInfoDialogVisible = val; - } - }; - }; - - $app.computed.worldDialogBind = function () { - return { - 'world-dialog': this.worldDialog, - 'hide-tooltips': this.hideTooltips, - 'shift-held': this.shiftHeld, - 'is-game-running': this.isGameRunning, - 'last-location': this.lastLocation, - 'instance-join-history': this.instanceJoinHistory, - 'update-instance-info': this.updateInstanceInfo, - 'is-age-gated-instances-visible': this.isAgeGatedInstancesVisible, - 'create-new-instance': this.createNewInstance, - 'instance-content-settings': this.instanceContentSettings, - 'offline-friends': this.offlineFriends, - 'active-friends': this.activeFriends, - 'online-friends': this.onlineFriends, - 'vip-friends': this.vipFriends, - 'has-group-permission': this.hasGroupPermission - }; - }; - - $app.computed.worldDialogEvent = function () { - return { - 'update:world-dialog': (val) => { - this.worldDialog = val; - }, - 'open-folder-generic': this.openFolderGeneric, - 'delete-vrchat-cache': this.deleteVRChatCache, - 'world-dialog-command': this.worldDialogCommand, - 'refresh-instance-player-count': this.refreshInstancePlayerCount - }; - }; - - $app.computed.groupDialogBind = function () { - return { - 'group-dialog': this.groupDialog, - 'hide-tooltips': this.hideTooltips, - 'last-location': this.lastLocation, - 'update-instance-info': this.updateInstanceInfo, - 'group-dialog-sorting-options': this.groupDialogSortingOptions, - 'group-dialog-filter-options': this.groupDialogFilterOptions, - 'is-group-gallery-loading': this.isGroupGalleryLoading, - 'gallery-select-dialog': this.gallerySelectDialog, - 'random-user-colours': this.randomUserColours - }; - }; - - $app.computed.groupDialogEvent = function () { - return { - 'refresh-instance-player-count': this.refreshInstancePlayerCount, - 'update-group-post-search': this.updateGroupPostSearch, - 'group-dialog-command': this.groupDialogCommand, - 'get-group-dialog-group': this.getGroupDialogGroup, - 'clear-image-gallery-select': this.clearImageGallerySelect, - 'update:gallery-select-dialog': (val) => - (this.gallerySelectDialog = val), - 'update:group-dialog': (val) => { - this.groupDialog = val; - } - }; - }; - - $app.computed.inviteGroupDialogBind = function () { - return { - 'dialog-data': this.inviteGroupDialog, - 'vip-friends': this.vipFriends, - 'online-friends': this.onlineFriends, - 'offline-friends': this.offlineFriends, - 'active-friends': this.activeFriends - }; - }; - - $app.computed.inviteGroupDialogEvent = function () { - return { - 'update:dialog-data': (val) => { - this.inviteGroupDialog = val; - } - }; - }; - - $app.computed.avatarDialogBind = function () { - return { - avatarDialog: this.avatarDialog, - hideTooltips: this.hideTooltips, - isGameRunning: this.isGameRunning - }; - }; - - $app.computed.avatarDialogEvent = function () { - return { - openFolderGeneric: this.openFolderGeneric, - deleteVRChatCache: this.deleteVRChatCache - }; - }; - - $app.computed.feedFiltersDialogBind = function () { - return { - feedFiltersDialogMode: this.feedFiltersDialogMode, - photonLoggingEnabled: this.photonLoggingEnabled, - sharedFeedFilters: this.sharedFeedFilters, - sharedFeedFiltersDefaults: this.sharedFeedFiltersDefaults - }; - }; - - $app.computed.feedFiltersDialogEvent = function () { - return { - 'update:feedFiltersDialogMode': (val) => { - console.log; - this.feedFiltersDialogMode = val; - }, + gameLogTableLookup: this.gameLogTableLookup, + gameLogIsFriend: this.gameLogIsFriend, + gameLogIsFavorite: this.gameLogIsFavorite, + lookupUser: this.lookupUser, + updateGameLogSessionTable: (val) => + (this.gameLogSessionTable = val), updateSharedFeed: this.updateSharedFeed }; }; + $app.computed.notificationTabBind = function () { + return { + menuActiveIndex: this.menuActiveIndex, + notificationTable: this.notificationTable, + shiftHeld: this.shiftHeld, + hideTooltips: this.hideTooltips, + lastLocation: this.lastLocation, + lastLocationDestination: this.lastLocationDestination, + isGameRunning: this.isGameRunning, + inviteResponseMessageTable: this.inviteResponseMessageTable, + updateImage: this.updateImage, + checkCanInvite: this.checkCanInvite, + inviteRequestResponseMessageTable: + this.inviteRequestResponseMessageTable + }; + }; + + $app.computed.notificationTabEvent = function () { + return { + inviteImageUpload: this.inviteImageUpload, + clearInviteImageUpload: this.clearInviteImageUpload + }; + }; + + $app.computed.feedTabBind = function () { + return { + menuActiveIndex: this.menuActiveIndex, + hideTooltips: this.hideTooltips, + feedTable: this.feedTable + }; + }; + + $app.computed.feedTabEvent = function () { + return { + feedTableLookup: this.feedTableLookup + }; + }; + + $app.computed.searchTabBind = function () { + return { + menuActiveIndex: this.menuActiveIndex, + searchText: this.searchText, + searchUserResults: this.searchUserResults, + randomUserColours: this.randomUserColours, + avatarRemoteDatabaseProviderList: + this.avatarRemoteDatabaseProviderList, + avatarRemoteDatabaseProvider: this.avatarRemoteDatabaseProvider, + hideTooltips: this.hideTooltips, + userDialog: this.userDialog, + lookupAvatars: this.lookupAvatars, + avatarRemoteDatabase: this.avatarRemoteDatabase + }; + }; + + $app.computed.searchTabEvent = function () { + return { + clearSearch: this.clearSearch, + setAvatarProvider: this.setAvatarProvider, + refreshUserDialogAvatars: this.refreshUserDialogAvatars, + moreSearchUser: this.moreSearchUser, + 'update:searchText': (value) => (this.searchText = value) + }; + }; + + $app.computed.profileTabBind = function () { + return { + menuActiveIndex: this.menuActiveIndex, + hideTooltips: this.hideTooltips, + inviteMessageTable: this.inviteMessageTable, + inviteResponseMessageTable: this.inviteResponseMessageTable, + inviteRequestMessageTable: this.inviteRequestMessageTable, + inviteRequestResponseMessageTable: + this.inviteRequestResponseMessageTable, + pastDisplayNameTable: this.pastDisplayNameTable, + friends: this.friends, + directAccessWorld: this.directAccessWorld + }; + }; + + $app.computed.profileTabEvent = function () { + return { + logout: this.logout, + lookupUser: this.lookupUser, + showEditInviteMessageDialog: this.showEditInviteMessageDialog + }; + }; + + $app.computed.playerListTabBind = function () { + return { + menuActiveIndex: this.menuActiveIndex, + currentInstanceWorld: this.currentInstanceWorld, + currentInstanceLocation: this.currentInstanceLocation, + currentInstanceWorldDescriptionExpanded: + this.currentInstanceWorldDescriptionExpanded, + photonLoggingEnabled: this.photonLoggingEnabled, + photonEventTableTypeFilter: this.photonEventTableTypeFilter, + photonEventTableTypeFilterList: this.photonEventTableTypeFilterList, + photonEventTableFilter: this.photonEventTableFilter, + hideTooltips: this.hideTooltips, + ipcEnabled: this.ipcEnabled, + photonEventIcon: this.photonEventIcon, + photonEventTable: this.photonEventTable, + photonEventTablePrevious: this.photonEventTablePrevious, + currentInstanceUserList: this.currentInstanceUserList, + chatboxUserBlacklist: this.chatboxUserBlacklist, + randomUserColours: this.randomUserColours, + lastLocation: this.lastLocation + }; + }; + + $app.computed.playerListTabEvent = function () { + return { + photonEventTableFilterChange: this.photonEventTableFilterChange, + getCurrentInstanceUserList: this.getCurrentInstanceUserList, + showUserFromPhotonId: this.showUserFromPhotonId, + lookupUser: this.lookupUser + }; + }; + + $app.computed.loginPageBind = function () { + return { + hideTooltips: this.hideTooltips, + loginForm: this.loginForm, + enableCustomEndpoint: this.enableCustomEndpoint + }; + }; + + $app.computed.loginPageEvent = function () { + return { + showVRCXUpdateDialog: this.showVRCXUpdateDialog, + promptProxySettings: this.promptProxySettings, + toggleCustomEndpoint: this.toggleCustomEndpoint, + deleteSavedLogin: this.deleteSavedLogin, + login: this.login, + relogin: this.relogin + }; + }; + $app.computed.vrcxUpdateDialogBind = function () { return { VRCXUpdateDialog: this.VRCXUpdateDialog, @@ -18059,97 +13834,18 @@ console.log(`isLinux: ${LINUX}`); $app.computed.vrcxUpdateDialogEvent = function () { return { + 'update:branch': (value) => (this.branch = value), loadBranchVersions: this.loadBranchVersions, cancelUpdate: this.cancelUpdate, installVRCXUpdate: this.installVRCXUpdate, - restartVRCX: this.restartVRCX, - 'update:branch': (val) => (this.branch = val) + restartVRCX: this.restartVRCX }; }; - $app.computed.screenshotMetadataDialogBind = function () { - return { - screenshotMetadataDialog: this.screenshotMetadataDialog, - currentlyDroppingFile: this.currentlyDroppingFile, - fullscreenImageDialog: this.fullscreenImageDialog - }; - }; + // - $app.computed.screenshotMetadataDialogEvent = function () { - return { - lookupUser: this.lookupUser - }; - }; - - $app.computed.vrchatConfigDialogBind = function () { - return { - isVRChatConfigDialogVisible: this.isVRChatConfigDialogVisible, - VRChatUsedCacheSize: this.VRChatUsedCacheSize, - VRChatTotalCacheSize: this.VRChatTotalCacheSize, - VRChatCacheSizeLoading: this.VRChatCacheSizeLoading, - folderSelectorDialog: this.folderSelectorDialog, - hideTooltips: this.hideTooltips - }; - }; - - $app.computed.vrchatConfigDialogEvent = function () { - return { - 'update:isVRChatConfigDialogVisible': (val) => - (this.isVRChatConfigDialogVisible = val), - getVRChatCacheSize: this.getVRChatCacheSize, - sweepVRChatCache: this.sweepVRChatCache - }; - }; - - $app.computed.youTubeApiDialogBind = function () { - return { - isYouTubeApiDialogVisible: this.isYouTubeApiDialogVisible, - lookupYouTubeVideo: this.lookupYouTubeVideo, - youTubeApiKey: this.youTubeApiKey - }; - }; - - $app.computed.youTubeApiDialogEvent = function () { - return { - 'update:isYouTubeApiDialogVisible': (val) => - (this.isYouTubeApiDialogVisible = val), - 'update:youTubeApiKey': (val) => (this.youTubeApiKey = val) - }; - }; - - $app.computed.notificationPositionDialogBind = function () { - return { - isNotificationPositionDialogVisible: - this.isNotificationPositionDialogVisible, - notificationPosition: this.notificationPosition - }; - }; - - $app.computed.notificationPositionDialogEvent = function () { - return { - 'update:isNotificationPositionDialogVisible': (val) => - (this.isNotificationPositionDialogVisible = val), - 'update:notificationPosition': (val) => - (this.notificationPosition = val), - changeNotificationPosition: this.changeNotificationPosition - }; - }; - - $app.computed.avatarProviderDialogBind = function () { - return { - isAvatarProviderDialogVisible: this.isAvatarProviderDialogVisible, - avatarRemoteDatabaseProviderList: - this.avatarRemoteDatabaseProviderList - }; - }; - - $app.computed.avatarProviderDialogEvent = function () { - return { - 'update:isAvatarProviderDialogVisible': (val) => - (this.isAvatarProviderDialogVisible = val), - saveAvatarProviderList: this.saveAvatarProviderList, - removeAvatarProvider: this.removeAvatarProvider - }; + $app.methods.languageClass = function (key) { + return languageClass(key); }; // #endregion diff --git a/src/app.pug b/src/app.pug index 1e150145..542f803f 100644 --- a/src/app.pug +++ b/src/app.pug @@ -1,8 +1,8 @@ doctype html #x-app.x-app(@dragenter.prevent @dragover.prevent @drop.prevent) - //- login - include ./mixins/loginPage.pug - +loginPage + LoginPage(v-if="!API.isLoggedIn" v-bind="loginPageBind" v-on="loginPageEvent") + + VRCXUpdateDialog(v-bind="vrcxUpdateDialogBind" v-on="vrcxUpdateDialogEvent") //- menu .x-menu-container @@ -23,47 +23,30 @@ doctype html circle style='font-size: 14px; height: 50px; width: 50px') - nav-menu(ref='menu' @select='selectMenu' :menu-active-index='menuActiveIndex') + NavMenu(ref='menu' @select='selectMenu' :menu-active-index='menuActiveIndex') //- ### Tabs ### template(v-if='API.isLoggedIn') - //- feed - include ./mixins/tabs/feed.pug - +feedTab + FeedTab(v-bind='feedTabBind' v-on='feedTabEvent') - //- gameLog - include ./mixins/tabs/gameLog.pug - +gameLogTab + GameLogTab(v-bind='gameLogTabBind' v-on='gameLogTabEvent') - //- playerList - include ./mixins/tabs/playerList.pug - +playerListTab + PlayerListTab(v-bind='playerListTabBind' v-on='playerListTabEvent') - //- search - include ./mixins/tabs/search.pug - +searchTab + SearchTab(v-bind='searchTabBind' v-on='searchTabEvent') FavoritesTab(v-bind='favoritesTabBind' v-on='favoritesTabEvent') - //- friendLog - include ./mixins/tabs/friendLog.pug - +friendLogTab + FriendLogTab(v-bind='friendLogTabBind') - //- moderation ModerationTab(v-bind='moderationTabBind') - //- notification - include ./mixins/tabs/notifications.pug - +notificationsTab + NotificationTab(v-bind='notificationTabBind' v-on='notificationTabEvent') - //- profile - include ./mixins/tabs/profile.pug - +profileTab + ProfileTab(v-bind='profileTabBind' v-on='profileTabEvent') - //- friends list FriendListTab(v-bind='friendsListTabBind' v-on='friendsListTabEvent') - //- charts KeepAlive ChartsTab(v-if='menuActiveIndex === "charts"' v-bind='chartsTabBind' v-on='chartsTabEvent') @@ -73,89 +56,8 @@ doctype html SideBar(v-bind='sideBarTabBind' v-on='sideBarTabEvent') - //- ## Dialogs ## -\\ - include ./mixins/dialogs/userDialog.pug - +userDialog - - include ./mixins/dialogs/images.pug - +images - - include ./mixins/dialogs/currentUser.pug - +currentUser - - include ./mixins/dialogs/invites.pug - +invites - - include ./mixins/dialogs/boops.pug - +boops - - //- previous instances - PreviousInstancesInfoDialog(v-bind='previousInstancesInfoDialogBind' v-on='previousInstancesInfoDialogEvent') - - PreviousInstancesUserDialog(v-bind='previousInstancesUserDialogBind' v-on='previousInstancesUserDialogEvent') - - //- favorites - FriendImportDialog(v-bind='friendImportDialogBind' v-on='friendImportDialogEvent') - - WorldImportDialog(v-bind='worldImportDialogBind' v-on='worldImportDialogEvent') - - AvatarImportDialog(v-bind='avatarImportDialogBind' v-on='avatarImportDialogEvent') - - //- favorites dialog - ChooseFavoriteGroupDialog(v-bind='favoriteDialogBind' v-on='favoriteDialogEvent') - - ExportFriendsListDialog(v-bind='exportFriendsListDialogBind' v-on='exportFriendsListDialogEvent') - - ExportAvatarsListDialog(v-bind='exportAvatarsListDialogBind' v-on='exportAvatarsListDialogEvent') - - //- launch - LaunchDialog(v-bind='launchDialogBind' v-on='launchDialogEvent') - - //- world - WorldDialog(v-bind='worldDialogBind' v-on='worldDialogEvent') - - //- group - GroupDialog(v-bind='groupDialogBind' v-on='groupDialogEvent') - - InviteGroupDialog(v-bind='inviteGroupDialogBind' v-on='inviteGroupDialogEvent') - - //- avatar - AvatarDialog(v-bind='avatarDialogBind' v-on='avatarDialogEvent') - - //- settings - FeedFiltersDialog(v-bind='feedFiltersDialogBind' v-on='feedFiltersDialogEvent') - - LaunchOptionsDialog(:is-launch-options-dialog-visible.sync='isLaunchOptionsDialogVisible') - - OpenSourceSoftwareNoticeDialog(:oss-dialog.sync='ossDialog') - - ChangelogDialog(:change-log-dialog.sync='changeLogDialog') - - VRCXUpdateDialog(v-bind='vrcxUpdateDialogBind' v-on='vrcxUpdateDialogEvent') - - ScreenshotMetadataDialog(v-bind='screenshotMetadataDialogBind' v-on='screenshotMetadataDialogEvent') - - DiscordNamesDialog(:discord-names-dialog-visible.sync='discordNamesDialogVisible' :friends='friends') - - EditInviteMessageDialog(:edit-invite-message-dialog.sync='editInviteMessageDialog') - - NoteExportDialog(:is-note-export-dialog-visible.sync='isNoteExportDialogVisible' :friends='friends') - - VRChatConfigDialog(v-bind='vrchatConfigDialogBind' v-on='vrchatConfigDialogEvent') - - YouTubeApiDialog(v-bind='youTubeApiDialogBind' v-on='youTubeApiDialogEvent') - - NotificationPositionDialog(v-bind='notificationPositionDialogBind' v-on='notificationPositionDialogEvent') - - AvatarProviderDialog(v-bind='avatarProviderDialogBind' v-on='avatarProviderDialogEvent') - - RegistryBackupDialog( - :isRegistryBackupDialogVisible.sync='isRegistryBackupDialogVisible' - :backupVrcRegistry='backupVrcRegistry') - - PrimaryPasswordDialog(:enablePrimaryPasswordDialog.sync='enablePrimaryPasswordDialog' @setPrimaryPassword="setPrimaryPassword") - - //- player list - ChatboxBlacklistDialog(:chatboxBlacklistDialog="chatboxBlacklistDialog" :chatboxUserBlacklist="chatboxUserBlacklist" @deleteChatboxUserBlacklist="deleteChatboxUserBlacklist") + //- ## Dialogs ## -\\ + include ./mixins/dialogs/dialogs.pug + +dialogs //- el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="templateDialog" :visible.sync="templateDialog.visible" :title="$t('dialog.template_dialog.header')" width="450px") diff --git a/src/app.scss b/src/app.scss index 1437ccc8..9e28e56e 100644 --- a/src/app.scss +++ b/src/app.scss @@ -159,7 +159,7 @@ a { display: flex; width: 100vw; height: 100vh; - overflow: hidden auto; + overflow: hidden; cursor: default; } diff --git a/src/assets/scss/themes/theme.material3.scss b/src/assets/scss/themes/theme.material3.scss index fef22ae0..a8e4d83e 100644 --- a/src/assets/scss/themes/theme.material3.scss +++ b/src/assets/scss/themes/theme.material3.scss @@ -590,6 +590,10 @@ input[type='number'], .el-table table tr td:first-child { border-left: none; } +.feed .el-table .el-table_1_column_5.el-table__cell > div { + display: flex; + align-items: center; +} .el-table .el-table__body-wrapper table tr:last-child th, .el-table table tr:last-child td, .el-table tr, diff --git a/src/classes/apiLogin.js b/src/classes/apiLogin.js index 21453b6f..7f224119 100644 --- a/src/classes/apiLogin.js +++ b/src/classes/apiLogin.js @@ -239,13 +239,12 @@ export default class extends baseClass { API.websocketDomain = API.websocketDomainVrchat; } return new Promise((resolve, reject) => { + this.loginForm.loading = true; if (this.enablePrimaryPassword) { this.checkPrimaryPassword(loginParmas) .then((pwd) => { - this.loginForm.loading = true; return API.getConfig() .catch((err) => { - this.loginForm.loading = false; reject(err); }) .then(() => { @@ -257,12 +256,10 @@ export default class extends baseClass { websocket: loginParmas.websocket }) .catch((err2) => { - this.loginForm.loading = false; // API.logout(); reject(err2); }) .then(() => { - this.loginForm.loading = false; resolve(); }); }); @@ -277,7 +274,6 @@ export default class extends baseClass { } else { API.getConfig() .catch((err) => { - this.loginForm.loading = false; reject(err); }) .then(() => { @@ -288,17 +284,15 @@ export default class extends baseClass { websocket: loginParmas.websocket }) .catch((err2) => { - this.loginForm.loading = false; API.logout(); reject(err2); }) .then(() => { - this.loginForm.loading = false; resolve(); }); }); } - }); + }).finally(() => (this.loginForm.loading = false)); }, async deleteSavedLogin(userId) { @@ -325,100 +319,90 @@ export default class extends baseClass { async login() { await webApiService.clearCookies(); - this.$refs.loginForm.validate((valid) => { - if (valid && !this.loginForm.loading) { - this.loginForm.loading = true; - if (this.loginForm.endpoint) { - API.endpointDomain = this.loginForm.endpoint; - API.websocketDomain = this.loginForm.websocket; - } else { - API.endpointDomain = API.endpointDomainVrchat; - API.websocketDomain = API.websocketDomainVrchat; - } - API.getConfig() - .catch((err) => { - this.loginForm.loading = false; - throw err; - }) - .then((args) => { - if ( - this.loginForm.saveCredentials && - this.enablePrimaryPassword - ) { - $app.$prompt( - $t('prompt.primary_password.description'), - $t('prompt.primary_password.header'), - { - inputType: 'password', - inputPattern: /[\s\S]{1,32}/ - } - ) - .then(({ value }) => { - let saveCredential = - this.loginForm.savedCredentials[ - Object.keys( - this.loginForm - .savedCredentials - )[0] - ]; - security - .decrypt( - saveCredential.loginParmas - .password, - value - ) - .then(() => { - security - .encrypt( - this.loginForm.password, - value - ) - .then((pwd) => { - API.login({ - username: - this.loginForm - .username, - password: - this.loginForm - .password, - endpoint: - this.loginForm - .endpoint, - websocket: - this.loginForm - .websocket, - saveCredentials: - this.loginForm - .saveCredentials, - cipher: pwd - }).then(() => { - this.$refs.loginForm.resetFields(); - }); + if (!this.loginForm.loading) { + this.loginForm.loading = true; + if (this.loginForm.endpoint) { + API.endpointDomain = this.loginForm.endpoint; + API.websocketDomain = this.loginForm.websocket; + } else { + API.endpointDomain = API.endpointDomainVrchat; + API.websocketDomain = API.websocketDomainVrchat; + } + API.getConfig() + .catch((err) => { + this.loginForm.loading = false; + throw err; + }) + .then((args) => { + if ( + this.loginForm.saveCredentials && + this.enablePrimaryPassword + ) { + $app.$prompt( + $t('prompt.primary_password.description'), + $t('prompt.primary_password.header'), + { + inputType: 'password', + inputPattern: /[\s\S]{1,32}/ + } + ) + .then(({ value }) => { + let saveCredential = + this.loginForm.savedCredentials[ + Object.keys( + this.loginForm.savedCredentials + )[0] + ]; + security + .decrypt( + saveCredential.loginParmas.password, + value + ) + .then(() => { + security + .encrypt( + this.loginForm.password, + value + ) + .then((pwd) => { + API.login({ + username: + this.loginForm + .username, + password: + this.loginForm + .password, + endpoint: + this.loginForm + .endpoint, + websocket: + this.loginForm + .websocket, + saveCredentials: + this.loginForm + .saveCredentials, + cipher: pwd }); - }); - }) - .finally(() => { - this.loginForm.loading = false; - }); - return args; - } - API.login({ - username: this.loginForm.username, - password: this.loginForm.password, - endpoint: this.loginForm.endpoint, - websocket: this.loginForm.websocket, - saveCredentials: this.loginForm.saveCredentials - }) - .then(() => { - this.$refs.loginForm.resetFields(); + }); + }); }) .finally(() => { this.loginForm.loading = false; }); return args; + } + API.login({ + username: this.loginForm.username, + password: this.loginForm.password, + endpoint: this.loginForm.endpoint, + websocket: this.loginForm.websocket, + saveCredentials: this.loginForm.saveCredentials + }).finally(() => { + this.loginForm.loading = false; }); - } - }); + return args; + }); + } }, logout() { diff --git a/src/classes/booping.js b/src/classes/booping.js deleted file mode 100644 index d9b58467..00000000 --- a/src/classes/booping.js +++ /dev/null @@ -1,104 +0,0 @@ -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; -import { notificationRequest } from '../api'; - -export default class extends baseClass { - constructor(_app, _API, _t) { - super(_app, _API, _t); - } - - init() { - /** - * @params {{ - userId: string, - emojiId: string - }} params - * @returns {Promise<{json: any, params}>} - */ - API.sendBoop = function (params) { - return this.call(`users/${params.userId}/boop`, { - method: 'POST', - params - }).then((json) => { - var args = { - json, - params - }; - this.$emit('BOOP:SEND', args); - return args; - }); - }; - } - - _data = { - sendBoopDialog: { - visible: false, - userId: '', - fileId: '' - } - }; - - _methods = { - sendBoop() { - var D = this.sendBoopDialog; - this.dismissBoop(D.userId); - var params = { - userId: D.userId - }; - if (D.fileId) { - params.emojiId = D.fileId; - } - API.sendBoop(params); - D.visible = false; - }, - - dismissBoop(userId) { - // JANK: This is a hack to remove boop notifications when responding - var array = this.notificationTable.data; - for (var i = array.length - 1; i >= 0; i--) { - var ref = array[i]; - if ( - ref.type !== 'boop' || - ref.$isExpired || - ref.senderUserId !== userId - ) { - continue; - } - notificationRequest.sendNotificationResponse({ - notificationId: ref.id, - responseType: 'delete', - responseData: '' - }); - } - }, - - showSendBoopDialog(userId) { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.sendBoopDialog.$el) - ); - var D = this.sendBoopDialog; - D.userId = userId; - D.visible = true; - if (this.emojiTable.length === 0 && API.currentUser.$isVRCPlus) { - this.refreshEmojiTable(); - } - }, - - getEmojiValue(emojiName) { - if (!emojiName) { - return ''; - } - return `vrchat_${emojiName.replace(/ /g, '_').toLowerCase()}`; - }, - - getEmojiName(emojiValue) { - // uppercase first letter of each word - if (!emojiValue) { - return ''; - } - return emojiValue - .replace('vrchat_', '') - .replace(/_/g, ' ') - .replace(/\b\w/g, (l) => l.toUpperCase()); - } - }; -} diff --git a/src/classes/currentUser.js b/src/classes/currentUser.js index cb993d8f..b0171a49 100644 --- a/src/classes/currentUser.js +++ b/src/classes/currentUser.js @@ -1,4 +1,5 @@ -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; +import { isRealInstance, parseLocation } from '../composables/instance/utils'; +import { $app, API, baseClass } from './baseClass.js'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -83,8 +84,8 @@ export default class extends baseClass { args.ref = this.applyCurrentUser(json); // when isGameRunning use gameLog instead of API - var $location = $app.parseLocation($app.lastLocation.location); - var $travelingLocation = $app.parseLocation( + var $location = parseLocation($app.lastLocation.location); + var $travelingLocation = parseLocation( $app.lastLocationDestination ); var location = $app.lastLocation.location; @@ -94,12 +95,12 @@ export default class extends baseClass { var travelingToWorld = $travelingLocation.worldId; var travelingToInstance = $travelingLocation.instanceId; if (!$app.isGameRunning && json.presence) { - if ($utils.isRealInstance(json.presence.world)) { + if (isRealInstance(json.presence.world)) { location = `${json.presence.world}:${json.presence.instance}`; } else { location = json.presence.world; } - if ($utils.isRealInstance(json.presence.travelingToWorld)) { + if (isRealInstance(json.presence.travelingToWorld)) { travelingToLocation = `${json.presence.travelingToWorld}:${json.presence.travelingToInstance}`; } else { travelingToLocation = json.presence.travelingToWorld; @@ -175,7 +176,7 @@ export default class extends baseClass { } Object.assign(ref, json); if (ref.homeLocation !== ref.$homeLocation.tag) { - ref.$homeLocation = $app.parseLocation(ref.homeLocation); + ref.$homeLocation = parseLocation(ref.homeLocation); // apply home location name to user dialog if ( $app.userDialog.visible && @@ -295,13 +296,12 @@ export default class extends baseClass { $languages: [], $locationTag: '', $travelingToLocation: '', - $vrchatcredits: null, ...json }; if ($app.isGameRunning) { ref.$previousAvatarSwapTime = Date.now(); } - ref.$homeLocation = $app.parseLocation(ref.homeLocation); + ref.$homeLocation = parseLocation(ref.homeLocation); ref.$isVRCPlus = ref.tags.includes('system_supporter'); this.applyUserTrustLevel(ref); this.applyUserLanguage(ref); @@ -316,32 +316,6 @@ export default class extends baseClass { } return ref; }; - - /** - * @typedef {{ - * status: 'active' | 'offline' | 'busy' | 'ask me' | 'join me', - * statusDescription: string - * }} SaveCurrentUserParameters - */ - - /** - * Updates current user's status. - * @param params {SaveCurrentUserParameters} new status to be set - * @returns {Promise<{json: any, params}>} - */ - API.saveCurrentUser = function (params) { - return this.call(`users/${this.currentUser.id}`, { - method: 'PUT', - params - }).then((json) => { - var args = { - json, - params - }; - this.$emit('USER:CURRENT:SAVE', args); - return args; - }); - }; } _data = {}; diff --git a/src/classes/discordRpc.js b/src/classes/discordRpc.js index 85e39d89..d54946f1 100644 --- a/src/classes/discordRpc.js +++ b/src/classes/discordRpc.js @@ -1,6 +1,8 @@ -import configRepository from '../service/config.js'; -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; import { worldRequest } from '../api'; +import { parseLocation } from '../composables/instance/utils'; +import { getLaunchURL } from '../composables/shared/utils'; +import configRepository from '../service/config.js'; +import { API, baseClass } from './baseClass.js'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -36,7 +38,7 @@ export default class extends baseClass { var L = this.lastLocation$; if (currentLocation !== this.lastLocation$.tag) { Discord.SetTimestamps(timeStamp, 0); - L = $app.parseLocation(currentLocation); + L = parseLocation(currentLocation); L.worldName = ''; L.thumbnailImageUrl = ''; L.worldCapacity = 0; @@ -76,7 +78,7 @@ export default class extends baseClass { } switch (L.accessType) { case 'public': - L.joinUrl = $utils.getLaunchURL(L); + L.joinUrl = getLaunchURL(L); L.accessName = `Public #${L.instanceName} (${platform})`; break; case 'invite+': diff --git a/src/classes/gameLog.js b/src/classes/gameLog.js index 03dbfc32..1dc5b195 100644 --- a/src/classes/gameLog.js +++ b/src/classes/gameLog.js @@ -1,8 +1,9 @@ import * as workerTimers from 'worker-timers'; +import { parseLocation } from '../composables/instance/utils'; import gameLogService from '../service/gamelog.js'; import configRepository from '../service/config.js'; import database from '../service/database.js'; -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; +import { baseClass, $app, API, $utils } from './baseClass.js'; import { userRequest } from '../api'; import dayjs from 'dayjs'; @@ -80,7 +81,7 @@ export default class extends baseClass { this.lastLocation.location, gameLog.dt ); - var worldName = this.replaceBioSymbols(gameLog.worldName); + var worldName = $utils.replaceBioSymbols(gameLog.worldName); if (this.isGameRunning) { this.lastLocationReset(gameLog.dt); this.clearNowPlaying(); @@ -100,7 +101,7 @@ export default class extends baseClass { this.applyGroupDialogInstances(); } this.addInstanceJoinHistory(gameLog.location, gameLog.dt); - var L = $utils.parseLocation(gameLog.location); + var L = parseLocation(gameLog.location); var entry = { created_at: gameLog.dt, type: 'Location', @@ -789,7 +790,7 @@ export default class extends baseClass { var videoPos = Number(data[1]); var videoLength = Number(data[2]); var displayName = data[3]; - var videoName = this.replaceBioSymbols(data[4]); + var videoName = $utils.replaceBioSymbols(data[4]); var videoUrl = videoName; var videoId = 'LSMedia'; if (videoUrl === this.nowPlaying.url) { @@ -981,29 +982,6 @@ export default class extends baseClass { this.addGameLogEntry(gameLog, this.lastLocation.location); }, - deleteGameLogEntryPrompt(row) { - this.$confirm('Continue? Delete Log', 'Confirm', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', - type: 'info', - callback: (action) => { - if (action === 'confirm') { - this.deleteGameLogEntry(row); - } - } - }); - }, - - deleteGameLogEntry(row) { - $app.removeFromArray(this.gameLogTable.data, row); - database.deleteGameLogEntry(row); - console.log(row); - database.getGamelogDatabase().then((data) => { - this.gameLogSessionTable = data; - this.updateSharedFeed(true); - }); - }, - gameLogSearch(row) { var value = this.gameLogTable.search.toUpperCase(); if (!value) { diff --git a/src/classes/gameRealtimeLogging.js b/src/classes/gameRealtimeLogging.js index f1fdb79c..2b10797a 100644 --- a/src/classes/gameRealtimeLogging.js +++ b/src/classes/gameRealtimeLogging.js @@ -1,8 +1,14 @@ import * as workerTimers from 'worker-timers'; +import { displayLocation, parseLocation } from '../composables/instance/utils'; +import { checkVRChatCache } from '../composables/shared/utils'; import configRepository from '../service/config.js'; import database from '../service/database.js'; -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; +import { baseClass, $app, API, $utils } from './baseClass.js'; import { instanceRequest, userRequest } from '../api'; +import { + photonEmojis, + photonEventType +} from '../composables/shared/constants/photon.js'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -80,111 +86,6 @@ export default class extends baseClass { } }, - photonEventType: [ - 'MeshVisibility', - 'AnimationFloat', - 'AnimationBool', - 'AnimationTrigger', - 'AudioTrigger', - 'PlayAnimation', - 'SendMessage', - 'SetParticlePlaying', - 'TeleportPlayer', - 'RunConsoleCommand', - 'SetGameObjectActive', - 'SetWebPanelURI', - 'SetWebPanelVolume', - 'SpawnObject', - 'SendRPC', - 'ActivateCustomTrigger', - 'DestroyObject', - 'SetLayer', - 'SetMaterial', - 'AddHealth', - 'AddDamage', - 'SetComponentActive', - 'AnimationInt', - 'AnimationIntAdd', - 'AnimationIntSubtract', - 'AnimationIntMultiply', - 'AnimationIntDivide', - 'AddVelocity', - 'SetVelocity', - 'AddAngularVelocity', - 'SetAngularVelocity', - 'AddForce', - 'SetUIText', - 'CallUdonMethod' - ], - - photonEmojis: [ - 'Angry', - 'Blushing', - 'Crying', - 'Frown', - 'Hand Wave', - 'Hang Ten', - 'In Love', - 'Jack O Lantern', - 'Kiss', - 'Laugh', - 'Skull', - 'Smile', - 'Spooky Ghost', - 'Stoic', - 'Sunglasses', - 'Thinking', - 'Thumbs Down', - 'Thumbs Up', - 'Tongue Out', - 'Wow', - 'Arrow Point', - "Can't see", - 'Hourglass', - 'Keyboard', - 'No Headphones', - 'No Mic', - 'Portal', - 'Shush', - 'Bats', - 'Cloud', - 'Fire', - 'Snow Fall', - 'Snowball', - 'Splash', - 'Web', - 'Beer', - 'Candy', - 'Candy Cane', - 'Candy Corn', - 'Champagne', - 'Drink', - 'Gingerbread', - 'Ice Cream', - 'Pineapple', - 'Pizza', - 'Tomato', - 'Beachball', - 'Coal', - 'Confetti', - 'Gift', - 'Gifts', - 'Life Ring', - 'Mistletoe', - 'Money', - 'Neon Shades', - 'Sun Lotion', - 'Boo', - 'Broken Heart', - 'Exclamation', - 'Go', - 'Heart', - 'Music Note', - 'Question', - 'Stop', - 'Zzz' - ], - photonEventTableFilter: '', photonEventTableTypeFilter: [], photonEventTableTypeOverlayFilter: [], @@ -894,7 +795,7 @@ export default class extends baseClass { var imageUrl = ''; if (type === 0) { var emojiId = data.Parameters[245][2]; - emojiName = this.photonEmojis[emojiId]; + emojiName = photonEmojis[emojiId]; } else if (type === 1) { emojiName = 'Custom'; var fileId = data.Parameters[245][1]; @@ -982,7 +883,7 @@ export default class extends baseClass { if (this.debugPhotonLogging) { var displayName = this.getDisplayNameFromPhotonId(senderId); var feed = `RPC ${displayName} ${ - this.photonEventType[eventData.EventType] + photonEventType[eventData.EventType] }${eventName}`; console.log('VrcRpc:', feed); } @@ -1026,7 +927,7 @@ export default class extends baseClass { shortName }); var location = instance.json.location; - var L = $utils.parseLocation(location); + var L = parseLocation(location); var groupName = ''; if (L.groupId) { groupName = await this.getGroupName(L.groupId); @@ -1040,14 +941,14 @@ export default class extends baseClass { // if (shortName === newShortName) { // portalType = 'Unlocked'; // } - var displayLocation = this.displayLocation( + var _displayLocation = displayLocation( location, worldName, groupName ); this.addEntryPhotonEvent({ photonId: this.getPhotonIdFromUserId(userId), - text: `PortalSpawn to ${displayLocation}`, + text: `PortalSpawn to ${_displayLocation}`, type: 'PortalSpawn', shortName, location, @@ -1210,10 +1111,10 @@ export default class extends baseClass { type: 'ChangeStatus', status: photonUser.status, previousStatus: ref.status, - statusDescription: this.replaceBioSymbols( + statusDescription: $utils.replaceBioSymbols( photonUser.statusDescription ), - previousStatusDescription: this.replaceBioSymbols( + previousStatusDescription: $utils.replaceBioSymbols( ref.statusDescription ), created_at: Date.parse(gameLogDate) @@ -1227,8 +1128,8 @@ export default class extends baseClass { return; } var avatar = user.avatarDict; - avatar.name = this.replaceBioSymbols(avatar.name); - avatar.description = this.replaceBioSymbols(avatar.description); + avatar.name = $utils.replaceBioSymbols(avatar.name); + avatar.description = $utils.replaceBioSymbols(avatar.description); var platform = ''; if (user.last_platform === 'android') { platform = 'Android'; @@ -1240,7 +1141,7 @@ export default class extends baseClass { platform = 'Desktop'; } this.photonUserSusieCheck(photonId, user, gameLogDate); - $utils.checkVRChatCache(avatar).then((cacheInfo) => { + checkVRChatCache(avatar).then((cacheInfo) => { var inCache = false; if (cacheInfo.Item1 > 0) { inCache = true; @@ -1410,9 +1311,11 @@ export default class extends baseClass { oldAvatarId !== avatar.id && photonId !== this.photonLobbyCurrentUser ) { - avatar.name = this.replaceBioSymbols(avatar.name); - avatar.description = this.replaceBioSymbols(avatar.description); - $utils.checkVRChatCache(avatar).then((cacheInfo) => { + avatar.name = $utils.replaceBioSymbols(avatar.name); + avatar.description = $utils.replaceBioSymbols( + avatar.description + ); + checkVRChatCache(avatar).then((cacheInfo) => { var inCache = false; if (cacheInfo.Item1 > 0) { inCache = true; diff --git a/src/classes/groups.js b/src/classes/groups.js index 3c19ce0e..bd6246be 100644 --- a/src/classes/groups.js +++ b/src/classes/groups.js @@ -7,6 +7,7 @@ import { instanceRequest, groupRequest } from '../api'; +import $utils from './utils'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -171,8 +172,8 @@ export default class extends baseClass { var D = $app.groupDialog; if (D.id === args.params.groupId) { for (var post of args.posts) { - post.title = $app.replaceBioSymbols(post.title); - post.text = $app.replaceBioSymbols(post.text); + post.title = $utils.replaceBioSymbols(post.title); + post.text = $utils.replaceBioSymbols(post.text); } if (args.posts.length > 0) { D.announcement = args.posts[0]; @@ -189,8 +190,8 @@ export default class extends baseClass { } var newPost = args.json; - newPost.title = $app.replaceBioSymbols(newPost.title); - newPost.text = $app.replaceBioSymbols(newPost.text); + newPost.title = $utils.replaceBioSymbols(newPost.title); + newPost.text = $utils.replaceBioSymbols(newPost.text); var hasPost = false; // update existing post for (var post of D.posts) { @@ -275,9 +276,9 @@ export default class extends baseClass { API.applyGroup = function (json) { var ref = this.cachedGroups.get(json.id); - json.rules = $app.replaceBioSymbols(json.rules); - json.name = $app.replaceBioSymbols(json.name); - json.description = $app.replaceBioSymbols(json.description); + json.rules = $utils.replaceBioSymbols(json.rules); + json.name = $utils.replaceBioSymbols(json.name); + json.description = $utils.replaceBioSymbols(json.description); if (typeof ref === 'undefined') { ref = { id: '', @@ -912,9 +913,6 @@ export default class extends baseClass { case 'Unsubscribe To Announcements': this.setGroupSubscription(D.id, false); break; - case 'Invite To Group': - this.showInviteGroupDialog(D.id, ''); - break; } }, @@ -1050,17 +1048,6 @@ export default class extends baseClass { this.userDialog.representedGroup = args.json; return args; }); - }, - - showInviteGroupDialog(groupId, userId) { - const D = this.inviteGroupDialog; - D.userIds = ''; - D.groups = []; - D.groupId = groupId; - D.groupName = groupId; - D.userId = userId; - D.userObject = {}; - D.visible = true; } }; } diff --git a/src/classes/languages.js b/src/classes/languages.js index f0f14894..a9f1cae5 100644 --- a/src/classes/languages.js +++ b/src/classes/languages.js @@ -24,85 +24,9 @@ export default class extends baseClass { } $app.languageDialog.languages = data; }); - - API.$on('LOGOUT', function () { - $app.languageDialog.visible = false; - }); } _data = { - // vrchat to famfamfam language mappings - languageMappings: { - eng: 'us', - kor: 'kr', - rus: 'ru', - spa: 'es', - por: 'pt', - zho: 'cn', - deu: 'de', - jpn: 'jp', - fra: 'fr', - swe: 'se', - nld: 'nl', - pol: 'pl', - dan: 'dk', - nor: 'no', - ita: 'it', - tha: 'th', - fin: 'fi', - hun: 'hu', - ces: 'cz', - tur: 'tr', - ara: 'ae', - ron: 'ro', - vie: 'vn', - ukr: 'ua', - ase: 'us', - bfi: 'gb', - dse: 'nl', - fsl: 'fr', - jsl: 'jp', - kvk: 'kr', - - mlt: 'mt', - ind: 'id', - hrv: 'hr', - heb: 'he', - afr: 'af', - ben: 'be', - bul: 'bg', - cmn: 'cn', - cym: 'cy', - ell: 'el', - est: 'et', - fil: 'ph', - gla: 'gd', - gle: 'ga', - hin: 'hi', - hmn: 'cn', - hye: 'hy', - isl: 'is', - lav: 'lv', - lit: 'lt', - ltz: 'lb', - mar: 'hi', - mkd: 'mk', - msa: 'my', - sco: 'gd', - slk: 'sk', - slv: 'sl', - tel: 'hi', - mri: 'nz', - wuu: 'cn', - yue: 'cn', - tws: 'cn', - asf: 'au', - nzs: 'nz', - gsg: 'de', - epo: 'eo', - tok: 'tok' - }, - subsetOfLanguages: [], languageDialog: { @@ -113,54 +37,5 @@ export default class extends baseClass { } }; - _methods = { - languageClass(language) { - var style = {}; - var mapping = this.languageMappings[language]; - if (typeof mapping !== 'undefined') { - style[mapping] = true; - } else { - style.unknown = true; - } - return style; - }, - - addUserLanguage(language) { - if (language !== String(language)) { - return; - } - const D = this.languageDialog; - D.loading = true; - userRequest - .addUserTags({ - tags: [`language_${language}`] - }) - .finally(function () { - D.loading = false; - }); - }, - - removeUserLanguage(language) { - if (language !== String(language)) { - return; - } - const D = this.languageDialog; - D.loading = true; - userRequest - .removeUserTags({ - tags: [`language_${language}`] - }) - .finally(function () { - D.loading = false; - }); - }, - - showLanguageDialog() { - this.$nextTick(() => - $app.adjustDialogZ(this.$refs.languageDialog.$el) - ); - var D = this.languageDialog; - D.visible = true; - } - }; + _methods = {}; } diff --git a/src/classes/memos.js b/src/classes/memos.js index d2cbd511..30856fbd 100644 --- a/src/classes/memos.js +++ b/src/classes/memos.js @@ -27,11 +27,6 @@ export default class extends baseClass { } }, - onUserMemoChange() { - var D = this.userDialog; - this.saveUserMemo(D.id, D.memo); - }, - async getUserMemo(userId) { try { return await database.getUserMemo(userId); diff --git a/src/classes/prompts.js b/src/classes/prompts.js index 9601e094..799bd8b4 100644 --- a/src/classes/prompts.js +++ b/src/classes/prompts.js @@ -132,139 +132,6 @@ export default class extends baseClass { ); }, - promptUserIdDialog() { - this.$prompt( - $t('prompt.direct_access_user_id.description'), - $t('prompt.direct_access_user_id.header'), - { - distinguishCancelAndClose: true, - confirmButtonText: $t('prompt.direct_access_user_id.ok'), - cancelButtonText: $t('prompt.direct_access_user_id.cancel'), - inputPattern: /\S+/, - inputErrorMessage: $t( - 'prompt.direct_access_user_id.input_error' - ), - callback: (action, instance) => { - if (action === 'confirm' && instance.inputValue) { - var testUrl = instance.inputValue.substring(0, 15); - if (testUrl === 'https://vrchat.') { - var userId = this.parseUserUrl( - instance.inputValue - ); - if (userId) { - this.showUserDialog(userId); - } else { - this.$message({ - message: $t( - 'prompt.direct_access_user_id.message.error' - ), - type: 'error' - }); - } - } else { - this.showUserDialog(instance.inputValue); - } - } - } - } - ); - }, - - promptUsernameDialog() { - this.$prompt( - $t('prompt.direct_access_username.description'), - $t('prompt.direct_access_username.header'), - { - distinguishCancelAndClose: true, - confirmButtonText: $t('prompt.direct_access_username.ok'), - cancelButtonText: $t( - 'prompt.direct_access_username.cancel' - ), - inputPattern: /\S+/, - inputErrorMessage: $t( - 'prompt.direct_access_username.input_error' - ), - callback: (action, instance) => { - if (action === 'confirm' && instance.inputValue) { - this.lookupUser({ - displayName: instance.inputValue - }); - } - } - } - ); - }, - - promptWorldDialog() { - this.$prompt( - $t('prompt.direct_access_world_id.description'), - $t('prompt.direct_access_world_id.header'), - { - distinguishCancelAndClose: true, - confirmButtonText: $t('prompt.direct_access_world_id.ok'), - cancelButtonText: $t( - 'prompt.direct_access_world_id.cancel' - ), - inputPattern: /\S+/, - inputErrorMessage: $t( - 'prompt.direct_access_world_id.input_error' - ), - callback: (action, instance) => { - if (action === 'confirm' && instance.inputValue) { - if (!this.directAccessWorld(instance.inputValue)) { - this.$message({ - message: $t( - 'prompt.direct_access_world_id.message.error' - ), - type: 'error' - }); - } - } - } - } - ); - }, - - promptAvatarDialog() { - this.$prompt( - $t('prompt.direct_access_avatar_id.description'), - $t('prompt.direct_access_avatar_id.header'), - { - distinguishCancelAndClose: true, - confirmButtonText: $t('prompt.direct_access_avatar_id.ok'), - cancelButtonText: $t( - 'prompt.direct_access_avatar_id.cancel' - ), - inputPattern: /\S+/, - inputErrorMessage: $t( - 'prompt.direct_access_avatar_id.input_error' - ), - callback: (action, instance) => { - if (action === 'confirm' && instance.inputValue) { - var testUrl = instance.inputValue.substring(0, 15); - if (testUrl === 'https://vrchat.') { - var avatarId = this.parseAvatarUrl( - instance.inputValue - ); - if (avatarId) { - this.showAvatarDialog(avatarId); - } else { - this.$message({ - message: $t( - 'prompt.direct_access_avatar_id.message.error' - ), - type: 'error' - }); - } - } else { - this.showAvatarDialog(instance.inputValue); - } - } - } - } - ); - }, - promptOmniDirectDialog() { this.$prompt( $t('prompt.direct_access_omni.description'), diff --git a/src/classes/uiComponents.js b/src/classes/uiComponents.js index 514dd4bf..b2b6e286 100644 --- a/src/classes/uiComponents.js +++ b/src/classes/uiComponents.js @@ -1,8 +1,9 @@ import Vue from 'vue'; import VueMarkdown from 'vue-markdown'; -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; import { instanceRequest, userRequest } from '../api'; -import utils from './utils'; +import { hasGroupPermission } from '../composables/group/utils'; +import { parseLocation } from '../composables/instance/utils'; +import { $app, $t, API, baseClass } from './baseClass.js'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -60,7 +61,7 @@ export default class extends baseClass { this.selfInvite(this.location, this.shortname); }, selfInvite(location, shortName) { - const L = utils.parseLocation(location); + const L = parseLocation(location); if (!L.isRealInstance) { return; } @@ -165,7 +166,7 @@ export default class extends baseClass { if (!this.location) { return; } - var L = $utils.parseLocation(this.location); + var L = parseLocation(this.location); if (!L.groupId) { return; } @@ -320,7 +321,7 @@ export default class extends baseClass { // check group perms var groupId = this.instance.ownerId; var group = API.cachedGroups.get(groupId); - this.canCloseInstance = utils.hasGroupPermission( + this.canCloseInstance = hasGroupPermission( group, 'group-instance-moderate' ); diff --git a/src/classes/utils.js b/src/classes/utils.js index f8af2b95..6a7d1057 100644 --- a/src/classes/utils.js +++ b/src/classes/utils.js @@ -1,8 +1,5 @@ -import Noty from 'noty'; - let echarts = null; -// messy here, organize later const _utils = { removeFromArray(array, item) { var { length } = array; @@ -14,7 +11,6 @@ const _utils = { } return false; }, - arraysMatch(a, b) { if (!Array.isArray(a) || !Array.isArray(b)) { return false; @@ -27,12 +23,10 @@ const _utils = { ) ); }, - escapeTag(tag) { var s = String(tag); return s.replace(/["&'<>]/g, (c) => `&#${c.charCodeAt(0)};`); }, - escapeTagRecursive(obj) { if (typeof obj === 'string') { return this.escapeTag(obj); @@ -44,7 +38,6 @@ const _utils = { } return obj; }, - timeToText(sec, isNeedSeconds = false) { let n = Number(sec); if (isNaN(n)) { @@ -72,7 +65,6 @@ const _utils = { } return arr.join(' '); }, - textToHex(text) { var s = String(text); return s @@ -80,7 +72,6 @@ const _utils = { .map((c) => c.charCodeAt(0).toString(16)) .join(' '); }, - commaNumber(num) { if (!num) { return '0'; @@ -88,182 +79,6 @@ const _utils = { var s = String(Number(num)); return s.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'); }, - - isRealInstance(instanceId) { - if (!instanceId) { - return false; - } - switch (instanceId) { - case ':': - case 'offline': - case 'offline:offline': - case 'private': - case 'private:private': - case 'traveling': - case 'traveling:traveling': - case instanceId.startsWith('local'): - return false; - } - return true; - }, - - parseLocation(tag) { - var _tag = String(tag || ''); - var ctx = { - tag: _tag, - isOffline: false, - isPrivate: false, - isTraveling: false, - isRealInstance: false, - worldId: '', - instanceId: '', - instanceName: '', - accessType: '', - accessTypeName: '', - region: '', - shortName: '', - userId: null, - hiddenId: null, - privateId: null, - friendsId: null, - groupId: null, - groupAccessType: null, - canRequestInvite: false, - strict: false, - ageGate: false - }; - if (_tag === 'offline' || _tag === 'offline:offline') { - ctx.isOffline = true; - } else if (_tag === 'private' || _tag === 'private:private') { - ctx.isPrivate = true; - } else if (_tag === 'traveling' || _tag === 'traveling:traveling') { - ctx.isTraveling = true; - } else if (!_tag.startsWith('local')) { - ctx.isRealInstance = true; - var sep = _tag.indexOf(':'); - // technically not part of instance id, but might be there when coping id from url so why not support it - var shortNameQualifier = '&shortName='; - var shortNameIndex = _tag.indexOf(shortNameQualifier); - if (shortNameIndex >= 0) { - ctx.shortName = _tag.substr( - shortNameIndex + shortNameQualifier.length - ); - _tag = _tag.substr(0, shortNameIndex); - } - if (sep >= 0) { - ctx.worldId = _tag.substr(0, sep); - ctx.instanceId = _tag.substr(sep + 1); - ctx.instanceId.split('~').forEach((s, i) => { - if (i) { - var A = s.indexOf('('); - var Z = A >= 0 ? s.lastIndexOf(')') : -1; - var key = Z >= 0 ? s.substr(0, A) : s; - var value = A < Z ? s.substr(A + 1, Z - A - 1) : ''; - if (key === 'hidden') { - ctx.hiddenId = value; - } else if (key === 'private') { - ctx.privateId = value; - } else if (key === 'friends') { - ctx.friendsId = value; - } else if (key === 'canRequestInvite') { - ctx.canRequestInvite = true; - } else if (key === 'region') { - ctx.region = value; - } else if (key === 'group') { - ctx.groupId = value; - } else if (key === 'groupAccessType') { - ctx.groupAccessType = value; - } else if (key === 'strict') { - ctx.strict = true; - } else if (key === 'ageGate') { - ctx.ageGate = true; - } - } else { - ctx.instanceName = s; - } - }); - ctx.accessType = 'public'; - if (ctx.privateId !== null) { - if (ctx.canRequestInvite) { - // InvitePlus - ctx.accessType = 'invite+'; - } else { - // InviteOnly - ctx.accessType = 'invite'; - } - ctx.userId = ctx.privateId; - } else if (ctx.friendsId !== null) { - // FriendsOnly - ctx.accessType = 'friends'; - ctx.userId = ctx.friendsId; - } else if (ctx.hiddenId !== null) { - // FriendsOfGuests - ctx.accessType = 'friends+'; - ctx.userId = ctx.hiddenId; - } else if (ctx.groupId !== null) { - // Group - ctx.accessType = 'group'; - } - ctx.accessTypeName = ctx.accessType; - if (ctx.groupAccessType !== null) { - if (ctx.groupAccessType === 'public') { - ctx.accessTypeName = 'groupPublic'; - } else if (ctx.groupAccessType === 'plus') { - ctx.accessTypeName = 'groupPlus'; - } - } - } else { - ctx.worldId = _tag; - } - } - return ctx; - }, - - displayLocation(location, worldName, groupName) { - var text = worldName; - var L = this.parseLocation(location); - if (L.isOffline) { - text = 'Offline'; - } else if (L.isPrivate) { - text = 'Private'; - } else if (L.isTraveling) { - text = 'Traveling'; - } else if (L.worldId) { - if (groupName) { - text = `${worldName} ${L.accessTypeName}(${groupName})`; - } else if (L.instanceId) { - text = `${worldName} ${L.accessTypeName}`; - } - } - return text; - }, - - extractFileId(s) { - var match = String(s).match(/file_[0-9A-Za-z-]+/); - return match ? match[0] : ''; - }, - - extractFileVersion(s) { - var match = /(?:\/file_[0-9A-Za-z-]+\/)([0-9]+)/gi.exec(s); - return match ? match[1] : ''; - }, - - extractVariantVersion(url) { - if (!url) { - return '0'; - } - try { - const params = new URLSearchParams(new URL(url).search); - const version = params.get('v'); - if (version) { - return version; - } - return '0'; - } catch { - return '0'; - } - }, - buildTreeData(json) { var node = []; for (var key in json) { @@ -325,8 +140,6 @@ const _utils = { }); return node; }, - - // app.js 4900ln // descending compareByCreatedAt(a, b) { if ( @@ -406,298 +219,69 @@ const _utils = { } return false; }, - convertFileUrlToImageUrl(url, resolution = 128) { - if (!url) { + compareByName(a, b) { + if (typeof a.name !== 'string' || typeof b.name !== 'string') { + return 0; + } + return a.name.localeCompare(b.name); + }, + replaceBioSymbols(text) { + if (!text) { return ''; } - /** - * possible patterns? - * /file/file_fileId/version - * /file/file_fileId/version/ - * /file/file_fileId/version/file - * /file/file_fileId/version/file/ - */ - const pattern = /file\/file_([a-f0-9-]+)\/(\d+)(\/file)?\/?$/; - const match = url.match(pattern); - - if (match) { - const fileId = match[1]; - const version = match[2]; - return `https://api.vrchat.cloud/api/1/image/file_${fileId}/${version}/${resolution}`; + var symbolList = { + '@': '@', + '#': '#', + $: '$', + '%': '%', + '&': '&', + '=': '=', + '+': '+', + '/': '⁄', + '\\': '\', + ';': ';', + ':': '˸', + ',': '‚', + '?': '?', + '!': 'ǃ', + '"': '"', + '<': '≺', + '>': '≻', + '.': '․', + '^': '^', + '{': '{', + '}': '}', + '[': '[', + ']': ']', + '(': '(', + ')': ')', + '|': '|', + '*': '∗' + }; + var newText = text; + for (var key in symbolList) { + var regex = new RegExp(symbolList[key], 'g'); + newText = newText.replace(regex, key); } - // no match return origin url - return url; + return newText.replace(/ {1,}/g, ' ').trimRight(); }, - replaceVrcPackageUrl(url) { - if (!url) { - return ''; - } - return url.replace('https://api.vrchat.cloud/', 'https://vrchat.com/'); - }, - getLaunchURL(instance) { - var L = instance; - if (L.instanceId) { - if (L.shortName) { - return `https://vrchat.com/home/launch?worldId=${encodeURIComponent( - L.worldId - )}&instanceId=${encodeURIComponent( - L.instanceId - )}&shortName=${encodeURIComponent(L.shortName)}`; - } - return `https://vrchat.com/home/launch?worldId=${encodeURIComponent( - L.worldId - )}&instanceId=${encodeURIComponent(L.instanceId)}`; - } - return `https://vrchat.com/home/launch?worldId=${encodeURIComponent( - L.worldId - )}`; - }, - getFaviconUrl(resource) { - try { - const url = new URL(resource); - return `https://icons.duckduckgo.com/ip2/${url.host}.ico`; - } catch (err) { - return ''; - } - }, - copyToClipboard(text) { - navigator.clipboard - .writeText(text) - .then(() => { - window.$app.$message({ - message: 'Copied successfully!', - type: 'success' - }); - }) - .catch((err) => { - console.error('Copy failed:', err); - this.$message.error('Copy failed!'); - }); - }, - hasGroupPermission(ref, permission) { + // descending + compareByUpdatedAt(a, b) { if ( - ref && - ref.myMember && - ref.myMember.permissions && - (ref.myMember.permissions.includes('*') || - ref.myMember.permissions.includes(permission)) + typeof a.updated_at !== 'string' || + typeof b.updated_at !== 'string' ) { - return true; + return 0; } - return false; - }, - - compareUnityVersion(unitySortNumber) { - if (!window.API.cachedConfig.sdkUnityVersion) { - console.error('No cachedConfig.sdkUnityVersion'); - return false; + var A = a.updated_at.toUpperCase(); + var B = b.updated_at.toUpperCase(); + if (A < B) { + return 1; } - - // 2022.3.6f1 2022 03 06 000 - // 2019.4.31f1 2019 04 31 000 - // 5.3.4p1 5 03 04 010 - // 2019.4.31f1c1 is a thing - var array = API.cachedConfig.sdkUnityVersion.split('.'); - if (array.length < 3) { - console.error('Invalid cachedConfig.sdkUnityVersion'); - return false; + if (A > B) { + return -1; } - var currentUnityVersion = array[0]; - currentUnityVersion += array[1].padStart(2, '0'); - var indexFirstLetter = array[2].search(/[a-zA-Z]/); - if (indexFirstLetter > -1) { - currentUnityVersion += array[2] - .substr(0, indexFirstLetter) - .padStart(2, '0'); - currentUnityVersion += '0'; - var letter = array[2].substr(indexFirstLetter, 1); - if (letter === 'p') { - currentUnityVersion += '1'; - } else { - // f - currentUnityVersion += '0'; - } - currentUnityVersion += '0'; - } else { - // just in case - currentUnityVersion += '000'; - } - // just in case - currentUnityVersion = currentUnityVersion.replace(/\D/g, ''); - - if ( - parseInt(unitySortNumber, 10) <= parseInt(currentUnityVersion, 10) - ) { - return true; - } - return false; - }, - async checkVRChatCache(ref) { - if (!ref.unityPackages) { - return { Item1: -1, Item2: false, Item3: '' }; - } - var assetUrl = ''; - var variant = ''; - for (var i = ref.unityPackages.length - 1; i > -1; i--) { - var unityPackage = ref.unityPackages[i]; - if (unityPackage.variant && unityPackage.variant !== 'security') { - continue; - } - if ( - unityPackage.platform === 'standalonewindows' && - _utils.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - if (unityPackage.variant !== 'standard') { - variant = unityPackage.variant; - } - break; - } - } - if (!assetUrl) { - assetUrl = ref.assetUrl; - } - var id = _utils.extractFileId(assetUrl); - var version = parseInt(_utils.extractFileVersion(assetUrl), 10); - var variantVersion = parseInt( - _utils.extractVariantVersion(assetUrl), - 10 - ); - if (!id || !version) { - return { Item1: -1, Item2: false, Item3: '' }; - } - - return AssetBundleManager.CheckVRChatCache( - id, - version, - variant, - variantVersion - ); - }, - async deleteVRChatCache(ref) { - var assetUrl = ''; - var variant = ''; - for (var i = ref.unityPackages.length - 1; i > -1; i--) { - var unityPackage = ref.unityPackages[i]; - if ( - unityPackage.variant && - unityPackage.variant !== 'standard' && - unityPackage.variant !== 'security' - ) { - continue; - } - if ( - unityPackage.platform === 'standalonewindows' && - $utils.compareUnityVersion(unityPackage.unitySortNumber) - ) { - assetUrl = unityPackage.assetUrl; - if (unityPackage.variant !== 'standard') { - variant = unityPackage.variant; - } - break; - } - } - var id = $utils.extractFileId(assetUrl); - var version = parseInt($utils.extractFileVersion(assetUrl), 10); - var variantVersion = parseInt( - $utils.extractVariantVersion(assetUrl), - 10 - ); - await AssetBundleManager.DeleteCache( - id, - version, - variant, - variantVersion - ); - }, - downloadAndSaveJson(fileName, data) { - if (!fileName || !data) { - return; - } - try { - var link = document.createElement('a'); - link.setAttribute( - 'href', - `data:application/json;charset=utf-8,${encodeURIComponent( - JSON.stringify(data, null, 2) - )}` - ); - link.setAttribute('download', `${fileName}.json`); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } catch { - new Noty({ - type: 'error', - text: $app.escapeTag('Failed to download JSON.') - }).show(); - } - }, - getAvailablePlatforms(unityPackages) { - var isPC = false; - var isQuest = false; - var isIos = false; - if (typeof unityPackages === 'object') { - for (var unityPackage of unityPackages) { - if ( - unityPackage.variant && - unityPackage.variant !== 'standard' && - unityPackage.variant !== 'security' - ) { - continue; - } - if (unityPackage.platform === 'standalonewindows') { - isPC = true; - } else if (unityPackage.platform === 'android') { - isQuest = true; - } else if (unityPackage.platform === 'ios') { - isIos = true; - } - } - } - return { isPC, isQuest, isIos }; - }, - getPlatformInfo(unityPackages) { - var pc = {}; - var android = {}; - var ios = {}; - if (typeof unityPackages === 'object') { - for (var unityPackage of unityPackages) { - if ( - unityPackage.variant && - unityPackage.variant !== 'standard' && - unityPackage.variant !== 'security' - ) { - continue; - } - if (unityPackage.platform === 'standalonewindows') { - if ( - unityPackage.performanceRating === 'None' && - pc.performanceRating - ) { - continue; - } - pc = unityPackage; - } else if (unityPackage.platform === 'android') { - if ( - unityPackage.performanceRating === 'None' && - android.performanceRating - ) { - continue; - } - android = unityPackage; - } else if (unityPackage.platform === 'ios') { - if ( - unityPackage.performanceRating === 'None' && - ios.performanceRating - ) { - continue; - } - ios = unityPackage; - } - } - } - return { pc, android, ios }; + return 0; } }; diff --git a/src/classes/vrcxNotifications.js b/src/classes/vrcxNotifications.js index 15e86960..490838fc 100644 --- a/src/classes/vrcxNotifications.js +++ b/src/classes/vrcxNotifications.js @@ -1,5 +1,7 @@ -import { baseClass, $app, API, $t, $utils } from './baseClass.js'; import { userRequest } from '../api'; +import { displayLocation } from '../composables/instance/utils'; +import { extractFileId, extractFileVersion } from '../composables/shared/utils'; +import { $app, API, baseClass } from './baseClass.js'; export default class extends baseClass { constructor(_app, _API, _t) { @@ -356,8 +358,8 @@ export default class extends baseClass { async notySaveImage(noty) { var imageUrl = await this.notyGetImage(noty); - var fileId = this.extractFileId(imageUrl); - var fileVersion = this.extractFileVersion(imageUrl); + var fileId = extractFileId(imageUrl); + var fileVersion = extractFileVersion(imageUrl); var imageLocation = ''; try { if (fileId && fileVersion) { @@ -414,7 +416,7 @@ export default class extends baseClass { break; case 'GPS': this.speak( - `${displayName} is in ${this.displayLocation( + `${displayName} is in ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -424,7 +426,7 @@ export default class extends baseClass { case 'Online': var locationName = ''; if (noty.worldName) { - locationName = ` to ${this.displayLocation( + locationName = ` to ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -442,7 +444,7 @@ export default class extends baseClass { break; case 'invite': this.speak( - `${displayName} has invited you to ${this.displayLocation( + `${displayName} has invited you to ${displayLocation( noty.details.worldId, noty.details.worldName, noty.groupName @@ -513,7 +515,7 @@ export default class extends baseClass { case 'PortalSpawn': if (displayName) { this.speak( - `${displayName} has spawned a portal to ${this.displayLocation( + `${displayName} has spawned a portal to ${displayLocation( noty.instanceId, noty.worldName, noty.groupName @@ -599,7 +601,7 @@ export default class extends baseClass { case 'GPS': AppApi.XSNotification( 'VRCX', - `${noty.displayName} is in ${this.displayLocation( + `${noty.displayName} is in ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -611,7 +613,7 @@ export default class extends baseClass { case 'Online': var locationName = ''; if (noty.worldName) { - locationName = ` to ${this.displayLocation( + locationName = ` to ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -645,7 +647,7 @@ export default class extends baseClass { 'VRCX', `${ noty.senderUsername - } has invited you to ${this.displayLocation( + } has invited you to ${displayLocation( noty.details.worldId, noty.details.worldName )}${message}`, @@ -755,7 +757,7 @@ export default class extends baseClass { 'VRCX', `${ noty.displayName - } has spawned a portal to ${this.displayLocation( + } has spawned a portal to ${displayLocation( noty.instanceId, noty.worldName, noty.groupName @@ -915,7 +917,7 @@ export default class extends baseClass { playOvrtHudNotifications, playOvrtWristNotifications, 'VRCX', - `${noty.displayName} is in ${this.displayLocation( + `${noty.displayName} is in ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -927,7 +929,7 @@ export default class extends baseClass { case 'Online': var locationName = ''; if (noty.worldName) { - locationName = ` to ${this.displayLocation( + locationName = ` to ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -969,7 +971,7 @@ export default class extends baseClass { 'VRCX', `${ noty.senderUsername - } has invited you to ${this.displayLocation( + } has invited you to ${displayLocation( noty.details.worldId, noty.details.worldName )}${message}`, @@ -1155,7 +1157,7 @@ export default class extends baseClass { 'VRCX', `${ noty.displayName - } has spawned a portal to ${this.displayLocation( + } has spawned a portal to ${displayLocation( noty.instanceId, noty.worldName, noty.groupName @@ -1345,7 +1347,7 @@ export default class extends baseClass { case 'GPS': this.desktopNotification( noty.displayName, - `is in ${this.displayLocation( + `is in ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -1356,7 +1358,7 @@ export default class extends baseClass { case 'Online': var locationName = ''; if (noty.worldName) { - locationName = ` to ${this.displayLocation( + locationName = ` to ${displayLocation( noty.location, noty.worldName, noty.groupName @@ -1385,7 +1387,7 @@ export default class extends baseClass { case 'invite': this.desktopNotification( noty.senderUsername, - `has invited you to ${this.displayLocation( + `has invited you to ${displayLocation( noty.details.worldId, noty.details.worldName )}${message}`, @@ -1515,7 +1517,7 @@ export default class extends baseClass { if (noty.displayName) { this.desktopNotification( noty.displayName, - `has spawned a portal to ${this.displayLocation( + `has spawned a portal to ${displayLocation( noty.instanceId, noty.worldName, noty.groupName diff --git a/src/classes/websocket.js b/src/classes/websocket.js index d77d5df7..1cc5e5b8 100644 --- a/src/classes/websocket.js +++ b/src/classes/websocket.js @@ -1,5 +1,6 @@ import * as workerTimers from 'worker-timers'; import Noty from 'noty'; +import { parseLocation } from '../composables/instance/utils'; import { baseClass, $app, API, $utils } from './baseClass.js'; import { groupRequest } from '../api'; @@ -265,8 +266,8 @@ export default class extends baseClass { case 'friend-online': // Where is instanceId, travelingToWorld, travelingToInstance? // More JANK, what a mess - var $location = $utils.parseLocation(content.location); - var $travelingToLocation = $utils.parseLocation( + var $location = parseLocation(content.location); + var $travelingToLocation = parseLocation( content.travelingToLocation ); if (content?.user?.id) { @@ -367,8 +368,8 @@ export default class extends baseClass { break; case 'friend-location': - var $location = $utils.parseLocation(content.location); - var $travelingToLocation = $utils.parseLocation( + var $location = parseLocation(content.location); + var $travelingToLocation = parseLocation( content.travelingToLocation ); if (!content?.user?.id) { diff --git a/src/components/Location.vue b/src/components/Location.vue index ea4bb07e..a6a2a90f 100644 --- a/src/components/Location.vue +++ b/src/components/Location.vue @@ -16,7 +16,7 @@ diff --git a/src/components/dialogs/AvatarDialog/ChangeAvatarImageDialog.vue b/src/components/dialogs/AvatarDialog/ChangeAvatarImageDialog.vue new file mode 100644 index 00000000..dca3c3a1 --- /dev/null +++ b/src/components/dialogs/AvatarDialog/ChangeAvatarImageDialog.vue @@ -0,0 +1,393 @@ + + + diff --git a/src/components/dialogs/AvatarDialog/SetAvatarStylesDialog.vue b/src/components/dialogs/AvatarDialog/SetAvatarStylesDialog.vue index 69e297bb..682c064a 100644 --- a/src/components/dialogs/AvatarDialog/SetAvatarStylesDialog.vue +++ b/src/components/dialogs/AvatarDialog/SetAvatarStylesDialog.vue @@ -1,14 +1,11 @@ diff --git a/src/components/dialogs/GroupDialog/GallerySelectDialog.vue b/src/components/dialogs/GroupDialog/GallerySelectDialog.vue new file mode 100644 index 00000000..7007c1a7 --- /dev/null +++ b/src/components/dialogs/GroupDialog/GallerySelectDialog.vue @@ -0,0 +1,136 @@ + + + diff --git a/src/components/dialogs/GroupDialog/GroupDialog.vue b/src/components/dialogs/GroupDialog/GroupDialog.vue index b1a0e40f..dd8a7cae 100644 --- a/src/components/dialogs/GroupDialog/GroupDialog.vue +++ b/src/components/dialogs/GroupDialog/GroupDialog.vue @@ -1,14 +1,11 @@ diff --git a/src/components/dialogs/GroupDialog/GroupMemberModerationDialog.vue b/src/components/dialogs/GroupDialog/GroupMemberModerationDialog.vue index a9bd7487..a4b4f747 100644 --- a/src/components/dialogs/GroupDialog/GroupMemberModerationDialog.vue +++ b/src/components/dialogs/GroupDialog/GroupMemberModerationDialog.vue @@ -1,15 +1,12 @@ diff --git a/src/components/dialogs/GroupDialog/GroupMemberModerationExportDialog.vue b/src/components/dialogs/GroupDialog/GroupMemberModerationExportDialog.vue index 3ae8f907..dd8cc2a2 100644 --- a/src/components/dialogs/GroupDialog/GroupMemberModerationExportDialog.vue +++ b/src/components/dialogs/GroupDialog/GroupMemberModerationExportDialog.vue @@ -1,14 +1,11 @@ diff --git a/src/components/dialogs/InviteDialog/InviteDialog.vue b/src/components/dialogs/InviteDialog/InviteDialog.vue new file mode 100644 index 00000000..8610e642 --- /dev/null +++ b/src/components/dialogs/InviteDialog/InviteDialog.vue @@ -0,0 +1,309 @@ + + + diff --git a/src/components/dialogs/InviteDialog/SendInviteConfirmDialog.vue b/src/components/dialogs/InviteDialog/SendInviteConfirmDialog.vue new file mode 100644 index 00000000..fea91f0d --- /dev/null +++ b/src/components/dialogs/InviteDialog/SendInviteConfirmDialog.vue @@ -0,0 +1,176 @@ + + + diff --git a/src/components/dialogs/InviteDialog/SendInviteDialog.vue b/src/components/dialogs/InviteDialog/SendInviteDialog.vue new file mode 100644 index 00000000..8198a2e7 --- /dev/null +++ b/src/components/dialogs/InviteDialog/SendInviteDialog.vue @@ -0,0 +1,165 @@ + + + diff --git a/src/components/dialogs/GroupDialog/InviteGroupDialog.vue b/src/components/dialogs/InviteGroupDialog.vue similarity index 95% rename from src/components/dialogs/GroupDialog/InviteGroupDialog.vue rename to src/components/dialogs/InviteGroupDialog.vue index 2e468f64..5a1aee49 100644 --- a/src/components/dialogs/GroupDialog/InviteGroupDialog.vue +++ b/src/components/dialogs/InviteGroupDialog.vue @@ -1,12 +1,10 @@ - + diff --git a/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesInfoDialog.vue b/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesInfoDialog.vue index 0b39955e..77379c17 100644 --- a/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesInfoDialog.vue +++ b/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesInfoDialog.vue @@ -1,14 +1,11 @@ - + diff --git a/src/components/dialogs/SendBoopDialog.vue b/src/components/dialogs/SendBoopDialog.vue new file mode 100644 index 00000000..df9b1f1c --- /dev/null +++ b/src/components/dialogs/SendBoopDialog.vue @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/dialogs/UserDialog/BioDialog.vue b/src/components/dialogs/UserDialog/BioDialog.vue new file mode 100644 index 00000000..f9aa99a1 --- /dev/null +++ b/src/components/dialogs/UserDialog/BioDialog.vue @@ -0,0 +1,90 @@ + + + diff --git a/src/components/dialogs/UserDialog/GalleryDialog.vue b/src/components/dialogs/UserDialog/GalleryDialog.vue new file mode 100644 index 00000000..c452186e --- /dev/null +++ b/src/components/dialogs/UserDialog/GalleryDialog.vue @@ -0,0 +1,1024 @@ + + + diff --git a/src/components/dialogs/UserDialog/LanguageDialog.vue b/src/components/dialogs/UserDialog/LanguageDialog.vue new file mode 100644 index 00000000..3a9ece90 --- /dev/null +++ b/src/components/dialogs/UserDialog/LanguageDialog.vue @@ -0,0 +1,96 @@ + + + diff --git a/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesUserDialog.vue b/src/components/dialogs/UserDialog/PreviousInstancesUserDialog.vue similarity index 94% rename from src/components/dialogs/PreviousInstancesDialog/PreviousInstancesUserDialog.vue rename to src/components/dialogs/UserDialog/PreviousInstancesUserDialog.vue index fa8f5365..f5d03f25 100644 --- a/src/components/dialogs/PreviousInstancesDialog/PreviousInstancesUserDialog.vue +++ b/src/components/dialogs/UserDialog/PreviousInstancesUserDialog.vue @@ -1,12 +1,10 @@ diff --git a/src/components/dialogs/UserDialog/SendInviteRequestDialog.vue b/src/components/dialogs/UserDialog/SendInviteRequestDialog.vue new file mode 100644 index 00000000..eb6243f5 --- /dev/null +++ b/src/components/dialogs/UserDialog/SendInviteRequestDialog.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/components/dialogs/UserDialog/SocialStatusDialog.vue b/src/components/dialogs/UserDialog/SocialStatusDialog.vue new file mode 100644 index 00000000..99cde856 --- /dev/null +++ b/src/components/dialogs/UserDialog/SocialStatusDialog.vue @@ -0,0 +1,109 @@ + + + diff --git a/src/components/dialogs/UserDialog/UserDialog.vue b/src/components/dialogs/UserDialog/UserDialog.vue new file mode 100644 index 00000000..e00f820e --- /dev/null +++ b/src/components/dialogs/UserDialog/UserDialog.vue @@ -0,0 +1,3179 @@ + + + diff --git a/src/components/dialogs/VRCXUpdateDialog.vue b/src/components/dialogs/VRCXUpdateDialog.vue index 8a280d03..1af439a6 100644 --- a/src/components/dialogs/VRCXUpdateDialog.vue +++ b/src/components/dialogs/VRCXUpdateDialog.vue @@ -1,13 +1,10 @@ diff --git a/src/components/dialogs/WorldDialog/SetWorldTagsDialog.vue b/src/components/dialogs/WorldDialog/SetWorldTagsDialog.vue index 32f76715..4a64f75a 100644 --- a/src/components/dialogs/WorldDialog/SetWorldTagsDialog.vue +++ b/src/components/dialogs/WorldDialog/SetWorldTagsDialog.vue @@ -1,13 +1,10 @@ - + + + diff --git a/src/views/FriendList/FriendList.vue b/src/views/FriendList/FriendList.vue index f04bf76f..bcdcafcb 100644 --- a/src/views/FriendList/FriendList.vue +++ b/src/views/FriendList/FriendList.vue @@ -270,9 +270,11 @@ + + diff --git a/src/views/GameLog/GameLog.vue b/src/views/GameLog/GameLog.vue new file mode 100644 index 00000000..0081e5f0 --- /dev/null +++ b/src/views/GameLog/GameLog.vue @@ -0,0 +1,278 @@ + + + + + diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue new file mode 100644 index 00000000..9d73e522 --- /dev/null +++ b/src/views/Login/Login.vue @@ -0,0 +1,227 @@ + + + + + diff --git a/src/views/Notifications/Notification.vue b/src/views/Notifications/Notification.vue new file mode 100644 index 00000000..c1ef35c3 --- /dev/null +++ b/src/views/Notifications/Notification.vue @@ -0,0 +1,670 @@ + + + + + diff --git a/src/views/Notifications/dialogs/EditAndSendInviteResponseDialog.vue b/src/views/Notifications/dialogs/EditAndSendInviteResponseDialog.vue new file mode 100644 index 00000000..a5feb348 --- /dev/null +++ b/src/views/Notifications/dialogs/EditAndSendInviteResponseDialog.vue @@ -0,0 +1,133 @@ + + + diff --git a/src/views/Notifications/dialogs/SendInviteRequestResponseDialog.vue b/src/views/Notifications/dialogs/SendInviteRequestResponseDialog.vue new file mode 100644 index 00000000..b1971573 --- /dev/null +++ b/src/views/Notifications/dialogs/SendInviteRequestResponseDialog.vue @@ -0,0 +1,125 @@ + + + diff --git a/src/views/Notifications/dialogs/SendInviteResponseConfirmDialog.vue b/src/views/Notifications/dialogs/SendInviteResponseConfirmDialog.vue new file mode 100644 index 00000000..012325a0 --- /dev/null +++ b/src/views/Notifications/dialogs/SendInviteResponseConfirmDialog.vue @@ -0,0 +1,95 @@ + + + diff --git a/src/views/Notifications/dialogs/SendInviteResponseDialog.vue b/src/views/Notifications/dialogs/SendInviteResponseDialog.vue new file mode 100644 index 00000000..76cd7ff0 --- /dev/null +++ b/src/views/Notifications/dialogs/SendInviteResponseDialog.vue @@ -0,0 +1,126 @@ + + + diff --git a/src/views/PlayerList/PlayerList.vue b/src/views/PlayerList/PlayerList.vue new file mode 100644 index 00000000..c59dc724 --- /dev/null +++ b/src/views/PlayerList/PlayerList.vue @@ -0,0 +1,984 @@ + + + + + diff --git a/src/views/PlayerList/dialogs/ChatboxBlacklistDialog.vue b/src/views/PlayerList/dialogs/ChatboxBlacklistDialog.vue index fdfa18f9..c82733bb 100644 --- a/src/views/PlayerList/dialogs/ChatboxBlacklistDialog.vue +++ b/src/views/PlayerList/dialogs/ChatboxBlacklistDialog.vue @@ -1,12 +1,9 @@ + + diff --git a/src/views/Profile/dialogs/DiscordNamesDialog.vue b/src/views/Profile/dialogs/DiscordNamesDialog.vue index af1c9ad0..0aeb610e 100644 --- a/src/views/Profile/dialogs/DiscordNamesDialog.vue +++ b/src/views/Profile/dialogs/DiscordNamesDialog.vue @@ -1,13 +1,10 @@ + + diff --git a/src/views/Settings/dialogs/AvatarProviderDialog.vue b/src/views/Settings/dialogs/AvatarProviderDialog.vue index 7b05c473..1f6c93c2 100644 --- a/src/views/Settings/dialogs/AvatarProviderDialog.vue +++ b/src/views/Settings/dialogs/AvatarProviderDialog.vue @@ -1,13 +1,10 @@