Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Conversation

@black-puppydog
Copy link
Contributor

This is very much WIP, but maybe folks want to test it...?

This is still lacking the context menu and for some reason the completion boxes (in search bar and post textareas) are slow as hell.
Apart from that it seems to work... 🙂

Copy link

@mwmiller mwmiller left a comment

Choose a reason for hiding this comment

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

LGTM with minimal oversight

@black-puppydog
Copy link
Contributor Author

Couldn't help myself and debugged a bit more.
The idea right now is to use electron-context-menu to replace electron-spellchecker. It should actually make this quite easy to do.
However, what I see is that when I right-click somewhere, the context menu only flickers in, then out immediately, so fast that all I can see is a white blip, and often not even that.
The building handler for the menu is called though. The menu just emits a menu-will-close event right afterwards.

@black-puppydog black-puppydog force-pushed the electron-bump branch 3 times, most recently from 4c31e7e to fbdda4e Compare March 1, 2021 08:40
webPreferences: {
nodeIntegration: true // XXX: Maybe not always necessary (?)
nodeIntegration: true, // XXX: Maybe not always necessary (?)
enableRemoteModule: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal is to be able to remove this line again.

Comment on lines +26 to +30
rootPath: path,
config: config,
data: opts.data || '',
title: opts.title || 'Patchwork',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we can pass this somehow directly to the BrowserWindow upon creation, we can save a round-trip of ipc...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also (and this is not a new issue, but nevertheless) I am thinking to strip config.keys.private out of this payload, to prevent the renderer process from accessing private key material. Not only should that improve the security in case of e.g. remote code execution CVEs, but also it should remove a potential foot-gun by only having one point in the code being even able to sign new messages, thus potentially preventing bug-induced forks...?

}

function dropTab (title, items) {
function buildDropdownMenuItems() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In hindsight, this could be done in the main process.
But even then, I'd probably build it like this for legibility and keep the buildMenu() around to add the navigate-to event handlers afterwards. So... dunno, feels okay to have the description of the page structure in the renderer process, that's where the rest of it lives too, right?

These were left-overs from a 4 year old commit. :P
Electron introduced native spell-checking in version 8, and this library
was subsequently abandoned.
@black-puppydog black-puppydog force-pushed the electron-bump branch 2 times, most recently from b76e1f8 to c3b4607 Compare March 6, 2021 22:01
To the latest version.
Seems to work, mostly. There's some slowness happening in the search
suggestions & completions, and of course there's still no context menu.
But posting & scuttling & reading still works, so there's that.

This still relies on the `remote` module, which is deprecated and considered
harmful. Need to work around that in the future, which... makes sense.
First step of getting remote out of the codebase.
Another step towards abolishing `remote`.
We were literally sending over a bunch of javascript code, and using
remote to execute it. Now it's done via a handler.
This one was a bit tougher. Basically I'm now creating a *descriptive*
structure on the renderer side, and then adding the event handlers on the
server side. The event handlers then simply trigger a navigation IPC message.
The old menu was handling more than we needed: it was doing spell-checking,
which has been built into electron since v8.0.0, and it was also overly
complicated. The new version should be a bit easier to read.
Avoiding use of the remote module means that a lot of things have to be
handled via explicit IPC (instead of relying on implicit proxy objects from
the remote module) and especially for the "Copy Message Text" and "Copy
Message Reference" items and such I had to hack a bit. As a result, this
*might* still have race conditions that would mean that text doesn't get
copied, or an outdated version of it.
@black-puppydog black-puppydog marked this pull request as ready for review March 6, 2021 22:33
@black-puppydog black-puppydog merged commit 06ded70 into master Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants