Преглед изворни кода

refactor: remove last jQuery bit for attachment upload

Co-authored-by: Junie <junie@jetbrains.com>
rugk пре 1 недеља
родитељ
комит
693cd994f1
1 измењених фајлова са 9 додато и 11 уклоњено
  1. 9 11
      js/privatebin.js

+ 9 - 11
js/privatebin.js

@@ -2804,7 +2804,7 @@ window.PrivateBin = (function () {
         /**
         /**
          * init status manager
          * init status manager
          *
          *
-         * preloads jQuery elements
+         * preloads DOM elements
          *
          *
          * @name   PasteViewer.init
          * @name   PasteViewer.init
          * @function
          * @function
@@ -5335,17 +5335,15 @@ window.PrivateBin = (function () {
                             'copy'
                             'copy'
                         );
                         );
                         try {
                         try {
-                            const blobData = await $.ajax({
-                                type: 'GET',
-                                url: attachment,
-                                processData: false,
-                                timeout: 10000,
-                                dataType: 'binary',
-                                xhrFields: {
-                                    withCredentials: false,
-                                    responseType: 'blob'
-                                }
+                            const response = await fetch(attachment, {
+                                method: 'GET',
+                                credentials: 'omit',
+                                signal: AbortSignal.timeout(10000)
                             });
                             });
+                            if (!response.ok) {
+                                throw new Error('HTTP ' + response.status);
+                            }
+                            const blobData = await response.blob();
                             if (blobData instanceof window.Blob) {
                             if (blobData instanceof window.Blob) {
                                 const fileReading = new Promise(function (resolve, reject) {
                                 const fileReading = new Promise(function (resolve, reject) {
                                     const fileReader = new FileReader();
                                     const fileReader = new FileReader();