fix: treat a logged-out launcher (autologin off, token 0) as needing login

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ysj7705andClaude Opus 5.5 committed 2026-10-24 21:43:56 +09:00
1 parent 7513fef6f8
commit 8774e850b6
2 files changed
+10 -2

No files matched your search

+2 -1
View File
@@ -93,7 +93,8 @@ class MudfishClient:
st = self.status() st = self.status()
if st.get("isSignedIn") and not force: if st.get("isSignedIn") and not force:
return st return st
if not st.get("token_v3") or not st.get("username"): # A logged-out launcher reports autologin=False and token_v3="0".
if not st.get("autologin") or str(st.get("token_v3") or "0") == "0" or not st.get("username"):
raise SigninError("no saved login") raise SigninError("no saved login")
body, ctype = _multipart({ body, ctype = _multipart({
"autologin": "ON", "username": st["username"], "password": st["token_v3"], "autologin": "ON", "username": st["username"], "password": st["token_v3"],
+8 -1
View File
@@ -4,7 +4,7 @@ import unittest
from mudfish_decky.client import AuthError, MudfishClient, MudfishError, SigninError from mudfish_decky.client import AuthError, MudfishClient, MudfishError, SigninError
BASE = "http://127.0.0.1:8282" BASE = "http://127.0.0.1:8282"
SIGNED_OUT = {"status": 200, "isSignedIn": False, "username": "u", "token_v3": "123", SIGNED_OUT = {"status": 200, "isSignedIn": False, "autologin": True, "username": "u", "token_v3": "123",
"item_conf_mode": "simple", "version": "6.6.0", "api_server": "api.mudfish.net", "jwt": ""} "item_conf_mode": "simple", "version": "6.6.0", "api_server": "api.mudfish.net", "jwt": ""}
SIGNIN_OK = {"status": 200, "token_v3": "456", "jwt": "JWT", "expert_mode": 0, "lang": "ko_KR", "alias_enable": 0} SIGNIN_OK = {"status": 200, "token_v3": "456", "jwt": "JWT", "expert_mode": 0, "lang": "ko_KR", "alias_enable": 0}
@@ -100,6 +100,13 @@ class ClientTest(unittest.TestCase):
with self.assertRaises(SigninError): with self.assertRaises(SigninError):
MudfishClient(BASE, t).ensure_signed_in() MudfishClient(BASE, t).ensure_signed_in()
def test_logged_out_launcher_is_signin_error_without_calling_cloud(self):
# After /logout.html the launcher reports autologin=False and token_v3="0".
t = FakeTransport({("GET", BASE + "/do/mudrun/status"): [dict(SIGNED_OUT, autologin=False, token_v3="0")]})
with self.assertRaises(SigninError):
MudfishClient(BASE, t).ensure_signed_in()
self.assertEqual(t.calls_to("POST", "https://api.mudfish.net/signin_ng_v3"), [])
def test_graphql_without_user_is_auth_error(self): def test_graphql_without_user_is_auth_error(self):
t = FakeTransport({("POST", "https://api.mudfish.net/graphql"): [{"errors": ["unauthorized"]}]}) t = FakeTransport({("POST", "https://api.mudfish.net/graphql"): [{"errors": ["unauthorized"]}]})
with self.assertRaises(AuthError): with self.assertRaises(AuthError):