From e58d89b0f1478588f3bb481587c9a0c45c981edc Mon Sep 17 00:00:00 2001 From: jrtechs Date: Mon, 4 Feb 2019 19:21:09 -0500 Subject: [PATCH] Updated view to give a link which is escaped so you can paste it in locations which are not web browsers. --- html/watch.html | 2 +- server.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/html/watch.html b/html/watch.html index db30deb..1fd2f4f 100644 --- a/html/watch.html +++ b/html/watch.html @@ -9,7 +9,7 @@

- +
diff --git a/server.js b/server.js index 160b7aa..d313b6b 100644 --- a/server.js +++ b/server.js @@ -27,9 +27,9 @@ app.use(session({ secret: config.sessionSecret, cookie: { maxAge: 6000000 }})); /** Template engine */ const whiskers = require('whiskers'); -var rootDir = '/home/jeff/public/Shows/'; +var rootDir = '/home/jeff/public/Movies/'; -var serverURL = "localhost:5000"; +var serverURL = "http://localhost:5000"; function fetchInTemplate(templateContext, templateKey, filename) { @@ -118,7 +118,7 @@ function getVideoTemplateInfo(templateContext, request) { templateContext.api = request.session.API; templateContext.serverURL = serverURL; - templateContext.videoURL = request.query.v; + templateContext.videoURL = request.query.v.split(" ").join("%20"); } app.get('/videos', (req, res) => renderHTML(req, res, "videos.html", getVideosTemplateInformation)); @@ -127,6 +127,8 @@ app.get('/watch', (req, res) => renderHTML(req, res, "watch.html", getVideoTempl app.get('/video/', function(request, result) { + console.log("called"); + console.log(request.query); if(checkPrivilege(request) >= PRIVILEGE.MEMBER || userUtils.isValidAPI(request.query.api, config)) { var videoID = request.query.v; @@ -169,6 +171,7 @@ app.get('/video/', function(request, result) } else { + console.log("invalid attempt to view video"); result.status(401); result.send('None shall pass'); }