diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html
index 60591173b..e2464cccf 100644
--- a/src/app/pages/publications/publications.page.html
+++ b/src/app/pages/publications/publications.page.html
@@ -19,11 +19,8 @@
Acções
-
-
+
-
+
diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts
index 5ffd706d5..5692a8d4e 100644
--- a/src/app/pages/publications/publications.page.ts
+++ b/src/app/pages/publications/publications.page.ts
@@ -82,7 +82,7 @@ export class PublicationsPage implements OnInit {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
this.intent = window["sharedContent"]
-
+
}
ngOnInit() {
@@ -237,42 +237,6 @@ export class PublicationsPage implements OnInit {
async onFileSelect(event: any) {
- const file:File = event.target.files[0];
-
-
- const chunkSize = 1024 * 1024; // Adjust the chunk size as needed
- const chunks = [];
- let offset = 0;
- let i = 0;
- let j = 0;
-
- function count () {
- j++
- return j
- }
-
- while (offset < file.size) {
- const chunk = file.slice(offset, offset + chunkSize);
- const reader = new FileReader();
-
- reader.onload = async () => {
-
- const headers = new HttpHeaders()
- .append('X-File-Name', "fileName")
- .append('X-File-Extension', "mp4")
- .append('X-File-Content-Length', i.toString())
- .append('X-File-Index', count().toString());
-
- const a = new Uint8Array(reader.result as ArrayBuffer)
- await this.http.post('http://localhost:3001/upload', a.buffer, { headers, responseType: 'blob' }).toPromise();
-
-
- };
- reader.readAsArrayBuffer(chunk);
- offset += chunkSize;
- i++;
- }
-
}
diff --git a/src/app/services/stream/stream.service.ts b/src/app/services/stream/stream.service.ts
index f1c12c1ef..d37e653f1 100644
--- a/src/app/services/stream/stream.service.ts
+++ b/src/app/services/stream/stream.service.ts
@@ -12,97 +12,6 @@ export class StreamService {
window["StreamService"] = this
}
-
- async uploadFile() {
- const API_URL = 'http://localhost:3000/upload'; // Replace with your server URL
- const filePath = 'path/to/large-file.zip'; // Replace with the path to your file
- const fileName = 'my-file'; // Specify your desired filename
- const fileExtension = 'zip'; // Specify the file extension
-
- const headers = new HttpHeaders()
- .append('X-File-Name', fileName)
- .append('X-File-Extension', fileExtension);
-
- const file = await this.readFileInChunks(filePath);
- const chunkSize = 1024 * 1024; // 1 MB chunk size (adjust as needed)
-
- for (let offset = 0; offset < file.length; offset += chunkSize) {
- const chunk = file.slice(offset, offset + chunkSize);
- // await this.uploadChunk(API_URL, chunk, headers);
- }
-
- console.log('Upload completed.');
- }
-
- async readFileInChunks(filePath: string): Promise {
- const response = await fetch(filePath);
- const reader = response.body.getReader();
- const chunks: Uint8Array[] = [];
- let done = false;
-
- while (!done) {
- const { value, done: isDone } = await reader.read();
- if (!isDone) {
- chunks.push(value);
- }
- done = isDone;
- }
-
- return new Uint8Array([].concat(...chunks.map((chunk) => Array.from(chunk))));
- }
-
- async uploadChunk(url: string, chunks: Uint8Array[], fileName, fileExtension): Promise {
-
- let i = 1
-
- console.log('123', chunks.length)
- for(const chunk of chunks) {
- try {
-
- console.log("iterate")
-
- const headers = new HttpHeaders()
- .append('X-File-Name', fileName)
- .append('X-File-Extension', fileExtension)
- .append('X-File-Content-Length', chunks.length.toString())
- .append('X-File-Index', i.toString())
-
- await this.http.post('http://localhost:3001/upload', chunk.buffer, { headers, responseType: 'blob' }).toPromise();
- i++
-
- } catch (error) {
- console.error('Upload error:', error);
- }
- }
-
- }
-
-
- async uploadChunkNoLoop(url: string, chunk: Uint8Array, fileName, fileExtension, i, length): Promise {
-
- console.log("iterate")
-
- const headers = new HttpHeaders()
- .append('X-File-Name', fileName)
- .append('X-File-Extension', fileExtension)
- .append('X-File-Content-Length', length)
- .append('X-File-Index', i.toString())
-
- await this.http.post('http://localhost:3001/upload', chunk.buffer, { headers, responseType: 'blob' }).toPromise();
-
- }
-
- uploadChunk1(chunk: Blob, chunkNumber: number, totalChunks: number, filename: string) {
-
- console.log(chunk)
-
- const headers = new HttpHeaders()
- .append('X-File-Name', filename)
- .append('X-File-Content-Length', totalChunks.toString())
- .append('X-File-Index', chunkNumber.toString())
-
- return this.http.post('http://localhost:3001/upload-chunk', Blob, { headers, responseType: 'blob' });
- }
}
// const text = 'Hello, World00120301010asdf1002sdf 0fsdfasf0001230 12300!\n';
diff --git a/src/app/shared/API/CMAPI/cmapi-api.service.ts b/src/app/shared/API/CMAPI/cmapi-api.service.ts
index 289afcb7d..927de3936 100644
--- a/src/app/shared/API/CMAPI/cmapi-api.service.ts
+++ b/src/app/shared/API/CMAPI/cmapi-api.service.ts
@@ -2,6 +2,7 @@ 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'
@@ -13,6 +14,7 @@ export class CMAPIAPIService {
getVideoHeader(url: string) {
- return this.http.head('http://localhost:3001/static/'+url, { observe: 'response' })
+ // return this.http.head('http://localhost:3001/static/'+url, { observe: 'response' })
+ return this.http.head(environment.apiURL+'ObjectServer/StreamFiles?path='+url, { observe: 'response' })
}
}
diff --git a/src/app/shared/publication/new-publication/new-publication.page.html b/src/app/shared/publication/new-publication/new-publication.page.html
index 89b589460..40b765508 100644
--- a/src/app/shared/publication/new-publication/new-publication.page.html
+++ b/src/app/shared/publication/new-publication/new-publication.page.html
@@ -86,7 +86,7 @@
-
+
@@ -127,7 +127,7 @@
-
+