update api
This commit is contained in:
parent
b7f633598f
commit
548f80a46f
2 changed files with 52 additions and 0 deletions
38
src/api.ts
38
src/api.ts
|
@ -328,6 +328,27 @@ export async function readDir(path: string): Promise<IResReadDir> {
|
||||||
return request(url, data);
|
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> {
|
export async function exportMdContent(id: DocumentId): Promise<IResExportMdContent> {
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -346,6 +367,23 @@ export async function pandoc(args: PandocArgs[]) {
|
||||||
return request(url, data);
|
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 ****************************************
|
// **************************************** System ****************************************
|
||||||
|
|
||||||
|
|
14
src/types/api.d.ts
vendored
14
src/types/api.d.ts
vendored
|
@ -30,6 +30,7 @@ interface IResGetTemplates {
|
||||||
|
|
||||||
interface IResReadDir {
|
interface IResReadDir {
|
||||||
isDir: boolean;
|
isDir: boolean;
|
||||||
|
isSymlink: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,3 +44,16 @@ interface IResBootProgress {
|
||||||
details: string;
|
details: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IResForwardProxy {
|
||||||
|
body: string;
|
||||||
|
contentType: string;
|
||||||
|
elapsed: number;
|
||||||
|
headers: { [key: string]: string };
|
||||||
|
status: number;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IResExportResources {
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue