Software /
code /
prosody-modules
Changeset
3514:8811b7dbe6e2
mod_pubsub_github: Add support for specifying an actor with less privileges
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 31 Mar 2019 17:59:17 +0200 |
parents | 3513:9556e92b2ec4 |
children | 3515:f756e051fa02 |
files | mod_pubsub_github/README.markdown mod_pubsub_github/mod_pubsub_github.lua |
diffstat | 2 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_pubsub_github/README.markdown Sun Mar 31 17:47:45 2019 +0200 +++ b/mod_pubsub_github/README.markdown Sun Mar 31 17:59:17 2019 +0200 @@ -26,6 +26,7 @@ ----------------------- ------------------- ------------------------------------------------------------ `github_node` `"github"`{.lua} The pubsub node to publish commits on. `github_secret` *not set* Shared secret used to sign HTTP requests. + `github_actor` *superuser* Which actor to do the publish as (used for access control) The URL for Github to post to would be either:
--- a/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 17:47:45 2019 +0200 +++ b/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 17:59:17 2019 +0200 @@ -6,6 +6,7 @@ local pubsub_service = module:depends("pubsub").service; local node = module:get_option("github_node", "github"); +local github_actor = module:get_option_string("github_actor") or true; local secret = module:get_option("github_secret"); local error_mapping = { @@ -35,7 +36,7 @@ end -- else .. is this even github? for _, commit in ipairs(data.commits) do - local ok, err = pubsub_service:publish(node, true, data.repository.name, + local ok, err = pubsub_service:publish(node, github_actor, data.repository.name, st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) :tag("id"):text(commit.id):up()