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

Possibility for plugins to get the listening host and port #5416

Closed
JohnXLivingston opened this issue Nov 18, 2022 · 3 comments
Closed

Possibility for plugins to get the listening host and port #5416

JohnXLivingston opened this issue Nov 18, 2022 · 3 comments
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨

Comments

@JohnXLivingston
Copy link
Contributor

Describe the problem to be solved

For the livechat plugin, I need to make API Calls from a XMPP server running on the Peertube server, to the Peertube instance.

For now, I use the public Peertube url to make these requests.

But this has 2 drawbacks:

  • requests go through nginx, but they could bypass nginx to directly hit Peertube, as it is on the same server (and use http instead of https for better perf)
  • in Docker installations, this can be a problem (the public url is not correctly resolved)

To fix the second point, I added a settings to change the API endpoint url, and you can for example set http://127.0.0.1:9000

I want to make this simpler, and I'd like to automatically compute this endpoint.

But for now, plugin manager provide no way to get the local host and port (the values listen.hostname and listen.port in the config file).

Describe the solution you would like

I'd like to have listen.host and listen.port somewhere in the helpers provided by Peertube.

For example, by adding it in the result of the backend getServerConfig helper.

Or by adding a new helper here:

function buildConfigHelpers () {
return {
getWebserverUrl () {
return WEBSERVER.URL
},
getServerConfig () {
return ServerConfigManager.Instance.getServerConfig()
}
}
}
. Could be something like that:

function buildConfigHelpers () {
  return {
    getWebserverUrl () {
      return WEBSERVER.URL
    },
    getServerListeningOptions {
        return { hostname: WEBSERVER.HOSTNAME, port: WEBSERVER.PORT }
    },
    getServerConfig () {
      return ServerConfigManager.Instance.getServerConfig()
    }
  }
}
@Chocobozzz Chocobozzz changed the title Feature request: possibility for plugins to get the listening host and port Possibility for plugins to get the listening host and port Nov 24, 2022
@Chocobozzz Chocobozzz added Type: Feature Request ✨ Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development labels Nov 24, 2022
@JohnXLivingston
Copy link
Contributor Author

Hi @Chocobozzz
As you already know, there was a stress test last week.
I think this Feature Request will help me to optimize the livechat plugin.
See here (in french, english translation coming soon): https://www.john-livingston.fr/foss/article/plugin-de-tchat-peertube-retour-rapide-sur-un-test-de-montee-en-charge#3_modules_prosody_specifiques

Is it possible to include this in the next release?

@Chocobozzz
Copy link
Owner

Implemented in 60bab7b

@JohnXLivingston
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨
Projects
None yet
Development

No branches or pull requests

2 participants