fix(plugin): guard non-numeric appId, improve 404 error handling
This commit is contained in:
@@ -872,8 +872,12 @@ exec mangohud "$@"
|
|||||||
return {"error": "Invalid JSON", "status": response.status}
|
return {"error": "Invalid JSON", "status": response.status}
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
try:
|
try:
|
||||||
err = json.loads(e.read().decode("utf-8"))
|
raw_body = e.read().decode("utf-8")
|
||||||
return {**err, "status": e.code}
|
try:
|
||||||
|
err = json.loads(raw_body)
|
||||||
|
return {**err, "status": e.code}
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
return {"error": f"Server returned status {e.code} (non-JSON response)", "status": e.code, "body": raw_body[:200]}
|
||||||
except Exception:
|
except Exception:
|
||||||
return {"error": f"Server returned status {e.code}", "status": e.code}
|
return {"error": f"Server returned status {e.code}", "status": e.code}
|
||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
|
|||||||
<PanelSection title="DeckyVault">
|
<PanelSection title="DeckyVault">
|
||||||
<PanelSectionRow>
|
<PanelSectionRow>
|
||||||
<div className={staticClasses.Text} style={{ fontSize: "12px", padding: "6px 0", opacity: 0.7, color: "#e74c3c" }}>
|
<div className={staticClasses.Text} style={{ fontSize: "12px", padding: "6px 0", opacity: 0.7, color: "#e74c3c" }}>
|
||||||
<FaTimes /> Could not load DeckyVault data. Please try again later.
|
<FaTimes /> Could not load DeckyVault data: {fetchError}
|
||||||
</div>
|
</div>
|
||||||
</PanelSectionRow>
|
</PanelSectionRow>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ export function registerLibraryAppPatch() {
|
|||||||
if (!child) return null
|
if (!child) return null
|
||||||
const overview = child.props.children.props.overview
|
const overview = child.props.children.props.overview
|
||||||
if (!overview || !isSteamGameType(overview.app_type)) return null
|
if (!overview || !isSteamGameType(overview.app_type)) return null
|
||||||
|
// Only inject for valid numeric app IDs
|
||||||
|
if (typeof overview.appid !== 'number' || overview.appid <= 0) return null
|
||||||
return child.props.children
|
return child.props.children
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user