Fix store: No games were shown
This commit is contained in:
parent
93ba380e27
commit
3fb34590f1
3 changed files with 20 additions and 12 deletions
|
@ -114,10 +114,22 @@ class ShopApiCore(QObject):
|
||||||
self.next_browse_request = (browse_model, handle_func)
|
self.next_browse_request = (browse_model, handle_func)
|
||||||
return
|
return
|
||||||
self.browse_active = True
|
self.browse_active = True
|
||||||
url = "https://www.epicgames.com/graphql?operationName=searchStoreQuery&variables="
|
url = "https://www.epicgames.com/graphql?operationName=searchStoreQuery&variables={}&extensions={}"
|
||||||
args = urllib.parse.quote_plus(str(browse_model.__dict__))
|
variables = urllib.parse.quote_plus(str(
|
||||||
|
dict(browse_model.__dict__))
|
||||||
|
)
|
||||||
|
extensions = urllib.parse.quote_plus(str(
|
||||||
|
dict(
|
||||||
|
persistedQuery=dict(
|
||||||
|
version=1,
|
||||||
|
sha256Hash="6e7c4dd0177150eb9a47d624be221929582df8648e7ec271c821838ff4ee148e"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
for old, new in [
|
for old, new in [
|
||||||
|
("%26", "&"),
|
||||||
("%27", "%22"),
|
("%27", "%22"),
|
||||||
("+", ""),
|
("+", ""),
|
||||||
("%3A", ":"),
|
("%3A", ":"),
|
||||||
|
@ -126,19 +138,16 @@ class ShopApiCore(QObject):
|
||||||
("%5D", "]"),
|
("%5D", "]"),
|
||||||
("True", "true"),
|
("True", "true"),
|
||||||
]:
|
]:
|
||||||
args = args.replace(old, new)
|
variables = variables.replace(old, new)
|
||||||
|
extensions = extensions.replace(old, new)
|
||||||
url = (
|
|
||||||
url
|
|
||||||
+ args
|
|
||||||
+ "&extensions=%7B%22persistedQuery%22:%7B%22version%22:1,%22sha256Hash%22:%220304d711e653a2914f3213a6d9163cc17153c60aef0ef52279731b02779231d2%22%7D%7D"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
url = url.format(variables, extensions)
|
||||||
self.auth_manager.get(
|
self.auth_manager.get(
|
||||||
url, lambda data: self._handle_browse_games(data, handle_func)
|
url, lambda data: self._handle_browse_games(data, handle_func)
|
||||||
)
|
)
|
||||||
|
|
||||||
def _handle_browse_games(self, data, handle_func):
|
def _handle_browse_games(self, data, handle_func):
|
||||||
|
print(data)
|
||||||
self.browse_active = False
|
self.browse_active = False
|
||||||
if data is None:
|
if data is None:
|
||||||
data = {}
|
data = {}
|
||||||
|
|
|
@ -146,7 +146,7 @@ class BrowseModel:
|
||||||
withMapping: bool = True
|
withMapping: bool = True
|
||||||
withPrice: bool = True
|
withPrice: bool = True
|
||||||
date: str = (
|
date: str = (
|
||||||
f"[,{datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%dT%X')}.999Z]"
|
f"[,{datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%dT%H:%M:%S')}.420Z]"
|
||||||
)
|
)
|
||||||
price: str = ""
|
price: str = ""
|
||||||
onSale: bool = False
|
onSale: bool = False
|
||||||
|
@ -180,4 +180,5 @@ class BrowseModel:
|
||||||
payload["effectiveDate"] = self.date
|
payload["effectiveDate"] = self.date
|
||||||
else:
|
else:
|
||||||
payload.pop("priceRange")
|
payload.pop("priceRange")
|
||||||
|
print(self.date)
|
||||||
return payload
|
return payload
|
||||||
|
|
|
@ -310,12 +310,10 @@ class ShopWidget(QScrollArea, Ui_ShopWidget):
|
||||||
self.discounts_gb.setVisible(True)
|
self.discounts_gb.setVisible(True)
|
||||||
|
|
||||||
self.game_stack.setCurrentIndex(1)
|
self.game_stack.setCurrentIndex(1)
|
||||||
date = f"[{datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d')},]"
|
|
||||||
|
|
||||||
browse_model = BrowseModel(
|
browse_model = BrowseModel(
|
||||||
language_code=self.core.language_code,
|
language_code=self.core.language_code,
|
||||||
country_code=self.core.country_code,
|
country_code=self.core.country_code,
|
||||||
date=date,
|
|
||||||
count=20,
|
count=20,
|
||||||
price=self.price,
|
price=self.price,
|
||||||
onSale=self.on_discount.isChecked(),
|
onSale=self.on_discount.isChecked(),
|
||||||
|
|
Loading…
Reference in a new issue