mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 07:02:50 +01:00
fix: support multiple user ids
This commit is contained in:
1 parent
9bc5964df2
commit
00369837cb
5 files changed
+66
-10
No files matched your search
+17
-9
@@ -151,7 +151,9 @@ def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]:
|
|||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def connect_debug(client: str, addr: str, appid: int, name: str, mods: list[str]) -> str:
|
def connect_debug(
|
||||||
|
client: str, addr: str, appid: int, name: str, mods: list[str]
|
||||||
|
) -> str:
|
||||||
concat = concat_mods(mods)
|
concat = concat_mods(mods)
|
||||||
client_args = concat_bash_args(client)
|
client_args = concat_bash_args(client)
|
||||||
params = [
|
params = [
|
||||||
@@ -167,6 +169,7 @@ def connect_debug(client: str, addr: str, appid: int, name: str, mods: list[str]
|
|||||||
client_args.extend(params)
|
client_args.extend(params)
|
||||||
return " ".join(client_args)
|
return " ".join(client_args)
|
||||||
|
|
||||||
|
|
||||||
# TODO: set config to name=user, use official server and no mods,
|
# TODO: set config to name=user, use official server and no mods,
|
||||||
# ensure that formatted string is identical to fixture with same hash
|
# ensure that formatted string is identical to fixture with same hash
|
||||||
def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
||||||
@@ -235,14 +238,19 @@ def find_user_id(path: Path) -> str | None:
|
|||||||
try:
|
try:
|
||||||
with open(resolved_path, "r") as f:
|
with open(resolved_path, "r") as f:
|
||||||
v = vdf.load(f)
|
v = vdf.load(f)
|
||||||
# NOTE: beta client
|
users = v["users"]
|
||||||
# /package/beta
|
# NOTE: beta client: /package/beta
|
||||||
if len(v["users"]) == 1:
|
last_user = next(iter(users))
|
||||||
return str(list(v["users"].keys())[0])
|
if len(users) == 1:
|
||||||
for user in v["users"]:
|
return last_user
|
||||||
if v["users"][user]["MostRecent"] == "1":
|
last_stamp = int(users[last_user]["Timestamp"])
|
||||||
return str(user)
|
for user in users:
|
||||||
return None
|
stamp = int(users[user]["Timestamp"])
|
||||||
|
if stamp > last_stamp:
|
||||||
|
last_stamp = stamp
|
||||||
|
last_user = user
|
||||||
|
print(last_user)
|
||||||
|
return last_user
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"users"
|
||||||
|
{
|
||||||
|
"0"
|
||||||
|
{
|
||||||
|
"AccountName" "STEAMUSER"
|
||||||
|
"PersonaName" "STEAMUSER"
|
||||||
|
"RememberPassword" "0"
|
||||||
|
"WantsOfflineMode" "0"
|
||||||
|
"SkipOfflineModeWarning" "0"
|
||||||
|
"AutoLogin" "1"
|
||||||
|
"Timestamp" "1787904411"
|
||||||
|
}
|
||||||
|
"1"
|
||||||
|
{
|
||||||
|
"AccountName" "STEAMUSER2"
|
||||||
|
"PersonaName" "STEAMUSER2"
|
||||||
|
"RememberPassword" "0"
|
||||||
|
"WantsOfflineMode" "0"
|
||||||
|
"SkipOfflineModeWarning" "0"
|
||||||
|
"AutoLogin" "1"
|
||||||
|
"Timestamp" "1787904647"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"users"
|
||||||
|
{
|
||||||
|
"0"
|
||||||
|
{
|
||||||
|
"AccountName" "STEAMUSER"
|
||||||
|
"PersonaName" "STEAMUSER"
|
||||||
|
"RememberPassword" "0"
|
||||||
|
"WantsOfflineMode" "0"
|
||||||
|
"SkipOfflineModeWarning" "0"
|
||||||
|
"AutoLogin" "1"
|
||||||
|
"Timestamp" "1797904411"
|
||||||
|
}
|
||||||
|
"1"
|
||||||
|
{
|
||||||
|
"AccountName" "STEAMUSER2"
|
||||||
|
"PersonaName" "STEAMUSER2"
|
||||||
|
"RememberPassword" "0"
|
||||||
|
"WantsOfflineMode" "0"
|
||||||
|
"SkipOfflineModeWarning" "0"
|
||||||
|
"AutoLogin" "1"
|
||||||
|
"Timestamp" "1787904647"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,6 @@
|
|||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AllowAutoLogin" "1"
|
"AllowAutoLogin" "1"
|
||||||
"MostRecent" "1"
|
"MostRecent" "1"
|
||||||
"Timestamp" "0"
|
"Timestamp" "10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,8 @@ pytestmark = pytest.mark.apitest
|
|||||||
("api/loginusers_legacy_client.vdf", 0),
|
("api/loginusers_legacy_client.vdf", 0),
|
||||||
("api/loginusers_legacy_client_multiple.vdf", 1),
|
("api/loginusers_legacy_client_multiple.vdf", 1),
|
||||||
("api/loginusers_beta_client.vdf", 0),
|
("api/loginusers_beta_client.vdf", 0),
|
||||||
|
("api/loginusers_beta_client_multiple.vdf", 1),
|
||||||
|
("api/loginusers_beta_client_multiple_2.vdf", 0),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_loginusers(monkeypatch, fixture: str, expect: int) -> None:
|
def test_loginusers(monkeypatch, fixture: str, expect: int) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user