mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Move savedCredentials to userId
This commit is contained in:
@@ -469,6 +469,7 @@ namespace VRCX
|
|||||||
// 2021.04.06 11:25:45 Log - [Network Processing] RPC invoked ConfigurePortal on (Clone [1600004] Portals/PortalInternalDynamic) for Natsumi-sama
|
// 2021.04.06 11:25:45 Log - [Network Processing] RPC invoked ConfigurePortal on (Clone [1600004] Portals/PortalInternalDynamic) for Natsumi-sama
|
||||||
// 2021.07.19 04:24:28 Log - [Behaviour] Will execute SendRPC/AlwaysBufferOne on (Clone [100004] Portals/PortalInternalDynamic) (UnityEngine.GameObject) for Natsumi-sama: S: "ConfigurePortal" I: 7 F: 0 B: 255 (local master owner)
|
// 2021.07.19 04:24:28 Log - [Behaviour] Will execute SendRPC/AlwaysBufferOne on (Clone [100004] Portals/PortalInternalDynamic) (UnityEngine.GameObject) for Natsumi-sama: S: "ConfigurePortal" I: 7 F: 0 B: 255 (local master owner)
|
||||||
// 2022.07.29 18:40:37 Log - [Behaviour] Instantiated a (Clone [800004] Portals/PortalInternalDynamic)
|
// 2022.07.29 18:40:37 Log - [Behaviour] Instantiated a (Clone [800004] Portals/PortalInternalDynamic)
|
||||||
|
// 2023 - deadge
|
||||||
|
|
||||||
if (line.Contains("[Behaviour] Instantiated a (Clone [") && line.Contains("] Portals/PortalInternalDynamic)"))
|
if (line.Contains("[Behaviour] Instantiated a (Clone [") && line.Contains("] Portals/PortalInternalDynamic)"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ namespace VRCX
|
|||||||
|
|
||||||
public string GetCookies()
|
public string GetCookies()
|
||||||
{
|
{
|
||||||
|
_cookieDirty = true; // force cookies to be saved for lastUserLoggedIn
|
||||||
|
|
||||||
using (var memoryStream = new MemoryStream())
|
using (var memoryStream = new MemoryStream())
|
||||||
{
|
{
|
||||||
new BinaryFormatter().Serialize(memoryStream, _cookieContainer);
|
new BinaryFormatter().Serialize(memoryStream, _cookieContainer);
|
||||||
@@ -122,6 +124,8 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream);
|
_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cookieDirty = true; // force cookies to be saved for lastUserLoggedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS4014
|
#pragma warning disable CS4014
|
||||||
|
|||||||
@@ -4884,6 +4884,7 @@ speechSynthesis.getVoices();
|
|||||||
this.refreshCustomCss();
|
this.refreshCustomCss();
|
||||||
this.refreshCustomScript();
|
this.refreshCustomScript();
|
||||||
this.checkVRChatDebugLogging();
|
this.checkVRChatDebugLogging();
|
||||||
|
this.migrateStoredUsers();
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
this.$el.style.display = '';
|
this.$el.style.display = '';
|
||||||
if (
|
if (
|
||||||
@@ -6847,6 +6848,7 @@ speechSynthesis.getVoices();
|
|||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
$app.loginForm.lastUserLoggedIn = '';
|
$app.loginForm.lastUserLoggedIn = '';
|
||||||
configRepository.remove('lastUserLoggedIn');
|
configRepository.remove('lastUserLoggedIn');
|
||||||
|
workerTimers.setTimeout(() => location.reload(), 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
$app.methods.checkPrimaryPassword = function (args) {
|
$app.methods.checkPrimaryPassword = function (args) {
|
||||||
@@ -6899,20 +6901,22 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(({value}) => {
|
.then(({value}) => {
|
||||||
for (let name in this.loginForm.savedCredentials) {
|
for (let userId in this.loginForm.savedCredentials) {
|
||||||
security
|
security
|
||||||
.decrypt(
|
.decrypt(
|
||||||
this.loginForm.savedCredentials[name]
|
this.loginForm.savedCredentials[userId]
|
||||||
.loginParmas.password,
|
.loginParmas.password,
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
.then((pt) => {
|
.then((pt) => {
|
||||||
this.saveCredentials = {
|
this.saveCredentials = {
|
||||||
username: name,
|
username:
|
||||||
|
this.loginForm.savedCredentials[userId]
|
||||||
|
.loginParmas.username,
|
||||||
password: pt
|
password: pt
|
||||||
};
|
};
|
||||||
this.updateStoredUser(
|
this.updateStoredUser(
|
||||||
this.loginForm.savedCredentials[name].user
|
this.loginForm.savedCredentials[userId].user
|
||||||
);
|
);
|
||||||
configRepository.setBool(
|
configRepository.setBool(
|
||||||
'enablePrimaryPassword',
|
'enablePrimaryPassword',
|
||||||
@@ -6942,17 +6946,22 @@ speechSynthesis.getVoices();
|
|||||||
this.enablePrimaryPasswordDialog.visible = false;
|
this.enablePrimaryPasswordDialog.visible = false;
|
||||||
if (this.enablePrimaryPassword) {
|
if (this.enablePrimaryPassword) {
|
||||||
let key = this.enablePrimaryPasswordDialog.password;
|
let key = this.enablePrimaryPasswordDialog.password;
|
||||||
for (let name in this.loginForm.savedCredentials) {
|
for (let userId in this.loginForm.savedCredentials) {
|
||||||
security
|
security
|
||||||
.encrypt(
|
.encrypt(
|
||||||
this.loginForm.savedCredentials[name].loginParmas
|
this.loginForm.savedCredentials[userId].loginParmas
|
||||||
.password,
|
.password,
|
||||||
key
|
key
|
||||||
)
|
)
|
||||||
.then((ct) => {
|
.then((ct) => {
|
||||||
this.saveCredentials = {username: name, password: ct};
|
this.saveCredentials = {
|
||||||
|
username:
|
||||||
|
this.loginForm.savedCredentials[userId]
|
||||||
|
.loginParmas.username,
|
||||||
|
password: ct
|
||||||
|
};
|
||||||
this.updateStoredUser(
|
this.updateStoredUser(
|
||||||
this.loginForm.savedCredentials[name].user
|
this.loginForm.savedCredentials[userId].user
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -6962,7 +6971,7 @@ speechSynthesis.getVoices();
|
|||||||
$app.methods.updateStoredUser = async function (currentUser) {
|
$app.methods.updateStoredUser = async function (currentUser) {
|
||||||
var savedCredentials = {};
|
var savedCredentials = {};
|
||||||
if (configRepository.getString('savedCredentials') !== null) {
|
if (configRepository.getString('savedCredentials') !== null) {
|
||||||
var savedCredentials = JSON.parse(
|
savedCredentials = JSON.parse(
|
||||||
configRepository.getString('savedCredentials')
|
configRepository.getString('savedCredentials')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -6971,20 +6980,38 @@ speechSynthesis.getVoices();
|
|||||||
user: currentUser,
|
user: currentUser,
|
||||||
loginParmas: this.saveCredentials
|
loginParmas: this.saveCredentials
|
||||||
};
|
};
|
||||||
savedCredentials[currentUser.username] = credentialsToSave;
|
savedCredentials[currentUser.id] = credentialsToSave;
|
||||||
delete this.saveCredentials;
|
delete this.saveCredentials;
|
||||||
} else if (
|
} else if (typeof savedCredentials[currentUser.id] !== 'undefined') {
|
||||||
typeof savedCredentials[currentUser.username] !== 'undefined'
|
savedCredentials[currentUser.id].user = currentUser;
|
||||||
) {
|
savedCredentials[currentUser.id].cookies =
|
||||||
savedCredentials[currentUser.username].user = currentUser;
|
|
||||||
savedCredentials[currentUser.username].cookies =
|
|
||||||
await webApiService.getCookies();
|
await webApiService.getCookies();
|
||||||
}
|
}
|
||||||
this.loginForm.savedCredentials = savedCredentials;
|
this.loginForm.savedCredentials = savedCredentials;
|
||||||
var jsonCredentialsArray = JSON.stringify(savedCredentials);
|
var jsonCredentialsArray = JSON.stringify(savedCredentials);
|
||||||
configRepository.setString('savedCredentials', jsonCredentialsArray);
|
configRepository.setString('savedCredentials', jsonCredentialsArray);
|
||||||
this.loginForm.lastUserLoggedIn = currentUser.username;
|
this.loginForm.lastUserLoggedIn = currentUser.id;
|
||||||
configRepository.setString('lastUserLoggedIn', currentUser.username);
|
configRepository.setString('lastUserLoggedIn', currentUser.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.migrateStoredUsers = function () {
|
||||||
|
var savedCredentials = {};
|
||||||
|
if (configRepository.getString('savedCredentials') !== null) {
|
||||||
|
savedCredentials = JSON.parse(
|
||||||
|
configRepository.getString('savedCredentials')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for (let name in savedCredentials) {
|
||||||
|
var userId = savedCredentials[name]?.user?.id;
|
||||||
|
if (userId && userId !== name) {
|
||||||
|
savedCredentials[userId] = savedCredentials[name];
|
||||||
|
delete savedCredentials[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configRepository.setString(
|
||||||
|
'savedCredentials',
|
||||||
|
JSON.stringify(savedCredentials)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.relogin = function (user) {
|
$app.methods.relogin = function (user) {
|
||||||
@@ -7062,11 +7089,11 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.deleteSavedLogin = function (username) {
|
$app.methods.deleteSavedLogin = function (userId) {
|
||||||
var savedCredentials = JSON.parse(
|
var savedCredentials = JSON.parse(
|
||||||
configRepository.getString('savedCredentials')
|
configRepository.getString('savedCredentials')
|
||||||
);
|
);
|
||||||
delete savedCredentials[username];
|
delete savedCredentials[userId];
|
||||||
// Disable primary password when no account is available.
|
// Disable primary password when no account is available.
|
||||||
if (Object.keys(savedCredentials).length === 0) {
|
if (Object.keys(savedCredentials).length === 0) {
|
||||||
this.enablePrimaryPassword = false;
|
this.enablePrimaryPassword = false;
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ html
|
|||||||
el-table-column(:label="$t('table.friendLog.type')" prop="type" width="150")
|
el-table-column(:label="$t('table.friendLog.type')" prop="type" width="150")
|
||||||
el-table-column(:label="$t('table.friendLog.user')" prop="displayName")
|
el-table-column(:label="$t('table.friendLog.user')" prop="displayName")
|
||||||
template(v-once #default="scope")
|
template(v-once #default="scope")
|
||||||
span(v-if="scope.row.type === 'DisplayName'") {{ scope.row.previousDisplayName }} #[i.el-icon-right]
|
span(v-if="scope.row.type === 'DisplayName'") {{ scope.row.previousDisplayName }} #[i.el-icon-right]
|
||||||
span.x-link(v-text="scope.row.displayName || scope.row.userId" @click="showUserDialog(scope.row.userId)")
|
span.x-link(v-text="scope.row.displayName || scope.row.userId" @click="showUserDialog(scope.row.userId)")
|
||||||
template(v-if="scope.row.type === 'TrustLevel'")
|
template(v-if="scope.row.type === 'TrustLevel'")
|
||||||
span ({{ scope.row.previousTrustLevel }} #[i.el-icon-right] {{ scope.row.trustLevel }})
|
span ({{ scope.row.previousTrustLevel }} #[i.el-icon-right] {{ scope.row.trustLevel }})
|
||||||
@@ -1422,7 +1422,7 @@ html
|
|||||||
span.sub-header {{ $t('view.settings.advanced.advanced.primary_password.header') }}
|
span.sub-header {{ $t('view.settings.advanced.advanced.primary_password.header') }}
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
span.name(style="min-width:300px") {{ $t('view.settings.advanced.advanced.primary_password.description') }}
|
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.username]")
|
el-switch(v-model="enablePrimaryPassword" @change="enablePrimaryPasswordChange" :disabled="!loginForm.savedCredentials[API.currentUser.id]")
|
||||||
span.sub-header {{ $t('view.settings.advanced.advanced.relaunch_vrchat.header') }}
|
span.sub-header {{ $t('view.settings.advanced.advanced.relaunch_vrchat.header') }}
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
span.name(style="min-width:300px") {{ $t('view.settings.advanced.advanced.relaunch_vrchat.description') }}
|
span.name(style="min-width:300px") {{ $t('view.settings.advanced.advanced.relaunch_vrchat.description') }}
|
||||||
|
|||||||
Reference in New Issue
Block a user