удалил генерируемый файл
This commit is contained in:
parent
aa726d4653
commit
f22eeb13ce
|
|
@ -1,167 +0,0 @@
|
|||
export const JSONRPC = {
|
||||
url: "/jsonrpc/rpc",
|
||||
__id: 1,
|
||||
/**
|
||||
*
|
||||
* @param method
|
||||
* @param params
|
||||
* @returns Object
|
||||
* @private
|
||||
*/
|
||||
__invoke: async function (method, params) {
|
||||
const request = await JSONRPC.__performRequest(method, params);
|
||||
|
||||
if (!request.success) {
|
||||
console.error(request.result);
|
||||
throw new Error("Failed to invoke method " + method + " with params " + JSON.stringify(params));
|
||||
}
|
||||
|
||||
return request.result;
|
||||
},
|
||||
__performRequest: async function (method, params) {
|
||||
const __this = this;
|
||||
const resp = await fetch(
|
||||
__this.url,
|
||||
{
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
cache: "no-cache",
|
||||
credentials: "include",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
redirect: "follow",
|
||||
referrerPolicy: "no-referrer",
|
||||
body: JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
method: method,
|
||||
params: params,
|
||||
id: __this.__id++
|
||||
})
|
||||
}
|
||||
);
|
||||
const success = resp.status === 200;
|
||||
const result = (success ? (await resp.json()).result : {
|
||||
"error": true,
|
||||
"code": resp.status,
|
||||
"status": resp.statusText,
|
||||
"body": await resp.text()
|
||||
});
|
||||
|
||||
return {
|
||||
"result": result,
|
||||
"success": success
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const TYPES = {};
|
||||
JSONRPC.SubscriptionManager = {};
|
||||
|
||||
JSONRPC.SubscriptionManager.getSubscribedResources=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.SubscriptionManager::getSubscribedResources", {});
|
||||
};
|
||||
|
||||
JSONRPC.SubscriptionManager.getAvailableResources=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.SubscriptionManager::getAvailableResources", {});
|
||||
};
|
||||
|
||||
JSONRPC.SubscriptionManager.setSubscribedResources=async function(resources){
|
||||
return await JSONRPC.__invoke("web.RPC.SubscriptionManager::setSubscribedResources", {"resources":resources});
|
||||
};
|
||||
|
||||
JSONRPC.SubscriptionManager.isUpdating=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.SubscriptionManager::isUpdating", {});
|
||||
};
|
||||
|
||||
JSONRPC.SubscriptionManager.triggerUpdate=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.SubscriptionManager::triggerUpdate", {});
|
||||
};
|
||||
JSONRPC.Auth = {};
|
||||
|
||||
JSONRPC.Auth.createToken=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::createToken", {});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.listTokens=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::listTokens", {});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.removeToken=async function(token){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::removeToken", {"token":token});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.createAPIToken=async function(description){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::createAPIToken", {"description":description});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.startSessionByPassword=async function(password){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::startSessionByPassword", {"password":password});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.startSessionByToken=async function(token){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::startSessionByToken", {"token":token});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.isAuthenticated=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::isAuthenticated", {});
|
||||
};
|
||||
|
||||
JSONRPC.Auth.logout=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.Auth::logout", {});
|
||||
};
|
||||
JSONRPC.System = {};
|
||||
|
||||
JSONRPC.System.shutdown=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::shutdown", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.getEnabledComponents=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::getEnabledComponents", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.setEnabledComponents=async function(components){
|
||||
return await JSONRPC.__invoke("web.RPC.System::setEnabledComponents", {"components":components});
|
||||
};
|
||||
|
||||
JSONRPC.System.isConfigChanged=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::isConfigChanged", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.hasUpdates=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::hasUpdates", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.getAvailableComponents=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::getAvailableComponents", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.getConfig=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::getConfig", {});
|
||||
};
|
||||
|
||||
JSONRPC.System.restart=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.System::restart", {});
|
||||
};
|
||||
JSONRPC.NetworkManager = {};
|
||||
|
||||
JSONRPC.NetworkManager.getOutputResources=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.NetworkManager::getOutputResources", {});
|
||||
};
|
||||
|
||||
JSONRPC.NetworkManager.isUpdating=async function(){
|
||||
return await JSONRPC.__invoke("web.RPC.NetworkManager::isUpdating", {});
|
||||
};
|
||||
|
||||
JSONRPC.NetworkManager.triggerUpdate=async function(ignoreCache){
|
||||
return await JSONRPC.__invoke("web.RPC.NetworkManager::triggerUpdate", {"ignoreCache":ignoreCache});
|
||||
};
|
||||
JSONRPC.OVPN = {};
|
||||
|
||||
JSONRPC.OVPN.restartSystemService=async function(){
|
||||
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.External.API.Components.OVPN::restartSystemService", {});
|
||||
};
|
||||
|
||||
JSONRPC.OVPN.getManagedRoutes=async function(){
|
||||
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.External.API.Components.OVPN::getManagedRoutes", {});
|
||||
};
|
||||
Loading…
Reference in New Issue