mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-25 06:00:56 +03:00
Merge branch 'master' of https://github.com/Tzahi12345/YoutubeDL-Material into dockertest
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
FROM arm32v7/alpine:3.12
|
||||
|
||||
COPY qemu-arm-static /usr/bin
|
||||
|
||||
ENV UID=1000 \
|
||||
GID=1000 \
|
||||
USER=youtube
|
||||
|
||||
134
backend/app.js
134
backend/app.js
@@ -30,6 +30,7 @@ var subscriptions_api = require('./subscriptions')
|
||||
const CONSTS = require('./consts')
|
||||
const { spawn } = require('child_process')
|
||||
const read_last_lines = require('read-last-lines');
|
||||
var ps = require('ps-node');
|
||||
|
||||
const is_windows = process.platform === 'win32';
|
||||
|
||||
@@ -503,6 +504,43 @@ async function getLatestVersion() {
|
||||
});
|
||||
}
|
||||
|
||||
async function killAllDownloads() {
|
||||
return new Promise(resolve => {
|
||||
ps.lookup({
|
||||
command: 'youtube-dl',
|
||||
}, function(err, resultList ) {
|
||||
if (err) {
|
||||
// failed to get list of processes
|
||||
logger.error('Failed to get a list of running youtube-dl processes.');
|
||||
logger.error(err);
|
||||
resolve({
|
||||
details: err,
|
||||
success: false
|
||||
});
|
||||
}
|
||||
|
||||
// processes that contain the string 'youtube-dl' in the name will be looped
|
||||
resultList.forEach(function( process ){
|
||||
if (process) {
|
||||
ps.kill(process.pid, 'SIGKILL', function( err ) {
|
||||
if (err) {
|
||||
// failed to kill, process may have ended on its own
|
||||
logger.warn(`Failed to kill process with PID ${process.pid}`);
|
||||
logger.warn(err);
|
||||
}
|
||||
else {
|
||||
logger.verbose(`Process ${process.pid} has been killed!`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
resolve({
|
||||
success: true
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function setPortItemFromENV() {
|
||||
return new Promise(resolve => {
|
||||
config_api.setConfigItem('ytdl_port', backendPort.toString());
|
||||
@@ -880,14 +918,16 @@ async function createPlaylistZipFile(fileNames, type, outputName, fullPathProvid
|
||||
|
||||
}
|
||||
|
||||
async function deleteAudioFile(name, blacklistMode = false) {
|
||||
async function deleteAudioFile(name, customPath = null, blacklistMode = false) {
|
||||
return new Promise(resolve => {
|
||||
// TODO: split descriptors into audio and video descriptors, as deleting an audio file will close all video file streams
|
||||
var jsonPath = path.join(audioFolderPath,name+'.mp3.info.json');
|
||||
var altJSONPath = path.join(audioFolderPath,name+'.info.json');
|
||||
var audioFilePath = path.join(audioFolderPath,name+'.mp3');
|
||||
let filePath = customPath ? customPath : audioFolderPath;
|
||||
|
||||
var jsonPath = path.join(filePath,name+'.mp3.info.json');
|
||||
var altJSONPath = path.join(filePath,name+'.info.json');
|
||||
var audioFilePath = path.join(filePath,name+'.mp3');
|
||||
var thumbnailPath = path.join(filePath,name+'.webp');
|
||||
var altThumbnailPath = path.join(filePath,name+'.jpg');
|
||||
|
||||
jsonPath = path.join(__dirname, jsonPath);
|
||||
altJSONPath = path.join(__dirname, altJSONPath);
|
||||
audioFilePath = path.join(__dirname, audioFilePath);
|
||||
@@ -927,7 +967,7 @@ async function deleteAudioFile(name, blacklistMode = false) {
|
||||
|
||||
// get ID from JSON
|
||||
|
||||
var jsonobj = utils.getJSONMp3(name, audioFolderPath);
|
||||
var jsonobj = utils.getJSONMp3(name, filePath);
|
||||
let id = null;
|
||||
if (jsonobj) id = jsonobj.id;
|
||||
|
||||
@@ -963,10 +1003,12 @@ async function deleteVideoFile(name, customPath = null, blacklistMode = false) {
|
||||
return new Promise(resolve => {
|
||||
let filePath = customPath ? customPath : videoFolderPath;
|
||||
var jsonPath = path.join(filePath,name+'.info.json');
|
||||
|
||||
var altJSONPath = path.join(filePath,name+'.mp4.info.json');
|
||||
var videoFilePath = path.join(filePath,name+'.mp4');
|
||||
var thumbnailPath = path.join(filePath,name+'.webp');
|
||||
var altThumbnailPath = path.join(filePath,name+'.jpg');
|
||||
|
||||
jsonPath = path.join(__dirname, jsonPath);
|
||||
videoFilePath = path.join(__dirname, videoFilePath);
|
||||
|
||||
@@ -1004,7 +1046,7 @@ async function deleteVideoFile(name, customPath = null, blacklistMode = false) {
|
||||
|
||||
// get ID from JSON
|
||||
|
||||
var jsonobj = utils.getJSONMp4(name, videoFolderPath);
|
||||
var jsonobj = utils.getJSONMp4(name, filePath);
|
||||
let id = null;
|
||||
if (jsonobj) id = jsonobj.id;
|
||||
|
||||
@@ -1193,6 +1235,7 @@ async function downloadFileByURL_exec(url, type, options, sessionID = null) {
|
||||
options.customFileFolderPath = fileFolderPath;
|
||||
}
|
||||
|
||||
options.downloading_method = 'exec';
|
||||
const downloadConfig = await generateArgs(url, type, options);
|
||||
|
||||
// adds download to download helper
|
||||
@@ -1328,6 +1371,7 @@ async function downloadFileByURL_normal(url, type, options, sessionID = null) {
|
||||
options.customFileFolderPath = fileFolderPath;
|
||||
}
|
||||
|
||||
options.downloading_method = 'normal';
|
||||
const downloadConfig = await generateArgs(url, type, options);
|
||||
|
||||
// adds download to download helper
|
||||
@@ -1468,24 +1512,24 @@ async function generateArgs(url, type, options) {
|
||||
var youtubePassword = options.youtubePassword;
|
||||
|
||||
let downloadConfig = null;
|
||||
let qualityPath = (is_audio && !options.skip_audio_args) ? '-f bestaudio' :'-f best[ext=mp4]';
|
||||
let qualityPath = (is_audio && !options.skip_audio_args) ? ['-f', 'bestaudio'] : ['-f', 'best[ext=mp4]'];
|
||||
const is_youtube = url.includes('youtu');
|
||||
if (!is_audio && !is_youtube) {
|
||||
// tiktok videos fail when using the default format
|
||||
qualityPath = null;
|
||||
} else if (!is_audio && !is_youtube && (url.includes('reddit') || url.includes('pornhub'))) {
|
||||
qualityPath = '-f bestvideo+bestaudio'
|
||||
qualityPath = ['-f', 'bestvideo+bestaudio']
|
||||
}
|
||||
|
||||
if (customArgs) {
|
||||
downloadConfig = customArgs.split(',,');
|
||||
} else {
|
||||
if (customQualityConfiguration) {
|
||||
qualityPath = `-f ${customQualityConfiguration}`;
|
||||
qualityPath = ['-f', customQualityConfiguration];
|
||||
} else if (selectedHeight && selectedHeight !== '' && !is_audio) {
|
||||
qualityPath = `-f '(mp4)[height=${selectedHeight}]'`;
|
||||
qualityPath = ['-f', `'(mp4)[height=${selectedHeight}'`];
|
||||
} else if (maxBitrate && is_audio) {
|
||||
qualityPath = `--audio-quality ${maxBitrate}`
|
||||
qualityPath = ['--audio-quality', maxBitrate]
|
||||
}
|
||||
|
||||
if (customOutput) {
|
||||
@@ -1494,7 +1538,7 @@ async function generateArgs(url, type, options) {
|
||||
downloadConfig = ['-o', path.join(fileFolderPath, videopath + (is_audio ? '.%(ext)s' : '.mp4')), '--write-info-json', '--print-json'];
|
||||
}
|
||||
|
||||
if (qualityPath) downloadConfig.push(qualityPath);
|
||||
if (qualityPath && options.downloading_method === 'exec') downloadConfig.push(...qualityPath);
|
||||
|
||||
if (is_audio && !options.skip_audio_args) {
|
||||
downloadConfig.push('-x');
|
||||
@@ -1848,7 +1892,7 @@ app.get('/api/config', function(req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/setConfig', function(req, res) {
|
||||
app.post('/api/setConfig', optionalJwt, function(req, res) {
|
||||
let new_config_file = req.body.new_config_file;
|
||||
if (new_config_file && new_config_file['YoutubeDLMaterial']) {
|
||||
let success = config_api.setConfigFile(new_config_file);
|
||||
@@ -1894,8 +1938,6 @@ app.post('/api/tomp3', optionalJwt, async function(req, res) {
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
}
|
||||
|
||||
res.end("yes");
|
||||
});
|
||||
|
||||
app.post('/api/tomp4', optionalJwt, async function(req, res) {
|
||||
@@ -1925,50 +1967,11 @@ app.post('/api/tomp4', optionalJwt, async function(req, res) {
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
}
|
||||
|
||||
res.end("yes");
|
||||
});
|
||||
|
||||
// gets the status of the mp3 file that's being downloaded
|
||||
app.post('/api/fileStatusMp3', function(req, res) {
|
||||
var name = decodeURIComponent(req.body.name + "");
|
||||
var exists = "";
|
||||
var fullpath = audioFolderPath + name + ".mp3";
|
||||
if (fs.existsSync(fullpath)) {
|
||||
exists = [basePath + audioFolderPath + name, getFileSizeMp3(name)];
|
||||
}
|
||||
else
|
||||
{
|
||||
var percent = 0;
|
||||
var size = getFileSizeMp3(name);
|
||||
var downloaded = getAmountDownloadedMp3(name);
|
||||
if (size > 0)
|
||||
percent = downloaded/size;
|
||||
exists = ["failed", getFileSizeMp3(name), percent];
|
||||
}
|
||||
//logger.info(exists + " " + name);
|
||||
res.send(exists);
|
||||
res.end("yes");
|
||||
});
|
||||
|
||||
// gets the status of the mp4 file that's being downloaded
|
||||
app.post('/api/fileStatusMp4', function(req, res) {
|
||||
var name = decodeURIComponent(req.body.name);
|
||||
var exists = "";
|
||||
var fullpath = videoFolderPath + name + ".mp4";
|
||||
if (fs.existsSync(fullpath)) {
|
||||
exists = [basePath + videoFolderPath + name, getFileSizeMp4(name)];
|
||||
} else {
|
||||
var percent = 0;
|
||||
var size = getFileSizeMp4(name);
|
||||
var downloaded = getAmountDownloadedMp4(name);
|
||||
if (size > 0)
|
||||
percent = downloaded/size;
|
||||
exists = ["failed", getFileSizeMp4(name), percent];
|
||||
}
|
||||
//logger.info(exists + " " + name);
|
||||
res.send(exists);
|
||||
res.end("yes");
|
||||
app.post('/api/killAllDownloads', optionalJwt, async function(req, res) {
|
||||
const result_obj = await killAllDownloads();
|
||||
res.send(result_obj);
|
||||
});
|
||||
|
||||
// gets all download mp3s
|
||||
@@ -2307,6 +2310,16 @@ app.post('/api/downloadVideosForSubscription', optionalJwt, async (req, res) =>
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/updateSubscription', optionalJwt, async (req, res) => {
|
||||
let updated_sub = req.body.subscription;
|
||||
let user_uid = req.isAuthenticated() ? req.user.uid : null;
|
||||
|
||||
let success = subscriptions_api.updateSubscription(updated_sub, user_uid);
|
||||
res.send({
|
||||
success: success
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/getAllSubscriptions', optionalJwt, async (req, res) => {
|
||||
let user_uid = req.isAuthenticated() ? req.user.uid : null;
|
||||
|
||||
@@ -2455,11 +2468,10 @@ app.post('/api/deleteMp3', optionalJwt, async (req, res) => {
|
||||
var wasDeleted = false;
|
||||
if (fs.existsSync(fullpath))
|
||||
{
|
||||
deleteAudioFile(name, blacklistMode);
|
||||
deleteAudioFile(name, null, blacklistMode);
|
||||
db.get('files.audio').remove({uid: uid}).write();
|
||||
wasDeleted = true;
|
||||
res.send(wasDeleted);
|
||||
res.end("yes");
|
||||
} else if (audio_obj) {
|
||||
db.get('files.audio').remove({uid: uid}).write();
|
||||
wasDeleted = true;
|
||||
@@ -2491,7 +2503,6 @@ app.post('/api/deleteMp4', optionalJwt, async (req, res) => {
|
||||
db.get('files.video').remove({uid: uid}).write();
|
||||
// wasDeleted = true;
|
||||
res.send(wasDeleted);
|
||||
res.end("yes");
|
||||
} else if (video_obj) {
|
||||
db.get('files.video').remove({uid: uid}).write();
|
||||
wasDeleted = true;
|
||||
@@ -2499,7 +2510,6 @@ app.post('/api/deleteMp4', optionalJwt, async (req, res) => {
|
||||
} else {
|
||||
wasDeleted = false;
|
||||
res.send(wasDeleted);
|
||||
res.end("yes");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ fi
|
||||
|
||||
# chown current working directory to current user
|
||||
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
||||
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' +
|
||||
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos."
|
||||
exec su-exec "$UID:$GID" "$0" "$@"
|
||||
fi
|
||||
|
||||
|
||||
21
backend/package-lock.json
generated
21
backend/package-lock.json
generated
@@ -575,6 +575,11 @@
|
||||
"xdg-basedir": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"connected-domain": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/connected-domain/-/connected-domain-1.0.0.tgz",
|
||||
"integrity": "sha1-v+dyOMdL5FOnnwy2BY3utPI1jpM="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
||||
@@ -1990,6 +1995,14 @@
|
||||
"ipaddr.js": "1.9.1"
|
||||
}
|
||||
},
|
||||
"ps-node": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/ps-node/-/ps-node-0.1.6.tgz",
|
||||
"integrity": "sha1-mvZ6mdex0BMuUaUDCZ04qNKs4sM=",
|
||||
"requires": {
|
||||
"table-parser": "^0.1.3"
|
||||
}
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
@@ -2348,6 +2361,14 @@
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"table-parser": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/table-parser/-/table-parser-0.1.3.tgz",
|
||||
"integrity": "sha1-BEHPzhallIFoTCfRtaZ/8VpDx7A=",
|
||||
"requires": {
|
||||
"connected-domain": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"tar-stream": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz",
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
"passport-jwt": "^4.0.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"progress": "^2.0.3",
|
||||
"ps-node": "^0.1.6",
|
||||
"read-last-lines": "^1.7.2",
|
||||
"shortid": "^2.2.15",
|
||||
"unzipper": "^0.10.10",
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
backend/public/1-es2015.c401a556fe28cac6abab.js
Normal file
1
backend/public/1-es2015.c401a556fe28cac6abab.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
backend/public/1-es5.c401a556fe28cac6abab.js
Normal file
1
backend/public/1-es5.c401a556fe28cac6abab.js
Normal file
File diff suppressed because one or more lines are too long
@@ -14,5 +14,5 @@
|
||||
<link rel="stylesheet" href="styles.5112d6db78cf21541598.css"></head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
<script src="runtime-es2015.0785764e1e4f6ab5497e.js" type="module"></script><script src="runtime-es5.0785764e1e4f6ab5497e.js" nomodule defer></script><script src="polyfills-es5.7f923c8f5afda210edd3.js" nomodule defer></script><script src="polyfills-es2015.5b408f108bcea938a7e2.js" type="module"></script><script src="main-es2015.0cbc545a4a3bee376826.js" type="module"></script><script src="main-es5.0cbc545a4a3bee376826.js" nomodule defer></script></body>
|
||||
<script src="runtime-es2015.42092efdfb84b81949da.js" type="module"></script><script src="runtime-es5.42092efdfb84b81949da.js" nomodule defer></script><script src="polyfills-es5.7f923c8f5afda210edd3.js" nomodule defer></script><script src="polyfills-es2015.5b408f108bcea938a7e2.js" type="module"></script><script src="main-es2015.0cbc545a4a3bee376826.js" type="module"></script><script src="main-es5.0cbc545a4a3bee376826.js" nomodule defer></script></body>
|
||||
</html>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"-es2015."+{1:"74313ded392a393618d4"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
|
||||
1
backend/public/runtime-es2015.42092efdfb84b81949da.js
Normal file
1
backend/public/runtime-es2015.42092efdfb84b81949da.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"-es2015."+{1:"c401a556fe28cac6abab"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
|
||||
@@ -1 +0,0 @@
|
||||
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"-es5."+{1:"74313ded392a393618d4"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
|
||||
1
backend/public/runtime-es5.42092efdfb84b81949da.js
Normal file
1
backend/public/runtime-es5.42092efdfb84b81949da.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"-es5."+{1:"c401a556fe28cac6abab"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
|
||||
@@ -81,7 +81,15 @@ async function getSubscriptionInfo(sub, user_uid = null) {
|
||||
|
||||
return new Promise(resolve => {
|
||||
// get videos
|
||||
let downloadConfig = ['--dump-json', '--playlist-end', '1']
|
||||
let downloadConfig = ['--dump-json', '--playlist-end', '1'];
|
||||
let useCookies = config_api.getConfigItem('ytdl_use_cookies');
|
||||
if (useCookies) {
|
||||
if (fs.existsSync(path.join(__dirname, 'appdata', 'cookies.txt'))) {
|
||||
downloadConfig.push('--cookies', path.join('appdata', 'cookies.txt'));
|
||||
} else {
|
||||
logger.warn('Cookies file could not be found. You can either upload one, or disable \'use cookies\' in the Advanced tab in the settings.');
|
||||
}
|
||||
}
|
||||
youtubedl.exec(sub.url, downloadConfig, {}, function(err, output) {
|
||||
if (debugMode) {
|
||||
logger.info('Subscribe: got info for subscription ' + sub.id);
|
||||
@@ -158,6 +166,11 @@ async function unsubscribe(sub, deleteMode, user_uid = null) {
|
||||
else
|
||||
db.get('subscriptions').remove({id: id}).write();
|
||||
|
||||
// failed subs have no name, on unsubscribe they shouldn't error
|
||||
if (!sub.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
const appendedBasePath = getAppendedBasePath(sub, basePath);
|
||||
if (deleteMode && fs.existsSync(appendedBasePath)) {
|
||||
if (sub.archive && fs.existsSync(sub.archive)) {
|
||||
@@ -417,6 +430,15 @@ function getSubscription(subID, user_uid = null) {
|
||||
return db.get('subscriptions').find({id: subID}).value();
|
||||
}
|
||||
|
||||
function updateSubscription(sub, user_uid = null) {
|
||||
if (user_uid) {
|
||||
users_db.get('users').find({uid: user_uid}).get('subscriptions').find({id: sub.id}).assign(sub).write();
|
||||
} else {
|
||||
db.get('subscriptions').find({id: sub.id}).assign(sub).write();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function subExists(subID, user_uid = null) {
|
||||
if (user_uid)
|
||||
return !!users_db.get('users').find({uid: user_uid}).get('subscriptions').find({id: subID}).value();
|
||||
@@ -476,6 +498,7 @@ function removeIDFromArchive(archive_path, id) {
|
||||
module.exports = {
|
||||
getSubscription : getSubscription,
|
||||
getAllSubscriptions : getAllSubscriptions,
|
||||
updateSubscription : updateSubscription,
|
||||
subscribe : subscribe,
|
||||
unsubscribe : unsubscribe,
|
||||
deleteSubscriptionFile : deleteSubscriptionFile,
|
||||
|
||||
Reference in New Issue
Block a user