style: webui
This commit is contained in:
1 parent
4e12901c0d
commit
6b717b2507
3 files changed
+31
-65
No files matched your search
@@ -1,53 +0,0 @@
|
||||
export interface OB11Config {
|
||||
httpHost: "",
|
||||
httpPort: number;
|
||||
httpPostUrls: string[];
|
||||
httpSecret: "",
|
||||
wsHost: "",
|
||||
wsPort: number;
|
||||
wsReverseUrls: string[];
|
||||
enableHttp: boolean;
|
||||
enableHttpHeart: boolean;
|
||||
enableHttpPost: boolean;
|
||||
enableWs: boolean;
|
||||
enableWsReverse: boolean;
|
||||
messagePostFormat: 'array' | 'string';
|
||||
reportSelfMessage: boolean;
|
||||
enableLocalFile2Url: boolean;
|
||||
debug: boolean;
|
||||
heartInterval: number;
|
||||
token: "",
|
||||
musicSignUrl: "",
|
||||
}
|
||||
|
||||
class WebUiApiWrapper {
|
||||
token: string = "";
|
||||
public async setOB11Config(config: OB11Config) {
|
||||
|
||||
}
|
||||
public async getOB11Config(): Promise<OB11Config> {
|
||||
// 返回示例配置
|
||||
return {
|
||||
httpHost: "",
|
||||
httpPort: 3000,
|
||||
httpPostUrls: [],
|
||||
httpSecret: "",
|
||||
wsHost: "",
|
||||
wsPort: 3000,
|
||||
wsReverseUrls: [],
|
||||
enableHttp: false,
|
||||
enableHttpHeart: false,
|
||||
enableHttpPost: false,
|
||||
enableWs: false,
|
||||
enableWsReverse: false,
|
||||
messagePostFormat: 'array',
|
||||
reportSelfMessage: false,
|
||||
enableLocalFile2Url: false,
|
||||
debug: false,
|
||||
heartInterval: 60000,
|
||||
token: "",
|
||||
musicSignUrl: "",
|
||||
};
|
||||
}
|
||||
}
|
||||
export const WebUiApi = new WebUiApiWrapper();
|
||||
@@ -0,0 +1,64 @@
|
||||
export interface OB11Config {
|
||||
[key: string]: any,
|
||||
httpHost: "",
|
||||
httpPort: number;
|
||||
httpPostUrls: string[];
|
||||
httpSecret: "",
|
||||
wsHost: "",
|
||||
wsPort: number;
|
||||
wsReverseUrls: string[];
|
||||
enableHttp: boolean;
|
||||
enableHttpHeart: boolean;
|
||||
enableHttpPost: boolean;
|
||||
enableWs: boolean;
|
||||
enableWsReverse: boolean;
|
||||
messagePostFormat: 'array' | 'string';
|
||||
reportSelfMessage: boolean;
|
||||
enableLocalFile2Url: boolean;
|
||||
debug: boolean;
|
||||
heartInterval: number;
|
||||
token: "",
|
||||
musicSignUrl: "",
|
||||
}
|
||||
class WebUiApiOB11ConfigWrapper {
|
||||
private retCredential: string = "";
|
||||
async Init(Credential: string) {
|
||||
this.retCredential = Credential;
|
||||
}
|
||||
async GetOB11Config(): Promise<OB11Config> {
|
||||
let ConfigResponse = await fetch('/api/OB11Config/GetConfig', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer " + this.retCredential,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
if (ConfigResponse.status == 200) {
|
||||
let ConfigResponseJson = await ConfigResponse.json();
|
||||
if (ConfigResponseJson.code == 0) {
|
||||
return ConfigResponseJson?.data;
|
||||
}
|
||||
}
|
||||
return {} as OB11Config;
|
||||
}
|
||||
async SetOB11Config(config: OB11Config): Promise<Boolean> {
|
||||
let ConfigResponse = await fetch('/api/OB11Config/SetConfig',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer " + this.retCredential,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(config)
|
||||
}
|
||||
);
|
||||
if (ConfigResponse.status == 200) {
|
||||
let ConfigResponseJson = await ConfigResponse.json();
|
||||
if (ConfigResponseJson.code == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export const OB11ConfigWrapper = new WebUiApiOB11ConfigWrapper();
|
||||
Reference in new issue
Block a user