This commit is contained in:
MattMan
2022-11-06 11:33:55 -05:00
2 changed files with 18 additions and 18 deletions

View File

@@ -3,8 +3,6 @@
The ***wtv minisrv***, or "***zefie_wtvp_minisrv***" project is a node.js project that provides a mini WebTV Server, aiming for full WTVP (WebTV Protocol) support.
This open source server is in beta status. Use at your own risk.
## Note: This is the `dev` branch. It offers more features and bug fixes than `master`. Until the release of v1.0 (and the removal of this message), it is suggested you download from this branch
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
### Current status:

View File

@@ -45,23 +45,25 @@ class WTVRegister {
// check against user accounts
var search_dir = this.session_store_dir + this.path.sep + "accounts";
if (directory) search_dir = directory;
this.fs.readdirSync(search_dir).forEach(file => {
if (self.fs.lstatSync(search_dir + self.path.sep + file).isDirectory() && !return_val) {
return_val = !self.checkUsernameAvailable(username, search_dir + self.path.sep + file);
}
if (!file.match(/user.*\.json/ig)) return;
try {
var temp_session_data_file = self.fs.readFileSync(search_dir + self.path.sep + file, 'Utf8');
var temp_session_data = JSON.parse(temp_session_data_file);
if (temp_session_data.subscriber_username) {
if (temp_session_data.subscriber_username.toLowerCase() == username.toLowerCase()) {
return_val = true;
}
if (this.fs.existsSync(directory)) {
this.fs.readdirSync(search_dir).forEach(file => {
if (self.fs.lstatSync(search_dir + self.path.sep + file).isDirectory() && !return_val) {
return_val = !self.checkUsernameAvailable(username, search_dir + self.path.sep + file);
}
} catch (e) {
console.error(" # Error parsing Session Data JSON", search_dir + self.path.sep + file, e);
}
});
if (!file.match(/user.*\.json/ig)) return;
try {
var temp_session_data_file = self.fs.readFileSync(search_dir + self.path.sep + file, 'Utf8');
var temp_session_data = JSON.parse(temp_session_data_file);
if (temp_session_data.subscriber_username) {
if (temp_session_data.subscriber_username.toLowerCase() == username.toLowerCase()) {
return_val = true;
}
}
} catch (e) {
console.error(" # Error parsing Session Data JSON", search_dir + self.path.sep + file, e);
}
});
}
return !return_val;
}