Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikage0o0 committed Oct 13, 2023
1 parent bc784b1 commit b600a03
Show file tree
Hide file tree
Showing 28 changed files with 1,443 additions and 1,351 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "link-arg=-lc"]
[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "link-arg=-lc"]
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye"

// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
60 changes: 30 additions & 30 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: buildDockerImage

on:
push:
branches:
- 'master'

jobs:
build_matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: chikage/matrix_bot:latest
name: buildDockerImage

on:
push:
branches:
- 'master'

jobs:
build_matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: chikage/matrix_bot:latest
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"rust-analyzer.showUnlinkedFileNotification": false
{
"rust-analyzer.showUnlinkedFileNotification": false
}
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[workspace]
members = [
"matrix_bot",
"matrix_bot_core",

# plugins
"plugins/yande_popular",
"plugins/webhook",
"plugins/qbittorrent",
]
resolver = "2"


[profile.release]
codegen-units = 1
lto = true
opt-level = 'z'
panic = "abort"
strip = true
[workspace]
members = [
"matrix_bot",
"matrix_bot_core",

# plugins
"plugins/yande_popular",
"plugins/webhook",
"plugins/qbittorrent",
]
resolver = "2"


[profile.release]
codegen-units = 1
lto = true
opt-level = 'z'
panic = "abort"
strip = true
38 changes: 19 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM rust:1.72.1-alpine3.18 as builder
COPY . /app
WORKDIR /app
RUN apk add --no-cache --virtual .build-deps \
make \
musl-dev \
openssl-dev \
perl \
pkgconfig \
openssl-libs-static \
&& cargo build --bin matrix_bot --release

FROM alpine:3.18
LABEL maintainer="Chikage <[email protected]>" \
org.opencontainers.image.source="https://github.com/Chikage0o0/matrix_bot"
COPY --from=builder /app/target/release/matrix_bot \
/usr/local/bin/matrix_bot
VOLUME ["/matrix_bot"]
ENV DATA_PATH=/matrix_bot
FROM rust:1.72.1-alpine3.18 as builder
COPY . /app
WORKDIR /app
RUN apk add --no-cache --virtual .build-deps \
make \
musl-dev \
openssl-dev \
perl \
pkgconfig \
openssl-libs-static \
&& cargo build --bin matrix_bot --release

FROM alpine:3.18
LABEL maintainer="Chikage <[email protected]>" \
org.opencontainers.image.source="https://github.com/Chikage0o0/matrix_bot"
COPY --from=builder /app/target/release/matrix_bot \
/usr/local/bin/matrix_bot
VOLUME ["/matrix_bot"]
ENV DATA_PATH=/matrix_bot
ENTRYPOINT ["/usr/local/bin/matrix_bot"]
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2023 Chikage0o0

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2023 Chikage0o0
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Matrix Bot

## 介绍
利用Matrix接口,实现Webhook、Yande 图片推送到Matrix的功能,支持E2EE信息推送。

## 使用
#### 命令行
```bash
./matrix_bot -S "https://ssdfsad" -u "sdfsadf" -p "1asdfasdf"
```
#### Docker
```bash
docker run -d --name matrix_bot \
-e HOMESERVER_URL="https://xxx.xxx" \
-e USERNAME="x" \
-e PASSWORD="x" \
-v ./matrix_bot:/matrix_bot \
--restart unless-stopped chikage/matrix_bot:latest
```
# Matrix Bot

## 介绍
利用Matrix接口,实现Webhook、Yande 图片推送到Matrix的功能,支持E2EE信息推送。

## 使用
#### 命令行
```bash
./matrix_bot -S "https://ssdfsad" -u "sdfsadf" -p "1asdfasdf"
```
#### Docker
```bash
docker run -d --name matrix_bot \
-e HOMESERVER_URL="https://xxx.xxx" \
-e USERNAME="x" \
-e PASSWORD="x" \
-v ./matrix_bot:/matrix_bot \
--restart unless-stopped chikage/matrix_bot:latest
```
插件的配置文件在`/matrix_bot/plugins`目录下
8 changes: 4 additions & 4 deletions matrix_bot_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod matrix;
pub mod sdk {
pub use matrix_sdk::config::SyncSettings;
}
pub mod matrix;
pub mod sdk {
pub use matrix_sdk::config::SyncSettings;
}
Loading

0 comments on commit b600a03

Please sign in to comment.