aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main
Commit message (Collapse)AuthorAge
* build: run integration tests in CIHEADmainLibravatar Kristóf Marussy2022-05-31
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): bump dependenciesLibravatar Kristóf Marussy2022-05-31
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor(main): improve config file handlingLibravatar Kristóf Marussy2022-05-30
| | | | | | | | Simplify config file watcher by debouncing events instead of throttling. Make sure to flush config changes on application exit. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* test(main): ConfigFile integration testLibravatar Kristóf Marussy2022-05-29
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: use undefined constantLibravatar Kristóf Marussy2022-05-28
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: move certificate trust to main processLibravatar Kristóf Marussy2022-05-27
| | | | | | | | There is no need to synchronize the list of trusted certificates to the renderer process, so we can get away with storing them in the transient state of the Profile store. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: fix test rootDir configurationLibravatar Kristóf Marussy2022-05-27
| | | | | | Each package should load the tests from its src directory only. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: use setBackgroundColor instead of CSSLibravatar Kristóf Marussy2022-05-26
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore: use node16 moduleResolution where possibleLibravatar Kristóf Marussy2022-05-26
| | | | | | | We can't do this in the renderer package, because we need to import MUI files that are not exported (MUI v6 is not ESM yet). Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): bump dependenciesLibravatar Kristóf Marussy2022-05-26
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(main): show location bar menu item enableLibravatar Kristóf Marussy2022-05-17
| | | | | | | Synchronize enabledness of the menu item with the toggle location bar button in the sidebar. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): bump dependenciesLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* test: tests for infrastructure/electron in mainLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* test: use test instead of itLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* test: prefer jest API instead of jest-eachLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): bump dependenciesLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix: vite dev server race conditionLibravatar Kristóf Marussy2022-05-16
| | | | | | | Handle the ERR_ABORTED error emitted by chromium when it tries to load the UI before the vite dev server is fully initialized. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): bump to react 18Libravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: integration testing supportLibravatar Kristóf Marussy2022-05-16
| | | | | | Run integration tests in an electron environment for the main process. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: config file saving and debuggingLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | Reduce the number of dependencies and the amount of code running in a security sensitive context. Instead of a deep comparison, we just compare the serialized versions of the config files. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: remove json5 dependencyLibravatar Kristóf Marussy2022-05-16
| | | | | | | Use a more standard config file format and reduce the amount of external code running in the security-sensitive context of the main process. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): remove ms to reduce dependency countLibravatar Kristóf Marussy2022-05-16
| | | | | | | | We can trivially do what it does, and removing it reduces the amount of external dependencies running in the security-sensitive context of the main process. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: reduce service switcher tearingLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | We render the location bar and notification banners separately for each service and keep track of the BrowserView size separately for each service to reduce the tearing that appears when people switch services. The tearing cannot be eliminated completely, because it comes from the separation between the main and renderer processes. But we can at least try and reduce the IPC round-tripping and layout calculations required to accurately position the services. This approach has an overhead compared to the single BrowserViewPlaceholder approach, because the renderer process has to layout the location bar and notification for all services, not only the selected one. The number of IPC messages during windows resize is also increased. To compensate, we increase the throttle interval for resize IPC messages and let electron itself resize the BrowserView between IPC updates. (We must still keep pumping IPC messages during window resize, because, e.g., changes in notification banner size due to re-layouting will still affect the required BrowserView size). If further reduction of IPC traffic is needed, we could implement batching for resize IPC messages and more intelligent throttling via a token bucker mechanism. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): upgrade dependenciesLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Certificate viewerLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | Show certificates with an interface modeled after firefox's certificate viewer so that they can be inspected before trusting. The current implementation assumes that each certificate has a unique fingerprint (collisions are astronomically unlikely). Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): Bump electron to 19 for setBackgroundColor fixLibravatar Kristóf Marussy2022-05-16
| | | | | | | | Since https://github.com/electron/electron/pull/33435 has landed in electron 19 alpha, but not in 18, moving to 19 lets us remove the workarounds for setBackgroundColor. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): Bump dependenciesLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(service-preload): Embed service-injectLibravatar Kristóf Marussy2022-05-16
| | | | | | | | Embed the service-inject script into the service-preload script to avoid having to load it manually and reduce IPC communication when a service loads. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(main): Do not show spurious abort errorLibravatar Kristóf Marussy2022-05-16
| | | | | | | | When the user aborts loading the webpage there is no error, so we don't need to display any and can just wait for the loading finished event from chromium. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(main): Fix typo in ConfigFile log messageLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Use i18next for language resolutionLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | | | | | Due to https://github.com/i18next/i18next/issues/1564 we still have to implement our own language resolution, but we can rely on resolvedLanguage to determine which language to pass through to the renderer. We will use the language detected by chromium as the system locale, so there is no need to use os-locale for detection any more. We use i18next in the main process do resolve the language, then set the resolve (not requested!) language in the renderer process to avoid doing resolution twice. This avoids the need in the renderer process to know the list of supported languages. We set the language and the writing direction in HTML in the renderer. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(main): Inconsistent RendererBridge snapshotLibravatar Kristóf Marussy2022-05-16
| | | | | | | Make sure that the snapshot we send to the renderer process corresponds to the state of the SharedStore after the last completed action. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(main): Language setting in config fileLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | Load localization according to either the environment or the configuration file from the list of supported locales. Ideally, we would also set the chromium locale with --lang, but by the time we have read the config file (to known which locale to set), electron has already initialized the chromium resource bundle. So the chromium localization will always be auto-detected by chromium. Also makes startup hopefully a bit faster by doing more things concurrently while the localization and the main window is being loaded. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): Bump electron to 18Libravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): Bump but keep from react 18 for nowLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | We need mui and mobx-react-like support before we can upgrade. See https://github.com/mobxjs/mobx/issues/2526 for discussion about the ramifications of concurrent rendering for mobx. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(renderer): Renderer translationsLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | Add react-i18n to make us able to use i18next translations in the renderer process just like we do in the main process. Translations are hot-reloaded automatically. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(main): Translation hot reloading during developmentLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(main): Add localization supportLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | | Add i18next with a custom backend to the main process to load localization from file. Missing localizations are written to a missing localizations file in debug mode, but silently fall back in production mode. We will also need to add a custom backend for the renderer process that communicates with the main process. (i18next-fs-electron-backend is not applicable here, because we need localizations both in the main and renderer processes.) Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Add custom menubarLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | The menu is populated reactive from the store with no caching. This doesn't seem to cause any performance problems so far. Currently the menu is electron-specific. In the future, we'll need a more runtime-independent way to build the menu. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: New window bannerLibravatar Kristóf Marussy2022-05-16
| | | | | | | | * Add renderer code for notification banners with buttons * Handle new window open requests by denying them and displaying a notification Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Open in external browserLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Temporary certificate acceptance backendLibravatar Kristóf Marussy2022-03-15
| | | | | | | | | | | | | We use the 'certificate-error' event of webContents to detect certificate verification errors and display a message to manually trust the certificate. Certificates are trusted per profile and only until Sophie is restarted. We still need to build the associated UI, the current one is just a rough prototype for debugging. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Handle service load failuresLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | Adds a "failed" state for services where the BrowserView and WebContents should be left around to keep history and allow people to navigate back. Access to the browser history otherwise doesn't seem possible (see https://github.com/electron/electron/issues/26727 and https://github.com/electron/electron/issues/7186), so destroying BrowserView and managing our own history is not possible. Also keep https://github.com/electron/electron/issues/24113 in mind. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(service-preload): Browser view canvas backgroundLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | Due to `BrowserView.setBackgroundColor` not working under linux, we have to inject styles to make sure our `BrowserView` is opaque. We try to cover more edge cases to avoid the interference of the injected style and the web site's own styles according to the CSS specification: https://www.w3.org/TR/css-backgrounds-3/#body-background In particular, we avoid overwriting the styles for the `html` element if `body` already has an opaque background so that the background of `body` can extend to the whole canvas. This might still interfere with the web site if it updates the background color on the fly (dark mode), but a reload should solve most of such issues. Hopefully, after https://github.com/electron/electron/issues/32898 is resolved, we can get rid of the hack entirely. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Location bar actionsLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | The buttons and the text field in the location bar shall now affect the BrowserView of the loaded service. Some error handling is still needed, e.g., when loading a web page fails due to a DNS error. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Shared model type factoriesLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | | Allows customization of stores both in the renderer and in the main process. Instead of exposing a basic model type from the shared module (which was be overwritted with more specific props in the main package), we expose factory function that can create specific model types in both the renderer and the main process. Using these package-specific customization to stores, the renderer package can attach IPC calls directly to store objects, which the main package can attach the handlers for IPC calls and other internal actions. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix: Stop spinner after in-page navigationLibravatar Kristóf Marussy2022-03-06
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Basic location barLibravatar Kristóf Marussy2022-02-24
| | | | | | Still needs adding event handlers to actually navigate the browser. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore(deps): Bump dependenciesLibravatar Kristóf Marussy2022-02-24
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Load and switch servicesLibravatar Kristóf Marussy2022-02-14
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>