mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix commit to hub
This commit is contained in:
@@ -238,6 +238,42 @@ 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++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -265,9 +301,6 @@ export class PublicationsPage implements OnInit {
|
||||
const loader = this.toastService.loading();
|
||||
try {
|
||||
await this.publications.DeletePresidentialAction(id).toPromise();
|
||||
if(window["refreshPublication"]) {
|
||||
window["refreshPublication"]();
|
||||
}
|
||||
this.toastService._successMessage()
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
@@ -316,7 +349,7 @@ export class PublicationsPage implements OnInit {
|
||||
componentProps: {
|
||||
publicationType: publicationType,
|
||||
folderId: folderId,
|
||||
intent: intent
|
||||
intent: window["sharedContent"]
|
||||
},
|
||||
cssClass: 'new-publication modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
@@ -329,8 +362,8 @@ export class PublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
goToPublicationsList(folderId: string) {
|
||||
if(this.intent){
|
||||
this.AddPublication('2',folderId,this.intent)
|
||||
if(window["sharedContent"]){
|
||||
this.AddPublication('2',folderId,window["sharedContent"])
|
||||
return
|
||||
}
|
||||
if (window.innerWidth < 701) {
|
||||
|
||||
Reference in New Issue
Block a user