Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:electron: Restart server silently when adding self signed cert and add some logs #3431

Conversation

MikesGlitch
Copy link
Contributor

@MikesGlitch MikesGlitch commented Sep 13, 2024

Selecting a self signed certificate no longer restarts the app. Instead we restart the server process silently. The user shouldn't notice.

I've also added some logging for errors given by nodeFetch. That should help people diagnose cert/network related erros.

showing err

Copy link

netlify bot commented Sep 13, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 3600b0c
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66e88ee395e6f800085cf37f
😎 Deploy Preview https://deploy-preview-3431.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Sep 13, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 5.17 MB → 5.17 MB (+274 B) +0.01%
Changeset
File Δ Size
src/hooks/useGlobalPref.ts 📈 +61 B (+16.80%) 363 B → 424 B
home/runner/work/actual/actual/packages/loot-core/src/client/actions/prefs.ts 📈 +46 B (+4.61%) 997 B → 1.02 kB
src/components/manager/ConfigServer.tsx 📈 +129 B (+1.72%) 7.33 kB → 7.45 kB
src/browser-preload.browser.js 📈 +38 B (+1.04%) 3.58 kB → 3.61 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.2 MB → 3.2 MB (+274 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/usePreviewTransactions.js 1.59 kB 0%
static/js/AppliedFilters.js 20.97 kB 0%
static/js/narrow.js 80.62 kB 0%
static/js/wide.js 225.24 kB 0%
static/js/ReportRouter.js 1.5 MB 0%

Copy link
Contributor

github-actions bot commented Sep 13, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.19 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.19 MB 0%

},
});
} catch (error) {
console.error(error); // log error
Copy link
Contributor Author

@MikesGlitch MikesGlitch Sep 13, 2024

Choose a reason for hiding this comment

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

Adds a bit extra logging - this will help with cert/network/other errors

@MikesGlitch MikesGlitch force-pushed the electron/restart-server-silently-and-logs branch from 20be64a to 48e56f4 Compare September 13, 2024 20:54
@MikesGlitch MikesGlitch marked this pull request as ready for review September 13, 2024 20:54
}
}

const isMounted = useRef(false);

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

💭 thought: ‏I think this doesn't actually work as intended.

What I think this should do: whenever self signed cert (serverSelfSignedCert) changes - the electron server is restarted.

What actually happens:

  • electron server is restarted the first time serverSelfSignedCert changes
  • if the cert changes again (or is removed) - the server does not restart anymore thus is broken again

Copy link
Member

Choose a reason for hiding this comment

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

If you move this to a useCallback that is called when setServerSelfSignedCert is called - that will make it work better IMO.

Copy link
Contributor Author

@MikesGlitch MikesGlitch Sep 14, 2024

Choose a reason for hiding this comment

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

What actually happens:

electron server is restarted the first time serverSelfSignedCert changes
if the cert changes again (or is removed) - the server does not restart anymore thus is broken again

That's not what I'm seeing:

test

If you move this to a useCallback that is called when setServerSelfSignedCert is called - that will make it work better IMO.

Yeah that was my original plan but setServerSelfSignedCert dispatches an action that writes to the file system, so there's a delay between dispatching and having an updated value for serverSelfSignedCert.

If the delay is too great, we restart the server before changing the value - that's why I changed it to watch for the value change rather than restating there.

Copy link
Member

Choose a reason for hiding this comment

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

If the delay is too great, we restart the server before changing the value - that's why I changed it to watch for the value change rather than restating there.

Hmm.. so it all comes down to how long the delay is. And if the delay is sufficiently long - even the useEffect solution wouldn't work. Could we await for the result of this dispatched action? Or perhaps listen to a callback of some sort?

Copy link
Contributor Author

@MikesGlitch MikesGlitch Sep 16, 2024

Choose a reason for hiding this comment

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

I've passed a callback on the dispatch which will trigger the restart. This feels cleaner than what I had 👍 3600b0c

