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

getServerIp #3360

Open
1 task done
Dark-Dragon opened this issue Apr 8, 2024 · 1 comment
Open
1 task done

getServerIp #3360

Dark-Dragon opened this issue Apr 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Dark-Dragon
Copy link
Contributor

Is your feature request related to a problem? Please describe.

With discord rich presence getting more adoption from scripts and servers over time, it has become common practice to want to add a button to directly join the server via tha mtasa:// protocol. In order to do so the script needs to know the ip and port of the server. Getting the port is really simple and works like a charm, however the same can't be said about the IP, which is fairly inconvenient to retrieve as outlined in the 'describe alternatives you've considered'-section.

Describe the solution you'd like

Ideally the server and client would provide a simple script function to return the server IP. The client should already know which IP it's connected to and the server could cache its IP to return whenever a script requests it.

Describe alternatives you've considered

  1. The wiki recommends to use getServerConfigSetting("serverip") which isn't exactly useful as it will just return the string 'auto' unless the server uses a manually specified IP.

  2. Another way to retrieve the server IP is to fetch it from any IP lookup website, like checkip.dyndns.com as recommended here This is technically a great solution, except fetchRemote requires ACL rights, which I think shouldn't be required to do something as trivial as retrieving the server IP. Additionally having to rely on those services availability could potentially be annoying and the method to do it is currently very hidden on the wiki, which makes it harder for people to find.

  3. Hard coding the ip/hostname. It's not really something I'd consider a real alternative. This works if you're making a script specifically for one server, but anyone who just makes scripts for general/public use or wants to sell them to server owners wouldn't really want to make this needlessly complicated for the other party involved.

Additional context

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@Dark-Dragon Dark-Dragon added the enhancement New feature or request label Apr 8, 2024
@Disinterpreter
Copy link
Member

Disinterpreter commented Apr 9, 2024

IMHO it's simpler to implement STUN function for getting IP.
Or fix it for Discord Rich Presence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants