naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.03k stars 316 forks source link

[DRAFT] Homebrewery as an Electron App #3502

Open G-Ambatte opened 3 weeks ago

G-Ambatte commented 3 weeks ago

This draft PR is some initial work towards enabling the use of Homebrewery locally as a standalone Electron app.

While this PR produces the base functionality, the following issues have been identified:

If you experiment with this and strike any issues, please record them here.

5e-Cleric commented 3 weeks ago
  • [ ] prompt, alert, confirm all do not work in ElectronJS

1537 was raised, we would need to get rid of those anyway.

login system does not work - uses prompt

If we are really working on a local version, we might as well use a different login system, similar to a OS login, simply username and password, and define a folder to save brews for every user.

switching to a new page often opens a new window

Right, we need to change how links work in local, or change it to a windowless browser instance, with multiple tabs..

G-Ambatte commented 3 weeks ago

we need to change how links work in local

Or just specify a new value for NODE_ENV : electron.

EDIT: A quick test of this shows that the forcessl.mw.js file also needed to be updated for this to work. Currently this has been achieved via manual edit, but there should be a better way to achieve the same result with less technical debt going forward.

G-Ambatte commented 3 weeks ago

login system does not work - uses prompt

This makes me think of <dialog> element showModal() method. It's not blocking, but it does present in the top-layer so cannot be behind anything, and all elements outside of the <dialog> are rendered inert while it is present, so the user cannot perform any other actions while it is displayed - but crucially, server side functions can continue as normal.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal

Gazook89 commented 3 weeks ago

Why would there be an account system at all?

5e-Cleric commented 3 weeks ago

Why would there be an account system at all?

For the same reason windows offers different accounts, multiple people might want multiple accounts in the same computer, i say we keep them for the local version.

G-Ambatte commented 3 weeks ago

Why would there be an account system at all?

If we were able to link to file system and thus have a users in their own folders, there might be less need for an account system.

That said, I still expect that some users will want to lock their documents so that it can't be viewed accidentally - and thus if they are exposed in the filesystem, they will not be protected. I'm not sure which option is the best way forward; at the moment, this is just a small experimental side branch.