-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2: delete old bridge and add stub v2 bridge
- Loading branch information
Showing
76 changed files
with
450 additions
and
6,980 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: Bug report | ||
about: If something is definitely wrong in the bridge (rather than just a setup issue), | ||
file a bug report. Remember to include relevant logs. | ||
labels: bug | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contact_links: | ||
- name: Troubleshooting docs & FAQ | ||
url: https://docs.mau.fi/bridges/general/troubleshooting.html | ||
about: Check this first if you're having problems setting up the bridge. | ||
- name: Support room | ||
url: https://matrix.to/#/#twitter:maunium.net | ||
about: For setup issues not answered by the troubleshooting docs, ask in the Matrix room. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
name: Enhancement request | ||
about: Submit a feature request or other suggestion | ||
labels: enhancement | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Go | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: ["1.22"] | ||
name: Lint ${{ matrix.go-version == '1.22' && '(latest)' || '(old)' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
|
||
- name: Install libolm | ||
run: sudo apt-get install libolm-dev libolm3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
export PATH="$HOME/go/bin:$PATH" | ||
- name: Run pre-commit | ||
uses: pre-commit/action@v3.0.1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
/.idea/ | ||
|
||
/.venv | ||
/env/ | ||
pip-selfcheck.json | ||
*.pyc | ||
__pycache__ | ||
/build | ||
/dist | ||
/*.egg-info | ||
/.eggs | ||
mautrix-twitter | ||
logs/ | ||
*.db* | ||
*.yaml | ||
!example-config.yaml | ||
!.pre-commit-config.yaml | ||
/start | ||
|
||
/config.yaml | ||
/registration.yaml | ||
*.log* | ||
*.db | ||
*.pickle | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
include: | ||
- project: 'mautrix/ci' | ||
file: '/python.yml' | ||
file: '/gov2.yml' | ||
|
||
variables: | ||
BINARY_NAME_V2: mautrix-twitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude_types: [markdown] | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
|
||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: v1.0.0-rc.1 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
files: ^(mautwitdm|mautrix_twitter)/.*\.pyi?$ | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
- id: go-imports-repo | ||
args: | ||
- "-local" | ||
- "go.mau.fi/mautrix-twitter" | ||
- "-w" | ||
- id: go-vet-repo-mod | ||
- id: go-staticcheck-repo-mod | ||
- id: go-mod-tidy | ||
|
||
- repo: https://github.com/beeper/pre-commit-go | ||
rev: v0.3.1 | ||
hooks: | ||
- id: isort | ||
files: ^(mautwitdm|mautrix_twitter)/.*\.pyi?$ | ||
- id: zerolog-ban-msgf | ||
- id: zerolog-use-stringer |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM alpine:3.20 | ||
|
||
ENV UID=1337 \ | ||
GID=1337 | ||
|
||
RUN apk add --no-cache ffmpeg su-exec ca-certificates bash jq curl yq-go | ||
|
||
ARG EXECUTABLE=./mautrix-twitter | ||
COPY $EXECUTABLE /usr/bin/mautrix-twitter | ||
COPY ./docker-run.sh /docker-run.sh | ||
ENV BRIDGEV2=1 | ||
VOLUME /data | ||
WORKDIR /data | ||
|
||
CMD ["/docker-run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
The mautrix-twitter developers grant the following special exceptions: | ||
|
||
* to Beeper the right to embed the program in the Beeper clients and servers, | ||
and use and distribute the collective work without applying the license to | ||
the whole. | ||
* to Element the right to distribute compiled binaries of the program as a part | ||
of the Element Server Suite and other server bundles without applying the | ||
license. | ||
|
||
All exceptions are only valid under the condition that any modifications to | ||
the source code of mautrix-twitter remain publicly available under the terms | ||
of the GNU AGPL version 3 or later. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
MAUTRIX_VERSION=$(cat go.mod | grep 'maunium.net/go/mautrix ' | awk '{ print $2 }' | head -n1) | ||
GO_LDFLAGS="-s -w -X main.Tag=$(git describe --exact-match --tags 2>/dev/null) -X main.Commit=$(git rev-parse HEAD) -X 'main.BuildTime=`date -Iseconds`' -X 'maunium.net/go/mautrix.GoModVersion=$MAUTRIX_VERSION'" | ||
go build -ldflags="$GO_LDFLAGS" ./cmd/mautrix-twitter "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// mautrix-twitter - A Matrix-Slack puppeting bridge. | ||
// Copyright (C) 2024 Tulir Asokan | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
package main | ||
|
||
func main() { | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
#!/bin/sh | ||
|
||
# Define functions. | ||
if [[ -z "$GID" ]]; then | ||
GID="$UID" | ||
fi | ||
|
||
BINARY_NAME=/usr/bin/mautrix-twitter | ||
|
||
function fixperms { | ||
chown -R $UID:$GID /data | ||
|
||
# /opt/mautrix-twitter is read-only, so disable file logging if it's pointing there. | ||
if [[ "$(yq e '.logging.handlers.file.filename' /data/config.yaml)" == "./mautrix-twitter.log" ]]; then | ||
yq -I4 e -i 'del(.logging.root.handlers[] | select(. == "file"))' /data/config.yaml | ||
yq -I4 e -i 'del(.logging.handlers.file)' /data/config.yaml | ||
fi | ||
} | ||
|
||
cd /opt/mautrix-twitter | ||
|
||
if [ ! -f /data/config.yaml ]; then | ||
cp example-config.yaml /data/config.yaml | ||
if [[ ! -f /data/config.yaml ]]; then | ||
$BINARY_NAME -c /data/config.yaml -e | ||
echo "Didn't find a config file." | ||
echo "Copied default config file to /data/config.yaml" | ||
echo "Modify that config file to your liking." | ||
echo "Start the container again after that to generate the registration file." | ||
fixperms | ||
exit | ||
fi | ||
|
||
if [ ! -f /data/registration.yaml ]; then | ||
python3 -m mautrix_twitter -g -c /data/config.yaml -r /data/registration.yaml || exit $? | ||
if [[ ! -f /data/registration.yaml ]]; then | ||
$BINARY_NAME -g -c /data/config.yaml -r /data/registration.yaml | ||
echo "Didn't find a registration file." | ||
echo "Generated one for you." | ||
echo "See https://docs.mau.fi/bridges/general/registering-appservices.html on how to use it." | ||
fixperms | ||
exit | ||
fi | ||
|
||
cd /data | ||
fixperms | ||
exec su-exec $UID:$GID python3 -m mautrix_twitter -c /data/config.yaml | ||
exec su-exec $UID:$GID $BINARY_NAME |
Oops, something went wrong.