Seperate public and private file shares
This commit is contained in:
parent
fab571f8be
commit
e3eb2130ba
1 changed files with 3 additions and 1 deletions
4
index.js
4
index.js
|
@ -7,6 +7,7 @@ var app = express()
|
|||
var PORT = process.env.PORT || 8080
|
||||
|
||||
var directory = process.env.FILES_DIR
|
||||
var pubDir = path.join(directory, 'public')
|
||||
|
||||
function humanFileSize(bytes, si = false, dp = 1) {
|
||||
const thresh = si ? 1000 : 1024;
|
||||
|
@ -38,6 +39,7 @@ if (!directory) {
|
|||
const videoFormats = ["mp4", "mkv"]
|
||||
|
||||
app.use(express.static(directory))
|
||||
app.use(express.static(pubDir))
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log("Now listening on PORT: " + PORT)
|
||||
|
@ -93,7 +95,7 @@ app.get("/video/*", (req, res) => {
|
|||
|
||||
app.get("/*", (req, res) => {
|
||||
var file = req.params[0]
|
||||
var absPath = path.join(directory, file)
|
||||
var absPath = path.join(pubDir, file)
|
||||
|
||||
if (file != '') {
|
||||
var baseHTML = fs.readFileSync(path.join(__dirname, 'resources/base.html')).toString()
|
||||
|
|
Loading…
Reference in a new issue