1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-04 21:14:13 +08:00

97 lines
3.0 KiB
Go
Raw Normal View History

2022-08-24 11:10:50 +08:00
import { File } from '@/api/interface/file';
import http from '@/api';
2022-09-13 11:10:02 +08:00
import { AxiosRequestConfig } from 'axios';
2023-03-02 13:54:07 +08:00
import { ResPage } from '../interface';
2022-08-19 16:02:58 +08:00
2022-08-24 11:10:50 +08:00
export const GetFilesList = (params: File.ReqFile) => {
2023-02-06 17:14:19 +08:00
return http.post<File.File>('files/search', params, 200000);
2022-08-19 16:02:58 +08:00
};
2022-08-24 17:34:21 +08:00
2023-03-02 13:54:07 +08:00
export const GetUploadList = (params: File.SearchUploadInfo) => {
return http.post<ResPage<File.UploadInfo>>('files/upload/search', params);
};
2022-08-24 17:34:21 +08:00
export const GetFilesTree = (params: File.ReqFile) => {
return http.post<File.FileTree[]>('files/tree', params);
};
2022-08-25 17:54:52 +08:00
export const CreateFile = (form: File.FileCreate) => {
return http.post<File.File>('files', form);
};
2022-08-25 18:48:03 +08:00
export const DeleteFile = (form: File.FileDelete) => {
return http.post<File.File>('files/del', form);
};
2022-12-01 10:36:49 +08:00
export const BatchDeleteFile = (form: File.FileBatchDelete) => {
return http.post('files/batch/del', form);
};
export const ChangeFileMode = (form: File.FileCreate) => {
2022-09-01 19:02:33 +08:00
return http.post<File.File>('files/mode', form);
2022-08-30 17:59:59 +08:00
};
2022-10-12 13:42:58 +08:00
export const LoadFile = (form: File.FilePath) => {
return http.post<string>('files/loadfile', form);
};
2022-08-30 17:59:59 +08:00
export const CompressFile = (form: File.FileCompress) => {
2022-09-01 19:02:33 +08:00
return http.post<File.File>('files/compress', form);
};
2022-09-01 19:02:33 +08:00
2022-08-31 13:59:02 +08:00
export const DeCompressFile = (form: File.FileDeCompress) => {
2022-09-01 19:02:33 +08:00
return http.post<File.File>('files/decompress', form);
};
export const GetFileContent = (params: File.ReqFile) => {
return http.post<File.File>('files/content', params);
};
export const SaveFileContent = (params: File.FileEdit) => {
return http.post<File.File>('files/save', params);
2022-08-31 13:59:02 +08:00
};
2022-09-03 18:41:52 +08:00
2023-03-08 15:33:43 +08:00
export const CheckFile = (path: string) => {
return http.post<boolean>('files/check', { path: path });
};
2022-09-13 11:10:02 +08:00
export const UploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/upload', params, config);
2022-09-03 18:41:52 +08:00
};
2022-09-03 22:22:40 +08:00
2023-03-12 11:40:21 +08:00
export const ChunkUploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/chunkupload', params, config);
};
2022-09-03 22:22:40 +08:00
export const RenameRile = (params: File.FileRename) => {
return http.post<File.File>('files/rename', params);
};
2022-09-05 16:25:26 +08:00
export const ChangeOwner = (params: File.FileOwner) => {
return http.post<File.File>('files/owner', params);
};
2022-09-06 17:48:49 +08:00
export const WgetFile = (params: File.FileWget) => {
2022-09-14 19:09:39 +08:00
return http.post<File.FileWgetRes>('files/wget', params);
2022-09-05 16:25:26 +08:00
};
2022-09-06 10:35:35 +08:00
export const MoveFile = (params: File.FileMove) => {
return http.post<File.File>('files/move', params);
};
2022-09-06 17:48:49 +08:00
export const DownloadFile = (params: File.FileDownload) => {
2023-03-14 23:04:53 +08:00
return http.download<BlobPart>('files/download', params, { responseType: 'blob', timeout: 20000 });
2022-09-06 17:48:49 +08:00
};
export const DownloadByPath = (path: string) => {
return http.download<BlobPart>('files/download/bypath', { path: path }, { responseType: 'blob', timeout: 40000 });
};
export const ComputeDirSize = (params: File.DirSizeReq) => {
return http.post<File.DirSizeRes>('files/size', params);
};
2022-09-14 19:09:39 +08:00
export const FileKeys = () => {
return http.get<File.FileKeys>('files/keys');
};