Skip to content

feat: sync game accounts and pilots from a Net-7.org login - #4

Open
dan51588 wants to merge 3 commits into
Rmkrs:mainfrom
dan51588:feature/net7-account-sync
Open

dan51588 wants to merge 3 commits into
Rmkrs:mainfrom
dan51588:feature/net7-account-sync

Conversation

@dan51588

Copy link
Copy Markdown
Contributor

Summary

Adds Net-7.org sync: Client Manager reads the game accounts and pilots of a Net-7.org (forum) login and brings its Accounts list in line with them, instead of entering every account and pilot by hand.

It is on the main screen under Accounts & tools → Manage, and next to Add in the Accounts window.

How it works

  1. Signs in the way the website's login form does (POST login/uname/pwd, plus remember when ticked).
  2. Reads https://www.net-7.org/api/account with the resulting PHP session cookie. One request returns every game account (id, username) and avatar (slot, account_id, name, race, prof). A 401 from that endpoint is how a rejected or expired login is detected.
  3. Shows the changes it would make, and applies them only after you confirm. Removing pilots asks again.

The Net-7 web team confirmed that the API and the PHP session cookie are the intended way to use it for now.

What the sync changes

Net7SiteAccountSync.Merge:

  • Matches game accounts by login name and adds the ones that are missing.
  • Makes the pilots of those accounts match the site exactly: adds, moves to the right slot (site slot 0–4 → manager slot 1–5) or to another account, sets race and profession, and removes pilots the site no longer has.
  • Keeps a pilot's Id when its name is found again, so profiles and launches that refer to it keep working.
  • Leaves accounts that are not on that login exactly as they are.
  • Never touches stored game passwords. The site does not provide them.

The site calls the Terran trade class "Tradesman"; it is mapped to the manager's "Trader". A race or profession the manager does not know is left unset, and the pilot's existing value is kept.

Login storage

  • The Net-7.org password is never stored.
  • With Remember login, only the site's cookies are kept, in %AppData%\Net7ClientManager\net7-site-session.json, protected for the Windows user like stored game passwords. Forget login deletes the file. An expired session is deleted and the password is asked for again.

Files

  • Net7Site/: Net7SiteClient (sign-in, API request, cookies), Net7SiteApiParser, Net7SiteAccountSync, Net7SiteSessionStore, and small records.
  • Forms/Net7SiteSyncForm.cs: the sync window. AccountsForm, MainForm and MainForm.TopPanel: the buttons.
  • Documentation/UserGuide/fleet-setup.md: a "Sync from Net-7.org" section.

Testing

  • dotnet build: 0 errors, no new analyzer warnings in the new files.
  • The parser on a real /api/account reply: 9 accounts and 33 avatars, all in the right slots, every race and profession recognised.
  • Live, against net-7.org:
    • sign in with a username and password, review and apply the changes;
    • sync again with a remembered login and no password.

🤖 Generated with Claude Code

dan51588 and others added 3 commits October 30, 2026 15:23
Adds a "Net-7.org sync" button to the Accounts window. It signs in to
www.net-7.org with the user's forum login, reads the Avatar Transfer
page (each slot carries its data as JSON in a data-avatar attribute) and
each avatar's page for race and profession, then previews the changes
before applying them.

- Only the game accounts on that Net-7.org login are changed; missing
  ones are added and their pilots made to match the site exactly,
  including removals. Other accounts are left untouched.
- Pilots keep their Id when found again by name, so saved launches
  still resolve; stored game passwords are never touched.
- With "Remember login" ticked, only the site's sign-in cookies are kept
  (DPAPI-protected, net7-site-session.json); the password never is.

Nothing changes unless the user opens the dialog and clicks Apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main screen's Accounts section gets a primary "Net-7.org sync"
button under Manage; it opens the same dialog and saves the result.
In the Accounts window the sync button is now primary and sits next to
Add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the cpanel/apanel HTML scraping with one request to
/api/account, which lists game accounts and avatars with slot, race
and profession. The API's 401 reply now detects a rejected or expired
login. "Tradesman" from the site maps to Client Manager's "Trader".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dan51588
dan51588 marked this pull request as ready for review October 31, 2026 01:30
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.

1 participant