├── .github ├── dependabot.yml └── workflows │ ├── audit.yml │ ├── nightly.yml │ └── rust.yml ├── .gitignore ├── .vscode └── settings.json ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── config.example.toml ├── migrations ├── 20200920112046_initial_layout.sql ├── 20201020174156_remote_user.sql ├── 20201022175053_activity_url.sql ├── 20201023130013_partial_unique_index_username.sql ├── 20201025201117_rename_activities_table.sql ├── 20201104191227_authorization.sql ├── 20201106224449_remove_not_null_application_id.sql ├── 20210119130652_remove_url_column.sql ├── 20210614155427_timestamp_to_timestamptz.sql └── 20210622131412_add_email_confirmation.sql ├── tranquility-content-length-limit ├── Cargo.toml └── src │ └── lib.rs ├── tranquility-http-signatures ├── .gitignore ├── Cargo.toml └── src │ ├── alg.rs │ ├── error.rs │ ├── key.rs │ ├── lib.rs │ ├── macros.rs │ ├── pem.rs │ ├── request.rs │ ├── signature.rs │ ├── sigstr.rs │ ├── tests.rs │ └── util.rs ├── tranquility-ratelimit ├── .gitignore ├── Cargo.toml └── src │ └── lib.rs ├── tranquility-types ├── .gitignore ├── Cargo.toml ├── README.md └── src │ ├── activitypub │ ├── activity.rs │ ├── actor.rs │ ├── attachment.rs │ ├── collection.rs │ ├── mod.rs │ ├── object.rs │ ├── tag.rs │ └── traits │ │ ├── mod.rs │ │ └── privacy.rs │ ├── lib.rs │ ├── mastodon │ ├── account.rs │ ├── app.rs │ ├── attachment.rs │ ├── card.rs │ ├── emoji.rs │ ├── field.rs │ ├── instance.rs │ ├── mention.rs │ ├── mod.rs │ ├── poll.rs │ ├── source.rs │ ├── status.rs │ └── tag.rs │ ├── nodeinfo.rs │ ├── tests.rs │ ├── util.rs │ └── webfinger.rs └── tranquility ├── .gitignore ├── Cargo.toml ├── build.rs ├── sqlx-data.json ├── src ├── activitypub │ ├── deliverer.rs │ ├── fetcher.rs │ ├── handler │ │ ├── accept.rs │ │ ├── announce.rs │ │ ├── create.rs │ │ ├── delete.rs │ │ ├── follow.rs │ │ ├── like.rs │ │ ├── mod.rs │ │ ├── reject.rs │ │ ├── undo.rs │ │ └── update.rs │ ├── instantiate.rs │ ├── interactions.rs │ ├── mod.rs │ └── routes │ │ ├── followers.rs │ │ ├── following.rs │ │ ├── inbox.rs │ │ ├── mod.rs │ │ ├── objects.rs │ │ ├── outbox.rs │ │ └── users.rs ├── api │ ├── mastodon │ │ ├── accounts.rs │ │ ├── apps.rs │ │ ├── convert.rs │ │ ├── instance.rs │ │ ├── mod.rs │ │ └── statuses.rs │ ├── mod.rs │ ├── oauth │ │ ├── authorize.rs │ │ ├── mod.rs │ │ └── token.rs │ └── register.rs ├── cli.rs ├── config.rs ├── consts.rs ├── crypto.rs ├── daemon.rs ├── database │ ├── actor.rs │ ├── follow.rs │ ├── inbox_urls.rs │ ├── mod.rs │ ├── oauth │ │ ├── application.rs │ │ ├── authorization.rs │ │ ├── mod.rs │ │ └── token.rs │ ├── object.rs │ └── outbox.rs ├── email.rs ├── error.rs ├── macros.rs ├── main.rs ├── server.rs ├── state.rs ├── tests │ ├── mod.rs │ ├── nodeinfo.rs │ └── register.rs ├── util │ ├── mention.rs │ └── mod.rs └── well_known │ ├── mod.rs │ ├── nodeinfo.rs │ └── webfinger.rs └── templates ├── base.html └── oauth ├── authorize.html └── token.html /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "cargo" 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | open-pull-requests-limit: 10 13 | commit-message: 14 | prefix: "chore" 15 | 16 | -------------------------------------------------------------------------------- /.github/workflows/audit.yml: -------------------------------------------------------------------------------- 1 | name: Security audit 2 | on: 3 | push: 4 | paths: 5 | - '**/Cargo.toml' 6 | - '**/Cargo.lock' 7 | 8 | jobs: 9 | security_audit: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - uses: actions-rs/audit-check@v1 14 | with: 15 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/nightly.yml: -------------------------------------------------------------------------------- 1 | on: 2 | schedule: 3 | - cron: '0 1 * * *' 4 | 5 | name: Nightly build 6 | 7 | env: 8 | CARGO_TERM_COLOR: always 9 | 10 | jobs: 11 | build: 12 | name: Build (Linux x86) 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout sources 16 | uses: actions/checkout@v2 17 | 18 | - name: Install stable toolchain 19 | uses: actions-rs/toolchain@v1 20 | with: 21 | toolchain: stable 22 | override: true 23 | 24 | - uses: actions/cache@v2 25 | with: 26 | path: | 27 | ~/.cargo/registry 28 | ~/.cargo/git 29 | target 30 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 31 | 32 | - name: Run cargo build 33 | uses: actions-rs/cargo@v1 34 | with: 35 | command: build 36 | args: --release --features email,jaeger,markdown 37 | 38 | - shell: bash 39 | run: strip target/release/tranquility 40 | 41 | - shell: bash 42 | run: mv target/release/tranquility target/release/tranquility-x86 43 | 44 | - uses: actions/upload-artifact@v2 45 | with: 46 | name: tranquility-linux 47 | path: target/release/tranquility-x86 48 | retention-days: 1 49 | 50 | build_armv7: 51 | name: Build (Linux ARMv7) 52 | runs-on: ubuntu-latest 53 | steps: 54 | - uses: actions/checkout@v2 55 | - uses: actions-rs/toolchain@v1 56 | with: 57 | toolchain: stable 58 | target: armv7-unknown-linux-gnueabihf 59 | override: true 60 | 61 | - uses: actions/cache@v2 62 | with: 63 | path: | 64 | ~/.cargo/registry 65 | ~/.cargo/git 66 | target 67 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 68 | 69 | - uses: actions-rs/cargo@v1 70 | with: 71 | use-cross: true 72 | command: build 73 | args: --release --target armv7-unknown-linux-gnueabihf --features jaeger,markdown 74 | 75 | - shell: bash 76 | run: mv target/armv7-unknown-linux-gnueabihf/release/tranquility target/armv7-unknown-linux-gnueabihf/release/tranquility-armv7 77 | 78 | - uses: actions/upload-artifact@v2 79 | with: 80 | name: tranquility-linux-armv7 81 | path: target/armv7-unknown-linux-gnueabihf/release/tranquility-armv7 82 | retention-days: 1 83 | 84 | publish: 85 | needs: [build, build_armv7] 86 | runs-on: ubuntu-latest 87 | steps: 88 | - uses: dev-drprasad/delete-tag-and-release@v0.1.3 89 | env: 90 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 91 | with: 92 | delete_release: true 93 | tag_name: nightly 94 | 95 | - uses: actions/download-artifact@v2 96 | 97 | - name: Upload binaries 98 | uses: meeDamian/github-release@2.0 99 | with: 100 | token: ${{ secrets.GITHUB_TOKEN }} 101 | tag: nightly 102 | prerelease: true 103 | gzip: false 104 | files: > 105 | tranquility-linux-x86:./tranquility-linux/tranquility-x86 106 | tranquility-linux-armv7:./tranquility-linux-armv7/tranquility-armv7 107 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Checks 2 | 3 | on: 4 | pull_request: 5 | 6 | push: 7 | branches: 8 | - main 9 | 10 | env: 11 | CARGO_TERM_COLOR: always 12 | 13 | jobs: 14 | check: 15 | name: Check 16 | needs: fmt 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v2 20 | - uses: actions-rs/toolchain@v1 21 | with: 22 | profile: minimal 23 | toolchain: stable 24 | override: true 25 | 26 | - uses: actions/cache@v2 27 | with: 28 | path: | 29 | ~/.cargo/registry 30 | ~/.cargo/git 31 | target 32 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 33 | 34 | - uses: actions-rs/cargo@v1 35 | with: 36 | command: check 37 | 38 | check_all_features: 39 | name: Check (all features) 40 | needs: fmt 41 | runs-on: ubuntu-latest 42 | steps: 43 | - uses: actions/checkout@v2 44 | - uses: actions-rs/toolchain@v1 45 | with: 46 | profile: minimal 47 | toolchain: stable 48 | override: true 49 | 50 | - uses: actions/cache@v2 51 | with: 52 | path: | 53 | ~/.cargo/registry 54 | ~/.cargo/git 55 | target 56 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 57 | 58 | - uses: actions-rs/cargo@v1 59 | with: 60 | command: check 61 | args: --all-features 62 | 63 | check_no_default: 64 | name: Check (no features) 65 | needs: fmt 66 | runs-on: ubuntu-latest 67 | steps: 68 | - uses: actions/checkout@v2 69 | - uses: actions-rs/toolchain@v1 70 | with: 71 | profile: minimal 72 | toolchain: stable 73 | override: true 74 | 75 | - uses: actions/cache@v2 76 | with: 77 | path: | 78 | ~/.cargo/registry 79 | ~/.cargo/git 80 | target 81 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 82 | 83 | - uses: actions-rs/cargo@v1 84 | with: 85 | command: check 86 | args: --no-default-features 87 | 88 | test: 89 | name: Test 90 | needs: [ fmt, clippy, check, check_all_features, check_no_default ] 91 | runs-on: ubuntu-latest 92 | 93 | services: 94 | postgres: 95 | image: postgres:alpine 96 | env: 97 | POSTGRES_USER: tranquility 98 | POSTGRES_PASSWORD: tranquility 99 | POSTGRES_DB: tests 100 | ports: 101 | - 5432:5432 102 | 103 | steps: 104 | - uses: actions/checkout@v2 105 | - uses: actions-rs/toolchain@v1 106 | with: 107 | profile: minimal 108 | toolchain: stable 109 | override: true 110 | 111 | - uses: actions/cache@v2 112 | with: 113 | path: | 114 | ~/.cargo/registry 115 | ~/.cargo/git 116 | target 117 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 118 | 119 | - uses: actions-rs/cargo@v1 120 | env: 121 | TEST_DB_URL: postgres://tranquility:tranquility@localhost:5432/tests 122 | with: 123 | command: test 124 | args: -- --show-output 125 | 126 | fmt: 127 | name: Rustfmt 128 | runs-on: ubuntu-latest 129 | steps: 130 | - uses: actions/checkout@v2 131 | - uses: actions-rs/toolchain@v1 132 | with: 133 | profile: minimal 134 | toolchain: stable 135 | override: true 136 | - run: rustup component add rustfmt 137 | - uses: actions-rs/cargo@v1 138 | with: 139 | command: fmt 140 | args: --all -- --check 141 | 142 | clippy: 143 | name: Clippy 144 | needs: fmt 145 | runs-on: ubuntu-latest 146 | steps: 147 | - uses: actions/checkout@v2 148 | - uses: actions-rs/toolchain@v1 149 | with: 150 | profile: minimal 151 | toolchain: stable 152 | override: true 153 | 154 | - uses: actions/cache@v2 155 | with: 156 | path: | 157 | ~/.cargo/registry 158 | ~/.cargo/git 159 | target 160 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 161 | 162 | - run: rustup component add clippy 163 | - uses: actions-rs/cargo@v1 164 | with: 165 | command: clippy 166 | args: --all-features -- -D warnings -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | config.json 3 | config.toml 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.allFeatures": true 3 | } -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [profile.release] 2 | lto = "thin" 3 | strip = true 4 | 5 | [workspace] 6 | members = [ 7 | "tranquility", 8 | "tranquility-content-length-limit", 9 | "tranquility-http-signatures", 10 | "tranquility-ratelimit", 11 | "tranquility-types", 12 | ] 13 | 14 | # TODO: Remove once SQLx v0.6 is out 15 | [patch.crates-io] 16 | sqlx = { git = "https://github.com/launchbadge/sqlx.git", rev = "826e63fc11fc43ce92099b6844d8a9155bf38356" } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2022 aumetra 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |