Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/init/dir/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Init() {
global.Dir.RecycleBinDir, _ = fileOp.CreateDirWithPath(true, "/.1panel_clash")
global.Dir.SSLLogDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/log/ssl"))

loadLocalDir()
//loadLocalDir()
}

func loadLocalDir() {
Expand Down
62 changes: 29 additions & 33 deletions frontend/src/api/modules/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,123 +3,119 @@ import { ResPage } from '../interface';
import { App } from '../interface/app';
import { TimeoutEnum } from '@/enums/http-enum';

export const SyncApp = (req: App.AppStoreSync) => {
export const syncApp = (req: App.AppStoreSync) => {
return http.post('apps/sync/remote', req);
};

export const SyncLocalApp = (req: App.AppStoreSync) => {
export const syncLocalApp = (req: App.AppStoreSync) => {
return http.post('apps/sync/local', req);
};

export const GetAppListUpdate = () => {
return http.get<App.AppUpdateRes>('apps/checkupdate');
};

export const SearchApp = (req: App.AppReq) => {
export const searchApp = (req: App.AppReq) => {
return http.post<App.AppResPage>('apps/search', req);
};

export const GetApp = (key: string) => {
export const getAppByKey = (key: string) => {
return http.get<App.AppDTO>('apps/' + key);
};

export const GetAppTags = () => {
export const getAppTags = () => {
return http.get<App.Tag[]>('apps/tags');
};

export const GetAppDetail = (appID: number, version: string, type: string) => {
export const getAppDetail = (appID: number, version: string, type: string) => {
return http.get<App.AppDetail>(`apps/detail/${appID}/${version}/${type}`);
};

export const GetAppDetailByID = (id: number) => {
export const getAppDetailByID = (id: number) => {
return http.get<App.AppDetail>(`apps/details/${id}`);
};

export const InstallApp = (install: App.AppInstall) => {
export const installApp = (install: App.AppInstall) => {
return http.post<any>('apps/install', install);
};

export const ChangePort = (params: App.ChangePort) => {
export const changePort = (params: App.ChangePort) => {
return http.post<any>('apps/installed/port/change', params);
};

export const SearchAppInstalled = (search: App.AppInstallSearch) => {
export const searchAppInstalled = (search: App.AppInstallSearch) => {
return http.post<ResPage<App.AppInstallDto>>('apps/installed/search', search);
};

export const ListAppInstalled = () => {
export const listAppInstalled = () => {
return http.get<Array<App.AppInstalledInfo>>('apps/installed/list');
};

export const GetAppPort = (type: string, name: string) => {
export const getAppPort = (type: string, name: string) => {
return http.post<number>(`apps/installed/loadport`, { type: type, name: name });
};

export const GetAppConnInfo = (type: string, name: string) => {
export const getAppConnInfo = (type: string, name: string) => {
return http.post<App.DatabaseConnInfo>(`apps/installed/conninfo`, { type: type, name: name });
};

export const CheckAppInstalled = (key: string, name: string) => {
export const checkAppInstalled = (key: string, name: string) => {
return http.post<App.CheckInstalled>(`apps/installed/check`, { key: key, name: name });
};

export const AppInstalledDeleteCheck = (appInstallId: number) => {
export const appInstalledDeleteCheck = (appInstallId: number) => {
return http.get<App.AppInstallResource[]>(`apps/installed/delete/check/${appInstallId}`);
};

export const GetAppInstalled = (search: App.AppInstalledSearch) => {
export const getAppInstalled = (search: App.AppInstalledSearch) => {
return http.post<App.AppInstalled[]>('apps/installed/search', search);
};

export const InstalledOp = (op: App.AppInstalledOp) => {
export const installedOp = (op: App.AppInstalledOp) => {
return http.post<any>('apps/installed/op', op, TimeoutEnum.T_40S);
};

export const SyncInstalledApp = () => {
export const syncInstalledApp = () => {
return http.post<any>('apps/installed/sync', {});
};

export const GetAppService = (key: string | undefined) => {
export const getAppService = (key: string | undefined) => {
return http.get<App.AppService[]>(`apps/services/${key}`);
};

export const GetAppUpdateVersions = (req: App.AppUpdateVersionReq) => {
export const getAppUpdateVersions = (req: App.AppUpdateVersionReq) => {
return http.post<any>(`apps/installed/update/versions`, req);
};

export const GetAppDefaultConfig = (key: string, name: string) => {
export const getAppDefaultConfig = (key: string, name: string) => {
return http.post<string>(`apps/installed/conf`, { type: key, name: name });
};

export const GetAppInstallParams = (id: number) => {
export const getAppInstallParams = (id: number) => {
return http.get<App.AppConfig>(`apps/installed/params/${id}`);
};

export const UpdateAppInstallParams = (req: any) => {
export const updateAppInstallParams = (req: any) => {
return http.post<any>(`apps/installed/params/update`, req);
};

export const IgnoreUpgrade = (req: any) => {
export const ignoreUpgrade = (req: any) => {
return http.post<any>(`apps/installed/ignore`, req);
};

export const GetIgnoredApp = () => {
export const getIgnoredApp = () => {
return http.get<App.IgnoredApp>(`apps/ignored/detail`);
};

export const UpdateInstallConfig = (req: App.AppConfigUpdate) => {
export const updateInstallConfig = (req: App.AppConfigUpdate) => {
return http.post(`apps/installed/config/update`, req);
};

export const GetAppStoreConfig = () => {
export const getAppStoreConfig = () => {
return http.get<App.AppStoreConfig>(`apps/store/config`);
};

export const UpdateAppStoreConfig = (req: App.AppStoreConfig) => {
export const updateAppStoreConfig = (req: App.AppStoreConfig) => {
return http.post(`apps/store/update`, req);
};

export const SyncCutomAppStore = (req: App.AppStoreSync) => {
export const syncCutomAppStore = (req: App.AppStoreSync) => {
return http.post(`/custom/app/sync`, req);
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has some slight discrepancies between the original version before merging and the current one. For example:

Original code:

-   return http.get<App.AppUpdateRes>('apps/checkupdate');

Corrected code:

-    return http.get<App.AppUpdateRes>('apps/checkupdate');   
``` The corrected code should be formatted to match Python's syntax.

There are also missing semicolons at various places indicating that some statements might not have been intended to run after a command, but this is likely unrelated since the code does not appear to contain a full JavaScript block of operations.

In summary, it seems there are formatting and content consistency improvements needed in both parts of the codebase related to `sync()` functions for different actions (such as installing apps, syncing their versions etc.). 

I would suggest reviewing these sections carefully if you want consistent coding across the project files.

Expand Down
56 changes: 28 additions & 28 deletions frontend/src/api/modules/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,87 @@ import { ResPage } from '../interface';
import { TimeoutEnum } from '@/enums/http-enum';
import { ReqPage } from '@/api/interface';

export const GetFilesList = (params: File.ReqFile) => {
export const getFilesList = (params: File.ReqFile) => {
return http.post<File.File>('files/search', params, TimeoutEnum.T_5M);
};

export const GetUploadList = (params: File.SearchUploadInfo) => {
export const getUploadList = (params: File.SearchUploadInfo) => {
return http.post<ResPage<File.UploadInfo>>('files/upload/search', params);
};

export const GetFilesTree = (params: File.ReqFile) => {
export const getFilesTree = (params: File.ReqFile) => {
return http.post<File.FileTree[]>('files/tree', params);
};

export const CreateFile = (form: File.FileCreate) => {
export const createFile = (form: File.FileCreate) => {
return http.post<File.File>('files', form);
};

export const DeleteFile = (form: File.FileDelete) => {
export const deleteFile = (form: File.FileDelete) => {
return http.post<File.File>('files/del', form);
};

export const BatchDeleteFile = (form: File.FileBatchDelete) => {
export const batchDeleteFile = (form: File.FileBatchDelete) => {
return http.post('files/batch/del', form);
};

export const ChangeFileMode = (form: File.FileCreate) => {
export const changeFileMode = (form: File.FileCreate) => {
return http.post<File.File>('files/mode', form);
};

export const CompressFile = (form: File.FileCompress) => {
export const compressFile = (form: File.FileCompress) => {
return http.post<File.File>('files/compress', form, TimeoutEnum.T_10M);
};

export const DeCompressFile = (form: File.FileDeCompress) => {
export const deCompressFile = (form: File.FileDeCompress) => {
return http.post<File.File>('files/decompress', form, TimeoutEnum.T_10M);
};

export const GetFileContent = (params: File.ReqFile) => {
export const getFileContent = (params: File.ReqFile) => {
return http.post<File.File>('files/content', params);
};

export const SaveFileContent = (params: File.FileEdit) => {
export const saveFileContent = (params: File.FileEdit) => {
return http.post<File.File>('files/save', params);
};

export const CheckFile = (path: string) => {
export const checkFile = (path: string) => {
return http.post<boolean>('files/check', { path: path });
};

export const UploadFileData = (params: FormData, config: AxiosRequestConfig) => {
export const uploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/upload', params, config);
};

export const ChunkUploadFileData = (params: FormData, config: AxiosRequestConfig) => {
export const chunkUploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/chunkupload', params, config);
};

export const RenameRile = (params: File.FileRename) => {
export const renameRile = (params: File.FileRename) => {
return http.post<File.File>('files/rename', params);
};

export const ChangeOwner = (params: File.FileOwner) => {
export const changeOwner = (params: File.FileOwner) => {
return http.post<File.File>('files/owner', params);
};

export const WgetFile = (params: File.FileWget) => {
export const wgetFile = (params: File.FileWget) => {
return http.post<File.FileWgetRes>('files/wget', params);
};

export const MoveFile = (params: File.FileMove) => {
export const moveFile = (params: File.FileMove) => {
return http.post<File.File>('files/move', params, TimeoutEnum.T_5M);
};

export const DownloadFile = (params: File.FileDownload) => {
export const downloadFile = (params: File.FileDownload) => {
return http.download<BlobPart>('files/download', params, { responseType: 'blob', timeout: TimeoutEnum.T_40S });
};

export const ComputeDirSize = (params: File.DirSizeReq) => {
export const computeDirSize = (params: File.DirSizeReq) => {
return http.post<File.DirSizeRes>('files/size', params, TimeoutEnum.T_5M);
};

export const FileKeys = () => {
export const fileKeys = () => {
return http.get<File.FileKeys>('files/keys');
};

Expand All @@ -101,30 +101,30 @@ export const clearRecycle = () => {
return http.post<any>('files/recycle/clear');
};

export const SearchFavorite = (params: ReqPage) => {
export const searchFavorite = (params: ReqPage) => {
return http.post<ResPage<File.Favorite>>('files/favorite/search', params);
};

export const AddFavorite = (path: string) => {
export const addFavorite = (path: string) => {
return http.post<any>('files/favorite', { path: path });
};

export const ReadByLine = (req: File.FileReadByLine) => {
export const readByLine = (req: File.FileReadByLine) => {
return http.post<any>('files/read', req);
};

export const RemoveFavorite = (id: number) => {
export const removeFavorite = (id: number) => {
return http.post<any>('files/favorite/del', { id: id });
};

export const BatchChangeRole = (params: File.FileRole) => {
export const batchChangeRole = (params: File.FileRole) => {
return http.post<any>('files/batch/role', params);
};

export const GetRecycleStatus = () => {
export const getRecycleStatus = () => {
return http.get<string>('files/recycle/status');
};

export const GetPathByType = (pathType: string) => {
export const getPathByType = (pathType: string) => {
return http.get<string>(`files/path/${pathType}`);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code is for a web application that interacts with various APIs related to files, including uploading/downloading files, creating/moving/deleteing them etc. The difference between the two versions of the code includes minor changes like using camelCase instead of snake_case or typo error in addFavorite. For any other major changes, we need more specific information about what exactly you want us to review.

For instance:

  1. In terms of optimization suggestions: There's room for optimizing function calls, reduce redundant HTTP headers when making multiple request at once, use try-catch blocks properly, avoid unnecessary null checks, and ensure consistency of spacing, indentation for better readability.

In summary, it seems these changes don't pose significant issues but can be improved through proper testing of the new version before integrating into the main project repository.

8 changes: 4 additions & 4 deletions frontend/src/api/modules/group.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Group } from '../interface/group';
import http from '@/api';

export const GetGroupList = (type: string) => {
export const getGroupList = (type: string) => {
return http.post<Array<Group.GroupInfo>>(`/core/groups/search`, { type: type });
};
export const CreateGroup = (params: Group.GroupCreate) => {
export const createGroup = (params: Group.GroupCreate) => {
return http.post<Group.GroupCreate>(`/core/groups`, params);
};
export const UpdateGroup = (params: Group.GroupUpdate) => {
export const updateGroup = (params: Group.GroupUpdate) => {
return http.post(`/core/groups/update`, params);
};
export const DeleteGroup = (id: number) => {
export const deleteGroup = (id: number) => {
return http.post(`/core/groups/del`, { id: id });
};
22 changes: 9 additions & 13 deletions frontend/src/api/modules/host-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,38 @@ import http from '@/api';
import { HostTool } from '../interface/host-tool';
import { TimeoutEnum } from '@/enums/http-enum';

export const GetSupervisorStatus = () => {
export const getSupervisorStatus = () => {
return http.post<HostTool.HostTool>(`/hosts/tool`, { type: 'supervisord', operate: 'status' });
};

export const OperateSupervisor = (operate: string) => {
export const operateSupervisor = (operate: string) => {
return http.post<any>(`/hosts/tool/operate`, { type: 'supervisord', operate: operate });
};

export const OperateSupervisorConfig = (req: HostTool.SupersivorConfig) => {
export const operateSupervisorConfig = (req: HostTool.SupersivorConfig) => {
return http.post<HostTool.SupersivorConfigRes>(`/hosts/tool/config`, req);
};

export const GetSupervisorLog = () => {
export const getSupervisorLog = () => {
return http.post<any>(`/hosts/tool/log`, { type: 'supervisord' });
};

export const InitSupervisor = (req: HostTool.SupersivorInit) => {
export const initSupervisor = (req: HostTool.SupersivorInit) => {
return http.post<any>(`/hosts/tool/init`, req);
};

export const CreateSupervisorProcess = (req: HostTool.SupersivorProcess) => {
export const createSupervisorProcess = (req: HostTool.SupersivorProcess) => {
return http.post<any>(`/hosts/tool/supervisor/process`, req);
};

export const OperateSupervisorProcess = (req: HostTool.ProcessReq) => {
export const operateSupervisorProcess = (req: HostTool.ProcessReq) => {
return http.post<any>(`/hosts/tool/supervisor/process`, req, TimeoutEnum.T_60S);
};

export const LoadProcessStatus = () => {
return http.post<Array<HostTool.ProcessStatus>>(`/hosts/tool/supervisor/process/load`, {}, TimeoutEnum.T_40S);
};

export const GetSupervisorProcess = () => {
export const getSupervisorProcess = () => {
return http.get<HostTool.SupersivorProcess[]>(`/hosts/tool/supervisor/process`);
};

export const OperateSupervisorProcessFile = (req: HostTool.ProcessFileReq) => {
export const operateSupervisorProcessFile = (req: HostTool.ProcessFileReq) => {
return http.post<any>(`/hosts/tool/supervisor/process/file`, req, TimeoutEnum.T_60S);
};
Loading
Loading