6c65726f79 / Transmissionic

Remote for Transmission Daemon
MIT License
453 stars 33 forks source link

Transmissionic fails when behind a proxy without specifying a port #1373

Open taylorcox75 opened 1 year ago

taylorcox75 commented 1 year ago

Describe the bug A large chunk of people, myself included use NGINX as a reverse proxy to accesstransmission-daemon via a subdomain / without a port behind. Meaning it's behind a proxy with no open ports to the internet. i.e. torrent.mydomain.com or mydomain.com/torrent.

Transmissionic does not work without a port as the :is hard coded regardless of if the user gives one. So if I leave that field blank, the url it parses is torrent.mydomain:9091/transmission/rpc/ or mydomain.com/torrent:9091/transmission/rpc/

To Reproduce

  1. Add a server.
  2. Even with the port field empty, it appends :9091.

Visually,: alt text

Platform:

Cause:

getRequestUrl(): string {
    let result = this.options.https ? "https":"http";
    result += "://"+this.options.host+":"+this.options.port+this.options.path; <----- Note the `+":"+`
    return result;
  }

So the URL will always have :port in it.

Fix: Add conditional logic in 2 places.

  1. The getRequestUrl function
  2. The loop that parses the user's input and maps it to an array.

If we only did step 1, the empty port field would be overwritten here:

 this.options = {
      host:'localhost',
      path:'/transmission/rpc',
      port:9091, <-----------------------
      port:'',
      https:false,
      timeout:timeout
    };
  1. There is no need to use a v-model-number. As we treat this field as a string everywhere, v-model equally works. There was some random edge case where a blank value wouldn't be accepted (i.e. what happens if the user enters then deletes the number value, replacing it with an empty string).
    <ion-input v-model.number="newConf.port" type="number" placeholder="9091"></ion-input>

I have already made these changes for a local build of this app, and have created a pull request if this was something you wanted patched here too.

taylorcox75 commented 1 year ago

https://github.com/6c65726f79/Transmissionic/pull/1374