@MikesGlitch MikesGlitch merged commit 3743a32 into actualbudget:master Sep 17, 2024
19 checks passed
@MikesGlitch MikesGlitch deleted the electron/restart-server-silently-and-logs branch September 17, 2024 07:59
a-gradina pushed a commit to a-gradina/actual that referenced this pull request Sep 24, 2024
…ogs (actualbudget#3431)

* restart server silently on add self signed cert and add some logging

* release notes

* fix name

* updating names to be more specific

* removing setloading

* feedback
matt-fidd added a commit that referenced this pull request Oct 3, 2024
* marked files for translation

* added release note

* fixed linting warnings

* 🐛 fix account filters being overridden (#3441)

* :electron: Reduce package size  (#3443)

* reduce package size of all packages

* release notes

* Update beforePackHook.ts

* [Maintenance] Cleanup react aria packages and dedupe (#3450)

* Cleanup react aria packages and dedupe

* Release notes

* ♻️ (synced-prefs) moving the prefs from metadata.json to the db (#3423)

* :electron: Restart server silently when adding self signed cert and add some logs (#3431)

* restart server silently on add self signed cert and add some logging

* release notes

* fix name

* updating names to be more specific

* removing setloading

* feedback

* ♻️ (synced-prefs) move budget type to synced prefs (#3427)

* update synced account balance in db if available (#3452)

* 🐛 (synced-prefs) fix bulk-reading not working in import modal (#3460)

* fix: csv import deduplication (#3456)

* ✨ release simplefin as a first-party feature (#3459)

Closes #2272

* Do not allow renaming to an empty category or group name (#3463)

* Do not allow renaming to an emoty category or group name

* Release notes

* [Mobile] Fix #3214 - Pull down to refresh triggering clicks on budget cells (#3374)

* Fix #3214

* Fix rollover indicator

* VRT

* Fix typecheck error

* VRT

* Release notes

* VRT

* Update style

* Fix budgeted

* VRT

* VRT

* Revert VRT

* VRT

* Fix style

* Revert usePreviewTransactions

* Fix error

* Fix reports form submit handlers (#3462)

* Fix form submit handlers

* Release notes

* :electron: Remove some old updater code (#3468)

* remove some old updater code

* remove old updater logic

* CSV import e2e tests (#3467)

* Fix React Aria Button hover styles  (#3453)

* Fiox hover styles and use className instead of inline to prepare for future css migration

* Release notes

* Cleanup

* Update edit rule hover style

* Undoable auto transfer notes + auto notes for cover (#3411)

* Undo auto transfer notes + auto notes for cover

* Release notes

* Fix notes

* Fix notes undo

* Do not show clicked category on transfer or cover menus

* Fix typecheck error

* typecheck

* Fix removeCategoriesFromGroups

* 🐛 (reports) deleting custom report should remove it from the dashboard (#3469)

* Revert "CSV import e2e tests (#3467)" (#3474)

This reverts commit 5e12d40.

* ♻️ (synced-prefs) separate metadata and local prefs out (#3458)

* :electron: Replace deprecated file protocol registration (#3475)

* replace deprecated file handler in electron

* release notes

* types eh

* types

* update sql regexp to default to empty string when field is null (#3480)

* ♻️ rename report/rollover budget to tracking/envelope (#3483)

* 🐛 (import) fix csv import checkboxes not working (#3478)

* Update tooltip and themes with better visibility (#3298)

* Update tooltip and themes with better visibility

* Rename merge request # into release notes

* rename release note

* update VRT

* tweak light theme

* dont put border on autocomplete menus

* update VRT

* tweak popover style

* simplify

* update VRT

* update VRT

---------

Co-authored-by: Dustin Conlon <dustin@dustinconlon.com>
Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>

* fix modals on mobile BudgetTable (#3487)

* Fix privacy filter (#3472)

* Fix privacy filter

* Release notes

* Coderabbit suggestion

* VRT

* VRT

* Revert VRT

* VRT

* VRT

* VRT

* VRT

* Delete VRT

* VRT

* Revert VRT

* 🐛 fix custom reports crashing when opening table (#3484)

* 🧪 (tests) adding custom report e2e tests (#3493)

* ✨ (dashboards) ability to save filters & timeframes on spending widgets (#3432)

* marked files for translation

* Revert ":bug: fix account filters being overridden (#3441)"

This reverts commit 7336bad.

* Revert "Revert ":bug: fix account filters being overridden (#3441)""

This reverts commit 5cbadc4.

* Revert changes due to failed rebase

* removed import of t

* fixed lint warning

* added PayeeTableRow.tsx

* needed changes

* bugfix: pluralization

* variables adjustments

* removed doubled trans

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
Co-authored-by: Michael Clark <5285928+MikesGlitch@users.noreply.github.com>
Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
Co-authored-by: Koen van Staveren <koenvanstaveren@hotmail.com>
Co-authored-by: Ryan Bianchi <1435081+qedi-r@users.noreply.github.com>
Co-authored-by: Robert Dyer <rdyer@unl.edu>
Co-authored-by: Dustin Conlon <dustin@dustinconlon.com>
Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>
Co-authored-by: Tim <hello@timsmart.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants