mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
Removed guest user
This commit is contained in:
parent
b38e646234
commit
673f909872
@ -1,7 +0,0 @@
|
||||
Download This:
|
||||
http://www.indyproject.org/Sockets/fpc/OpenSSLforWin64.en.aspx
|
||||
|
||||
Extract and move it to
|
||||
C:\OpenSSL-Win64\lib\
|
||||
|
||||
Now greenlock will install
|
||||
@ -35,14 +35,13 @@ mstream -c /path/to/cert.pem -k /path/to/key.pem
|
||||
```
|
||||
|
||||
## User System
|
||||
mStream can have a single user and guest. If the user is not set (default behaviour), mStream will permit unrestricted access to the system.
|
||||
mStream can have a single user and guest. If the user is not set (default behavior), mStream will permit unrestricted access to the system.
|
||||
|
||||
```shell
|
||||
# Set User
|
||||
mstream -u [username] -x [password]
|
||||
|
||||
# Set user and guest
|
||||
mstream -u [username] -x [password] -G [guest name] -X [guest password]
|
||||
mstream -u admin -x password
|
||||
```
|
||||
|
||||
#### Login Secret
|
||||
@ -93,4 +92,4 @@ In order for UI folder to work, you will need three files:
|
||||
* remote.html
|
||||
* shared.html
|
||||
|
||||
These files will be served by the `/`, `/remote`, and `/shared` endpoints respectively.
|
||||
These files will be served by the `/`, `/remote`, and `/shared` endpoints respectively.
|
||||
|
||||
@ -1,5 +1,30 @@
|
||||
# Coming Soon!
|
||||
|
||||
The project is going to start moving to setting up mStream via a JSON config file.
|
||||
```
|
||||
{
|
||||
"port": 3000,
|
||||
"userinterface":"public",
|
||||
"database_plugin":{
|
||||
"dbPath":"/path/to/db",
|
||||
},
|
||||
"folders": {
|
||||
'blues': '/home/to/blues',
|
||||
'rock': '/home/to/q1043'
|
||||
},
|
||||
"users": {
|
||||
'paul': {
|
||||
"password":"r4r4",
|
||||
"email":"paul@wall.com",
|
||||
vpath: blues
|
||||
}
|
||||
'mike': {
|
||||
"password":"grgr",
|
||||
vpath: [
|
||||
blues,
|
||||
rock
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSON configs allow settings to be saved and allow more elaborate config schemes
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
exports.setup = function(args){
|
||||
const program = require('commander');
|
||||
program
|
||||
.version('3.0.7')
|
||||
.version('3.2.1')
|
||||
// Server Config
|
||||
.option('-p, --port <port>', 'Select Port', /^\d+$/i, 3000)
|
||||
.option('-i, --userinterface <folder>', 'Specify folder name that will be served as the UI', 'public')
|
||||
@ -16,9 +16,6 @@ exports.setup = function(args){
|
||||
// User System
|
||||
.option('-u, --user <user>', 'Set Username')
|
||||
.option('-x, --password <password>', 'Set Password')
|
||||
.option('-e, --email <email>', 'Set User Email (optional)')
|
||||
.option('-G, --guestname <guestname>', 'Set Guest Username')
|
||||
.option('-X, --guestpassword <guestpassword>', 'Set Guest Password')
|
||||
|
||||
// Port Forwarding
|
||||
.option('-t, --tunnel', 'Use nat-pmp to configure port fowarding')
|
||||
@ -28,7 +25,6 @@ exports.setup = function(args){
|
||||
|
||||
// DB
|
||||
.option('-d, --database <path>', 'Specify Database Filepath', 'mstream.db')
|
||||
.option('-D, --databaseplugin <databaseplugin>', '', /^(sqlite|beets)$/i, 'sqlite') // TODO: Remove this
|
||||
|
||||
.parse(args);
|
||||
|
||||
@ -52,18 +48,6 @@ exports.setup = function(args){
|
||||
password:program.password,
|
||||
musicDir:program.musicdir
|
||||
};
|
||||
|
||||
if(program.email){
|
||||
program3.users[program.user].email = program.email;
|
||||
}
|
||||
|
||||
// Guest account
|
||||
if(program.guestname && program.guestpassword){
|
||||
program3.users[program.guestname] = {
|
||||
password:program.guestpassword,
|
||||
guestTo:program.user
|
||||
};
|
||||
}
|
||||
}else{
|
||||
console.log('USER SYSTEM NOT ENABLED!');
|
||||
// Store the musicDir to be used in setup
|
||||
@ -72,7 +56,6 @@ exports.setup = function(args){
|
||||
|
||||
// db plugins
|
||||
program3.database_plugin = {
|
||||
type:program.databaseplugin,
|
||||
dbPath:program.database
|
||||
};
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ exports.setup = function(args, rootDir){
|
||||
|
||||
// TODO: Make sure all music directories are unique
|
||||
// TODO: No subsets/super-sets/duplicates
|
||||
if(!loadJson.users[username].guestTo && !fs.statSync( loadJson.users[username].musicDir ).isDirectory()){
|
||||
if( !fs.statSync( loadJson.users[username].musicDir ).isDirectory()){
|
||||
return {error:loadJson.users[username].username + " music directory could not be found"};
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,9 +115,6 @@ exports.setup = function(mstream, program){
|
||||
function *bootScan(){
|
||||
// Loop through list of users
|
||||
for (let username in program.users) {
|
||||
if(program.users[username].guestTo){
|
||||
continue;
|
||||
}
|
||||
|
||||
yield scanIt( {
|
||||
username: username,
|
||||
|
||||
3
modules/fogmachine-ddns.js
Normal file
3
modules/fogmachine-ddns.js
Normal file
@ -0,0 +1,3 @@
|
||||
// Login
|
||||
|
||||
// Download cert
|
||||
@ -58,11 +58,6 @@ exports.setup = function(mstream, program, express){
|
||||
// Setup user password
|
||||
generateSaltedPassword(username, Users[username]["password"]);
|
||||
|
||||
// If this is a guest user, continue
|
||||
if(Users[username].guestTo){
|
||||
continue;
|
||||
}
|
||||
|
||||
// If dir has not been added yet
|
||||
if ( !(Users[username].musicDir in permissionsMap) ){
|
||||
// Generate unique vPath if necessary
|
||||
@ -135,12 +130,7 @@ exports.setup = function(mstream, program, express){
|
||||
return res.redirect('/login-failed');
|
||||
}
|
||||
|
||||
var vPath;
|
||||
if(Users[username].guestTo){
|
||||
vPath = Users[Users[username].guestTo].vPath;
|
||||
}else{
|
||||
vPath = Users[username].vPath;
|
||||
}
|
||||
var vPath = Users[username].vPath;
|
||||
|
||||
// return the information including token as JSON
|
||||
res.json(
|
||||
@ -154,9 +144,6 @@ exports.setup = function(mstream, program, express){
|
||||
});
|
||||
});
|
||||
|
||||
// Guest Users are not allowed to access these functions
|
||||
const forbiddenFunctions = ['/db/recursive-scan', '/saveplaylist', '/deleteplaylist'];
|
||||
|
||||
// Middleware that checks for token
|
||||
mstream.use(function(req, res, next) {
|
||||
// check header or url parameters or post parameters for token
|
||||
@ -196,20 +183,6 @@ exports.setup = function(mstream, program, express){
|
||||
req.user = Users[decoded.username];
|
||||
req.user.username = decoded.username;
|
||||
|
||||
// Deny guest access
|
||||
if(req.user.guestTo && forbiddenFunctions.indexOf(req.path) != -1){
|
||||
return res.redirect('/guest-access-denied');
|
||||
}
|
||||
|
||||
|
||||
// Set user request data
|
||||
// TODO: Should we clone this in stead of referencing it ???
|
||||
if(req.user.guestTo){
|
||||
// Setup guest credentials based and normal user credentials
|
||||
req.user.username = req.user.guestTo;
|
||||
req.user.vPath = Users[req.user.guestTo].vPath;
|
||||
req.user.musicDir = Users[req.user.guestTo].musicDir;
|
||||
}
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
@ -171,7 +171,6 @@ function bootServer(program2) {
|
||||
port: program2.port,
|
||||
userinterface: 'public',
|
||||
database_plugin: {
|
||||
type: 'sqlite',
|
||||
dbPath: fe.join(app.getPath('userData'), 'save/mstreamXdb.lite')
|
||||
},
|
||||
musicDir: program2.filepath
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mstream",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"description": "music streaming server",
|
||||
"main": "mstream-command-line-boot-wrapper.js",
|
||||
"bin": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user