Skip to content

Commit

Permalink
Change startup friends load, fix primary password
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Oct 31, 2024
1 parent 7c3c14a commit 6563b39
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 29 deletions.
25 changes: 13 additions & 12 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ speechSynthesis.getVoices();
this.checkVRChatDebugLogging();
this.checkAutoBackupRestoreVrcRegistry();
await this.migrateStoredUsers();
this.loginForm.savedCredentials =
(await configRepository.getString('savedCredentials')) !== null
? JSON.parse(
await configRepository.getString('savedCredentials')
)
: {};
this.loginForm.lastUserLoggedIn =
await configRepository.getString('lastUserLoggedIn');
this.$nextTick(async function () {
this.$el.style.display = '';
if (
Expand Down Expand Up @@ -599,14 +607,6 @@ speechSynthesis.getVoices();
this.applyUserTrustLevel(ref);
this.applyUserLanguage(ref);
this.cachedUsers.set(ref.id, ref);

if (this.currentUser?.offlineFriends.includes(ref.id)) {
$app.addFriend(ref.id, 'offline');
} else if (this.currentUser?.activeFriends.includes(ref.id)) {
$app.addFriend(ref.id, 'active');
} else if (this.currentUser?.onlineFriends.includes(ref.id)) {
$app.addFriend(ref.id, 'online');
}
} else {
var props = {};
for (var prop in ref) {
Expand Down Expand Up @@ -681,6 +681,10 @@ speechSynthesis.getVoices();
}
}
}
var friendCtx = $app.friends.get(ref.id);
if (friendCtx) {
friendCtx.ref = ref;
}
if (ref.id === this.currentUser.id) {
if (ref.status) {
this.currentUser.status = ref.status;
Expand Down Expand Up @@ -4274,9 +4278,6 @@ speechSynthesis.getVoices();
};

$app.methods.refreshFriends = function (ref, fromGetCurrentUser) {
if (!this.friendLogInitStatus) {
return;
}
var map = new Map();
for (var id of ref.friends) {
map.set(id, 'offline');
Expand Down Expand Up @@ -5347,6 +5348,7 @@ speechSynthesis.getVoices();
args.json?.presence?.groups
);
await $app.getCurrentUserGroups();
$app.refreshFriends(args.ref, args.fromGetCurrentUser);
try {
if (
await configRepository.getBool(`friendLogInit_${args.json.id}`)
Expand All @@ -5355,7 +5357,6 @@ speechSynthesis.getVoices();
} else {
await $app.initFriendLog(args.json.id);
}
$app.refreshFriends(args.ref, args.fromGetCurrentUser);
} catch (err) {
if (!$app.dontLogMeOut) {
$app.$message({
Expand Down
9 changes: 0 additions & 9 deletions html/src/classes/apiLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ export default class extends baseClass {
}

async init() {
$app.savedCredentials =
(await configRepository.getString('savedCredentials')) !== null
? JSON.parse(
await configRepository.getString('savedCredentials')
)
: {};
$app.lastUserLoggedIn =
await configRepository.getString('lastUserLoggedIn');

API.isLoggedIn = false;
API.attemptingAutoLogin = false;

Expand Down
4 changes: 2 additions & 2 deletions html/src/localization/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"vrcx_updater": {
"header": "VRCX Updater",
"change_build": "Change build",
"auto_update": "Auto update",
"update_action": "Update action",
"auto_update_off": "Off",
"auto_update_notify": "Notify",
"auto_update_download": "Auto Download",
Expand Down Expand Up @@ -443,7 +443,7 @@
},
"screenshot_helper": {
"header": "Screenshot Helper",
"description": "Will store the world ID, world name and players in instance inside the file metadata of any pictures you take in-game.",
"description": "Store world ID, world name and players inside the instance inside the file metadata of any pictures you take in-game.",
"description_tooltip": "Unfortunately, windows doesn't support viewing PNG text chunks(few things do) natively, but you can view it using a command-line tool like exiftool, a png chunk inspector, or a hex editor.",
"enable": "Enable",
"modify_filename": "Modify Filename",
Expand Down
8 changes: 4 additions & 4 deletions html/src/mixins/friendsListSidebar.pug
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mixin friendsListSidebar()
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-if="friend.pendingOffline") #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }}
location.extra(v-else :location="friend.ref.location" :traveling="friend.ref.travelingToLocation" :link="false")
template(v-else)
template(v-else-if="friendLogInitStatus")
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isOnlineFriends = !isOnlineFriends; saveFriendsGroupStates()" v-show="onlineFriends.length")
Expand All @@ -65,7 +65,7 @@ mixin friendsListSidebar()
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-if="friend.pendingOffline") #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }}
location.extra(v-else :location="friend.ref.location" :traveling="friend.ref.travelingToLocation" :link="false")
template(v-else)
template(v-else-if="friendLogInitStatus")
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isActiveFriends = !isActiveFriends; saveFriendsGroupStates()" v-show="activeFriends.length")
Expand All @@ -80,7 +80,7 @@ mixin friendsListSidebar()
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-text="friend.ref.statusDescription" :link="false")
template(v-else)
template(v-else-if="friendLogInitStatus")
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isOfflineFriends = !isOfflineFriends; saveFriendsGroupStates()" v-show="offlineFriends.length")
Expand All @@ -95,7 +95,7 @@ mixin friendsListSidebar()
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-text="friend.ref.statusDescription")
template(v-else)
template(v-else-if="friendLogInitStatus")
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
el-tab-pane
Expand Down
4 changes: 2 additions & 2 deletions html/src/mixins/tabs/settings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mixin settingsTab()
div.options-container-item
el-button(size="small" icon="el-icon-document" @click="showChangeLogDialog()") {{ $t("view.settings.general.vrcx_updater.change_log") }}
el-button(size="small" icon="el-icon-upload" @click="showVRCXUpdateDialog()") {{ $t("view.settings.general.vrcx_updater.change_build") }}
+simpleRadioGroup("view.settings.general.vrcx_updater.auto_update", "autoUpdateVRCX", [
+simpleRadioGroup("view.settings.general.vrcx_updater.update_action", "autoUpdateVRCX", [
{ label: "Off", translationKey: "view.settings.general.vrcx_updater.auto_update_off" },
{ label: "Notify", translationKey: "view.settings.general.vrcx_updater.auto_update_notify" },
{ label: "Auto Download", translationKey: "view.settings.general.vrcx_updater.auto_update_download" },
Expand Down Expand Up @@ -446,7 +446,7 @@ mixin settingsTab()
span.sub-header {{ $t('view.settings.advanced.advanced.primary_password.header') }}
div.options-container-item
span.name(style="min-width:300px") {{ $t('view.settings.advanced.advanced.primary_password.description') }}
el-switch(v-model="enablePrimaryPassword" @change="enablePrimaryPasswordChange" :disabled="!loginForm.savedCredentials[API.currentUser.id]")
el-switch(v-model="enablePrimaryPassword" @change="enablePrimaryPasswordChange" :disabled="!enablePrimaryPassword")
span.sub-header {{ $t('view.settings.advanced.advanced.relaunch_vrchat.header') }}
//- Advanced | Relaunch VRChat After Crash
div.options-container-item
Expand Down

0 comments on commit 6563b39

Please sign in to comment.