From e6121b3f52596d8cf455e65b20eb0914f8bf1b05 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 8 Aug 2024 14:51:21 +0000 Subject: [PATCH] chore: Moving to Forgejo instead of Github Signed-off-by: Awiteb --- .forgejo/workflows/ci.yml | 25 ++++++++++++++++ .github/FUNDING.yml | 1 - .github/workflows/auto_close_pr.yml | 34 +++++++++++++++++++++ .github/workflows/cd.yml | 35 ---------------------- .github/workflows/ci.yml | 44 --------------------------- README.md | 46 ++++++++++++++++------------- 6 files changed, 85 insertions(+), 100 deletions(-) create mode 100644 .forgejo/workflows/ci.yml delete mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/auto_close_pr.yml delete mode 100644 .github/workflows/cd.yml delete mode 100644 .github/workflows/ci.yml diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..a504b8b --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Rust CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + rust_ci: + name: Rust CI + runs-on: debian + steps: + - uses: actions/checkout@v4 + - uses: https://codeberg.org/TheAwiteb/rust-action@v1.75 + - name: Check MSRV + run: cargo +1.75 build + - name: Build the source code + run: cargo build + - name: Check the code format + run: cargo fmt -- --check + - name: Run cargo-check + run: cargo check + - name: Run cargo-clippy + run: cargo clippy -- -D warnings \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 07292fe..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: "TheAwiteb" \ No newline at end of file diff --git a/.github/workflows/auto_close_pr.yml b/.github/workflows/auto_close_pr.yml new file mode 100644 index 0000000..9a298c7 --- /dev/null +++ b/.github/workflows/auto_close_pr.yml @@ -0,0 +1,34 @@ +name: Auto close PR + +on: + pull_request: + types: [opened, reopened] + +jobs: + close_pr: + name: Auto close PR + runs-on: ubuntu-latest + steps: + - name: Send close comment + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $PAT" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \ + -d '{"body":"${{ env.BODY }}"}' + env: + PAT: ${{ secrets.PAT }} + BODY: This repository is mirror only and you cannot create a pull request for it. Please open your PR in https://git.4rs.nl/awiteb/salvo-captcha + - name: Close the PR + run: | + curl -L \ + -X PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $PAT" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }} \ + -d '{"state":"closed"}' + env: + PAT: ${{ secrets.PAT }} diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 21322e1..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: CD - -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+ - -jobs: - release: - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@stable - - name: Build Changelog 🏗 - id: changelog - uses: mikepenz/release-changelog-builder-action@v4.0.0 - with: - configuration: "./.github/config/changelog-builder-action.json" - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Create Release 🖋 - uses: softprops/action-gh-release@v1 - with: - prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'pre') }} - body: ${{steps.changelog.outputs.changelog}} - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Publish to crates.io 🚀 - uses: katyo/publish-crates@v2 - with: - token: ${{ secrets.PAT }} - registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index fe291c2..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: CI - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - name: Rust build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo build --workspace --all-features --all-targets - rustfmt: - name: Rust format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo fmt -- --check - check: - name: Rust check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo check --workspace --all-features --all-targets - clippy: - name: Rust clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo clippy --workspace --all-features -- -D warnings - test: - name: Rust test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo test --workspace --all-features diff --git a/README.md b/README.md index 02cd22b..9e036cf 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ A captcha middleware for [salvo](salvo.rs) framework. It uses [`captcha`](https: -### Add to your project +## Add to your project + First, add the following to your `Cargo.toml`: ```toml @@ -22,36 +23,41 @@ Or use [cargo-add](https://doc.rust-lang.org/cargo/commands/cargo-add.html) to a $ cargo add salvo-captcha ``` -### Usage +## Usage + See the [examples](examples) directory for a complete example. +## Storage -### Storage -The storage of the captcha is handled by a [`CaptchaStore`] trait. You can implement your own storage or use the `cacache-rs` by enabling the `cacache-storage` feature. +The storage of the captcha is handled by a [`CaptchaStore`] trait. You can implement your own storage or use the [`cacache-rs`] by enabling the `cacache-storage` feature. ```toml [dependencies] salvo-captcha = { version = "0.1", features = ["cacache-storage"] } ``` -### Captcha name and difficulty -In this table you can see the different between the difficulties and the name of the captcha. +## Captcha name and difficulty -| Name | Difficulty | Image | -|------|------------|-------| -| `Amelia` | Easy | ![Simple](https://i.suar.me/1JaxG/s) | -| `Amelia` | Medium | ![Simple](https://i.suar.me/l7zBl/s) | -| `Amelia` | Hard | ![Simple](https://i.suar.me/qXAlx/s) | -| `Lucy` | Easy | ![Simple](https://i.suar.me/edwBG/s) | -| `Lucy` | Medium | ![Simple](https://i.suar.me/NJmg0/s) | -| `Lucy` | Hard | ![Simple](https://i.suar.me/OJK7M/s) | -| `Mila` | Easy | ![Simple](https://i.suar.me/dO78z/s) | -| `Mila` | Medium | ![Simple](https://i.suar.me/PXBwK/s) | -| `Mila` | Hard | ![Simple](https://i.suar.me/8edgE/s) | +In this table, you can see the difference between the difficulties and the name of the captcha. + +| Name | Easy | Medium | Hard | +| :----: | :----------------------------------: | :----------------------------------: | :----------------------------------: | +| Amelia | ![Simple](https://i.suar.me/1JaxG/s) | ![Simple](https://i.suar.me/l7zBl/s) | ![Simple](https://i.suar.me/qXAlx/s) | +| Lucy | ![Simple](https://i.suar.me/edwBG/s) | ![Simple](https://i.suar.me/NJmg0/s) | ![Simple](https://i.suar.me/OJK7M/s) | +| Mila | ![Simple](https://i.suar.me/dO78z/s) | ![Simple](https://i.suar.me/PXBwK/s) | ![Simple](https://i.suar.me/8edgE/s) | + +## Mirrors + +- Github (https://github.com/TheAwiteb/salvo-captcha) +- Codeberg (https://codeberg.org/awiteb/salvo-captcha) + +### Main Repository + +- My Git (https://git.4rs.nl/awiteb/salvo-captcha) + +## License -### License This project is licensed under the MIT license for more details see [LICENSE](LICENSE) or http://opensource.org/licenses/MIT. - [`CaptchaStore`]: https://docs.rs/salvo_captcha/0.1.0/salvo_captcha/trait.CaptchaStore.html -[cacache-rs]: https://github.com/zkat/cacache-rs \ No newline at end of file +[`cacache-rs`]: https://github.com/zkat/cacache-rs