aboutsummaryrefslogtreecommitdiff
path: root/modules/git_webhooks/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-24 17:13:51 +0100
committerGravatar jesopo2019-06-24 17:14:39 +0100
commit6b8120dc517a1b41c9fc951d989b53746c8fadb0 (patch)
tree7d427c5eaf5a4b21d99bef00c8dcc18bfb07e3cb /modules/git_webhooks/__init__.py
parentAdd missing 'utils' import (diff)
signature
Add gitea.py, fix some consts being in the wrong file
Diffstat (limited to 'modules/git_webhooks/__init__.py')
-rw-r--r--modules/git_webhooks/__init__.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/git_webhooks/__init__.py b/modules/git_webhooks/__init__.py
index d861e5bb..e140d33d 100644
--- a/modules/git_webhooks/__init__.py
+++ b/modules/git_webhooks/__init__.py
@@ -1,9 +1,13 @@
import itertools, json, urllib.parse
from src import ModuleManager, utils
-from . import colors, github
+from . import colors, gitea, github
FORM_ENCODED = "application/x-www-form-urlencoded"
+DEFAULT_EVENT_CATEGORIES = [
+ "ping", "code", "pr", "issue", "repo"
+]
+
@utils.export("channelset", {"setting": "git-prevent-highlight",
"help": "Enable/disable preventing highlights",
"validate": utils.bool_or_none, "example": "on"})
@@ -16,12 +20,18 @@ FORM_ENCODED = "application/x-www-form-urlencoded"
class Module(ModuleManager.BaseModule):
def on_load(self):
self._github = github.GitHub()
+ self._gitea = gitea.Gitea()
@utils.hook("api.post.github")
def _api_github_webhook(self, event):
return self._webhook("github", "GitHub", self._github,
event["data"], event["headers"])
+ @utils.hook("api.post.gitea")
+ def _api_gitea_webhook(self, event):
+ return self._webhook("gitea", "Gitea", self._github,
+ event["data"], event["headers"])
+
def _webhook(self, webhook_type, webhook_name, handler, payload_str,
headers):
payload = payload_str.decode("utf8")