This commit is contained in:
Peter Maquiran
2024-02-23 12:39:59 +01:00
29 changed files with 1742 additions and 877 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,20 @@
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';
import { environment } from 'src/environments/environment';
@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' })
return this.http.head(environment.apiURL+'ObjectServer/StreamFiles?path='+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));
}
}
@@ -23,7 +23,7 @@ export class MiddlewareServiceService {
window["MiddlewareServiceService"] = this
}
refreshToken(refreshToken: string){
refreshToken(refreshToken: string) {
const data = {
refreshToken: refreshToken
}
@@ -158,7 +158,7 @@ export class MiddlewareServiceService {
// ===========================================================================
CMAPIFileContent({length, path, index, blobFile}) {
CMAPIPing() {
const headers = new HttpHeaders();
headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
@@ -172,19 +172,16 @@ export class MiddlewareServiceService {
const formData = new FormData();
formData.append("blobFile", blobFile);
formData.append("length", length);
formData.append("index", index.toString());
formData.append("blobFile", "blobFile");
formData.append("length", "length");
formData.append("index", "index.toString(");
if(path) {
formData.append("path", path);
}
return this.http.post<IuploadFileLK>(`${geturl}`, formData, options)
}
GetViewer(DocId: string, FsId: string) {
GetViewer(DocId: string, FsId: string) {
const geturl = environment.apiURL + 'ecm/document/viewfile';
let params = new HttpParams();
@@ -197,4 +194,39 @@ export class MiddlewareServiceService {
};
return this.http.get<string>(`${geturl}`, options);
}
CMAPIFileContent({length, path, index, base64}) {
// const geturl = 'http://localhost:3001/FileHub';
const geturl = environment.apiPCURL + 'FileContent/UploadFile';
const data = {
index,
length,
base64,
path,
}
return this.http.post<IuploadFileLK>(`${geturl}`, data)
}
CMAPIRequestUpload() {
const geturl = environment.apiPCURL + 'FileContent/RequestUpload';
return this.http.get<string>(`${geturl}`)
}
CMAPIUploadStatus() {
const geturl = environment.apiPCURL + 'FileContent/UploadStatus';
return this.http.get<string>(`${geturl}`)
}
tryToReachTheServer() {
let opts = {
headers: {},
}
return this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts)
}
}