@@ -93,6 +93,7 @@ import {
93
93
} from " @fortawesome/free-solid-svg-icons" ;
94
94
import { FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
95
95
import axios from " axios" ;
96
+ import pako from " pako" ;
96
97
97
98
library .add (fasFileDownload, fasSpinner, fasClipboard, fasShareNodes);
98
99
@@ -259,26 +260,21 @@ export default {
259
260
},
260
261
async postToPastebin () {
261
262
try {
262
- const response = await fetch (" https://bytebin.openwb.de/post" , {
263
- method: " POST" ,
263
+ // Compress the log data using gzip
264
+ const compressedData = pako .gzip (this .logData );
265
+
266
+ const response = await axios .post (" https://bytebin.openwb.de/post" , compressedData, {
264
267
headers: {
265
- " Content-Type" : " text/log" ,
268
+ " Content-Type" : " application/octet-stream" ,
269
+ " Content-Encoding" : " gzip" ,
266
270
},
267
- body: this .logData ,
268
271
});
269
272
270
- if (! response .ok ) {
271
- throw new Error (" Network response was not ok" );
272
- }
273
-
274
- const responseData = await response .json ();
275
- const pastebinKey = responseData .key ;
276
- if (! pastebinKey) {
277
- console .log (responseData);
273
+ if (! response .data .key ) {
278
274
throw new Error (" Key is missing in the response" );
279
275
}
280
- console .log (responseData);
281
276
277
+ const pastebinKey = response .data .key ;
282
278
this .pastebinLink = ` https://paste.openwb.de/${ pastebinKey} ` ;
283
279
console .log (" Pastebin link:" , this .pastebinLink );
284
280
this .copyToClipboard (this .pastebinLink , false );
0 commit comments