Archive improvements

Began UI for viewing/modifying archives
This commit is contained in:
Tzahi12345
2023-03-26 01:01:36 -04:00
parent a2b5484b75
commit 62ad4226d9
17 changed files with 369 additions and 15 deletions

View File

@@ -106,7 +106,10 @@ import {
SetNotificationsToReadRequest,
GetNotificationsResponse,
UpdateTaskOptionsRequest,
User
User,
DeleteArchiveItemRequest,
GetArchivesRequest,
GetArchivesResponse
} from '../api-types';
import { isoLangs } from './settings/locales_list';
import { Title } from '@angular/platform-browser';
@@ -431,8 +434,11 @@ export class PostsService implements CanActivate {
return this.http.post<UpdateConcurrentStreamResponse>(this.path + 'updateConcurrentStream', body, this.httpOptions);
}
uploadCookiesFile(fileFormData) {
return this.http.post<SuccessObject>(this.path + 'uploadCookies', fileFormData, this.httpOptions);
uploadCookiesFile(cookiesFile: File, cookiesFilePath: string) {
const formData = new FormData()
formData.append('cookies', cookiesFile, cookiesFilePath);
// const body: UploadCookiesRequest = formData;
return this.http.post<SuccessObject>(this.path + 'uploadCookies', formData, this.httpOptions);
}
downloadArchive(type: FileType, sub_id: string) {
@@ -440,6 +446,24 @@ export class PostsService implements CanActivate {
return this.http.post(this.path + 'downloadArchive', body, {responseType: 'blob', params: this.httpOptions.params});
}
getArchives(sub_id: string) {
const body: GetArchivesRequest = {sub_id: sub_id};
return this.http.post<GetArchivesResponse>(this.path + 'getArchives', body, this.httpOptions);
}
importArchive(archiveFile: File, type: FileType, sub_id: string = null) {
const formData = new FormData()
formData.append('archive', archiveFile, 'archive.txt');
formData.append('type', type);
formData.append('sub_id', sub_id);
return this.http.post<SuccessObject>(this.path + 'importArchive', formData, this.httpOptions);
}
deleteArchiveItem(extractor: string, id: string, type: FileType, sub_id: string = null) {
const body: DeleteArchiveItemRequest = {extractor: extractor, id: id, type: type, sub_id: sub_id};
return this.http.post<SuccessObject>(this.path + 'deleteArchiveItem', body, this.httpOptions);
}
getFileFormats(url) {
const body: GetFileFormatsRequest = {url: url};
return this.http.post<GetFileFormatsResponse>(this.path + 'getFileFormats', body, this.httpOptions);