Merge pull request #428 from aclist/fix/invalid-mod-manifest

fix: handle invalid mods on server
This commit is contained in:
aclist 2026-08-04 23:06:05 +09:00 committed by GitHub
commit bd0bfcb03d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 3 deletions

View File

@ -139,6 +139,9 @@ def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]:
j = r.json()
rows = j["response"]["publishedfiledetails"]
for row in rows:
# NOTE: not a valid published file
if row["result"] == 9:
continue
title = str(row["title"])
_id = str(row["publishedfileid"])
time = int(row["time_updated"])
@ -205,9 +208,11 @@ def launch_offline(
proc = subprocess.run([*client_args, *params])
return proc.returncode
def find_loginusers(path: Path) -> Path:
return path / "config" / "loginusers.vdf"
def find_user_id(path: Path) -> str | None:
resolved_path = find_loginusers(path)
try:
@ -226,7 +231,6 @@ def find_user_id(path: Path) -> str | None:
return None
def find_user_id_32(path: Path) -> int:
uid = find_user_id(path)
if uid is None:

View File

@ -86,6 +86,7 @@ class Prerequisites:
mods: list[list[str]]
game_mode: bool
is_last_server: bool
invalid_mods: list[tuple[str, str]]
allows_downloads: tuple[bool, str]
@ -191,6 +192,9 @@ class ConnectionManager:
is_last = self.is_last_server()
# TODO: strings
invalid_mods = [(mod[0], mod[1]) for mod in remote_mods if mod[2] == "Invalid mod"]
prereqs = Prerequisites(
name=info.server_name,
appid=info.game_id,
@ -206,6 +210,7 @@ class ConnectionManager:
mods=remote_mods,
game_mode=game_mode,
is_last_server=is_last,
invalid_mods=invalid_mods,
allows_downloads=allows_downloads,
)
@ -261,6 +266,11 @@ class ConnectionManager:
for mod in alpha_mods:
if any(mod[1] in tuple for tuple in missing_mods):
mod[2] = resync
for mod in alpha_mods:
# NOTE: if the mod is neither synched or out of date, it is a malformed mod
if mod[2] == "":
# TODO: strings
mod[2] = "Invalid mod"
return alpha_mods, missing_mods

View File

@ -239,6 +239,15 @@ class PreConnectionAssistant(Gtk.Box):
)
"""Errors"""
if len(prereqs.invalid_mods) > 0:
pairs = [": ".join(sub) for sub in prereqs.invalid_mods]
lines = "\n".join(pairs)
msg = (
"Server has invalid mods that are not recognized by Steam.\n"
"Contact the server owner and include these mod IDs in your report:\n"
f"{lines}"
)
errors.append(msg)
if prereqs.binary_missing:
errors.append(
f"Remote server is running the build '{prereqs.build}', but it is not installed.\n{resync_msg}"
@ -275,10 +284,10 @@ class PreConnectionAssistant(Gtk.Box):
allows_dl, running_app = prereqs.allows_downloads
if len(prereqs.mods) > 0 and allows_dl is False:
msg = (
f"The game '{running_app}' is currently running in Steam, but background downloads are not enabled.\n"
f"The app '{running_app}' is currently running in Steam, but background downloads are not enabled.\n"
"Either stop the game first, or update your global Steam settings or the game's local settings.\n"
"Otherwise, mods may be queued for download but never update."
)
)
warnings.append(msg)
self.add_warnings(warnings)