mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
video uploader
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service";
|
||||
import { CMAPIAPIService } from "src/app/shared/API/CMAPI/cmapi-api.service";
|
||||
import { ok, err } from 'neverthrow';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CMAPIService {
|
||||
|
||||
constructor(public MiddlewareServiceService: MiddlewareServiceService) {
|
||||
window["CMAPIService"] = this
|
||||
constructor(
|
||||
public MiddlewareServiceService: MiddlewareServiceService,
|
||||
private CMAPIAPIService: CMAPIAPIService) {
|
||||
window["CMAPIAPIRepository"] = this
|
||||
}
|
||||
|
||||
async FileContent({length, path, index, blobFile}) {
|
||||
@@ -20,7 +24,33 @@ export class CMAPIService {
|
||||
} catch (error) {
|
||||
return err(error)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async ping() {
|
||||
try {
|
||||
await this.MiddlewareServiceService.tryToReachTheServer().toPromise();
|
||||
return ok(true)
|
||||
|
||||
} catch (error) {
|
||||
|
||||
if(error.status == 0) {
|
||||
return err(false)
|
||||
}
|
||||
|
||||
return ok(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getVideoHeader(url: string) {
|
||||
try {
|
||||
await this.CMAPIAPIService.getVideoHeader(url).toPromise()
|
||||
return ok(true)
|
||||
} catch(error) {
|
||||
return err(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user