Skip to content

Improve TR log in handling and remove app login code#327

Open
RealCLanger wants to merge 1 commit intopytr-org:masterfrom
RealCLanger:improve-login
Open

Improve TR log in handling and remove app login code#327
RealCLanger wants to merge 1 commit intopytr-org:masterfrom
RealCLanger:improve-login

Conversation

@RealCLanger
Copy link
Copy Markdown
Collaborator

@RealCLanger RealCLanger commented Mar 28, 2026

This PR improves TR log in handling, fixes a few bugs and removes the app login.

In detail:

  • The app login coding is removed since it seems that it has been broken for a while and nobody found a way to make it work again, as per App Login Broken #250 and Remove app login method #274. web login is the (only) way to go. This will also remove the dependency to ecdsa, as requested in replace ecdsa with cryptography #249
  • handling of resuming existing web sessions was cleaned up
  • AWS WAF token is only generated and sent during web log in. It seems it is not needed for resumed sessions.
  • An issue with webgl.json has been fixed which came due to an addition of the license information
  • some logging/output was improved

@RealCLanger
Copy link
Copy Markdown
Collaborator Author

@Felixoid would you mind having a look?

@RealCLanger RealCLanger mentioned this pull request Mar 28, 2026
Copy link
Copy Markdown
Contributor

@Felixoid Felixoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty straightforward changes with improved code. Some minor points to highlight 👍


def payout(self, amount):
return self._sign_request("/api/v1/payout", {"amount": amount}).json()
return requests.request(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be self._web_request? For other places as well

if not self._weblogin:
payload_with_token["token"] = self.session_token

await ws.send(f"sub {subscription_id} {json.dumps(payload_with_token)}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like payload_with_token = payload.copy() is unnecessary now and here json.dumps(payload) can be used

Comment on lines +149 to +151
if not self._waf_token:
self._waf_token = self._fetch_waf_token()
self._set_waf_cookie(self._waf_token)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not self._waf_token:
self._waf_token = self._fetch_waf_token()
self._set_waf_cookie(self._waf_token)
if not self._waf_token:
self._waf_token = self._fetch_waf_token()
if self._waf_token:
self._set_waf_cookie(self._waf_token)

I feel it should be under the condition. self._fetch_waf_token can return None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants