Browse Source

Updated view to give a link which is escaped so you can paste it in locations which are not web browsers.

pull/6/head
jrtechs 5 years ago
parent
commit
e58d89b0f1
2 changed files with 7 additions and 4 deletions
  1. +1
    -1
      html/watch.html
  2. +6
    -3
      server.js

+ 1
- 1
html/watch.html View File

@ -9,7 +9,7 @@
<div class="d-flex justify-content-center p-4"> <div class="d-flex justify-content-center p-4">
<p id="copyStatus"></p> <p id="copyStatus"></p>
<input class="form-control" type="text" value="{serverURL}/video?v={videoURL}&api={api}" id="directLink">
<input class="form-control" type="text" value="{serverURL}/video\?v\={videoURL}\&api\={api}" id="directLink">
<button class="btn btn-secondary align-content-center" onclick="copyVideoPath()">Copy Direct Link</button> <button class="btn btn-secondary align-content-center" onclick="copyVideoPath()">Copy Direct Link</button>
</div> </div>

+ 6
- 3
server.js View File

@ -27,9 +27,9 @@ app.use(session({ secret: config.sessionSecret, cookie: { maxAge: 6000000 }}));
/** Template engine */ /** Template engine */
const whiskers = require('whiskers'); 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) function fetchInTemplate(templateContext, templateKey, filename)
{ {
@ -118,7 +118,7 @@ function getVideoTemplateInfo(templateContext, request)
{ {
templateContext.api = request.session.API; templateContext.api = request.session.API;
templateContext.serverURL = serverURL; 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)); 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) app.get('/video/', function(request, result)
{ {
console.log("called");
console.log(request.query);
if(checkPrivilege(request) >= PRIVILEGE.MEMBER || userUtils.isValidAPI(request.query.api, config)) if(checkPrivilege(request) >= PRIVILEGE.MEMBER || userUtils.isValidAPI(request.query.api, config))
{ {
var videoID = request.query.v; var videoID = request.query.v;
@ -169,6 +171,7 @@ app.get('/video/', function(request, result)
} }
else else
{ {
console.log("invalid attempt to view video");
result.status(401); result.status(401);
result.send('None shall pass'); result.send('None shall pass');
} }

Loading…
Cancel
Save