Transmissionic
Transmissionic copied to clipboard
Transmissionic fails when behind a proxy without specifying a port
Describe the bug
A large chunk of people, myself included use NGINX as a reverse proxy to access transmission-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
- Add a server.
- Even with the port field empty, it appends
:9091
.
Visually,:
Platform:
- Reproduced on iOS and Windows 11
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.
- The
getRequestUrl
function - 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
};
- 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.
https://github.com/6c65726f79/Transmissionic/pull/1374