Lightweight node app to use in place of plex to self host your video and movie collections. Running on just under 50MB of ram this is ideal for people looking to host videos on minimal hardware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

56 lines
1.2 KiB

const routes = require('express').Router();
const utils = require("../utils");
const fs = require('fs');
const videoManager = require('../videoManager');
function isPublicVideo(videoURL)
{
return false;
}
routes.get('/', (request, result) =>
{
try
{
const videoID = request.query.v;
const splitArray = videoID.split('/');
const name = splitArray[splitArray.length -1] + ".png";
console.log(name);
var file="";
if(!videoManager.isPublicVideo(videoID))
{
if(utils.checkPrivilege(request) >= utils.PRIVILEGE.MEMBER)
{
file = fs.readFileSync("./icon/private/" + name);
}
else
{
utils.printError(result, "You need to be logged in");
throw "Not logged in";
}
}
else
{
file = fs.readFileSync("./icon/public/" + name);
}
result.writeHead(200, {'Content-Type': 'image/png',
'Vary': 'Accept-Encoding'});
result.write(file);
result.end();
}
catch(error)
{
utils.printError(result, "Invalid Icon");
console.log(error);
}
});
module.exports = routes;