Skip to content

Commit

Permalink
Merge branch 'Main' of https://github.com/BlocBlocTheDev/s3s-docker i…
Browse files Browse the repository at this point in the history
…nto Main
  • Loading branch information
BlocBlocTheDev committed Sep 11, 2024
2 parents 9b58581 + cf861a1 commit bdc18c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions iksm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

S3S_VERSION = "unknown"
NSOAPP_VERSION = "unknown"
NSOAPP_VER_FALLBACK = "2.10.0"
NSOAPP_VER_FALLBACK = "2.10.1"
WEB_VIEW_VERSION = "unknown"
WEB_VIEW_VER_FALLBACK = "6.0.0-9f87c815" # fallback for current splatnet 3 ver
WEB_VIEW_VER_FALLBACK = "6.0.0-30a1464a" # fallback for current splatnet 3 ver
SPLATNET3_URL = "https://api.lp1.av5ja.srv.nintendo.net"
GRAPHQL_URL = SPLATNET3_URL + "/api/graphql"
F_GEN_URL = "unknown"
Expand Down
20 changes: 13 additions & 7 deletions s3s.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from packaging import version
import iksm, utils

A_VERSION = "0.6.5.1"
A_VERSION = "0.6.6-docker"

DEBUG = False

Expand Down Expand Up @@ -634,6 +634,12 @@ def prepare_battle_result(battle, ismonitoring, isblackout, overview_data=None):
payload["fest_dragon"] = "100x"
elif times_battle == "DOUBLE_DRAGON":
payload["fest_dragon"] = "333x"
elif times_battle == "CONCH_SHELL_SCRAMBLE":
payload["conch_clash"] = "1x"
elif times_battle == "CONCH_SHELL_SCRAMBLE_10":
payload["conch_clash"] = "10x"
elif times_battle == "CONCH_SHELL_SCRAMBLE_33": # presumed
payload["conch_clash"] = "33x"

payload["clout_change"] = battle["festMatch"]["contribution"]
payload["fest_power"] = battle["festMatch"]["myFestPower"] # pro only
Expand Down Expand Up @@ -1375,7 +1381,7 @@ def get_num_results(which):
return n


def fetch_and_upload_single_result(hash, noun, isblackout, istestrun):
def fetch_and_upload_single_result(hash_, noun, isblackout, istestrun):
'''Performs a GraphQL request for a single vsResultId/coopHistoryDetailId and call post_result().'''

if noun in ("battles", "battle"):
Expand All @@ -1388,15 +1394,15 @@ def fetch_and_upload_single_result(hash, noun, isblackout, istestrun):
lang = 'en-US'

result_post = requests.post(iksm.GRAPHQL_URL,
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash),
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash_),
headers=headbutt(forcelang=lang),
cookies=dict(_gtoken=GTOKEN))
try:
result = json.loads(result_post.text)
post_result(result, False, isblackout, istestrun) # not monitoring mode
except json.decoder.JSONDecodeError: # retry once, hopefully avoid a few errors
result_post = requests.post(iksm.GRAPHQL_URL,
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash),
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash_),
headers=headbutt(forcelang=lang),
cookies=dict(_gtoken=GTOKEN))
try:
Expand All @@ -1407,7 +1413,7 @@ def fetch_and_upload_single_result(hash, noun, isblackout, istestrun):
print("Error uploading one of your battles. Continuing...")
pass
else:
print("Error uploading one of your battles. Please try running s3s again.")
print(f"(!) Error uploading one of your battles. Please try running s3s again. This may also be an error on Nintendo's end. See https://github.com/frozenpandaman/s3s/issues/189 for more info. Use the `errors_pass_silently` config key to skip this {noun} and continue running the script.")
sys.exit(1)


Expand Down Expand Up @@ -2044,8 +2050,8 @@ def main():
results = results[:n] # limit to n uploads
results.reverse() # sort from oldest to newest
noun = utils.set_noun(which)
for hash in results:
fetch_and_upload_single_result(hash, noun, blackout, test_run) # not monitoring mode
for hash_ in results:
fetch_and_upload_single_result(hash_, noun, blackout, test_run) # not monitoring mode

thread_pool.shutdown(wait=True)

Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'XBattleHistoriesQuery': 'eb5996a12705c2e94813a62e05c0dc419aad2811b8d49d53e5732290105559cb', # blank (query1)
'EventBattleHistoriesQuery': 'e47f9aac5599f75c842335ef0ab8f4c640e8bf2afe588a3b1d4b480ee79198ac', # blank (query1)
'VsHistoryDetailQuery': '20f88b10d0b1d264fcb2163b0866de26bbf6f2b362f397a0258a75b7fa900943', # vsResultId (query2)
'CoopHistoryQuery': '0f8c33970a425683bb1bdecca50a0ca4fb3c3641c0b2a1237aedfde9c0cb2b8f', # blank (query1)
'CoopHistoryQuery': 'e11a8cf2c3de7348495dea5cdcaa25e0c153541c4ed63f044b6c174bc5b703df', # blank (query1)
'CoopHistoryDetailQuery': 'f2d55873a9281213ae27edc171e2b19131b3021a2ae263757543cdd3bf015cc8', # coopHistoryDetailId (query2)
'MyOutfitCommonDataEquipmentsQuery': '45a4c343d973864f7bb9e9efac404182be1d48cf2181619505e9b7cd3b56a6e8' # for lean's seed checker
}
Expand Down

0 comments on commit bdc18c9

Please sign in to comment.