aboutsummaryrefslogtreecommitdiff
path: root/modules/git_webhooks/__init__.py
diff options
context:
space:
mode:
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")