config settings now just have url and port

fixed bug where multi download mode would not allow file card link clicking
This commit is contained in:
Isaac Grynsztein
2020-02-28 00:14:46 -05:00
parent 09bdae90e2
commit 5e331b9ffa
8 changed files with 28 additions and 35 deletions

View File

@@ -31,7 +31,7 @@ db.defaults(
// config values // config values
var frontendUrl = null; var frontendUrl = null;
var backendUrl = null; var backendUrl = null;
var backendPort = 17442; var backendPort = null;
var usingEncryption = null; var usingEncryption = null;
var basePath = null; var basePath = null;
var audioFolderPath = null; var audioFolderPath = null;
@@ -85,7 +85,7 @@ function startServer() {
if (usingEncryption) if (usingEncryption)
{ {
https.createServer(options, app).listen(backendPort, function() { https.createServer(options, app).listen(backendPort, function() {
console.log('HTTPS: Anchor set on 17442'); console.log('HTTPS: Started on PORT ' + backendPort);
}); });
} }
else else
@@ -121,9 +121,9 @@ async function loadConfig() {
// get config library // get config library
// config = require('config'); // config = require('config');
frontendUrl = !debugMode ? config_api.getConfigItem('ytdl_frontend_url') : 'http://localhost:4200'; // frontendUrl = !debugMode ? config_api.getConfigItem('ytdl_frontend_url') : 'http://localhost:4200';
backendUrl = config_api.getConfigItem('ytdl_backend_url') url = !debugMode ? config_api.getConfigItem('ytdl_url') : 'http://localhost:4200';
backendPort = 17442; backendPort = config_api.getConfigItem('ytdl_port');
usingEncryption = config_api.getConfigItem('ytdl_use_encryption'); usingEncryption = config_api.getConfigItem('ytdl_use_encryption');
basePath = config_api.getConfigItem('ytdl_base_path'); basePath = config_api.getConfigItem('ytdl_base_path');
audioFolderPath = config_api.getConfigItem('ytdl_audio_folder_path'); audioFolderPath = config_api.getConfigItem('ytdl_audio_folder_path');
@@ -149,7 +149,7 @@ async function loadConfig() {
}; };
} }
url_domain = new URL(frontendUrl); url_domain = new URL(url);
// start the server here // start the server here
startServer(); startServer();

View File

