- remove extra debugging
- fix: could not unregister if multiple users existed
- fix: http(s) proxy
- add example in user_config.example.json to use public proxy
- maybe fix: double reg
- add support for "modpacks" to viewergen
  - first mod is "BackgroundSound" by @Sgeo (and https://github.com/elishacloud/dxwrapper)
This commit is contained in:
zefie
2022-11-28 11:48:37 -05:00
parent c2a3081afd
commit 040e035548
9 changed files with 70 additions and 20 deletions

View File

@@ -91,7 +91,7 @@ class WTVClientSessionData {
}
switchUserID(user_id, update_mail = true, update_ticket = true, update_favorite = true) {
this.user_id = user_id;
this.user_id = parseInt(user_id);
if (user_id != null) {
this.loadSessionData();
if (this.isRegistered() && update_mail) this.assignMailStore();
@@ -505,12 +505,13 @@ class WTVClientSessionData {
try {
// only save if file has changed
var json_save_data = JSON.stringify(this.session_store);
var json_load_data = (!skip_merge) ? this.loadSessionData(true) : {};
var sessionToStore = this.session_store;
var json_save_data = JSON.stringify(sessionToStore);
var json_load_data = (skip_merge) ? {} : this.loadSessionData(true);
var storeDir = this.getUserStoreDirectory();
if (!this.fs.existsSync(storeDir)) this.mkdirRecursive(storeDir);
var sessionToStore = this.session_store;
if (sessionToStore.password_valid) delete sessionToStore.password_valid; // do not save validity state of password login, resets when session expires
if (json_save_data != json_load_data) this.fs.writeFileSync(storeDir + "user" + this.user_id + ".json", JSON.stringify(sessionToStore), "Utf8");
return true;

View File

@@ -44,8 +44,7 @@ class WTVRegister {
// check against user accounts
directory = (directory) ? directory : this.session_store_dir + this.path.sep + "accounts";
console.log(directory)
if (this.fs.existsSync(directory)) {
this.fs.readdirSync(directory).forEach(file => {
if (self.fs.lstatSync(directory + self.path.sep + file).isDirectory() && !return_val) {