mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 05:47:50 +00:00
json:get_webui_templates
This commit is contained in:
parent
4cc5ccd0b8
commit
e84e090c8e
@ -46,11 +46,13 @@ from web import webapi
|
|||||||
import page_decorators as deco
|
import page_decorators as deco
|
||||||
from web import cookies, setcookie as w_setcookie
|
from web import cookies, setcookie as w_setcookie
|
||||||
import utils
|
import utils
|
||||||
|
from render import render
|
||||||
|
from utils import dict_cb
|
||||||
|
from lib import json
|
||||||
|
|
||||||
from deluge.ui.client import sclient,aclient
|
from deluge.ui.client import sclient,aclient
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
from deluge import component
|
from deluge import component
|
||||||
from utils import dict_cb
|
|
||||||
from lib import json
|
|
||||||
|
|
||||||
def json_response(result, id):
|
def json_response(result, id):
|
||||||
print json.write({
|
print json.write({
|
||||||
@ -80,13 +82,12 @@ class json_rpc:
|
|||||||
"""
|
"""
|
||||||
#extra exposed methods
|
#extra exposed methods
|
||||||
json_exposed = ["update_ui","get_stats","set_torrent_options","system_listMethods",
|
json_exposed = ["update_ui","get_stats","set_torrent_options","system_listMethods",
|
||||||
"get_webui_config","set_webui_config"]
|
"get_webui_config","set_webui_config","get_webui_templates"]
|
||||||
cache = {}
|
cache = {}
|
||||||
torrent_options = ["trackers","max_connections","max_upload_slots","max_upload_speed",
|
torrent_options = ["trackers","max_connections","max_upload_slots","max_upload_speed",
|
||||||
"max_download_speed","file_priorities","prioritize_first_last","auto_managed","stop_at_ratio",
|
"max_download_speed","file_priorities","prioritize_first_last","auto_managed","stop_at_ratio",
|
||||||
"stop_ratio","remove_at_ratio"]
|
"stop_ratio","remove_at_ratio"]
|
||||||
|
|
||||||
|
|
||||||
def GET(self):
|
def GET(self):
|
||||||
return json_error("only POST is supported")
|
return json_error("only POST is supported")
|
||||||
|
|
||||||
@ -245,6 +246,10 @@ class json_rpc:
|
|||||||
utils.config.save()
|
utils.config.save()
|
||||||
utils.apply_config()
|
utils.apply_config()
|
||||||
|
|
||||||
|
def get_webui_templates(self):
|
||||||
|
return render.get_templates()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
component.get("PageManager").register_page("/json/rpc",json_rpc)
|
component.get("PageManager").register_page("/json/rpc",json_rpc)
|
||||||
|
@ -109,6 +109,16 @@ function set_webui_config(cfg_dict) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function get_webui_templates() {
|
||||||
|
service.get_webui_templates({params:[ ],
|
||||||
|
onSuccess:function(data){
|
||||||
|
alert(service.__toJSON(data));
|
||||||
|
},
|
||||||
|
onException:function(errorObj){
|
||||||
|
alert("Error: " + errorObj);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -131,6 +141,7 @@ function set_webui_config(cfg_dict) {
|
|||||||
<button onclick="set_webui_config({'button_style':1})">set_webui_config({'button_style':1})</button>
|
<button onclick="set_webui_config({'button_style':1})">set_webui_config({'button_style':1})</button>
|
||||||
<button onclick="set_webui_config({'button_style':2})">set_webui_config({'button_style':2})</button>
|
<button onclick="set_webui_config({'button_style':2})">set_webui_config({'button_style':2})</button>
|
||||||
<button onclick="get_webui_config()">get_webui_config()</button>
|
<button onclick="get_webui_config()">get_webui_config()</button>
|
||||||
|
<button onclick="get_webui_templates()">get_webui_templates()</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user