From c01a3df23c40e1f846e2924362b0acc9809f8c24 Mon Sep 17 00:00:00 2001 From: Fazorath Date: Wed, 28 Oct 2026 21:55:14 +0000 Subject: [PATCH] Ship the registered EVE client ID as the sign-in default (#57) --- .claude/skills/run-windows/SKILL.md | 2 +- EveProfitManager/sso.py | 12 +++++------- EveProfitManager/test_sso.py | 19 ++++++++++++++++++- README.md | 2 ++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.claude/skills/run-windows/SKILL.md b/.claude/skills/run-windows/SKILL.md index 4cc1d13..b46035a 100644 --- a/.claude/skills/run-windows/SKILL.md +++ b/.claude/skills/run-windows/SKILL.md @@ -26,7 +26,7 @@ Log in through the EVE launcher, dock the character, and set EVE to windowed or ## Launch -Needs `EVE_CLIENT_ID` (the app's client ID from developers.eveonline.com; callback `http://127.0.0.1:8765/callback`) set in the user's environment. If it's missing, stop and ask; don't hunt for it in files. +`EVE_CLIENT_ID` is optional: the app ships a built-in client ID (callback `http://127.0.0.1:8765/callback`). Set the variable only to override it with another registered app's client ID. ```powershell git clone https://github.com/Fazorath/AbyssTracker.git $env:TEMP\abyss-rig # or git pull in an existing clone diff --git a/EveProfitManager/sso.py b/EveProfitManager/sso.py index 36d693d..6e2ec4c 100644 --- a/EveProfitManager/sso.py +++ b/EveProfitManager/sso.py @@ -39,6 +39,9 @@ class SignInError(Exception): pass +DEFAULT_CLIENT_ID = "28c1d7859b4e49f6bb97a13441e8be7c" + + @dataclass class Character: id: int @@ -46,13 +49,8 @@ class Character: def _client_id(): - client_id = os.environ.get("EVE_CLIENT_ID") - if not client_id: - raise SignInError( - "Set the EVE_CLIENT_ID environment variable to your app's client ID " - "(register at https://developers.eveonline.com/applications)." - ) - return client_id + # PKCE with no client secret: the client ID is public, so it ships as the default. + return os.environ.get("EVE_CLIENT_ID") or DEFAULT_CLIENT_ID def _port(): diff --git a/EveProfitManager/test_sso.py b/EveProfitManager/test_sso.py index 64a9e93..d2ad5a7 100644 --- a/EveProfitManager/test_sso.py +++ b/EveProfitManager/test_sso.py @@ -1,10 +1,12 @@ +import os import time import unittest +from unittest import mock import jwt from cryptography.hazmat.primitives.asymmetric import rsa -from sso import InvalidToken, validate_token +from sso import DEFAULT_CLIENT_ID, InvalidToken, _client_id, validate_token CLIENT_ID = "my-client-id" KEY = rsa.generate_private_key(public_exponent=65537, key_size=2048) @@ -53,5 +55,20 @@ def test_rejects_bad_tokens(self): validate(token) +class ClientIdTests(unittest.TestCase): + def test_default_when_unset(self): + with mock.patch.dict(os.environ, clear=False): + os.environ.pop("EVE_CLIENT_ID", None) + self.assertEqual(_client_id(), DEFAULT_CLIENT_ID) + + def test_default_when_empty(self): + with mock.patch.dict(os.environ, {"EVE_CLIENT_ID": ""}): + self.assertEqual(_client_id(), DEFAULT_CLIENT_ID) + + def test_env_overrides_default(self): + with mock.patch.dict(os.environ, {"EVE_CLIENT_ID": "mine"}): + self.assertEqual(_client_id(), "mine") + + if __name__ == "__main__": unittest.main() diff --git a/README.md b/README.md index ba0787e..782012a 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ This program is designed to help users track their profits and time spent during payout) field and Log button, the session's profit, ISK/hour and runs, and the last three runs. It shares the timer and session with the full window; **Unpin** lets other windows cover it and **Expand** brings the full window back. + - **Sign-in:** works out of the box with the app's built-in EVE client ID (public, PKCE, no secret). Set the + `EVE_CLIENT_ID` environment variable only to override it with your own registered application. - **Run detection:** when signed in, switch on **Detect runs from EVE** in the session toolbar. The app polls your character's location (ESI caches it for 5 seconds), starts the timer when you enter Abyssal Deadspace, and on exit pauses it and prompts you to enter your wallet and log the run.