Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using port other than 80 to host proxy #7

Closed
Akasiek opened this issue May 30, 2024 · 4 comments
Closed

Using port other than 80 to host proxy #7

Akasiek opened this issue May 30, 2024 · 4 comments

Comments

@Akasiek
Copy link

Akasiek commented May 30, 2024

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
Copy link
Owner

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
Copy link
Author

Akasiek commented May 30, 2024

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
Copy link

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

@Akasiek
Copy link
Author

Akasiek commented Jun 1, 2024

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...

@Akasiek Akasiek closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants