video uploader

This commit is contained in:
Peter Maquiran
2024-01-29 13:49:53 +01:00
parent 892bdbe5cf
commit 2605d73baa
11 changed files with 757 additions and 179 deletions
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { CMAPIAPIService } from './cmapi-api.service';
describe('CMAPIAPIService', () => {
let service: CMAPIAPIService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CMAPIAPIService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { HttpServiceService } from 'src/app/services/http/http-service.service';
import { HttpClient, HttpEvent, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class CMAPIAPIService {
constructor( private HttpServiceService: HttpServiceService,
private http: HttpClient,) { }
getVideoHeader(url: string) {
return this.http.head('http://localhost:3001/static/'+url, { observe: 'response' })
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { CMAPIService } from './cmapi.service';
describe('CMAPIService', () => {
let service: CMAPIService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CMAPIService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+21
View File
@@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { HttpServiceService } from 'src/app/services/http/http-service.service';
import { HttpClient, HttpEvent, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class CMAPIService {
constructor( private HttpServiceService: HttpServiceService,
private http: HttpClient,) {
window["CMAPIService"] = this
}
getVideoHeader(url: string): Observable<Boolean> {
return this.http.head(url, { observe: 'response' })
.map(response => response.status === 200)
.catch(() => Observable.of(false));
}
}
@@ -158,7 +158,7 @@ export class MiddlewareServiceService {
// ===========================================================================
CMAPIFileContent({length, path, index, blobFile}) {
CMAPIPing() {
const headers = new HttpHeaders();
headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
@@ -170,6 +170,31 @@ export class MiddlewareServiceService {
};
const formData = new FormData();
formData.append("blobFile", "blobFile");
formData.append("length", "length");
formData.append("index", "index.toString(");
return this.http.post<IuploadFileLK>(`${geturl}`, formData, options)
}
CMAPIFileContent({length, path, index, blobFile}) {
const headers = new HttpHeaders();
headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
// const geturl = 'http://localhost:3001/FileHub';
// const geturl = environment.apiURL + 'Tasks/DelegateTask';
const geturl = environment.apiPCURL + 'FileContent';
let options = {
headers: headers
};
const formData = new FormData();
formData.append("blobFile", blobFile);
@@ -182,4 +207,15 @@ export class MiddlewareServiceService {
return this.http.post<IuploadFileLK>(`${geturl}`, formData, options)
}
tryToReachTheServer() {
let opts = {
headers: {},
}
return this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts)
}
}