fifa17-recon: take running-backend versions of 8 runtime files (direction fix)
The earlier reconcile committed the local working-tree versions of these files, which are OLDER than the deployed backend. The running container (C) is byte-identical to docker/fifa17-python/tools (B) and is a strict superset: it adds profile_path_for/select_account/ensure_security_question (fut_store), safe_header_for_log/safe_request_path/security_question_route (utas_server), account_sync_route/_match_call/match_ready_body, plus POW balance fields and match lifecycle support, with zero unique local functions lost. Reconciled tree is now a strict superset of B with every shared file byte-identical; verified via md5 map (0 missing, 0 differing).
This commit is contained in:
@@ -17,7 +17,19 @@ sys.path.insert(0, HERE)
|
||||
import fut_cards
|
||||
from fut_account import ACCOUNT # single source of truth for identity/club
|
||||
|
||||
PROFILE_PATH = os.environ.get("FUT_PROFILE", os.path.join(HERE, "fifa17_profile.json"))
|
||||
PROFILE_ROOT = os.environ.get("FUT_PROFILE_ROOT", "")
|
||||
|
||||
|
||||
def profile_path_for(persona_id):
|
||||
explicit = os.environ.get("FUT_PROFILE")
|
||||
if explicit:
|
||||
return explicit
|
||||
if PROFILE_ROOT:
|
||||
return os.path.join(PROFILE_ROOT, str(int(persona_id)), "fifa17_profile.json")
|
||||
return os.path.join(HERE, "fifa17_profile.json")
|
||||
|
||||
|
||||
PROFILE_PATH = profile_path_for(ACCOUNT.persona_id)
|
||||
|
||||
# ---- FUT_DISCARD_TABLE: the REAL FIFA 17 quick-sell values ------------------
|
||||
#
|
||||
@@ -386,18 +398,51 @@ class Store:
|
||||
p["clubName"] = ACCOUNT.club_name
|
||||
p["clubAbbr"] = ACCOUNT.club_abbr
|
||||
p["established"] = ACCOUNT.established
|
||||
# EA/EASFC account-bar state belongs to the same persona as the FUT
|
||||
# save, but remains a distinct balance from FUT coins.
|
||||
p["powLevel"] = ACCOUNT.pow_level
|
||||
p["powExp"] = ACCOUNT.pow_exp
|
||||
p["powExpMax"] = ACCOUNT.pow_exp_max
|
||||
p["powFunds"] = ACCOUNT.pow_funds
|
||||
p["powFundsCap"] = ACCOUNT.pow_funds_cap
|
||||
return p
|
||||
|
||||
def _save(self):
|
||||
parent = os.path.dirname(self.path)
|
||||
if parent:
|
||||
os.makedirs(parent, exist_ok=True)
|
||||
tmp = self.path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump(self._p, f, indent=1)
|
||||
os.replace(tmp, self.path)
|
||||
|
||||
def select_account(self, persona_id):
|
||||
"""Switch the single active session to its isolated persistent FUT save."""
|
||||
with _LOCK:
|
||||
self.path = profile_path_for(persona_id)
|
||||
self._p = None
|
||||
return self.load()
|
||||
|
||||
# ---- accessors used by utas_server -------------------------------------
|
||||
def profile(self):
|
||||
return self.load()
|
||||
|
||||
def ensure_security_question(self):
|
||||
"""Persist OpenFUT's account-scoped compatibility state for the FUT gate.
|
||||
|
||||
FIFA 17 transforms any entered answer before sending it. OpenFUT does not
|
||||
need that value to emulate a retired service, so neither the clear text nor
|
||||
the transformed value is stored. The only durable fact is that this
|
||||
OpenFUT profile has an initialized, verified compatibility record.
|
||||
"""
|
||||
expected = {"version": 1, "verified": True}
|
||||
with _LOCK:
|
||||
p = self.load()
|
||||
if p.get("securityQuestion") != expected:
|
||||
p["securityQuestion"] = dict(expected)
|
||||
self._save()
|
||||
return dict(p["securityQuestion"])
|
||||
|
||||
def refresh_identity(self):
|
||||
"""Re-mirror ACCOUNT into the save AND persist it.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user