]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Align data-upload to controller endpoints
authorAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 9 May 2025 07:16:19 +0000 (10:16 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 9 May 2025 07:16:19 +0000 (10:16 +0300)
interface/index.html
interface/js/app/upload.js

index 14dd880dccc3a73f5da18ab4b1666f517efb0f38..2654b7728354a2895680d9d9e8276b560767274c 100644 (file)
                                        </div>
                                        <div class="card-footer d-md-flex justify-content-between py-1">
                                                <div class="input-group d-inline-flex w-auto my-1">
-                                                       <button type="submit" class="btn btn-primary d-flex align-items-center" data-upload="scan"><i class="fas fa-search me-2"></i>Scan message</button>
+                                                       <button type="submit" class="btn btn-primary d-flex align-items-center" data-upload="checkv2"><i class="fas fa-search me-2"></i>Scan message</button>
                                                        <button class="btn btn-secondary d-flex align-items-center" id="scanOptionsToggle" data-bs-toggle="collapse" data-bs-target="#scanOptions"><i class="fas fa-bars me-2"></i>Options</button>
                                                </div>
                                                <div class="input-group d-inline-flex w-auto my-1">
                                                                        <p>Learn Bayesian classifier:</p>
                                                                        <form>
                                                                                <div class="btn-group">
-                                                                                       <button class="btn btn-success d-flex align-items-center" type="button" data-upload="ham" disabled><i class="fas fa-thumbs-up me-2"></i>Upload HAM</button>
-                                                                                       <button class="btn btn-danger d-flex align-items-center" type="button" data-upload="spam" disabled><i class="fas fa-thumbs-down me-2"></i>Upload SPAM</button>
+                                                                                       <button class="btn btn-success d-flex align-items-center" type="button" data-upload="learnham" disabled><i class="fas fa-thumbs-up me-2"></i>Upload HAM</button>
+                                                                                       <button class="btn btn-danger d-flex align-items-center" type="button" data-upload="learnspam" disabled><i class="fas fa-thumbs-down me-2"></i>Upload SPAM</button>
                                                                                </div>
                                                                        </form>
                                                                </div>
index 8ae00f20ea1d799d08ba79f359e9eb7c46edd4ca..d5283cdb16505c926bc353c71ebf6eb7fa7faa1f 100644 (file)
@@ -32,24 +32,9 @@ define(["jquery", "app/common", "app/libft"],
         let filesIdx = null;
         let scanTextHeaders = {};
 
-        function uploadText(data, source, headers, method = "POST") {
+        function uploadText(data, url, headers, method = "POST") {
             const deferred = new $.Deferred();
 
-            let url = null;
-            if (source === "spam") {
-                url = "learnspam";
-            } else if (source === "ham") {
-                url = "learnham";
-            } else if (source === "fuzzyadd") {
-                url = "fuzzyadd";
-            } else if (source === "fuzzydel") {
-                url = "fuzzydel";
-            } else if (source === "fuzzydelhash") {
-                url = "fuzzydelhash";
-            } else if (source === "scan") {
-                url = "checkv2";
-            }
-
             function server() {
                 if (common.getSelector("selSrv") === "All SERVERS" &&
                     common.getSelector("selLearnServers") === "random") {
@@ -243,7 +228,7 @@ define(["jquery", "app/common", "app/libft"],
             const source = $(this).data("upload");
             const data = $("#scanMsgSource").val();
             if ($.trim(data).length > 0) {
-                if (source === "scan") {
+                if (source === "checkv2") {
                     getScanTextHeaders();
                     scanText(data);
                 } else if (source === "compute-fuzzy") {