update api

This commit is contained in:
frostime 2023-08-15 11:06:33 +08:00
parent b7f633598f
commit 548f80a46f
2 changed files with 52 additions and 0 deletions

View file

@ -328,6 +328,27 @@ export async function readDir(path: string): Promise<IResReadDir> {
return request(url, data);
}
// /api/export/exportResources
/*
{
"paths": [
"/conf/appearance/boot",
"/conf/appearance/langs",
"/conf/appearance/emojis/conf.json",
"/conf/appearance/icons/index.html",
],
"name": "zip-file-name"
}
*/
export async function exportResources(paths: string[], name: string): Promise<IResExportResources> {
let data = {
paths: paths,
name: name
}
let url = '/api/export/exportResources';
return request(url, data);
}
export async function exportMdContent(id: DocumentId): Promise<IResExportMdContent> {
let data = {
@ -346,6 +367,23 @@ export async function pandoc(args: PandocArgs[]) {
return request(url, data);
}
// **************************************** Network ****************************************
export async function forwardProxy(
url: string, method: string, payload: any,
headers: any[], timeout: number = 7000, contentType: string = "text/html"
): Promise<IResForwardProxy> {
let data = {
url: url,
method: method,
timeout: timeout,
contentType: contentType,
headers: headers,
payload: payload
}
let url1 = '/api/network/forwardProxy';
return request(url1, data);
}
// **************************************** System ****************************************

14
src/types/api.d.ts vendored
View file

@ -30,6 +30,7 @@ interface IResGetTemplates {
interface IResReadDir {
isDir: boolean;
isSymlink: boolean;
name: string;
}
@ -43,3 +44,16 @@ interface IResBootProgress {
details: string;
}
interface IResForwardProxy {
body: string;
contentType: string;
elapsed: number;
headers: { [key: string]: string };
status: number;
url: string;
}
interface IResExportResources {
path: string;
}