-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nortonandrews/scanner-bugfixing
Bugfixing, media notifications, recursive scanning and password protection
- Loading branch information
Showing
16 changed files
with
295 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"rootDir": "/mnt/Media/Voice", | ||
"password": false, | ||
"scannerMaxRecursionDepth": 2, | ||
"worksPerPage": 12 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const path = require('path'); | ||
const express = require('express'); | ||
|
||
const config = require('../../config.json'); | ||
|
||
const router = express.Router(); | ||
|
||
router.get('/', (req, res, next) => { | ||
res.sendFile(path.join(__dirname, '..', '..', 'static', 'auth.html')); | ||
}); | ||
|
||
router.post('/', (req, res, next) => { | ||
if (req.body.password === config.password) { | ||
req.session.auth = true; | ||
} | ||
|
||
res.redirect('/'); | ||
}); | ||
|
||
const authenticator = (req, res, next) => { | ||
if (req.path === '/auth/' | ||
|| req.path === '/main.css' | ||
|| req.path.indexOf('/static/') === 0 | ||
|| req.session.auth | ||
|| !config.password | ||
) { | ||
next(); | ||
} else { | ||
res.redirect('/auth/'); | ||
} | ||
}; | ||
|
||
module.exports = { router, authenticator }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.