feat: plugin installation webui

This commit is contained in:
Junyan Qin
2025-08-15 22:05:39 +08:00
parent b464d238c5
commit 288b294148
7 changed files with 234 additions and 8 deletions
+6
View File
@@ -253,6 +253,12 @@ export class BackendClient extends BaseHttpClient {
return this.post('/api/v1/plugins/install/github', { source });
}
public installPluginFromLocal(file: File): Promise<AsyncTaskCreatedResp> {
const formData = new FormData();
formData.append('file', file);
return this.postFile('/api/v1/plugins/install/local', formData);
}
public removePlugin(
author: string,
name: string,
+16
View File
@@ -192,4 +192,20 @@ export abstract class BaseHttpClient {
public delete<T = unknown>(url: string, config?: RequestConfig): Promise<T> {
return this.request<T>({ method: 'delete', url, ...config });
}
public postFile<T = unknown>(
url: string,
formData: FormData,
config?: RequestConfig,
): Promise<T> {
return this.request<T>({
method: 'post',
url,
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
},
...config,
});
}
}