mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-13 03:41:29 +03:00
Working with encryption!
This commit is contained in:
@@ -23,20 +23,39 @@ export class AppComponent {
|
||||
constructor(private postsService: PostsService) {
|
||||
this.audioOnly = true;
|
||||
|
||||
// starts handshake
|
||||
this.doHandshake();
|
||||
|
||||
|
||||
this.postsService.loadNavItems().subscribe(result => {
|
||||
var backendUrl = result.YoutubeDLMaterial.Host.backendurl;
|
||||
|
||||
this.postsService.path = backendUrl;
|
||||
this.postsService.startPath = backendUrl;
|
||||
this.postsService.startPathSSL = backendUrl;
|
||||
});
|
||||
}
|
||||
|
||||
urlForm = new FormControl('', [Validators.required]);
|
||||
|
||||
doHandshake() {
|
||||
this.postsService.startHandshake().subscribe(url => {
|
||||
this.postsService.path = "http://" + url;
|
||||
doHandshake(url: string) {
|
||||
this.postsService.startHandshake(url).subscribe(theurl => {
|
||||
this.postsService.path = theurl;
|
||||
this.postsService.handShakeComplete = true;
|
||||
console.log("Handshake complete!");
|
||||
},
|
||||
error => {
|
||||
console.log("Initial handshake failed, make sure port 17442 is open!");
|
||||
console.log("Initial handshake failed on http.");
|
||||
this.doHandshakeSSL(url);
|
||||
});
|
||||
}
|
||||
|
||||
doHandshakeSSL(url: string) {
|
||||
this.postsService.startHandshakeSSL(url).subscribe(theurl => {
|
||||
this.postsService.path = theurl;
|
||||
this.postsService.handShakeComplete = true;
|
||||
console.log("Handshake complete!");
|
||||
},
|
||||
error => {
|
||||
console.log("Initial handshake failed on https too! Make sure port 17442 is open.");
|
||||
this.postsService.handShakeComplete = false;
|
||||
});
|
||||
}
|
||||
@@ -119,3 +138,4 @@ export class AppComponent {
|
||||
return re.test(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ import { NgModule } from '@angular/core';
|
||||
import {MatNativeDateModule, MatRadioModule, MatInputModule, MatButtonModule, MatSidenavModule, MatIconModule, MatListModule,
|
||||
MatSnackBarModule, MatCardModule, MatSelectModule, MatToolbarModule, MatCheckboxModule,
|
||||
MatProgressBarModule } from '@angular/material';
|
||||
import { NgConfigureModule, ConfigureOptions } from 'ng4-configure/ng4-configure';
|
||||
import { MyOptions } from './configuration_options.component';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import { AppComponent } from './app.component';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { ConfigureOptions } from 'ng4-configure/ng4-configure';
|
||||
|
||||
export class MyOptions extends ConfigureOptions {
|
||||
ConfigurationURL: string = 'assets/config.json';
|
||||
AppVersion: string = '0.0.0';
|
||||
BustCache: boolean = false
|
||||
}
|
||||
@@ -12,15 +12,22 @@ export class PostsService {
|
||||
audioFolder: string = "";
|
||||
videoFolder: string = "";
|
||||
startPath: string = "http://localhost:17442/";
|
||||
startPathSSL: string = "https://localhost:17442/"
|
||||
handShakeComplete: boolean = false;
|
||||
|
||||
constructor(private http: Http){
|
||||
console.log('PostsService Initialized...');
|
||||
}
|
||||
|
||||
startHandshake(): Observable<string>
|
||||
startHandshake(url: string): Observable<string>
|
||||
{
|
||||
return this.http.get(this.startPath + "url")
|
||||
return this.http.get(url + "geturl")
|
||||
.map(res => res.json());
|
||||
}
|
||||
|
||||
startHandshakeSSL(url: string): Observable<string>
|
||||
{
|
||||
return this.http.get(url + "geturl")
|
||||
.map(res => res.json());
|
||||
}
|
||||
|
||||
@@ -57,6 +64,14 @@ export class PostsService {
|
||||
return this.http.post(this.path + "mp4fileexists",{name: name})
|
||||
.map(res => res.json());
|
||||
}
|
||||
|
||||
loadNavItems() {
|
||||
return this.http.get("../../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.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user