diff options
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/rspamd.js | 5 | ||||
-rw-r--r-- | interface/js/app/upload.js | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index b440022e4..66b1766c9 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -548,6 +548,11 @@ function ($, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_config, $("#selSrv").change(function () { checked_server = this.value; $("#selSrv [value=\"" + checked_server + "\"]").prop("checked", true); + if (checked_server === "All SERVERS") { + $("#learnServers").show(); + } else { + $("#learnServers").hide(); + } tabClick("#" + $("#navBar > ul > .nav-item > .nav-link.active").attr("id")); }); diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index 3e95c2171..cef5c596e 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -43,6 +43,16 @@ define(["jquery"], } else if (source === "scan") { url = "checkv2"; } + + function server() { + if (rspamd.getSelector("selSrv") === "All SERVERS" && + rspamd.getSelector("selLearnServers") === "random") { + const servers = $("#selSrv option").slice(1).map(function (_, o) { return o.value; }); + return servers[Math.floor(Math.random() * servers.length)]; + } + return null; + } + rspamd.query(url, { data: data, params: { @@ -56,7 +66,8 @@ define(["jquery"], if (jqXHR.status !== 200) { rspamd.alertMessage("alert-info", jqXHR.statusText); } - } + }, + server: server() }); } |