diff --git a/backend/app.js b/backend/app.js index 732982a..6c378e3 100644 --- a/backend/app.js +++ b/backend/app.js @@ -211,6 +211,7 @@ app.post('/mp4fileexists', function(req, res) { }); app.get('/video/:id', function(req , res){ + var head; const path = "video/" + req.params.id + ".mp4"; const stat = fs.statSync(path) const fileSize = stat.size @@ -223,7 +224,7 @@ app.get('/video/:id', function(req , res){ : fileSize-1 const chunksize = (end-start)+1 const file = fs.createReadStream(path, {start, end}) - const head = { + head = { 'Content-Range': `bytes ${start}-${end}/${fileSize}`, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize, @@ -232,7 +233,7 @@ app.get('/video/:id', function(req , res){ res.writeHead(206, head); file.pipe(res); } else { - const head = { + head = { 'Content-Length': fileSize, 'Content-Type': 'video/mp4', } @@ -242,6 +243,7 @@ app.get('/video/:id', function(req , res){ }); app.get('/audio/:id', function(req , res){ + var head; const path = "audio/" + req.params.id + ".mp3"; const stat = fs.statSync(path) const fileSize = stat.size @@ -254,7 +256,7 @@ app.get('/audio/:id', function(req , res){ : fileSize-1 const chunksize = (end-start)+1 const file = fs.createReadStream(path, {start, end}) - const head = { + head = { 'Content-Range': `bytes ${start}-${end}/${fileSize}`, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize, @@ -263,7 +265,7 @@ app.get('/audio/:id', function(req , res){ res.writeHead(206, head); file.pipe(res); } else { - const head = { + head = { 'Content-Length': fileSize, 'Content-Type': 'audio/mp3', } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0735951..8b7413e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -35,6 +35,9 @@ export class AppComponent { this.postsService.path = backendUrl; this.postsService.startPath = backendUrl; this.postsService.startPathSSL = backendUrl; + }, + error => { + console.log(error); }); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 249a9b7..cdfeed1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,6 +9,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import { HttpModule } from '@angular/http'; import { HttpClientModule } from '@angular/common/http'; import { PostsService } from 'app/posts.services'; +import {APP_BASE_HREF} from '@angular/common'; @NgModule({ declarations: [ diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 5859fed..5f31bf5 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -66,11 +66,9 @@ export class PostsService { } loadNavItems() { - return this.http.get("../../backend/config/default.json") + console.log("Config location: " + window.location.href + "backend/config/default.json"); + return this.http.get(window.location.href + "backend/config/default.json") .map(res => res.json()); - //This is optional, you can remove the last line - // if you don't want to log loaded json in - // console. } } diff --git a/src/index.html b/src/index.html index 510b804..520ca11 100644 --- a/src/index.html +++ b/src/index.html @@ -3,7 +3,7 @@ YoutubeDLMaterial - + @@ -12,7 +12,6 @@ -