Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maubot
gitlab
Commits
fd424375
Unverified
Commit
fd424375
authored
5 years ago
by
Lorenz Steinert
Browse files
Options
Downloads
Patches
Plain Diff
remove submodule
parent
357cbdf2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gitlab
+0
-1
0 additions, 1 deletion
gitlab
gitlab/__init__.py
+58
-0
58 additions, 0 deletions
gitlab/__init__.py
with
58 additions
and
1 deletion
gitlab
@
5643b7a5
Subproject commit 5643b7a5ec9b514603b4e7ba173607f7c0b4defd
This diff is collapsed.
Click to expand it.
gitlab/__init__.py
0 → 100644
+
58
−
0
View file @
fd424375
from
typing
import
Type
from
aiohttp
import
web
from
mautrix.types
import
EventType
from
mautrix.util.config
import
BaseProxyConfig
,
ConfigUpdateHelper
from
maubot
import
Plugin
,
MessageEvent
from
maubot.handlers
import
event
class
Config
(
BaseProxyConfig
):
def
do_update
(
self
,
helper
:
ConfigUpdateHelper
)
->
None
:
helper
.
copy
(
"
path
"
)
helper
.
copy
(
"
port
"
)
helper
.
copy
(
"
secret
"
)
helper
.
copy
(
"
base_command
"
)
class
Gitlab
(
Plugin
):
routes
=
web
.
RouteTableDef
()
async
def
post_handler
(
self
,
request
):
if
not
request
.
headers
[
'
X-Gitlab-Token
'
]
==
self
.
config
[
'
secret
'
]:
self
.
log
.
warn
(
'
unauthorised access
'
)
return
web
.
Response
()
self
.
log
.
debug
(
str
(
request
))
self
.
log
.
debug
(
str
(
request
.
query
[
'
room
'
]))
await
self
.
client
.
send_text
(
request
.
query
[
'
room
'
],
str
(
request
))
return
web
.
Response
()
async
def
start
(
self
)
->
None
:
self
.
config
.
load_and_update
()
self
.
app
=
web
.
Application
()
self
.
app
.
add_routes
([
web
.
post
(
self
.
config
[
'
path
'
],
self
.
post_handler
)])
self
.
runner
=
web
.
AppRunner
(
self
.
app
)
await
self
.
runner
.
setup
()
await
self
.
runner
.
setup
()
site
=
web
.
TCPSite
(
self
.
runner
,
'
0.0.0.0
'
,
self
.
config
[
'
port
'
])
await
site
.
start
()
async
def
stop
(
self
)
->
None
:
await
self
.
runner
.
cleanup
()
@event.on
(
EventType
.
ROOM_MESSAGE
)
async
def
handler
(
self
,
event
:
MessageEvent
)
->
None
:
if
event
.
sender
!=
self
.
client
.
mxid
:
for
ii
in
[
'
path
'
,
'
port
'
,
'
secret
'
,
'
base_command
'
]:
await
self
.
client
.
send_text
(
event
.
room_id
,
str
(
self
.
config
[
ii
]))
@classmethod
def
get_config_class
(
cls
)
->
Type
[
BaseProxyConfig
]:
return
Config
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment