Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/run-windows/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions EveProfitManager/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@ class SignInError(Exception):
pass


DEFAULT_CLIENT_ID = "28c1d7859b4e49f6bb97a13441e8be7c"


@dataclass
class Character:
id: int
name: str


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():
Expand Down
19 changes: 18 additions & 1 deletion EveProfitManager/test_sso.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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()
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading