edrlab / thorium-reader

A cross platform desktop reading app, based on the Readium Desktop toolkit
https://www.edrlab.org/software/thorium-reader/
BSD 3-Clause "New" or "Revised" License
1.79k stars 154 forks source link

Thorium uses port 8000 #1504

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello,

Thank you so much for your work on this app. The Internet badly needs a good, cross-platform ebook reader.

I noticed that Thorium uses port 8000 even when it's downloaded as a standalone app.

As a result you can't run code snippets that default to http://localhost:8000/ like Django (a massively popular Python framework), for example.

llemeurfr commented 3 years ago

Hi, our lead dev is currently testing solutions which would allow the removal of the internal http server (which feeds the internal Chromium browser). If successful, this will solve this issue.

I didn't check the current port, but in the short term it could certainly be changed for something unused by major frameworks.

ghost commented 3 years ago

Amazing, thank you 🙏

danielweck commented 3 years ago

Thorium uses a library that finds an unused port for launching the HTTP server (aka "streamer"): https://github.com/edrlab/thorium-reader/blob/8a9807bca7d34c05d9719d823ae55bbf2a250478/src/main/redux/sagas/streamer.ts#L31-L33

We can set start and end boundaries for the search range, but we cannot exclude commonly-used ports (as far as I know): https://github.com/http-party/node-portfinder#ports-search-scope

Once the Electron bugs are solved, we will switch to a non-HTTP "streamer": https://github.com/edrlab/thorium-reader/pull/1258#issuecomment-729247364

llemeurfr commented 3 years ago

Looking at https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers it is true that finding free places is difficult.

ghost commented 3 years ago

Do you even need a server? Plenty of Electron apps don't ship with an active server. They build their projects then run the built files.

llemeurfr commented 3 years ago

@alvinometric see https://github.com/edrlab/thorium-reader/pull/1258.

danielweck commented 3 years ago

Do you even need a server?

To complete Laurent's answer: yes, Thorium needs to serve audio/video files via HTTP as streaming media is currently broken in Electron's custom URL protocol handler: https://github.com/edrlab/thorium-reader/pull/1258#issuecomment-729247364 We plan to remove the dependency on a HTTP server in a future Thorium release, once the audio/video bug is fixed.

ghost commented 3 years ago

Oh, I see. So the PR that fixes this has been merged but we're still waiting for it to be released as part of Electron 12. Did I understand that correctly?

danielweck commented 3 years ago

The merged PR enables a new HTTP-less mode in Thorium, which is currently turned off (at build time). We will activate this new feature once video/audio streaming works in Electron registerStreamerProtocol() (I have to run tests against v12 first, and note that Thorium currently builds on v11)

llemeurfr commented 3 years ago

Because we will move to an HTTP-less mode asap, we will close this issue now.

danielweck commented 3 years ago

It's coming! https://github.com/edrlab/thorium-reader/pull/1258#issuecomment-903984349

ghost commented 3 years ago

👏