mirror of
https://github.com/frozenpandaman/s3s.git
synced 2026-08-24 03:14:30 -05:00
Merge remote-tracking branch 'upstream/HEAD'
This commit is contained in:
2
iksm.py
2
iksm.py
@@ -12,7 +12,7 @@ S3S_VERSION = "unknown"
|
||||
NSOAPP_VERSION = "unknown"
|
||||
NSOAPP_VER_FALLBACK = "2.10.1"
|
||||
WEB_VIEW_VERSION = "unknown"
|
||||
WEB_VIEW_VER_FALLBACK = "6.0.0-30a1464a" # fallback for current splatnet 3 ver
|
||||
WEB_VIEW_VER_FALLBACK = "10.0.0-88706e32" # 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"
|
||||
|
||||
33
s3s.py
Executable file → Normal file
33
s3s.py
Executable file → Normal file
@@ -12,7 +12,7 @@ from packaging import version
|
||||
import iksm, utils
|
||||
import s3_token_extractor
|
||||
|
||||
A_VERSION = "0.6.7"
|
||||
A_VERSION = "0.7.0"
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@@ -147,6 +147,10 @@ def gen_new_tokens(reason, force=False):
|
||||
print("Cannot access SplatNet 3 without having played online.")
|
||||
sys.exit(0)
|
||||
|
||||
if (DISABLE_REFRESH_RC is not None):
|
||||
print(f"Token refresh is disabled because --norefresh is active. Exiting with RC {DISABLE_REFRESH_RC}.")
|
||||
sys.exit(DISABLE_REFRESH_RC)
|
||||
|
||||
if SESSION_TOKEN == "":
|
||||
print("Please log in to your Nintendo Account to obtain your session_token.")
|
||||
new_token = iksm.log_in(A_VERSION, APP_USER_AGENT, F_GEN_URL)
|
||||
@@ -684,6 +688,12 @@ def prepare_battle_result(battle, ismonitoring, isblackout, overview_data=None):
|
||||
except: # could be null in historical data
|
||||
pass
|
||||
|
||||
if not payload.get("bankara_power_after"):
|
||||
try:
|
||||
payload["series_weapon_power_after"] = battle["bankaraMatch"]["weaponPower"]
|
||||
except: # could be null in historical data
|
||||
pass
|
||||
|
||||
battle_id = base64.b64decode(battle["id"]).decode('utf-8')
|
||||
battle_id_mutated = battle_id.replace("BANKARA", "RECENT") # normalize the ID, make work with -M and -r
|
||||
|
||||
@@ -1804,6 +1814,7 @@ def parse_arguments():
|
||||
help="dry run for testing (won't post to stat.ink)")
|
||||
parser.add_argument("--getseed", required=False, action="store_true",
|
||||
help="export JSON for gear & Shell-Out Machine seed checker")
|
||||
parser.add_argument("--norefresh", dest="RC", required=False, nargs="?", action="store", help=argparse.SUPPRESS, const=0)
|
||||
parser.add_argument("--skipprefetch", required=False, action="store_true", help=argparse.SUPPRESS)
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -1831,6 +1842,8 @@ def main():
|
||||
outfile = parser_result.o # output to local files
|
||||
skipprefetch = parser_result.skipprefetch # skip prefetch checks to ensure token validity
|
||||
|
||||
rc_value = parser_result.RC # stop application instead of trying to refresh tokens
|
||||
|
||||
# setup
|
||||
#######
|
||||
check_for_updates()
|
||||
@@ -1840,7 +1853,7 @@ def main():
|
||||
|
||||
# i/o checks
|
||||
############
|
||||
if getseed and len(sys.argv) > 2 and "--skipprefetch" not in sys.argv:
|
||||
if getseed and any(re.search("^(--getseed|--skipprefetch|--norefresh|[0-9]+)$", arg) is None for arg in sys.argv[1:]):
|
||||
print("Cannot use --getseed with other arguments. Exiting.")
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1852,7 +1865,7 @@ def main():
|
||||
print("That doesn't make any sense! :) Exiting.")
|
||||
sys.exit(0)
|
||||
|
||||
elif outfile and len(sys.argv) > 2 and "--skipprefetch" not in sys.argv:
|
||||
elif outfile and any(re.search("^(-o|--skipprefetch|--norefresh|[0-9]+)$", arg) is None for arg in sys.argv[1:]):
|
||||
print("Cannot use -o with other arguments. Exiting.")
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1870,6 +1883,18 @@ def main():
|
||||
print("Minimum number of seconds in monitoring mode is 60. Exiting.")
|
||||
sys.exit(0)
|
||||
|
||||
global DISABLE_REFRESH_RC
|
||||
DISABLE_REFRESH_RC = None
|
||||
if rc_value is not None:
|
||||
try:
|
||||
DISABLE_REFRESH_RC = int(rc_value)
|
||||
except ValueError:
|
||||
print("Number provided for --norefresh must be an integer. Exiting.")
|
||||
sys.exit(1)
|
||||
if DISABLE_REFRESH_RC < 0:
|
||||
print("RC for --norefresh must be 0 or positive! Exiting.")
|
||||
sys.exit(1)
|
||||
|
||||
# export results to file: -o flag
|
||||
#################################
|
||||
if outfile:
|
||||
@@ -1885,7 +1910,7 @@ def main():
|
||||
overview_filename = "overview.json"
|
||||
else:
|
||||
export_dir = os.path.join(cwd, 'exports')
|
||||
utc_time = datetime.datetime.utcnow().strftime('%Y%m%dT%H%M%SZ')
|
||||
utc_time = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None).strftime('%Y%m%dT%H%M%SZ')
|
||||
overview_filename = f'overview-{utc_time}.json'
|
||||
if not os.path.exists(export_dir):
|
||||
os.makedirs(export_dir)
|
||||
|
||||
2
utils.py
2
utils.py
@@ -28,7 +28,7 @@ translate_rid = {
|
||||
'PrivateBattleHistoriesQuery': 'fef94f39b9eeac6b2fac4de43bc0442c16a9f2df95f4d367dd8a79d7c5ed5ce7', # blank (query1)
|
||||
'XBattleHistoriesQuery': 'eb5996a12705c2e94813a62e05c0dc419aad2811b8d49d53e5732290105559cb', # blank (query1)
|
||||
'EventBattleHistoriesQuery': 'e47f9aac5599f75c842335ef0ab8f4c640e8bf2afe588a3b1d4b480ee79198ac', # blank (query1)
|
||||
'VsHistoryDetailQuery': '20f88b10d0b1d264fcb2163b0866de26bbf6f2b362f397a0258a75b7fa900943', # vsResultId (query2)
|
||||
'VsHistoryDetailQuery': '94faa2ff992222d11ced55e0f349920a82ac50f414ae33c83d1d1c9d8161c5dd', # vsResultId (query2)
|
||||
'CoopHistoryQuery': 'e11a8cf2c3de7348495dea5cdcaa25e0c153541c4ed63f044b6c174bc5b703df', # blank (query1)
|
||||
'CoopHistoryDetailQuery': 'f2d55873a9281213ae27edc171e2b19131b3021a2ae263757543cdd3bf015cc8', # coopHistoryDetailId (query2)
|
||||
'MyOutfitCommonDataEquipmentsQuery': '45a4c343d973864f7bb9e9efac404182be1d48cf2181619505e9b7cd3b56a6e8' # for lean's seed checker
|
||||
|
||||
Reference in New Issue
Block a user