Repository navigation
fix(windows): keep user data local, log errors - #271
Open
edospadoni wants to merge 2 commits into
Open
edospadoni wants to merge 2 commits into
edospadoni wants to merge 2 commits into
Conversation
The roaming folder can be redirected or synced between the PCs of the same user, such as the office PC and the smart working notebook. The password is encrypted with safeStorage, that is DPAPI bound to the machine, so a blob written on one PC may not decrypt on the other and NethLink asks for the password again. The PCs also overwrite each other's state. On the first start the app copies its state and the renderer localStorage (audio devices, ringtone) from the old roaming folder, which is left in place for older versions. Assisted-by: Claude Code:claude-opus-5-5
In production nothing but the PhoneIsland lines reached the log file,
so a failed auto login on a customer's PC left no trace. Warnings and
errors are now always written, info and debug stay dev only.
The main process messages were also lost in dev: ipcMain.emit passed
the message where the listener expects the event. Errors are logged
with name and message instead of {}, and a password that safeStorage
cannot decrypt gets its own warning.
Assisted-by: Claude Code:claude-opus-5-5
This branch has not been deployed
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.
Some users run NethLink with the same account on two Windows PCs, such as an office PC and a notebook for remote work, and NethLink keeps asking them for the password. On Windows NethLink stored its data in the roaming profile folder (
%APPDATA%), which companies often redirect or sync between PCs. The saved password is encrypted with Electron safeStorage, which on Windows uses DPAPI (the Windows data protection API), tied to the machine and the Windows user: a password saved on one PC may not decrypt on the other, and the two PCs overwrite each other's settings. We could not confirm the cause from the customer's logs, because in production NethLink wrote almost nothing to its log file.On Windows the data now lives in the local, per-machine folder (
%LOCALAPPDATA%). On the first start NethLink copies its settings and the saved audio devices and ringtone from the old folder, which stays in place for older versions. On every platform, warnings and errors now reach the log file in production too.src/main/lib/localUserData.ts: moves the data folder on Windows before anything reads it, so it is the first import inmain.tssrc/shared/utils/logger.ts: writes warnings and errors in production, keeps error messages instead of{}, and fixes main process messages that never reached the fileAccountController.autoLogin(): logs a dedicated warning when the saved password cannot be decryptedHow to test
%LOCALAPPDATA%\nethlinkDEV=true, corruptlastUserCryptPswinuser_data.jsonwhile NethLink is closed, then start it: the login page appears and the log file inlogs\containscannot decrypt the saved password with safeStorage