Repository navigation
Link Mudlet folder: read and write back encoding, TLS, login, password and command history - #465
Merged
Merged
Conversation
) Desktop's MudletApp::writeProfileData/readProfileData keep `encoding`, `ssl_tsl`, `login` and `password` as a QDataStream (Qt_5_12) QString: a big-endian uint32 byte length (0xFFFFFFFF for null), then UTF-16BE. The #436 readers took those bytes as UTF-8 text, so an imported desktop profile lost its server encoding and TLS, and sent "\0\0\0\b\0H\0e\0r\0o" as the character name with no password. - New qtProfileData.ts decodes/encodes that format; anything that is not a whole QString is still read as plain text, for hand-written files. - Import decodes the four files with it. An ssl_tsl that holds no check state now falls back to the save's mSslTsl instead of reading as off. - Export writes them in the same format, so desktop can read an exported profile's TLS, login and encoding back. - The #436 tests now use the bytes desktop really writes. Fixes #455 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiCGwimBDRdEXJa3hd9i7F
#450) "Link Mudlet folder…" read none of the files desktop keeps a profile's connection details in, so a linked profile read a non-UTF-8 game as UTF-8, connected in plaintext, and lost its auto-login and command history. - readDesktopProfileFiles (mudletProfileImport.ts) is now the one reader of `encoding`, `ssl_tsl`, `login`, `password` and `command_history_main`, shared by the import and the link. - Linking reads TLS and the character name into the connection record and hands the password to the credential vault, as an import does; the folder's own password file is left alone. - Every open of a linked profile (loadMudletLinkedProfile — cold start included, once the folder handle has permission) re-reads the encoding, TLS and character name, so a desktop change arrives. Desktop's history is merged in, desktop's commands first, whenever the file changed since it was last read. - Linked write-back is already two-way for the save, so this client's encoding, TLS and character-name changes are written back to those files in desktop's QString format, only when they differ. Never the password; the history stays read-only, since a running desktop rewrites it on exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiCGwimBDRdEXJa3hd9i7F
When desktop's `encoding` file named an encoding Mudlet Web cannot decode, loadMudletLinkedProfile kept the sidecar's older serverEncoding, and the next save wrote that back over desktop's choice. The file now wins whenever it exists; the profile reads as UTF-8 and nothing is written back. Also replace the stale "write-back is DISABLED" comment in flushProfileData. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Um3ZSHRbGj1Rbf55rAQzdM
# Conflicts: # src/import/mudletProfileImport.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #450.
This builds on #461 (#455, now merged), reusing its Qt QString decoder.
Changes
ssl_tsl,loginandpasswordfiles. The password goes into the encrypted vault once, at link time, and the folder's copy is never rewritten.ConnectionScreenshows any warnings, as an import does.encoding,ssl_tslandloginfrom the folder, so changes made on desktop show up.encodingfile wins over the web's saved value.ScriptingEngine.flushProfileData, and only formudletLinkedprofiles.tlsorcharLoginAccounton the connection record now also triggers a save.command_history_mainis merged into the web's history, desktop's commands first, deduplicated and capped. This only happens when the file's modification time has changed, tracked inmudlet_history_<id>_desktop_mtime. It is never written back, so it can't race a running desktop Mudlet, which rewrites the file on exit.readDesktopProfileFilesfor these files.tests/import/linkedDesktopFiles450.test.tsandtests/scripting/linkedDesktopFilesWriteback450.test.ts, using real desktop byte dumps.Review fixes (15780ad)
encodingfile named an encoding the web can't decode, the sidecar value was kept, and the next save overwrote desktop's choice with it. Fixed, with a regression test.LINKED_WRITEBACK_ENABLEDstill said "DISABLED". Replaced.Known minor quirk
If a linked folder has no
ssl_tslfile but its save hasmSslTsl="yes", the first save writesssl_tsl= 2. That matches the save, and it's rare, because desktop writes the file whenever the checkbox changes.Testing
yarn typecheckpasses.yarn check:vendoredpasses.yarn test, after merging master: 5,411 pass. The only failure is the GBK euro-sign test, which also fails locally on master and passes in CI.🤖 Generated with Claude Code
https://claude.ai/code/session_01Um3ZSHRbGj1Rbf55rAQzdM