Podginator / KoboOmnivoreConverter

A Proxy to enable the Kobo Clara to use Omnivore over Pocket for it's articles.
64 stars 9 forks source link

Using port other than 80 to host proxy #7

Closed Akasiek closed 5 months ago

Akasiek commented 5 months ago

Hi! Is there any way to not use port 80 for proxy? I'm using my Synology NAS to host the proxy but I already use port 80 on it and I cannot change it.

Is it as easy as just changing this line in index.js? Or maybe I need to change the hosts file on my Kobo too?

// Start the server on port 8080
server.listen(80, () => {
    console.log("Server running on port 5090");
});

I'm not even going to ask why there are 3 different ports here...


I'm getting this error when running node ./index.js &:

Akasiek@Coriolanus:~/KoboOmnivoreConverter$ sudo node ./index.js &
[1] 3125
Akasiek@Coriolanus:~/KoboOmnivoreConverter$ node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::80
    at Server.setupListenHandle [as _listen2] (node:net:1872:16)
    at listenInCluster (node:net:1920:12)
    at Server.listen (node:net:2008:7)
    at /volume1/homes/Akasiek/KoboOmnivoreConverter/index.js:55:12
    at Generator.next (<anonymous>)
    at /volume1/homes/Akasiek/KoboOmnivoreConverter/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/volume1/homes/Akasiek/KoboOmnivoreConverter/index.js:4:12)
    at /volume1/homes/Akasiek/KoboOmnivoreConverter/index.js:20:8
    at Object.<anonymous> (/volume1/homes/Akasiek/KoboOmnivoreConverter/index.js:58:4)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1899:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 80
}

Node.js v20.9.0
Podginator commented 5 months ago

Heh - That is classic Copy and Paste nonsense. Really should have fixed it.

Anyway, it should be possible, but it'll require more than just changing the port.

If you know which IP the server is running on you can change the file https://github.com/Podginator/KoboOmnivoreConverter/blob/main/hook/pocket.cc and recompile it, similar to what is said in this file https://github.com/Podginator/KoboOmnivoreConverter/blob/main/hook/README.md

then just have 192.168.0.whatever:port and rerun the server on that port number.

The original version of this replaced some hardcoded strings in a library, so the port 80 stuff is a remnant of that.

Akasiek commented 5 months ago

Ok. I have followed all the steps. Now the server and Kobo seem to see each other, but I still get this error:

UnsupportedMediaTypeError: unsupported charset "UTF8"
    at jsonParser (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/body-parser/lib/types/json.js:130:12)
    at Layer.handle [as handle_request] (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:328:13)
    at /volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:346:12)
    at next (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:280:10)
    at expressInit (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:328:13)
    at /volume1/homes/Akasiek/KoboOmnivoreConverter/node_modules/express/lib/router/index.js:286:9

Probably a completely different problem now...

jeremyharper commented 5 months ago

Oh hey, @Akasiek, I had the same issue and fixed it here: https://github.com/Podginator/KoboOmnivoreConverter/issues/8

Akasiek commented 5 months ago

Oh hey, @Akasiek, I had the same issue and fixed it here: #8

Thanks! You should maybe also create a Pull Request.

Although now that I'm looking at it, it looks like the dependency is to blame...