aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAge
...
* fix(renderer): Consistent store initializationLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | Make sure the RendererStore is in a state consistent with the MainStore before attempting to initialize the application. This avoids, e.g., race conditions when trying to load the default locale spuriously before loading the actually selected locale. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: Properly shut down watch modeLibravatar Kristóf Marussy2022-05-16
| | | | | | Also fixes argument passing to the application. 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>
* build: Allow command line arguments to watchLibravatar Kristóf Marussy2022-05-16
| | | | 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>
* feat(renderer): Introduce chunk splittingLibravatar Kristóf Marussy2022-05-16
| | | | | | | This should make the application load a tiny bit faster by delaying loading the UI in parallel with setting up stores and localization. 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>
* design: Increase location bar UI densityLibravatar Kristóf Marussy2022-05-16
| | | | 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(renderer): Show service error on service iconLibravatar Kristóf Marussy2022-05-16
| | | | | | Service icons fade out on errors and an icon is displayed. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(renderer): Update window titleLibravatar Kristóf Marussy2022-03-15
| | | | 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(renderer): Back and forward mouse buttonsLibravatar Kristóf Marussy2022-03-15
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* design: Inset sidebarLibravatar Kristóf Marussy2022-03-15
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor(renderer): Location bar security labelLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | | | Since electron doesn't have an API to extract the current certificate, except in the case of certificate errors, there's no point in making the security warning / padlock icon clickable. We instead display a plain icon and a warning message. We will later display the certificate details in case of a validation error (when we have access to the certificate) as part of an error message. Also makes the security labels more visible to people with protanopia who use the dark mode of the UI. 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>
* design: Simpler message count indicatorsLibravatar Kristóf Marussy2022-03-06
| | | | 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>
* design: Location bar and other UI stylingLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | InputBase paddings are idiosyncratic if there is both a start and an end adornment. To simplify the styles, we override the styling from InputBase and compute our own paddings. The animated color change when switching from a secure site to an insecure one was distracting, so we disable color animations in the location bar.
* 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>
* fix: Cosmetic fixesLibravatar Kristóf Marussy2022-02-14
| | | | | | | | | * Update the browser view size more quickly (negligible CPU usage overhead) * Style the body element by default instead of the html element for better compatibility with website CSS. 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>
* feat: Unread message badgesLibravatar Kristóf Marussy2022-02-08
|
* feat: Save selected service to fileLibravatar Kristóf Marussy2022-02-08
| | | | | | | Sophie start off from the service that was selected when it was last open. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* test: Add tests for main window hardeningLibravatar Kristóf Marussy2022-02-08
| | | | | | | We try to stub/mock the Electron API to make sure the test environment is as close to the runtime environment for this security critical code. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: Add test-utils packageLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | | Added as a common devDependency, this lets us handle test utility code from one place. For now, the main reason for its existence is the workaround code for importing jest-each from ESM. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Extract main window hardeningLibravatar Kristóf Marussy2022-02-08
| | | | | | | This code is security critical, so it should be properly extracted to enable testing. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Extract resource path managementLibravatar Kristóf Marussy2022-02-08
| | | | | | | Lets us access absolute paths and URLs without directly calling node APIs. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* chore: Annotate shared packages for purityLibravatar Kristóf Marussy2022-02-08
| | | | | | | Enabled better tree shaking and smaller bundle sizes by excluding mobx-state-tree and zod dependencies whenever possible. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Extract config handlingLibravatar Kristóf Marussy2022-02-08
| | | | | | | Move the handling of the contents of the config file out of the stores and into dedicated files to simplify the code of the stores. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Coding conventionsLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | Make sure that files have a default import with the same name as the file whenever possible to reduce surprise. Also shuffles around some file names for better legibility. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Apply shared store patches in batchesLibravatar Kristóf Marussy2022-02-08
| | | | | | Makes sure that the renderer always sees a consistent state. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Store services in a mapLibravatar Kristóf Marussy2022-02-08
| | | | | | | Makes the synchronization of references across the main/renderer process boundary more robust. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Move runtime state into shared modelsLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | | | Now the runtime state lives inside the model (instead of being associated to the static settings via a map), which simplifies state management. Static settings are now located inside the runtime models, so we must create tests to make sure that the settings are being persisted correctly. The contents of the config file are now generated as a view of store (instead of a snapshot), which adds flexibility. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Add selected service field to SharedStoreLibravatar Kristóf Marussy2022-02-08
| | | | | | Lets the main process see which service is currently selected. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Rename main services to infrastructureLibravatar Kristóf Marussy2022-02-08
| | | | | | | | Makes it clear that we are talking about wrappers for nodejs and electron functionality, and not the services being displayed by the application. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Add RuntimeService storeLibravatar Kristóf Marussy2022-02-08
| | | | | | | Stores transient state for services shared between the main and renderer processes. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix: Do not access localStorage in service-preloadLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | | | | loglevel wants to persist the current log level in localStorage, which apparently crashes the network service. We'll need to find another way to log in service preload scripts. The main window preload scripts seems unaffected, even though we use loglevel (and hence localStorage) in both the preload and the renderer script. Maybe related: https://github.com/electron/electron/issues/31689 Signed-off-by: Kristóf Marussy <kristof@marussy.com>