From f5e482cbc1fab063a1221f904ca53d38d94e3a13 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Jul 2024 15:42:06 +0300 Subject: [PATCH 1/2] Use window.location.origin everywhere for consistency --- code.user.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code.user.js b/code.user.js index 517bcc6..7edca25 100644 --- a/code.user.js +++ b/code.user.js @@ -76,7 +76,7 @@ ? unsafeWindow.g_strInventoryLoadURL : typeof unsafeWindow.g_strProfileURL !== 'undefined' && unsafeWindow.g_strProfileURL != null ? unsafeWindow.g_strProfileURL + '/inventory/json/' - : 'https://steamcommunity.com/my/inventory/json/', + : window.location.origin + '/my/inventory/json/', isLoggedIn ? unsafeWindow.g_rgWalletInfo : undefined); var currencyId = @@ -415,7 +415,7 @@ var itemId = item.assetid || item.id; $.ajax({ type: "POST", - url: 'https://steamcommunity.com/market/sellitem/', + url: window.location.origin + '/market/sellitem/', data: { sessionid: sessionId, appid: item.appid, @@ -630,8 +630,8 @@ // Get the current price history for an item. SteamMarket.prototype.getCurrentPriceHistory = function(appid, market_name, callback) { - var url = window.location.protocol + - '//steamcommunity.com/market/pricehistory/?appid=' + + var url = window.location.origin + + '/market/pricehistory/?appid=' + appid + '&market_hash_name=' + market_name; @@ -699,7 +699,7 @@ // Get the item name id from a market item. SteamMarket.prototype.getCurrentMarketItemNameId = function(appid, market_name, callback) { - var url = window.location.protocol + '//steamcommunity.com/market/listings/' + appid + '/' + market_name; + var url = window.location.origin + '/market/listings/' + appid + '/' + market_name; $.get(url, function(page) { var matches = /Market_LoadOrderSpread\( (\d+) \);/.exec(page); @@ -782,8 +782,8 @@ callback(ERROR_FAILED); return; } - var url = window.location.protocol + - '//steamcommunity.com/market/itemordershistogram?country=' + + var url = window.location.origin + + '/market/itemordershistogram?country=' + country + '&language=english¤cy=' + currencyId + @@ -1611,7 +1611,7 @@ itemsString += '&items[]=' + encodeURIComponent(itemName) + '&qty[]=' + itemsWithQty[itemName]; } - var baseUrl = 'https://steamcommunity.com/market/multisell'; + var baseUrl = window.location.origin + '/market/multisell'; var redirectUrl = baseUrl + '?appid=' + appid + '&contextid=' + contextid + itemsString; var dialog = unsafeWindow.ShowDialog('Steam Economy Enhancer', ''); @@ -2753,7 +2753,7 @@ } var marketListingsItemsQueue = async.queue(function(listing, next) { - $.get(window.location.protocol + '//steamcommunity.com/market/mylistings?count=100&start=' + listing, + $.get(window.location.origin + '/market/mylistings?count=100&start=' + listing, function(data) { if (!data || !data.success) { next(); From e82580492e60f956ad9408f38fac3849dc3a9f1d Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Jul 2024 16:16:24 +0300 Subject: [PATCH 2/2] crossDomain is not needed --- code.user.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/code.user.js b/code.user.js index 7edca25..80e4efa 100644 --- a/code.user.js +++ b/code.user.js @@ -434,10 +434,6 @@ error: function(data) { return callback(ERROR_FAILED, data); }, - crossDomain: true, - xhrFields: { - withCredentials: true - }, dataType: 'json' }); }; @@ -536,10 +532,6 @@ error: function(data) { return callback(ERROR_FAILED, data); }, - crossDomain: true, - xhrFields: { - withCredentials: true - }, dataType: 'json' }); } catch (e) { @@ -575,10 +567,6 @@ error: function(data) { return callback(ERROR_FAILED, data); }, - crossDomain: true, - xhrFields: { - withCredentials: true - }, dataType: 'json' }); } catch (e) { @@ -612,10 +600,6 @@ error: function(data) { return callback(ERROR_FAILED, data); }, - crossDomain: true, - xhrFields: { - withCredentials: true - }, dataType: 'json' }); } catch (e) {