@@ -1,8 +1,8 @@
{ {
"YoutubeDLMaterial": { "YoutubeDLMaterial": {
"Host": { "Host": {
"frontendurl": "http://example.com", "url": "http://example.com",
"backendurl": "http://example.com:17442/" "port": "17442"
}, },
"Encryption": { "Encryption": {
"use-encryption": false, "use-encryption": false,
@@ -10,7 +10,7 @@
"key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem" "key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem"
}, },
"Downloader": { "Downloader": {
"path-base": "http://example.com:17442/", "path-base": "http://example.com:17442/api/",
"path-audio": "audio/", "path-audio": "audio/",
"path-video": "video/" "path-video": "video/"
}, },

View File

@@ -1,16 +1,16 @@
{ {
"YoutubeDLMaterial": { "YoutubeDLMaterial": {
"Host": { "Host": {
"frontendurl": "https://example.com", "url": "https://example.com",
"backendurl": "https://example.com:17442/" "port": "17442"
}, },
"Encryption": { "Encryption": {
"use-encryption": true, "use-encryption": true,
"cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem", "cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem",
"key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem" "key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem"
}, },
"Downloader": { "Downloader": {
"path-base": "https://example.com:17442/", "path-base": "https://example.com:17442/api/",
"path-audio": "audio/", "path-audio": "audio/",
"path-video": "video/" "path-video": "video/"
}, },

View File

@@ -2,13 +2,13 @@ var config = require('config');
let CONFIG_ITEMS = { let CONFIG_ITEMS = {
// Host // Host
'ytdl_frontend_url': { 'ytdl_url': {
'key': 'ytdl_frontend_url', 'key': 'ytdl_url',
'path': 'YoutubeDLMaterial.Host.frontendurl' 'path': 'YoutubeDLMaterial.Host.url'
}, },
'ytdl_backend_url': { 'ytdl_port': {
'key': 'ytdl_backend_url', 'key': 'ytdl_port',
'path': 'YoutubeDLMaterial.Host.backendurl' 'path': 'YoutubeDLMaterial.Host.port'
}, },
// Encryption // Encryption

View File

@@ -204,7 +204,6 @@ export class MainComponent implements OnInit {
// loading config // loading config
this.postsService.loadNavItems().subscribe(res => { // loads settings this.postsService.loadNavItems().subscribe(res => { // loads settings
const result = !this.postsService.debugMode ? res['config_file'] : res; const result = !this.postsService.debugMode ? res['config_file'] : res;
const backendUrl = result['YoutubeDLMaterial']['Host']['backendurl'];
this.fileManagerEnabled = result['YoutubeDLMaterial']['Extra']['file_manager_enabled']; this.fileManagerEnabled = result['YoutubeDLMaterial']['Extra']['file_manager_enabled'];
this.downloadOnlyMode = result['YoutubeDLMaterial']['Extra']['download_only_mode']; this.downloadOnlyMode = result['YoutubeDLMaterial']['Extra']['download_only_mode'];
this.allowMultiDownloadMode = result['YoutubeDLMaterial']['Extra']['allow_multi_download_mode']; this.allowMultiDownloadMode = result['YoutubeDLMaterial']['Extra']['allow_multi_download_mode'];
@@ -217,9 +216,6 @@ export class MainComponent implements OnInit {
this.allowQualitySelect = result['YoutubeDLMaterial']['Extra']['allow_quality_select']; this.allowQualitySelect = result['YoutubeDLMaterial']['Extra']['allow_quality_select'];
this.allowAdvancedDownload = result['YoutubeDLMaterial']['Advanced']['allow_advanced_download']; this.allowAdvancedDownload = result['YoutubeDLMaterial']['Advanced']['allow_advanced_download'];
this.postsService.path = backendUrl + 'api/';
this.postsService.startPath = backendUrl;
this.postsService.startPathSSL = backendUrl;
if (this.fileManagerEnabled) { if (this.fileManagerEnabled) {
this.getMp3s(); this.getMp3s();
@@ -395,7 +391,7 @@ export class MainComponent implements OnInit {
if (new_download && this.current_download !== new_download) { if (new_download && this.current_download !== new_download) {
// console.log('mismatched downloads'); // console.log('mismatched downloads');
} else if (!this.multiDownloadMode) { } else if (!this.multiDownloadMode || !new_download) {
// if download only mode, just download the file. no redirect // if download only mode, just download the file. no redirect
if (forceView === false && this.downloadOnlyMode && !this.iOS) { if (forceView === false && this.downloadOnlyMode && !this.iOS) {
if (is_playlist) { if (is_playlist) {
@@ -434,7 +430,7 @@ export class MainComponent implements OnInit {
if (new_download && this.current_download !== new_download) { if (new_download && this.current_download !== new_download) {
// console.log('mismatched downloads'); // console.log('mismatched downloads');
} else if (!this.multiDownloadMode) { } else if (!this.multiDownloadMode || !new_download) {
// if download only mode, just download the file. no redirect // if download only mode, just download the file. no redirect
if (forceView === false && this.downloadOnlyMode) { if (forceView === false && this.downloadOnlyMode) {
if (is_playlist) { if (is_playlist) {

View File

@@ -58,11 +58,7 @@ export class PlayerComponent implements OnInit {
this.baseStreamPath = result['YoutubeDLMaterial']['Downloader']['path-base']; this.baseStreamPath = result['YoutubeDLMaterial']['Downloader']['path-base'];
this.audioFolderPath = result['YoutubeDLMaterial']['Downloader']['path-audio']; this.audioFolderPath = result['YoutubeDLMaterial']['Downloader']['path-audio'];
this.videoFolderPath = result['YoutubeDLMaterial']['Downloader']['path-video']; this.videoFolderPath = result['YoutubeDLMaterial']['Downloader']['path-video'];
const backendUrl = result['YoutubeDLMaterial']['Host']['backendurl'];
this.postsService.path = backendUrl + 'api/';
this.postsService.startPath = backendUrl;
this.postsService.startPathSSL = backendUrl;
let fileType = null; let fileType = null;
if (this.type === 'audio') { if (this.type === 'audio') {

View File

@@ -30,6 +30,7 @@ export class PostsService {
if (isDevMode()) { if (isDevMode()) {
this.debugMode = true; this.debugMode = true;
this.path = 'http://localhost:17442/api/';
} }
} }

View File

@@ -1,16 +1,16 @@
{ {
"YoutubeDLMaterial": { "YoutubeDLMaterial": {
"Host": { "Host": {
"frontendurl": "http://localhost:4200", "url": "http://localhost",
"backendurl": "http://localhost:17442/" "port": "17442"
}, },
"Encryption": { "Encryption": {
"use-encryption": false, "use-encryption": false,
"cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem", "cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem",
"key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem" "key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem"
}, },
"Downloader": { "Downloader": {
"path-base": "http://localhost:17442/", "path-base": "http://localhost:17442/api/",
"path-audio": "audio/", "path-audio": "audio/",
"path-video": "video/" "path-video": "video/"
}, },