mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Compare commits
338 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da92cf8f9f | |||
| 2811234219 | |||
| d029e0a0dd | |||
| 84144b2bc4 | |||
| ee6fde8f51 | |||
| 8132b98ac3 | |||
| db2f038f0a | |||
| 7848c9c71b | |||
| 77909d57f7 | |||
| ce3d16d040 | |||
| 6cbd2b1bfc | |||
| 70cfc6d2f5 | |||
| cddc323bd2 | |||
| cddf4f19bd | |||
| 8dabe60322 | |||
| d6a648b6e7 | |||
| e91f8a8395 | |||
| 8d10a1a919 | |||
| 2c3ef0f70c | |||
| ac71247ea9 | |||
| fceb1acb1f | |||
| b53ace8f3c | |||
| 086f2dae97 | |||
| 9900145221 | |||
| 24724b3db4 | |||
| 60a3d7df26 | |||
| d920dc169c | |||
| 0643ff1ced | |||
| 8a85fc43a6 | |||
| b8d3156b53 | |||
| 7de0dfe749 | |||
| 7d823915cd | |||
| 84f9ec03df | |||
| f95da87354 | |||
| dd196ffcc5 | |||
| b8cab22e54 | |||
| f6e5a5e92b | |||
| cdb53be5fb | |||
| daee4a234a | |||
| ec85635c0c | |||
| ccd0d93470 | |||
| 99b59859c0 | |||
| 38ad2384f0 | |||
| cca05845c0 | |||
| 985d5f57fe | |||
| 264c8fc68e | |||
| d05cb930ff | |||
| 6163005cf6 | |||
| e7270d1f7a | |||
| 66215952ee | |||
| da95ff74ea | |||
| 07ff893a38 | |||
| ea72673d32 | |||
| affc0ce1df | |||
| 0f81f730d8 | |||
| 9290542c84 | |||
| 16edacaeff | |||
| c73b7baaf5 | |||
| ea72d1ce42 | |||
| 6ad864c4a1 | |||
| bee92f3b5a | |||
| d5db048ec6 | |||
| c36e68e73c | |||
| 8f3627d55c | |||
| f8f0b8731e | |||
| 32686f8990 | |||
| 63b766bd74 | |||
| 79b84f5940 | |||
| 64b15f3cd3 | |||
| 19464b3211 | |||
| e7d018fa0d | |||
| ec1f0a1037 | |||
| 42a023b9d0 | |||
| 94e03574a8 | |||
| fffe4a3d69 | |||
| cb0edd90be | |||
| e885f6c8ad | |||
| b231f4bd2e | |||
| 66dbdc6533 | |||
| f2427ba09e | |||
| f9c680e6af | |||
| 2dbbb6b295 | |||
| f24e84145b | |||
| 7d230f5d90 | |||
| c23429eee6 | |||
| 7ed5c1e392 | |||
| 50589e5179 | |||
| 9591c52463 | |||
| b9fafc2e55 | |||
| 21fc6809de | |||
| 29eb1133bd | |||
| d39001a081 | |||
| 5cf2ca2400 | |||
| 1fe65ef19f | |||
| 777dbe1e8f | |||
| bda5848ec5 | |||
| 9e6ac44928 | |||
| 426b4fae83 | |||
| 8f6420e2d0 | |||
| 1f9584ca11 | |||
| a94903d88e | |||
| dcdbc5332a | |||
| 213cbaef42 | |||
| 588c9165ef | |||
| 085df57d84 | |||
| da698b6eea | |||
| 8ff74be592 | |||
| 846546f12d | |||
| 85c4440562 | |||
| ee1d89492e | |||
| 71674bdece | |||
| ff766e2383 | |||
| da678f1fcb | |||
| 27918f176b | |||
| 7d8ac9e3ce | |||
| bba0c44d1b | |||
| 8d9cac323a | |||
| fa96a573ca | |||
| 9690ad312e | |||
| c25a75b8aa | |||
| f421eaccda | |||
| b793201792 | |||
| 76de8f4137 | |||
| 9522e043a1 | |||
| 076433b21c | |||
| a1c7538d08 | |||
| 27c9be5e70 | |||
| d3f0110f93 | |||
| 923425b898 | |||
| 1d9eecbed5 | |||
| 7400d9e7a5 | |||
| a0476d9dc5 | |||
| c509dcc7b8 | |||
| d6da36314d | |||
| 3ff04eba7e | |||
| 8de1461103 | |||
| 039186b9e0 | |||
| 62acbe3a3e | |||
| 7e66d5b194 | |||
| e234f983a1 | |||
| c5b3db5735 | |||
| 392f7c88c1 | |||
| f1d36e2a89 | |||
| 62cf9655b0 | |||
| c6800a1288 | |||
| cd62747f39 | |||
| 763ce3d83e | |||
| 5a739e65e3 | |||
| 14967a54a1 | |||
| 3b2e909949 | |||
| b7e399b528 | |||
| 251ae82bba | |||
| fb7790cf56 | |||
| 901db92c85 | |||
| 7910d2f774 | |||
| 29e9442c2d | |||
| bb847974a4 | |||
| 0be4f5f0c6 | |||
| 8fbab1f87c | |||
| 687733bf7d | |||
| 72688c948f | |||
| dfef1bd284 | |||
| c3435db357 | |||
| fcfc582396 | |||
| e20840973e | |||
| 69031a125f | |||
| b0cfdeb61b | |||
| e8aa8f738b | |||
| d9cfc4bd2f | |||
| a975706711 | |||
| 2b57e8a94b | |||
| 1138df63b3 | |||
| ee5731d063 | |||
| f4ec36c724 | |||
| 71bf1598fb | |||
| 02d40e9688 | |||
| 4fd9ce1174 | |||
| 1f7e5e88a9 | |||
| 0b2697ba43 | |||
| f967b8c0c6 | |||
| cfad9861df | |||
| a2408366b2 | |||
| 38f437e9d5 | |||
| be60c42981 | |||
| 510d1e1872 | |||
| 0d2d1d7c03 | |||
| 4c466c38b1 | |||
| 72e1e52268 | |||
| 2b59fa45a1 | |||
| f39d357a32 | |||
| 13844eea85 | |||
| cea87d3d95 | |||
| 33eaa9dd84 | |||
| fda3134137 | |||
| a334ed0146 | |||
| 3a3adc2801 | |||
| f1977924f8 | |||
| e7e311b080 | |||
| 601dac54eb | |||
| 14e2b42caa | |||
| 4267beace5 | |||
| ea1e9a1485 | |||
| 893598249f | |||
| 8ff02c628d | |||
| 659e360b10 | |||
| 6638165b75 | |||
| 107bacfc0d | |||
| c767b94d46 | |||
| 9518e41291 | |||
| 760bb2efeb | |||
| 144b6bc9da | |||
| c6f0197ef9 | |||
| 8ed038fb6b | |||
| 270f398afb | |||
| 861d682383 | |||
| 555990a5ad | |||
| 69badb0c98 | |||
| 9a227fac71 | |||
| f7ce4ebb06 | |||
| 722637d530 | |||
| 2bf9699285 | |||
| dfa8f2c5be | |||
| 2cffe5172b | |||
| d835c8eb69 | |||
| c677ebb8cf | |||
| 32b134c367 | |||
| 92dd33386c | |||
| 3b9646dede | |||
| 2db14697be | |||
| e7a42d7b74 | |||
| ae3c753d71 | |||
| e95748330d | |||
| 1616c99015 | |||
| 2450efe63a | |||
| a13b75eeb4 | |||
| 621ae06631 | |||
| a9750f560c | |||
| 732ccb548d | |||
| 9dbdcf2493 | |||
| 85ffece367 | |||
| 8e3f5b7ca0 | |||
| 9c300ba24e | |||
| 0b350894de | |||
| 85970c9852 | |||
| fa8f29382b | |||
| 1930ff408d | |||
| 7b3b00cd66 | |||
| 4dcdcf8ae8 | |||
| 3b3cabb1b6 | |||
| 792d6af652 | |||
| 58d3d01cbe | |||
| 008bfa4d94 | |||
| afde316a75 | |||
| b3b7739d67 | |||
| ea6aecae10 | |||
| 81a8e54e7c | |||
| e823b1d676 | |||
| 0bfb620d2f | |||
| 7f174b1a65 | |||
| 27fc6a766e | |||
| 86883fcf71 | |||
| 1fb9d9cbd3 | |||
| 3ed9e83f5e | |||
| 5a14125e7b | |||
| 9351d7ebeb | |||
| e5aa809a07 | |||
| cb70967b5c | |||
| aab99dbeea | |||
| 5869b244b0 | |||
| 0dfe8c4c8a | |||
| 0b1ac24cdd | |||
| 793bc08999 | |||
| 57916e9b90 | |||
| f234f9005c | |||
| 2beb349c30 | |||
| c29ed95b02 | |||
| b8aad6745d | |||
| 858914a73e | |||
| f23e0417ed | |||
| 844164bda9 | |||
| 4b5882b4a2 | |||
| c44772077e | |||
| 4b458dcd5a | |||
| f132722a3b | |||
| 621b15a2a9 | |||
| ae1b0855ba | |||
| f36f711de9 | |||
| dce5fbddc1 | |||
| b678fede2f | |||
| e26f653a46 | |||
| bc3ae9cd81 | |||
| 53f1274956 | |||
| a2013b5aaa | |||
| b905513423 | |||
| 07dbd800ee | |||
| e12f25503e | |||
| 6c03ee7f59 | |||
| e3c4eec7cf | |||
| 255767c10b | |||
| a82ca7b1c0 | |||
| bdb0bdee2d | |||
| 0244c9e778 | |||
| 45d1a5aceb | |||
| 289e087066 | |||
| d7cf94878a | |||
| f76b55f728 | |||
| 18c3f091f7 | |||
| 00854f191b | |||
| b9eb87d76d | |||
| acd1cb71fd | |||
| a32b4ea9a6 | |||
| a9a85fb61d | |||
| d41626553f | |||
| 2c9f466872 | |||
| 7e83c817ec | |||
| b7996e5046 | |||
| 708dbc8355 | |||
| 0cade255e9 | |||
| aa55b64586 | |||
| ac2280977d | |||
| 576f4a5b59 | |||
| 6d9bb2bbe3 | |||
| 13c5639e18 | |||
| 28d62cd414 | |||
| eef258807a | |||
| 787ca9f211 | |||
| 0bb98fbb24 | |||
| bfd7f5bd3f | |||
| ee705b2c34 | |||
| ec7d880c39 | |||
| 6e86da1af8 | |||
| cda752e2cf | |||
| 0602eea898 | |||
| ac2accc8ea | |||
| fd813b8b33 | |||
| 18b53db737 | |||
| 53150ef7ff | |||
| eb5a8b4aa9 |
+8
-26
@@ -1,27 +1,9 @@
|
||||
# Local build and dev artifacts
|
||||
target
|
||||
tests
|
||||
|
||||
# Docker files
|
||||
Dockerfile*
|
||||
|
||||
# IDE files
|
||||
.vscode
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# Git folder
|
||||
.git
|
||||
.gitea
|
||||
.gitlab
|
||||
.github
|
||||
|
||||
# Dot files
|
||||
.env
|
||||
servers
|
||||
compose.yml
|
||||
node_modules
|
||||
.gitignore
|
||||
|
||||
# Toml files
|
||||
rustfmt.toml
|
||||
|
||||
# Documentation
|
||||
#*.md
|
||||
Dockerfile
|
||||
.svelte-kit
|
||||
build
|
||||
output
|
||||
.git
|
||||
+3
-12
@@ -1,15 +1,6 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
[*.{js,ts,svelte}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
|
||||
[*.nix]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -1,7 +0,0 @@
|
||||
# .git-blame-ignore-revs
|
||||
# adds a proper rustfmt.toml and formats the entire codebase
|
||||
1d1ac065141181438e744e7d8abd0e45f75a2f91
|
||||
f419c64aca300a338096b4e0db4c73ace54f23d0
|
||||
# use chain_width 60
|
||||
162948313c212193965dece50b816ef0903172ba
|
||||
5998a0d883d31b866f7c8c46433a8857eae51a89
|
||||
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
<!-- Please describe your changes here -->
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
- [ ] I ran `cargo fmt`, `cargo clippy`, and `cargo test`
|
||||
- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license
|
||||
|
||||
@@ -1,344 +0,0 @@
|
||||
name: CI and Artifacts
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
# documentation workflow deals with this or is not relevant for this workflow
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- 'conduwuit-example.toml'
|
||||
- 'book.toml'
|
||||
- '.gitlab-ci.yml'
|
||||
- '.gitignore'
|
||||
- 'renovate.json'
|
||||
- 'docs/**'
|
||||
- 'debian/**'
|
||||
- 'docker/**'
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.head_ref || github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Required to make some things output color
|
||||
TERM: ansi
|
||||
# Publishing to my nix binary cache
|
||||
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||
# Just in case incremental is still being set to true, speeds up CI
|
||||
CARGO_INCREMENTAL: 0
|
||||
# Custom nix binary cache if fork is being used
|
||||
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
||||
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Sync repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag comparison check
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
# Tag mismatch with latest repo tag check to prevent potential downgrades
|
||||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
|
||||
if [ $LATEST_TAG != ${{ github.ref_name }} ]; then
|
||||
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.'
|
||||
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.' >> $GITHUB_STEP_SUMMARY
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Enable Cachix binary cache
|
||||
run: |
|
||||
nix profile install nixpkgs#cachix
|
||||
cachix use crane
|
||||
cachix use nix-community
|
||||
|
||||
- name: Configure Magic Nix Cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Apply Nix binary cache configuration
|
||||
run: |
|
||||
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
|
||||
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems
|
||||
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg= conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=
|
||||
EOF
|
||||
|
||||
- name: Use alternative Nix binary caches if specified
|
||||
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
|
||||
run: |
|
||||
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
|
||||
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
|
||||
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
|
||||
EOF
|
||||
|
||||
- name: Prepare build environment
|
||||
run: |
|
||||
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
|
||||
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
|
||||
direnv allow
|
||||
nix develop --command true
|
||||
|
||||
- name: Run CI tests
|
||||
run: |
|
||||
direnv exec . engage > >(tee -a test_output.log)
|
||||
|
||||
- name: Sync Complement repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'matrix-org/complement'
|
||||
path: complement_src
|
||||
|
||||
- name: Run Complement tests
|
||||
run: |
|
||||
direnv exec . bin/complement 'complement_src' 'complement_test_logs.jsonl' 'complement_test_results.jsonl'
|
||||
cp -v -f result complement_oci_image.tar.gz
|
||||
|
||||
- name: Upload Complement OCI image
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: complement_oci_image.tar.gz
|
||||
path: complement_oci_image.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload Complement logs
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: complement_test_logs.jsonl
|
||||
path: complement_test_logs.jsonl
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload Complement results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: complement_test_results.jsonl
|
||||
path: complement_test_results.jsonl
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Diff Complement results with checked-in repo results
|
||||
# TODO: figure out why our complement results are not 100% consistent so we don't need to allow failures
|
||||
continue-on-error: true
|
||||
run: |
|
||||
diff -u --color=always complement_test_results.jsonl tests/test_results/complement/test_results.jsonl > >(tee -a complement_test_output.log)
|
||||
|
||||
- name: Add Complement diff result to Job Summary
|
||||
run: |
|
||||
echo '# Complement diff results' >> $GITHUB_STEP_SUMMARY
|
||||
echo '```diff' >> $GITHUB_STEP_SUMMARY
|
||||
tail -n 100 complement_test_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Update Job Summary
|
||||
if: success() || failure()
|
||||
run: |
|
||||
if [ ${{ job.status }} == 'success' ]; then
|
||||
echo '# ✅ completed suwuccessfully' >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
tail -n 20 test_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: tests
|
||||
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-unknown-linux-musl
|
||||
- target: aarch64-unknown-linux-musl-jemalloc
|
||||
- target: x86_64-unknown-linux-musl
|
||||
- target: x86_64-unknown-linux-musl-jemalloc
|
||||
steps:
|
||||
- name: Sync repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Install and enable Cachix binary cache
|
||||
run: |
|
||||
nix profile install nixpkgs#cachix
|
||||
cachix use crane
|
||||
cachix use nix-community
|
||||
|
||||
- name: Configure Magic Nix Cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Apply Nix binary cache configuration
|
||||
run: |
|
||||
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
|
||||
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit
|
||||
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg= conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
|
||||
EOF
|
||||
|
||||
- name: Use alternative Nix binary caches if specified
|
||||
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
|
||||
run: |
|
||||
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
|
||||
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
|
||||
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
|
||||
EOF
|
||||
|
||||
- name: Prepare build environment
|
||||
run: |
|
||||
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
|
||||
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
|
||||
direnv allow
|
||||
nix develop --command true
|
||||
|
||||
- name: Build static ${{ matrix.target }}
|
||||
run: |
|
||||
bin/nix-build-and-cache just .#static-${{ matrix.target }}
|
||||
mkdir -p target/release
|
||||
cp -v -f result/bin/conduit target/release/
|
||||
direnv exec . cargo deb --no-build --no-strip --output target/debian/${{ matrix.target }}.deb
|
||||
mv target/release/conduit static-${{ matrix.target }}
|
||||
|
||||
- name: Upload static-${{ matrix.target }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: static-${{ matrix.target }}
|
||||
path: static-${{ matrix.target }}
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload deb ${{ matrix.target }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: deb-${{ matrix.target }}
|
||||
path: target/debian/${{ matrix.target }}.deb
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Build OCI image ${{ matrix.target }}
|
||||
run: |
|
||||
bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}
|
||||
cp -v -f result oci-image-${{ matrix.target }}.tar.gz
|
||||
|
||||
- name: Upload OCI image ${{ matrix.target }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oci-image-${{ matrix.target }}
|
||||
path: oci-image-${{ matrix.target }}.tar.gz
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
docker:
|
||||
name: Docker publish
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '')
|
||||
env:
|
||||
DOCKER_ARM64: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
|
||||
DOCKER_AMD64: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
|
||||
DOCKER_TAG: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
|
||||
DOCKER_BRANCH: docker.io/${{ github.repository }}:${{ (startsWith(github.ref, 'refs/tags/v') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
|
||||
GHCR_ARM64: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
|
||||
GHCR_AMD64: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
|
||||
GHCR_TAG: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
|
||||
GHCR_BRANCH: ghcr.io/${{ github.repository }}:${{ (startsWith(github.ref, 'refs/tags/v') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
|
||||
GLCR_ARM64: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
|
||||
GLCR_AMD64: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
|
||||
GLCR_TAG: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
|
||||
GLCR_BRANCH: registry.gitlab.com/conduwuit/conduwuit:${{ (startsWith(github.ref, 'refs/tags/v') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
|
||||
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
||||
steps:
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ vars.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitLab Container Registry
|
||||
if: ${{ (vars.GITLAB_USERNAME != '') && (env.GITLAB_TOKEN != '') }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.gitlab.com
|
||||
username: ${{ vars.GITLAB_USERNAME }}
|
||||
password: ${{ secrets.GITLAB_TOKEN }}
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Move OCI images into position
|
||||
run: |
|
||||
mv oci-image-x86_64-*-jemalloc/*.tar.gz oci-image-amd64.tar.gz
|
||||
mv oci-image-aarch64-*-jemalloc/*.tar.gz oci-image-arm64v8.tar.gz
|
||||
|
||||
- name: Load and push amd64 image
|
||||
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
|
||||
run: |
|
||||
docker load -i oci-image-amd64.tar.gz
|
||||
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_AMD64 }}
|
||||
docker tag $(docker images -q conduit:main) ${{ env.GHCR_AMD64 }}
|
||||
docker tag $(docker images -q conduit:main) ${{ env.GLCR_AMD64 }}
|
||||
docker push ${{ env.DOCKER_AMD64 }}
|
||||
docker push ${{ env.GHCR_AMD64 }}
|
||||
docker push ${{ env.GLCR_AMD64 }}
|
||||
|
||||
- name: Load and push arm64 image
|
||||
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
|
||||
run: |
|
||||
docker load -i oci-image-arm64v8.tar.gz
|
||||
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_ARM64 }}
|
||||
docker tag $(docker images -q conduit:main) ${{ env.GHCR_ARM64 }}
|
||||
docker tag $(docker images -q conduit:main) ${{ env.GLCR_ARM64 }}
|
||||
docker push ${{ env.DOCKER_ARM64 }}
|
||||
docker push ${{ env.GHCR_ARM64 }}
|
||||
docker push ${{ env.GLCR_ARM64 }}
|
||||
|
||||
- name: Create Docker combined manifests
|
||||
run: |
|
||||
# Dockerhub Container Registry
|
||||
docker manifest create ${{ env.DOCKER_TAG }} --amend ${{ env.DOCKER_ARM64 }} --amend ${{ env.DOCKER_AMD64 }}
|
||||
docker manifest create ${{ env.DOCKER_BRANCH }} --amend ${{ env.DOCKER_ARM64 }} --amend ${{ env.DOCKER_AMD64 }}
|
||||
# GitHub Container Registry
|
||||
docker manifest create ${{ env.GHCR_TAG }} --amend ${{ env.GHCR_ARM64 }} --amend ${{ env.GHCR_AMD64 }}
|
||||
docker manifest create ${{ env.GHCR_BRANCH }} --amend ${{ env.GHCR_ARM64 }} --amend ${{ env.GHCR_AMD64 }}
|
||||
# GitLab Container Registry
|
||||
docker manifest create ${{ env.GLCR_TAG }} --amend ${{ env.GLCR_ARM64 }} --amend ${{ env.GCCR_AMD64 }}
|
||||
docker manifest create ${{ env.GLCR_BRANCH }} --amend ${{ env.GLCR_ARM64 }} --amend ${{ env.GLCR_AMD64 }}
|
||||
|
||||
- name: Push manifests to Docker registries
|
||||
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
|
||||
run: |
|
||||
docker manifest push ${{ env.DOCKER_TAG }}
|
||||
docker manifest push ${{ env.DOCKER_BRANCH }}
|
||||
docker manifest push ${{ env.GHCR_TAG }}
|
||||
docker manifest push ${{ env.GHCR_BRANCH }}
|
||||
docker manifest push ${{ env.GLCR_TAG }}
|
||||
docker manifest push ${{ env.GLCR_BRANCH }}
|
||||
|
||||
- name: Add Image Links to Job Summary
|
||||
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
|
||||
run: |
|
||||
echo "- \`docker pull ${{ env.DOCKER_TAG }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- \`docker pull ${{ env.GHCR_TAG }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- \`docker pull ${{ env.GLCR_TAG }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -1,117 +0,0 @@
|
||||
name: Documentation and GitHub Pages
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# Required to make some things output color
|
||||
TERM: ansi
|
||||
# Publishing to my nix binary cache
|
||||
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||
# Custom nix binary cache if fork is being used
|
||||
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
||||
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Documentation and GitHub Pages
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
steps:
|
||||
- name: Sync repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup GitHub Pages
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Install Nix (with flakes and nix-command enabled)
|
||||
uses: cachix/install-nix-action@v26
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
|
||||
# Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
extra-substituters = https://nix-community.cachix.org
|
||||
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
|
||||
extra-substituters = https://crane.cachix.org
|
||||
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
|
||||
extra-substituters = https://attic.kennel.juneis.dog/conduit
|
||||
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
|
||||
extra-substituters = https://attic.kennel.juneis.dog/conduwuit
|
||||
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
|
||||
|
||||
- name: Add alternative Nix binary caches if specified
|
||||
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
|
||||
run: |
|
||||
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
|
||||
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
|
||||
|
||||
- name: Pop/push Magic Nix Cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Configure `nix-direnv`
|
||||
run: |
|
||||
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
|
||||
|
||||
- name: Install `direnv` and `nix-direnv`
|
||||
run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv
|
||||
|
||||
# Do this to shorten the logs for the real CI step
|
||||
- name: Populate `/nix/store`
|
||||
run: nix develop --command true
|
||||
|
||||
- name: Allow direnv
|
||||
run: direnv allow
|
||||
|
||||
- name: Cache CI dependencies
|
||||
run: |
|
||||
./bin/nix-build-and-cache ci
|
||||
|
||||
- name: Build documentation (book)
|
||||
run: |
|
||||
./bin/nix-build-and-cache just .#book
|
||||
cp -r --dereference result public
|
||||
- name: Upload generated documentation (book) as normal artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: public
|
||||
path: public
|
||||
if-no-files-found: error
|
||||
# don't compress again
|
||||
compression-level: 0
|
||||
|
||||
- name: Upload generated documentation (book) as GitHub Pages artifact
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: public
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
if: github.event_name != 'pull_request'
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Trivy code and vulnerability scanning
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '00 12 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
trivy-scan:
|
||||
name: Trivy Scan
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
actions: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Trivy code and vulnerability scanner on repo
|
||||
uses: aquasecurity/trivy-action@0.20.0
|
||||
with:
|
||||
scan-type: repo
|
||||
format: sarif
|
||||
output: trivy-results.sarif
|
||||
severity: CRITICAL,HIGH,MEDIUM,LOW
|
||||
|
||||
- name: Run Trivy code and vulnerability scanner on filesystem
|
||||
uses: aquasecurity/trivy-action@0.20.0
|
||||
with:
|
||||
scan-type: fs
|
||||
format: sarif
|
||||
output: trivy-results.sarif
|
||||
severity: CRITICAL,HIGH,MEDIUM,LOW
|
||||
+3
-96
@@ -1,97 +1,4 @@
|
||||
# Local environment overrides
|
||||
/.env
|
||||
node_modules
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# IntelliJ
|
||||
.idea/
|
||||
out/
|
||||
*.iml
|
||||
modules.xml
|
||||
*.ipr
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# Linux backup files
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# Rust
|
||||
/target/
|
||||
|
||||
### vscode ###
|
||||
.vscode/*
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# Conduit
|
||||
conduit.toml
|
||||
conduit.db
|
||||
|
||||
# Etc.
|
||||
**/*.rs.bk
|
||||
cached_target
|
||||
|
||||
# Nix artifacts
|
||||
/result*
|
||||
|
||||
# Direnv cache
|
||||
/.direnv
|
||||
|
||||
test-conduit/
|
||||
test-conduit.toml
|
||||
|
||||
# Gitlab CI cache
|
||||
/.gitlab-ci.d
|
||||
|
||||
# mdbook output
|
||||
public/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
# Zed
|
||||
.zed/
|
||||
|
||||
# idk where you're coming from, but i'm tired of you
|
||||
rustc-ice-*
|
||||
|
||||
# complement test logs are huge
|
||||
tests/test_results/complement/test_logs.jsonl
|
||||
servers/*.ign
|
||||
.parcel-cache
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
stages:
|
||||
- ci
|
||||
- artifacts
|
||||
- publish
|
||||
|
||||
variables:
|
||||
# Makes some things print in color
|
||||
TERM: ansi
|
||||
# Faster cache and artifact compression / decompression
|
||||
FF_USE_FASTZIP: true
|
||||
# Print progress reports for cache and artifact transfers
|
||||
TRANSFER_METER_FREQUENCY: 5s
|
||||
|
||||
# Avoid duplicate pipelines
|
||||
# See: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||
when: never
|
||||
- if: $CI
|
||||
|
||||
before_script:
|
||||
# Enable nix-command and flakes
|
||||
- if command -v nix > /dev/null; then echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Add conduwuit binary cache
|
||||
- if command -v nix > /dev/null; then echo "extra-substituters = https://attic.kennel.juneis.dog/conduwuit" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=" >> /etc/nix/nix.conf; fi
|
||||
|
||||
- if command -v nix > /dev/null; then echo "extra-substituters = https://attic.kennel.juneis.dog/conduit" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Add alternate binary cache
|
||||
- if command -v nix > /dev/null && [ -n "$ATTIC_ENDPOINT" ]; then echo "extra-substituters = $ATTIC_ENDPOINT" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null && [ -n "$ATTIC_PUBLIC_KEY" ]; then echo "extra-trusted-public-keys = $ATTIC_PUBLIC_KEY" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Add Lix binary cache
|
||||
- if command -v nix > /dev/null; then echo "extra-substituters = https://cache.lix.systems" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Add crane binary cache
|
||||
- if command -v nix > /dev/null; then echo "extra-substituters = https://crane.cachix.org" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Add nix-community binary cache
|
||||
- if command -v nix > /dev/null; then echo "extra-substituters = https://nix-community.cachix.org" >> /etc/nix/nix.conf; fi
|
||||
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" >> /etc/nix/nix.conf; fi
|
||||
|
||||
# Install direnv and nix-direnv
|
||||
- if command -v nix > /dev/null; then nix-env -iA nixpkgs.direnv nixpkgs.nix-direnv; fi
|
||||
|
||||
# Allow .envrc
|
||||
- if command -v nix > /dev/null; then direnv allow; fi
|
||||
|
||||
# Cache attic client
|
||||
- if command -v nix > /dev/null; then ./bin/nix-build-and-cache --inputs-from . attic; fi
|
||||
|
||||
# Set CARGO_HOME to a cacheable path
|
||||
- export CARGO_HOME="$(git rev-parse --show-toplevel)/.gitlab-ci.d/cargo"
|
||||
|
||||
ci:
|
||||
stage: ci
|
||||
image: nixos/nix:2.22.1
|
||||
script:
|
||||
# Cache CI dependencies
|
||||
- ./bin/nix-build-and-cache ci
|
||||
|
||||
- direnv exec . engage
|
||||
cache:
|
||||
key: nix
|
||||
paths:
|
||||
- target
|
||||
- .gitlab-ci.d
|
||||
rules:
|
||||
# CI on upstream runners (only available for maintainers)
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $IS_UPSTREAM_CI == "true"
|
||||
# Manual CI on unprotected branches that are not MRs
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_REF_PROTECTED == "false"
|
||||
when: manual
|
||||
# Manual CI on forks
|
||||
- if: $IS_UPSTREAM_CI != "true"
|
||||
when: manual
|
||||
- if: $CI
|
||||
interruptible: true
|
||||
|
||||
artifacts:
|
||||
stage: artifacts
|
||||
image: nixos/nix:2.22.0
|
||||
script:
|
||||
- ./bin/nix-build-and-cache just .#static-x86_64-unknown-linux-musl
|
||||
- cp result/bin/conduit x86_64-unknown-linux-musl
|
||||
|
||||
- mkdir -p target/release
|
||||
- cp result/bin/conduit target/release
|
||||
- direnv exec . cargo deb --no-build --no-strip
|
||||
- mv target/debian/*.deb x86_64-unknown-linux-musl.deb
|
||||
|
||||
# Since the OCI image package is based on the binary package, this has the
|
||||
# fun side effect of uploading the normal binary too. Conduit users who are
|
||||
# deploying with Nix can leverage this fact by adding our binary cache to
|
||||
# their systems.
|
||||
#
|
||||
# Note that although we have an `oci-image-x86_64-unknown-linux-musl`
|
||||
# output, we don't build it because it would be largely redundant to this
|
||||
# one since it's all containerized anyway.
|
||||
- ./bin/nix-build-and-cache just .#oci-image
|
||||
- cp result oci-image-amd64.tar.gz
|
||||
|
||||
- ./bin/nix-build-and-cache just .#static-aarch64-unknown-linux-musl
|
||||
- cp result/bin/conduit aarch64-unknown-linux-musl
|
||||
|
||||
- ./bin/nix-build-and-cache just .#oci-image-aarch64-unknown-linux-musl
|
||||
- cp result oci-image-arm64v8.tar.gz
|
||||
|
||||
- ./bin/nix-build-and-cache just .#book
|
||||
# We can't just copy the symlink, we need to dereference it https://gitlab.com/gitlab-org/gitlab/-/issues/19746
|
||||
- cp -r --dereference result public
|
||||
artifacts:
|
||||
paths:
|
||||
- x86_64-unknown-linux-musl
|
||||
- aarch64-unknown-linux-musl
|
||||
- x86_64-unknown-linux-musl.deb
|
||||
- oci-image-amd64.tar.gz
|
||||
- oci-image-arm64v8.tar.gz
|
||||
- public
|
||||
rules:
|
||||
# CI required for all MRs
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
# Optional CI on forks
|
||||
- if: $IS_UPSTREAM_CI != "true"
|
||||
when: manual
|
||||
allow_failure: true
|
||||
- if: $CI
|
||||
interruptible: true
|
||||
|
||||
pages:
|
||||
stage: publish
|
||||
dependencies:
|
||||
- artifacts
|
||||
only:
|
||||
- next
|
||||
script:
|
||||
- "true"
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
<!-- Please describe your changes here -->
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
- [ ] I ran `cargo fmt`, `cargo clippy`, and `cargo test`
|
||||
- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Docs: Map markdown to html files
|
||||
- source: /docs/(.+)\.md/
|
||||
public: '\1.html'
|
||||
@@ -1,134 +0,0 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement over email at
|
||||
strawberry@puppygock.gay or over Matrix at @strawberry:puppygock.gay.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
# Contributing guide
|
||||
|
||||
This page is for about contributing to conduwuit. The [development](docs/development.md) page may be of interest for you as well.
|
||||
|
||||
If you would like to work on an [issue][issues] that is not assigned, preferably ask in the Matrix room first at [#conduwuit:puppygock.gay][conduwuit-matrix], and comment on it.
|
||||
|
||||
### Linting and Formatting
|
||||
|
||||
It is mandatory all your changes satisfy the lints (clippy, rustc, rustdoc, etc) and your code is formatted via the **nightly** `cargo fmt`. A lot of the `rustfmt.toml` features depend on nightly toolchain. It would be ideal if they weren't nightly-exclusive features, but they currently still are. CI's rustfmt uses nightly.
|
||||
|
||||
If you need to allow a lint, please make sure it's either obvious as to why (e.g. clippy saying redundant clone but it's actually required) or it has a comment saying why. Do not write inefficient code for the sake of satisfying lints. If a lint is wrong and provides a more inefficient solution or suggestion, allow the lint and mention that in a comment.
|
||||
|
||||
### Running CI tests locally
|
||||
|
||||
conduwuit's CI for tests, linting, formatting, audit, etc use [`engage`][engage]. engage can be installed from nixpkgs or `cargo install engage`. conduwuit's Nix flake devshell has the nixpkgs engage with `direnv`. Use `engage --help` for more usage details.
|
||||
|
||||
To test, format, lint, etc that CI would do, install engage, allow the `.envrc` file using `direnv allow`, and run `engage`.
|
||||
|
||||
All of the tasks are defined at the [engage.toml][engage.toml] file. You can view all of them neatly by running `engage list`
|
||||
|
||||
If you would like to run only a specific engage task group, use `just`:
|
||||
- `engage just <group>`
|
||||
- Example: `engage just lints`
|
||||
|
||||
If you would like to run a specific engage task in a specific group, use `just <GROUP> [TASK]`: `engage just lints cargo-fmt`
|
||||
|
||||
The following binaries are used in [`engage.toml`][engage.toml]:
|
||||
|
||||
- [`engage`][engage]
|
||||
- `nix`
|
||||
- [`direnv`][direnv]
|
||||
- `rustc`
|
||||
- `cargo`
|
||||
- `cargo-fmt`
|
||||
- `rustdoc`
|
||||
- `cargo-clippy`
|
||||
- [`cargo-audit`][cargo-audit]
|
||||
- [`cargo-deb`][cargo-deb]
|
||||
- [`lychee`][lychee]
|
||||
|
||||
### Matrix tests
|
||||
|
||||
CI runs [Complement][complement], but currently does not fail if results from the checked-in results differ with the new results. If your changes are done to fix Matrix tests, note that in your pull request. If more Complement tests start failing from your changes, please review the logs (they are uploaded as artifacts) and determine if they're intended or not.
|
||||
|
||||
If you'd like to run Complement locally using Nix, see the [testing](docs/development/testing.md) page.
|
||||
|
||||
[Sytest][sytest] support will come soon.
|
||||
|
||||
### Writing documentation
|
||||
|
||||
conduwuit's website uses [`mdbook`][mdbook] and deployed via CI using GitHub Pages in the [`documentation.yml`][documentation.yml] workflow file with Nix's mdbook in the devshell. All documentation is in the `docs/` directory at the top level. The compiled mdbook website is also uploaded as an artifact.
|
||||
|
||||
To build the documentation using Nix, run: `bin/nix-build-and-cache just .#book`
|
||||
|
||||
The output of the mdbook generation is in `result/`. mdbooks can be opened in your browser from the individual HTML files without any web server needed.
|
||||
|
||||
### Inclusivity and Diversity
|
||||
|
||||
All **MUST** code and write with inclusivity and diversity in mind. See the [following page by Google on writing inclusive code and documentation](https://developers.google.com/style/inclusive-documentation).
|
||||
|
||||
This **EXPLICITLY** forbids usage of terms like "blacklist"/"whitelist" and "master"/"slave", [forbids gender-specific words and phrases](https://developers.google.com/style/pronouns#gender-neutral-pronouns), forbids ableist language like "sanity-check", "cripple", or "insane", and forbids culture-specific language (e.g. US-only holidays or cultures).
|
||||
|
||||
No exceptions are allowed. Dependencies that may use these terms are allowed but [do not replicate the name in your functions or variables](https://developers.google.com/style/inclusive-documentation#write-around).
|
||||
|
||||
In addition to language, write and code with the user experience in mind. This is software that intends to be used by everyone, so make it easy and comfortable for everyone to use. 🏳️⚧️
|
||||
|
||||
### Variable, comment, function, etc standards
|
||||
|
||||
Rust's default style and standards with regards to [function names, variable names, comments](https://rust-lang.github.io/api-guidelines/naming.html), etc applies here.
|
||||
|
||||
### Creating pull requests
|
||||
|
||||
Please try to keep contributions to the GitHub. While the mirrors of conduwuit allow for pull/merge requests, there is no guarantee I will see them in a timely manner. Additionally, please mark WIP or unfinished or incomplete PRs as drafts. This prevents me from having to ping once in a while to double check the status of it, especially when the CI completed successfully and everything so it *looks* done.
|
||||
|
||||
If you open a pull request on one of the mirrors, it is your responsibility to inform me about its existence. In the future I may try to solve this with more repo bots in the conduwuit Matrix room. There is no mailing list or email-patch support on the sr.ht mirror, but if you'd like to email me a git patch you can do so at `strawberry@puppygock.gay`.
|
||||
|
||||
Direct all PRs/MRs to the `main` branch.
|
||||
|
||||
By sending a pull request or patch, you are agreeing that your changes are allowed to be licenced under the Apache-2.0 licence and all of your conduct is in line with the Contributor's Covenant.
|
||||
|
||||
[issues]: https://github.com/girlbossceo/conduwuit/issues
|
||||
[conduwuit-matrix]: https://matrix.to/#/#conduwuit:puppygock.gay
|
||||
[complement]: https://github.com/matrix-org/complement/
|
||||
[engage.toml]: https://github.com/girlbossceo/conduwuit/blob/main/engage.toml
|
||||
[engage]: https://charles.page.computer.surgery/engage/
|
||||
[sytest]: https://github.com/matrix-org/sytest/
|
||||
[cargo-deb]: https://github.com/kornelski/cargo-deb
|
||||
[lychee]: https://github.com/lycheeverse/lychee
|
||||
[cargo-audit]: https://github.com/RustSec/rustsec/tree/main/cargo-audit
|
||||
[direnv]: https://direnv.net/
|
||||
[mdbook]: https://rust-lang.github.io/mdBook/
|
||||
[documentation.yml]: https://github.com/girlbossceo/conduwuit/blob/main/.github/workflows/documentation.yml
|
||||
Generated
-4668
File diff suppressed because it is too large
Load Diff
-656
@@ -1,656 +0,0 @@
|
||||
[package]
|
||||
# TODO: when can we rename to conduwuit?
|
||||
name = "conduit"
|
||||
description = "a very cool fork of Conduit, a Matrix homeserver written in Rust"
|
||||
license = "Apache-2.0"
|
||||
authors = [
|
||||
"strawberry <strawberry@puppygock.gay>",
|
||||
"timokoesters <timo@koesters.xyz>",
|
||||
]
|
||||
homepage = "https://conduwuit.puppyirl.gay/"
|
||||
repository = "https://github.com/girlbossceo/conduwuit"
|
||||
readme = "README.md"
|
||||
version = "0.3.3"
|
||||
edition = "2021"
|
||||
|
||||
# See also `rust-toolchain.toml`
|
||||
rust-version = "1.77.0"
|
||||
|
||||
[dependencies]
|
||||
console-subscriber = { version = "0.2", optional = true }
|
||||
|
||||
infer = { version = "0.15", default-features = false }
|
||||
|
||||
# for hot lib reload
|
||||
hot-lib-reloader = { version = "^0.7", optional = true }
|
||||
|
||||
# Used for secure identifiers
|
||||
rand = "0.8.5"
|
||||
|
||||
# Used for conduit::Error type
|
||||
thiserror = "1.0.60"
|
||||
|
||||
# Used to encode server public key
|
||||
base64 = "0.22.1"
|
||||
|
||||
# Used when hashing the state
|
||||
ring = "0.17.8"
|
||||
|
||||
# Used to find matching events for appservices
|
||||
regex = "1.10.4"
|
||||
|
||||
# Used to load forbidden room/user regex from config
|
||||
serde_regex = "1.1.0"
|
||||
|
||||
# Used to make working with iterators easier, was already a transitive depdendency
|
||||
itertools = "0.12.1"
|
||||
|
||||
# jwt jsonwebtokens
|
||||
jsonwebtoken = "9.3.0"
|
||||
|
||||
# Used for ruma wrapper
|
||||
serde_html_form = "0.2.6"
|
||||
|
||||
# used for TURN server authentication
|
||||
hmac = "0.12.1"
|
||||
sha-1 = "0.10.1"
|
||||
|
||||
# used for checking if an IP is in specific subnets / CIDR ranges easier
|
||||
ipaddress = "0.1.3"
|
||||
|
||||
# to get the client IP address of requests
|
||||
#axum-client-ip = "0.4.2"
|
||||
|
||||
# to parse user-friendly time durations in admin commands
|
||||
cyborgtime = "2.1.1"
|
||||
|
||||
# all the web/HTTP dependencies
|
||||
# Used for the http request / response body type for Ruma endpoints used with reqwest
|
||||
bytes = "1.6.0"
|
||||
http = "1.1.0"
|
||||
http-body-util = "0.1.1"
|
||||
|
||||
# used to replace the channels of the tokio runtime
|
||||
loole = "0.3.0"
|
||||
|
||||
# Validating urls in config, was already a transitive dependency
|
||||
url = { version = "2.5.0", features = ["serde"] }
|
||||
|
||||
async-trait = "0.1.80"
|
||||
|
||||
lru-cache = "0.1.2"
|
||||
sanitize-filename = "0.5.0"
|
||||
|
||||
# standard date and time tools
|
||||
[dependencies.chrono]
|
||||
version = "0.4.38"
|
||||
features = ["alloc"]
|
||||
default-features = false
|
||||
|
||||
# Web framework
|
||||
[dependencies.axum]
|
||||
version = "0.7.5"
|
||||
default-features = false
|
||||
features = ["form", "http1", "http2", "json", "matched-path"]
|
||||
|
||||
[dependencies.axum-extra]
|
||||
version = "0.9.3"
|
||||
default-features = false
|
||||
features = ["typed-header"]
|
||||
|
||||
[dependencies.axum-server]
|
||||
version = "0.6.0"
|
||||
features = ["tls-rustls"]
|
||||
|
||||
[dependencies.tower]
|
||||
version = "0.4.13"
|
||||
features = ["util"]
|
||||
|
||||
[dependencies.tower-http]
|
||||
version = "0.5.2"
|
||||
features = [
|
||||
"add-extension",
|
||||
"cors",
|
||||
"sensitive-headers",
|
||||
"set-header",
|
||||
"trace",
|
||||
"util",
|
||||
"catch-panic",
|
||||
]
|
||||
|
||||
[dependencies.hyper]
|
||||
version = "1.3.1"
|
||||
features = ["server", "http1", "http2"]
|
||||
|
||||
[dependencies.hyper-util]
|
||||
version = "0.1.3"
|
||||
|
||||
[dependencies.reqwest]
|
||||
version = "0.12.4"
|
||||
default-features = false
|
||||
features = ["rustls-tls-native-roots", "socks", "hickory-dns"]
|
||||
|
||||
# all the serde stuff
|
||||
# Used for pdu definition
|
||||
[dependencies.serde]
|
||||
version = "1.0.201"
|
||||
features = ["rc"]
|
||||
# Used for appservice registration files
|
||||
[dependencies.serde_yaml]
|
||||
version = "0.9.34"
|
||||
# Used for ruma wrapper
|
||||
[dependencies.serde_json]
|
||||
version = "1.0.117"
|
||||
features = ["raw_value"]
|
||||
|
||||
|
||||
# Used for password hashing
|
||||
[dependencies.argon2]
|
||||
version = "0.5.3"
|
||||
features = ["alloc", "rand"]
|
||||
default-features = false
|
||||
|
||||
# Used to generate thumbnails for images
|
||||
[dependencies.image]
|
||||
version = "0.25.1"
|
||||
default-features = false
|
||||
features = ["jpeg", "png", "gif", "webp"]
|
||||
|
||||
# logging
|
||||
[dependencies.log]
|
||||
version = "0.4.21"
|
||||
default-features = false
|
||||
[dependencies.tracing]
|
||||
version = "0.1.40"
|
||||
default-features = false
|
||||
[dependencies.tracing-subscriber]
|
||||
version = "0.3.18"
|
||||
features = ["env-filter"]
|
||||
|
||||
# optional SHA256 media keys feature
|
||||
[dependencies.sha2]
|
||||
version = "0.10.8"
|
||||
optional = true
|
||||
|
||||
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
|
||||
[dependencies.opentelemetry]
|
||||
version = "0.21.0"
|
||||
optional = true
|
||||
[dependencies.tracing-flame]
|
||||
version = "0.2.0"
|
||||
optional = true
|
||||
[dependencies.tracing-opentelemetry]
|
||||
version = "0.22.0"
|
||||
optional = true
|
||||
[dependencies.opentelemetry_sdk]
|
||||
version = "0.21.2"
|
||||
optional = true
|
||||
features = ["rt-tokio"]
|
||||
[dependencies.opentelemetry-jaeger]
|
||||
version = "0.20.0"
|
||||
optional = true
|
||||
features = ["rt-tokio"]
|
||||
|
||||
# optional sentry metrics for crash/panic reporting
|
||||
[dependencies.sentry]
|
||||
version = "0.32.3"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = [
|
||||
"backtrace",
|
||||
"contexts",
|
||||
"debug-images",
|
||||
"panic",
|
||||
"rustls",
|
||||
"tower",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"reqwest",
|
||||
"log",
|
||||
]
|
||||
[dependencies.sentry-tracing]
|
||||
version = "0.32.3"
|
||||
optional = true
|
||||
[dependencies.sentry-tower]
|
||||
version = "0.32.3"
|
||||
optional = true
|
||||
|
||||
# optional jemalloc usage
|
||||
[dependencies.tikv-jemalloc-sys]
|
||||
version = "0.5.4"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["stats", "unprefixed_malloc_on_supported_platforms"]
|
||||
[dependencies.tikv-jemallocator]
|
||||
version = "0.5.4"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["stats", "unprefixed_malloc_on_supported_platforms"]
|
||||
[dependencies.tikv-jemalloc-ctl]
|
||||
version = "0.5.4"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["use_std"]
|
||||
|
||||
# for URL previews
|
||||
[dependencies.webpage]
|
||||
version = "2.0.1"
|
||||
default-features = false
|
||||
|
||||
# to support multiple variations of setting a config option
|
||||
[dependencies.either]
|
||||
version = "1.11.0"
|
||||
features = ["serde"]
|
||||
|
||||
# to listen on both HTTP and HTTPS if listening on TLS dierctly from conduwuit for complement or sytest
|
||||
[dependencies.axum-server-dual-protocol]
|
||||
version = "0.6"
|
||||
optional = true
|
||||
|
||||
# used for conduit's CLI and admin room command parsing
|
||||
[dependencies.clap]
|
||||
version = "4.5.4"
|
||||
default-features = false
|
||||
features = ["std", "derive", "help", "usage", "error-context", "string"]
|
||||
|
||||
[dependencies.futures-util]
|
||||
version = "0.3.30"
|
||||
default-features = false
|
||||
|
||||
# Used for reading the configuration from conduwuit.toml & environment variables
|
||||
[dependencies.figment]
|
||||
version = "0.10.18"
|
||||
features = ["env", "toml"]
|
||||
|
||||
# Used for matrix spec type definitions and helpers
|
||||
[dependencies.ruma]
|
||||
git = "https://github.com/girlbossceo/ruma"
|
||||
branch = "conduwuit-changes"
|
||||
features = [
|
||||
"compat",
|
||||
"rand",
|
||||
"appservice-api-c",
|
||||
"client-api",
|
||||
"federation-api",
|
||||
"push-gateway-api-c",
|
||||
"state-res",
|
||||
"unstable-exhaustive-types",
|
||||
"ring-compat",
|
||||
"unstable-unspecified",
|
||||
"unstable-msc2448",
|
||||
"unstable-msc2666",
|
||||
"unstable-msc2867",
|
||||
"unstable-msc2870",
|
||||
"unstable-msc3026",
|
||||
"unstable-msc3061",
|
||||
"unstable-msc3575",
|
||||
"unstable-msc4121",
|
||||
"unstable-msc4125",
|
||||
"unstable-extensible-events",
|
||||
]
|
||||
|
||||
[dependencies.ruma-identifiers-validation]
|
||||
git = "https://github.com/girlbossceo/ruma"
|
||||
branch = "conduwuit-changes"
|
||||
|
||||
[dependencies.hickory-resolver]
|
||||
version = "0.24.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.rust-rocksdb]
|
||||
git = "https://github.com/zaidoon1/rust-rocksdb"
|
||||
branch = "master"
|
||||
optional = true
|
||||
default-features = true
|
||||
features = ["multi-threaded-cf", "zstd"]
|
||||
|
||||
[dependencies.rusqlite]
|
||||
git = "https://github.com/rusqlite/rusqlite"
|
||||
#branch = "master"
|
||||
rev = "e00b626e2b1c67347d789fb7f600281705c89381"
|
||||
optional = true
|
||||
features = ["bundled"]
|
||||
|
||||
# used only by rusqlite
|
||||
[dependencies.parking_lot]
|
||||
version = "0.12.2"
|
||||
optional = true
|
||||
|
||||
# used only by rusqlite
|
||||
[dependencies.thread_local]
|
||||
version = "1.1.8"
|
||||
optional = true
|
||||
|
||||
# used only by rusqlite and rust-rocksdb
|
||||
[dependencies.num_cpus]
|
||||
version = "1.16.0"
|
||||
|
||||
[dependencies.tokio]
|
||||
version = "1.37.0"
|
||||
features = ["fs", "macros", "sync", "signal"]
|
||||
|
||||
# *nix-specific dependencies
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
nix = { version = "0.28.0", features = ["resource"] }
|
||||
sd-notify = { version = "0.4.1", optional = true } # systemd is only available/relevant on *nix platforms
|
||||
|
||||
|
||||
[target.'cfg(all(not(target_env = "msvc"), target_os = "linux"))'.dependencies]
|
||||
hardened_malloc-rs = { version = "0.1.2", optional = true, features = [
|
||||
"static",
|
||||
"gcc",
|
||||
"light",
|
||||
], default-features = false }
|
||||
#hardened_malloc-rs = { optional = true, features = ["static","clang","light"], path = "../hardened_malloc-rs", default-features = false }
|
||||
|
||||
|
||||
# backport of [https://github.com/tokio-rs/tracing/pull/2956] to the 0.1.x branch of tracing.
|
||||
# we can switch back to upstream if #2956 is merged and backported in the upstream repo.
|
||||
[patch.crates-io.tracing-subscriber]
|
||||
git = "https://github.com/girlbossceo/tracing"
|
||||
branch = "tracing-subscriber/env-filter-clone-0.1.x-backport"
|
||||
[patch.crates-io.tracing]
|
||||
git = "https://github.com/girlbossceo/tracing"
|
||||
branch = "tracing-subscriber/env-filter-clone-0.1.x-backport"
|
||||
[patch.crates-io.tracing-core]
|
||||
git = "https://github.com/girlbossceo/tracing"
|
||||
branch = "tracing-subscriber/env-filter-clone-0.1.x-backport"
|
||||
|
||||
[features]
|
||||
default = [
|
||||
"backend_rocksdb",
|
||||
"systemd",
|
||||
"element_hacks",
|
||||
"sentry_telemetry",
|
||||
"gzip_compression",
|
||||
"brotli_compression",
|
||||
"zstd_compression",
|
||||
"release_max_log_level",
|
||||
"io_uring",
|
||||
]
|
||||
backend_sqlite = ["sqlite"]
|
||||
backend_rocksdb = ["rocksdb"]
|
||||
rocksdb = ["dep:rust-rocksdb"]
|
||||
jemalloc = [
|
||||
"dep:tikv-jemalloc-sys",
|
||||
"dep:tikv-jemalloc-ctl",
|
||||
"dep:tikv-jemallocator",
|
||||
"rust-rocksdb/jemalloc",
|
||||
]
|
||||
jemalloc_prof = ["tikv-jemalloc-sys/profiling"]
|
||||
sqlite = ["dep:rusqlite", "dep:parking_lot", "dep:thread_local"]
|
||||
systemd = ["dep:sd-notify"]
|
||||
sentry_telemetry = ["dep:sentry", "dep:sentry-tracing", "dep:sentry-tower"]
|
||||
|
||||
gzip_compression = ["tower-http/compression-gzip", "reqwest/gzip"]
|
||||
zstd_compression = ["tower-http/compression-zstd"]
|
||||
brotli_compression = ["tower-http/compression-br", "reqwest/brotli"]
|
||||
|
||||
sha256_media = ["dep:sha2"]
|
||||
io_uring = ["rust-rocksdb/io-uring"]
|
||||
axum_dual_protocol = ["dep:axum-server-dual-protocol"]
|
||||
|
||||
perf_measurements = [
|
||||
"dep:opentelemetry",
|
||||
"dep:tracing-flame",
|
||||
"dep:tracing-opentelemetry",
|
||||
"dep:opentelemetry_sdk",
|
||||
"dep:opentelemetry-jaeger",
|
||||
]
|
||||
|
||||
# enable the tokio_console server
|
||||
# incompatible with release_max_log_level
|
||||
tokio_console = ["dep:console-subscriber", "tokio/tracing"]
|
||||
|
||||
hot_reload = ["dep:hot-lib-reloader"]
|
||||
|
||||
hardened_malloc = ["dep:hardened_malloc-rs"]
|
||||
|
||||
# increases performance, reduces build times, and reduces binary size by not compiling or
|
||||
# genreating code for log level filters that users will generally not use (debug and trace) only in release builds
|
||||
#
|
||||
# the expense is obviously losing those log level filters for usage at runtime. debug builds will still have all log levels
|
||||
release_max_log_level = [
|
||||
"tracing/max_level_trace",
|
||||
"tracing/release_max_level_info",
|
||||
"log/max_level_trace",
|
||||
"log/release_max_level_info",
|
||||
]
|
||||
|
||||
# developer feature useful only in debug builds.
|
||||
dev_release_log_level = []
|
||||
|
||||
# client/server interopability hacks
|
||||
#
|
||||
## element has various non-spec compliant behaviour
|
||||
element_hacks = []
|
||||
|
||||
|
||||
[package.metadata.deb]
|
||||
name = "conduwuit"
|
||||
maintainer = "strawberry <strawberry@puppygock.gay>"
|
||||
copyright = "2024, strawberry <strawberry@puppygock.gay>"
|
||||
license-file = ["LICENSE", "3"]
|
||||
depends = "$auto, ca-certificates"
|
||||
extended-description = """\
|
||||
a cool hard fork of Conduit, a Matrix homeserver written in Rust"""
|
||||
section = "net"
|
||||
priority = "optional"
|
||||
assets = [
|
||||
[
|
||||
"debian/README.md",
|
||||
"usr/share/doc/conduwuit/README.Debian",
|
||||
"644",
|
||||
],
|
||||
[
|
||||
"README.md",
|
||||
"usr/share/doc/conduwuit/",
|
||||
"644",
|
||||
],
|
||||
[
|
||||
"target/release/conduit",
|
||||
"usr/sbin/conduwuit",
|
||||
"755",
|
||||
],
|
||||
[
|
||||
"conduwuit-example.toml",
|
||||
"etc/conduwuit/conduwuit.toml",
|
||||
"640",
|
||||
],
|
||||
]
|
||||
conf-files = ["/etc/conduwuit/conduwuit.toml"]
|
||||
maintainer-scripts = "debian/"
|
||||
systemd-units = { unit-name = "conduwuit" }
|
||||
|
||||
|
||||
[profile.dev]
|
||||
#debug = 0
|
||||
lto = 'off'
|
||||
codegen-units = 512
|
||||
incremental = true
|
||||
overflow-checks = true
|
||||
#panic = "abort"
|
||||
|
||||
# seems to speed up continuous debug compilations
|
||||
[profile.dev.build-override]
|
||||
opt-level = 3
|
||||
[profile.dev.package."*"] # external dependencies
|
||||
opt-level = 1
|
||||
[profile.dev.package."tokio"]
|
||||
opt-level = 3
|
||||
|
||||
# default release profile
|
||||
[profile.release]
|
||||
lto = 'thin'
|
||||
incremental = false
|
||||
opt-level = 3
|
||||
strip = "symbols"
|
||||
control-flow-guard = true # Windows only
|
||||
debug = 0
|
||||
|
||||
# release profile with debug symbols
|
||||
[profile.release-debuginfo]
|
||||
inherits = "release"
|
||||
strip = "none"
|
||||
debug = "full"
|
||||
|
||||
|
||||
# high performance release profile which uses fat LTO across all crates, 1 codegen unit, max opt-level, and optimises across all crates
|
||||
[profile.release-high-perf]
|
||||
inherits = "release"
|
||||
lto = 'fat'
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
|
||||
# For releases also try to max optimizations for dependencies:
|
||||
[profile.release-high-perf.build-override]
|
||||
debug = 0
|
||||
opt-level = 3
|
||||
codegen-units = 1
|
||||
|
||||
[profile.release-high-perf.package."*"]
|
||||
debug = 0
|
||||
opt-level = 3
|
||||
codegen-units = 1
|
||||
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[workspace.lints.rust]
|
||||
missing_abi = "warn"
|
||||
noop_method_call = "warn"
|
||||
pointer_structural_match = "warn"
|
||||
explicit_outlives_requirements = "warn"
|
||||
unused_extern_crates = "warn"
|
||||
unused_import_braces = "warn"
|
||||
unused_lifetimes = "warn"
|
||||
unused_qualifications = "warn"
|
||||
unused_macro_rules = "warn"
|
||||
dead_code = "warn"
|
||||
elided_lifetimes_in_paths = "warn"
|
||||
macro_use_extern_crate = "warn"
|
||||
single_use_lifetimes = "warn"
|
||||
unsafe_op_in_unsafe_fn = "warn"
|
||||
unreachable_pub = "warn"
|
||||
|
||||
# this seems to suggest broken code and is not working correctly
|
||||
unused_braces = "allow"
|
||||
|
||||
# some sadness
|
||||
missing_docs = "allow"
|
||||
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# pedantic = "warn"
|
||||
|
||||
suspicious = "warn" # assume deny in practice
|
||||
perf = "warn" # assume deny in practice
|
||||
|
||||
redundant_clone = "warn"
|
||||
cloned_instead_of_copied = "warn"
|
||||
expl_impl_clone_on_copy = "warn"
|
||||
unnecessary_cast = "warn"
|
||||
cast_lossless = "warn"
|
||||
ptr_as_ptr = "warn"
|
||||
mut_mut = "warn"
|
||||
char_lit_as_u8 = "warn"
|
||||
dbg_macro = "warn"
|
||||
empty_structs_with_brackets = "warn"
|
||||
get_unwrap = "warn"
|
||||
negative_feature_names = "warn"
|
||||
pub_without_shorthand = "warn"
|
||||
rc_buffer = "warn"
|
||||
rc_mutex = "warn"
|
||||
redundant_feature_names = "warn"
|
||||
redundant_type_annotations = "warn"
|
||||
rest_pat_in_fully_bound_structs = "warn"
|
||||
str_to_string = "warn"
|
||||
string_to_string = "warn"
|
||||
tests_outside_test_module = "warn"
|
||||
undocumented_unsafe_blocks = "warn"
|
||||
unneeded_field_pattern = "warn"
|
||||
unseparated_literal_suffix = "warn"
|
||||
wildcard_dependencies = "warn"
|
||||
or_fun_call = "warn"
|
||||
unnecessary_lazy_evaluations = "warn"
|
||||
assertions_on_result_states = "warn"
|
||||
default_union_representation = "warn"
|
||||
deref_by_slicing = "warn"
|
||||
empty_drop = "warn"
|
||||
exit = "warn"
|
||||
filetype_is_file = "warn"
|
||||
float_cmp_const = "warn"
|
||||
format_push_string = "warn"
|
||||
impl_trait_in_params = "warn"
|
||||
lossy_float_literal = "warn"
|
||||
mem_forget = "warn"
|
||||
missing_assert_message = "warn"
|
||||
mutex_atomic = "warn"
|
||||
semicolon_outside_block = "warn"
|
||||
fn_to_numeric_cast = "warn"
|
||||
fn_to_numeric_cast_with_truncation = "warn"
|
||||
string_lit_chars_any = "warn"
|
||||
suspicious_xor_used_as_pow = "warn"
|
||||
try_err = "warn"
|
||||
unnecessary_safety_comment = "warn"
|
||||
unnecessary_safety_doc = "warn"
|
||||
unnecessary_self_imports = "warn"
|
||||
verbose_file_reads = "warn"
|
||||
cast_possible_wrap = "warn"
|
||||
redundant_closure_for_method_calls = "warn"
|
||||
large_futures = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
match_bool = "warn"
|
||||
struct_excessive_bools = "warn"
|
||||
must_use_candidate = "warn"
|
||||
collapsible_else_if = "warn"
|
||||
inconsistent_struct_constructor = "warn"
|
||||
manual_string_new = "warn"
|
||||
zero_sized_map_values = "warn"
|
||||
unnecessary_box_returns = "warn"
|
||||
map_unwrap_or = "warn"
|
||||
implicit_clone = "warn"
|
||||
match_wildcard_for_single_variants = "warn"
|
||||
unnecessary_wraps = "warn"
|
||||
match_same_arms = "warn"
|
||||
ignored_unit_patterns = "warn"
|
||||
redundant_else = "warn"
|
||||
explicit_into_iter_loop = "warn"
|
||||
used_underscore_binding = "warn"
|
||||
needless_pass_by_value = "warn"
|
||||
too_many_lines = "warn"
|
||||
let_underscore_untyped = "warn"
|
||||
single_match = "warn"
|
||||
single_match_else = "warn"
|
||||
explicit_deref_methods = "warn"
|
||||
explicit_iter_loop = "warn"
|
||||
manual_let_else = "warn"
|
||||
trivially_copy_pass_by_ref = "warn"
|
||||
wildcard_imports = "warn"
|
||||
checked_conversions = "warn"
|
||||
#integer_arithmetic = "warn"
|
||||
#as_conversions = "warn"
|
||||
|
||||
# some sadness
|
||||
missing_errors_doc = "allow"
|
||||
missing_panics_doc = "allow"
|
||||
module_name_repetitions = "allow"
|
||||
if_not_else = "allow"
|
||||
doc_markdown = "allow"
|
||||
cast_possible_truncation = "allow"
|
||||
cast_precision_loss = "allow"
|
||||
cast_sign_loss = "allow"
|
||||
same_name_method = "allow"
|
||||
mod_module_files = "allow"
|
||||
unwrap_used = "allow"
|
||||
expect_used = "allow"
|
||||
if_then_some_else_none = "allow"
|
||||
let_underscore_must_use = "allow"
|
||||
map_err_ignore = "allow"
|
||||
missing_docs_in_private_items = "allow"
|
||||
multiple_inherent_impl = "allow"
|
||||
error_impl_error = "allow"
|
||||
string_add = "allow"
|
||||
string_slice = "allow"
|
||||
ref_patterns = "allow"
|
||||
@@ -1,202 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2023 June
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,71 +0,0 @@
|
||||
# conduwuit
|
||||
|
||||
`main` / stable: [](https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml)
|
||||
|
||||
<!-- ANCHOR: catchphrase -->
|
||||
### a very cool, featureful fork of [Conduit](https://conduit.rs/)
|
||||
<!-- ANCHOR_END: catchphrase -->
|
||||
|
||||
Visit the [Conduwuit documentation](https://conduwuit.puppyirl.gay/) for more information.
|
||||
|
||||
<!-- ANCHOR: body -->
|
||||
#### What is Matrix?
|
||||
|
||||
[Matrix](https://matrix.org) is an open network for secure and decentralized
|
||||
communication. Users from every Matrix homeserver can chat with users from all
|
||||
other Matrix servers. You can even use bridges (also called Matrix Appservices)
|
||||
to communicate with users outside of Matrix, like a community on Discord.
|
||||
|
||||
#### What is the goal?
|
||||
|
||||
An efficient Matrix homeserver that's easy to set up and just works. You can install
|
||||
it on a mini-computer like the Raspberry Pi to host Matrix for your family,
|
||||
friends or company.
|
||||
|
||||
#### Can I try it out?
|
||||
|
||||
An official conduwuit server ran by me is available at transfem.dev ([element.transfem.dev](https://element.transfem.dev) / [cinny.transfem.dev](https://cinny.transfem.dev))
|
||||
|
||||
transfem.dev is a public homeserver that can be used, it is not a "test only homeserver". This means there are rules, so please read the rules: [https://transfem.dev/homeserver_rules.txt](https://transfem.dev/homeserver_rules.txt)
|
||||
|
||||
transfem.dev is also listed at [servers.joinmatrix.org](https://servers.joinmatrix.org/)
|
||||
|
||||
#### What is the current status?
|
||||
|
||||
conduwuit is a hard fork of Conduit which is in beta, meaning you can join and participate in most
|
||||
Matrix rooms, but not all features are supported and you might run into bugs
|
||||
from time to time.
|
||||
|
||||
<!-- ANCHOR_END: body -->
|
||||
|
||||
<!-- ANCHOR: footer -->
|
||||
|
||||
#### Contact
|
||||
|
||||
If you run into any question, feel free to
|
||||
- Ask us in `#conduwuit:puppygock.gay` on Matrix
|
||||
- [Open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new)
|
||||
|
||||
#### Donate
|
||||
|
||||
- Liberapay: <https://liberapay.com/girlbossceo>
|
||||
- Ko-fi: <https://ko-fi.com/puppygock>
|
||||
- GitHub Sponsors: <https://github.com/sponsors/girlbossceo>
|
||||
|
||||
#### Logo
|
||||
|
||||
Original repo and Matrix room picture was from bran (<3). Current banner image and logo is directly from [this cohost post](https://cohost.org/RatBaby/post/1028290-finally-a-flag-for).
|
||||
|
||||
#### Is it conduwuit or Conduwuit?
|
||||
|
||||
Both, but I prefer conduwuit.
|
||||
|
||||
#### Mirrors of conduwuit
|
||||
|
||||
- GitHub: <https://github.com/girlbossceo/conduwuit>
|
||||
- GitLab: <https://gitlab.com/conduwuit/conduwuit>
|
||||
- git.girlcock.ceo: <https://git.girlcock.ceo/strawberry/conduwuit>
|
||||
- git.gay: <https://git.gay/june/conduwuit>
|
||||
- Codeberg: <https://codeberg.org/girlbossceo/conduwuit>
|
||||
- sourcehut: <https://git.sr.ht/~girlbossceo/conduwuit>
|
||||
<!-- ANCHOR_END: footer -->
|
||||
@@ -1,2 +0,0 @@
|
||||
[advisories]
|
||||
ignore = ["RUSTSEC-2020-0016"]
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Path to Complement's source code
|
||||
#
|
||||
# The `COMPLEMENT_SRC` environment variable is set in the Nix dev shell, which
|
||||
# points to a store path containing the Complement source code. It's likely you
|
||||
# want to just pass that as the first argument to use it here.
|
||||
COMPLEMENT_SRC="$1"
|
||||
|
||||
# A `.jsonl` file to write test logs to
|
||||
LOG_FILE="$2"
|
||||
|
||||
# A `.jsonl` file to write test results to
|
||||
RESULTS_FILE="$3"
|
||||
|
||||
OCI_IMAGE="complement-conduit:main"
|
||||
|
||||
toplevel="$(git rev-parse --show-toplevel)"
|
||||
|
||||
pushd "$toplevel" > /dev/null
|
||||
|
||||
bin/nix-build-and-cache just .#complement
|
||||
|
||||
docker load < result
|
||||
popd > /dev/null
|
||||
|
||||
# It's okay (likely, even) that `go test` exits nonzero
|
||||
set +o pipefail
|
||||
env \
|
||||
-C "$COMPLEMENT_SRC" \
|
||||
COMPLEMENT_BASE_IMAGE="$OCI_IMAGE" \
|
||||
go test -tags="conduwuit_blacklist" -v -timeout 1h -json ./tests | tee "$LOG_FILE"
|
||||
set -o pipefail
|
||||
|
||||
# Post-process the results into an easy-to-compare format, sorted by Test name for reproducible results
|
||||
cat "$LOG_FILE" | jq -s -c 'sort_by(.Test)[]' | jq -c '
|
||||
select(
|
||||
(.Action == "pass" or .Action == "fail" or .Action == "skip")
|
||||
and .Test != null
|
||||
) | {Action: .Action, Test: .Test}
|
||||
' > "$RESULTS_FILE"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
toplevel="$(git rev-parse --show-toplevel)"
|
||||
|
||||
# Build just the single installable and forward any other arguments too
|
||||
just() {
|
||||
# uses nix-output-monitor (nom) if available
|
||||
if command -v nom &> /dev/null; then
|
||||
nom build "$@"
|
||||
else
|
||||
nix build -L "$@"
|
||||
fi
|
||||
|
||||
if [ -z "$ATTIC_TOKEN" ]; then
|
||||
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
|
||||
return
|
||||
fi
|
||||
|
||||
# historical "conduit" store for compatibility purposes, same as conduwuit
|
||||
nix run --inputs-from "$toplevel" attic -- \
|
||||
login \
|
||||
conduit \
|
||||
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduit}" \
|
||||
"$ATTIC_TOKEN"
|
||||
|
||||
# Find all output paths of the installables and their build dependencies
|
||||
readarray -t derivations < <(nix path-info --derivation "$@")
|
||||
cache=()
|
||||
for derivation in "${derivations[@]}"; do
|
||||
cache+=(
|
||||
"$(nix-store --query --requisites --include-outputs "$derivation")"
|
||||
)
|
||||
done
|
||||
|
||||
# Upload them to Attic (conduit store)
|
||||
#
|
||||
# Use `xargs` and a here-string because something would probably explode if
|
||||
# several thousand arguments got passed to a command at once. Hopefully no
|
||||
# store paths include a newline in them.
|
||||
(
|
||||
IFS=$'\n'
|
||||
nix shell --inputs-from "$toplevel" attic -c xargs \
|
||||
attic push conduit <<< "${cache[*]}"
|
||||
)
|
||||
|
||||
# main "conduwuit" store
|
||||
nix run --inputs-from "$toplevel" attic -- \
|
||||
login \
|
||||
conduwuit \
|
||||
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduwuit}" \
|
||||
"$ATTIC_TOKEN"
|
||||
|
||||
# Upload them to Attic (conduwuit store)
|
||||
#
|
||||
# Use `xargs` and a here-string because something would probably explode if
|
||||
# several thousand arguments got passed to a command at once. Hopefully no
|
||||
# store paths include a newline in them.
|
||||
(
|
||||
IFS=$'\n'
|
||||
nix shell --inputs-from "$toplevel" attic -c xargs \
|
||||
attic push conduwuit <<< "${cache[*]}"
|
||||
)
|
||||
}
|
||||
|
||||
# Build and cache things needed for CI
|
||||
ci() {
|
||||
cache=(
|
||||
--inputs-from "$toplevel"
|
||||
|
||||
# Keep sorted
|
||||
"$toplevel#devShells.x86_64-linux.default"
|
||||
attic#default
|
||||
nixpkgs#direnv
|
||||
nixpkgs#jq
|
||||
nixpkgs#nix-direnv
|
||||
)
|
||||
|
||||
just "${cache[@]}"
|
||||
}
|
||||
|
||||
# Build and cache *all* the package outputs from the flake.nix
|
||||
packages() {
|
||||
declare -a cache="($(
|
||||
nix flake show --json 2> /dev/null |
|
||||
nix run --inputs-from "$toplevel" nixpkgs#jq -- \
|
||||
-r \
|
||||
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | @sh'
|
||||
))"
|
||||
|
||||
just "${cache[@]}"
|
||||
}
|
||||
|
||||
|
||||
eval "$@"
|
||||
@@ -1,18 +0,0 @@
|
||||
[book]
|
||||
title = "conduwuit"
|
||||
description = "conduwuit, which is a well-maintained fork of Conduit, is a simple, fast and reliable chat server for the Matrix protocol"
|
||||
language = "en"
|
||||
multilingual = false
|
||||
src = "docs"
|
||||
|
||||
[build]
|
||||
build-dir = "public"
|
||||
create-missing = true
|
||||
|
||||
[output.html]
|
||||
git-repository-url = "https://github.com/girlbossceo/conduwuit"
|
||||
edit-url-template = "https://github.com/girlbossceo/conduwuit/edit/main/{path}"
|
||||
git-repository-icon = "fa-github-square"
|
||||
|
||||
[output.html.search]
|
||||
limit-results = 15
|
||||
@@ -1 +0,0 @@
|
||||
too-many-lines-threshold = 700
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
# podman save --format oci-archive jade-website-frontend:latest | gzip | ssh core@176.126.240.240 -T "zcat | podman load"
|
||||
# podman compose create
|
||||
# let containers = podman ps -a --format json | from json | where Labels."com.docker.compose.project" == "jade-website"
|
||||
|
||||
# podman compose create; let containers = podman ps -a --format json | from json | where Labels."com.docker.compose.project" == "jade-website"; podman kube generate ($containers | get Id) | save deployment.yml
|
||||
# echo deployment.yml | ssh core@176.126.240.240 -T "cat > deployment.yml"
|
||||
# $containers.1.Labels | to yaml
|
||||
|
||||
# podman kube generate -s ($containers | get Id) --podman-only | ssh core@176.126.240.240 -T "cat > deployment.yml"
|
||||
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
jade-website-frontend:
|
||||
image: jade-website-frontend:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: packages/website/Dockerfile
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - 3000:3000
|
||||
networks:
|
||||
- proxy
|
||||
# deploy:
|
||||
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
|
||||
|
||||
# - "traefik.http.routers.to-website.rule=Host(`jade.ellis.link`)"
|
||||
# - "traefik.http.routers.to-website.entrypoints=http"
|
||||
- "traefik.http.routers.to-website.rule=Host(`jade.ellis.link.localhost`)"
|
||||
- "traefik.http.routers.to-website.entrypoints=http"
|
||||
# - "traefik.http.routers.to-website.tls=true"
|
||||
# - "traefik.http.routers.to-website.tls.certresolver=letsencrypt"
|
||||
# - "traefik.http.routers.to-website.middlewares=cors-headers@docker"
|
||||
|
||||
# - "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
|
||||
# - "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||
# - "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
|
||||
|
||||
|
||||
traefik:
|
||||
image: "traefik:latest"
|
||||
container_name: "traefik"
|
||||
restart: "unless-stopped"
|
||||
# privileged: true
|
||||
security_opt:
|
||||
- "label=type:container_runtime_t"
|
||||
command:
|
||||
- "--log.level=DEBUG"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--entrypoints.http.address=:8080"
|
||||
# - "--entrypoints.https.address=:443"
|
||||
# - "--acme"
|
||||
# - "--certificatesresolvers.letsencrypt.acme.email='jade@ellis.link'"
|
||||
# - "--certificatesresolvers.letsencrypt.acme.storage=/certificates/acme.json"
|
||||
|
||||
# - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
|
||||
# - "--certificatesresolvers.letsencrypt.acme.httpChallenge.entryPoint=http"
|
||||
# - "--certificatesresolvers.lets-encrypt.acme.tlschallenge=true"
|
||||
|
||||
# - "--entrypoints.http.http.redirections.entryPoint.to=https"
|
||||
# - "--entrypoints.http.http.redirections.entryPoint.scheme=https"
|
||||
|
||||
# - --api.dashboard=true
|
||||
# - --api.insecure=true
|
||||
ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- "/run/user/1000/podman/podman.sock:/var/run/docker.sock"
|
||||
# - "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "traefik-public-certificates:/certificates"
|
||||
# - "./traefik_config:/etc/traefik"
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
|
||||
# # middleware redirect
|
||||
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
|
||||
# # global redirect to https
|
||||
# - "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
|
||||
# - "traefik.http.routers.redirs.entrypoints=http"
|
||||
# - "traefik.http.routers.redirs.middlewares=redirect-to-https"
|
||||
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
# external: true
|
||||
enable_ipv6: true
|
||||
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
traefik-public-certificates:
|
||||
# mkdir -p ~/.config/containers/systemd
|
||||
# nano ~/.config/containers/systemd/deployment.kube
|
||||
|
||||
# [Unit]
|
||||
# Description=Deployment via kubernetes
|
||||
# Before=local-fs.target
|
||||
# [Kube]
|
||||
# Yaml=/var/home/core/deployment.yml
|
||||
# [Install]
|
||||
# # Start by default on boot
|
||||
# WantedBy=multi-user.target default.target
|
||||
|
||||
# systemctl --user daemon-reload
|
||||
# systemctl --user start deployment.service
|
||||
@@ -1,742 +0,0 @@
|
||||
# =============================================================================
|
||||
# This is the official example config for conduwuit.
|
||||
# If you use it for your server, you will need to adjust it to your own needs.
|
||||
# At the very least, change the server_name field!
|
||||
#
|
||||
# This documentation can also be found at https://conduwuit.puppyirl.gay/configuration.html
|
||||
# =============================================================================
|
||||
|
||||
[global]
|
||||
|
||||
# The server_name is the pretty name of this server. It is used as a suffix for user
|
||||
# and room ids. Examples: matrix.org, conduit.rs
|
||||
|
||||
# The Conduit server needs all /_matrix/ requests to be reachable at
|
||||
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).
|
||||
|
||||
# If that's not possible for you, you can create /.well-known files to redirect
|
||||
# requests (delegation). See
|
||||
# https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixclient
|
||||
# and
|
||||
# https://spec.matrix.org/v1.9/server-server-api/#getwell-knownmatrixserver
|
||||
# for more information
|
||||
|
||||
# YOU NEED TO EDIT THIS
|
||||
#server_name = "your.server.name"
|
||||
|
||||
# Servers listed here will be used to gather public keys of other servers (notary trusted key servers).
|
||||
#
|
||||
# The default behaviour for conduwuit is to attempt to query trusted key servers before querying the individual servers.
|
||||
# This is done for performance reasons, but if you would like to query individual servers before the notary servers
|
||||
# configured below, set to
|
||||
#
|
||||
# (Currently, conduwuit doesn't support batched key requests, so this list should only contain Synapse servers)
|
||||
# Defaults to `matrix.org`
|
||||
# trusted_servers = ["matrix.org"]
|
||||
|
||||
# Sentry.io crash/panic reporting, performance monitoring/metrics, etc. This is NOT enabled by default.
|
||||
# conduwuit's default Sentry reporting endpoint is o4506996327251968.ingest.us.sentry.io
|
||||
#
|
||||
# Defaults to *false*
|
||||
#sentry = false
|
||||
|
||||
# Sentry reporting URL if a custom one is desired
|
||||
#
|
||||
# Defaults to conduwuit's default Sentry endpoint: "https://fe2eb4536aa04949e28eff3128d64757@o4506996327251968.ingest.us.sentry.io/4506996334657536"
|
||||
#sentry_endpoint = ""
|
||||
|
||||
# Report your Conduwuit server_name in Sentry.io crash reports and metrics
|
||||
#
|
||||
# Defaults to false
|
||||
#sentry_send_server_name = false
|
||||
|
||||
# Performance monitoring/tracing sample rate for Sentry.io
|
||||
#
|
||||
# Note that too high values may impact performance, and can be disabled by setting it to 0.0
|
||||
#
|
||||
# Defaults to 0.15
|
||||
#sentry_traces_sample_rate = 0.15
|
||||
|
||||
|
||||
### Database configuration
|
||||
|
||||
# This is the only directory where conduwuit will save its data, including media
|
||||
database_path = "/var/lib/matrix-conduit/"
|
||||
|
||||
# Database backend: Only rocksdb and sqlite are supported. Please note that sqlite
|
||||
# will perform significantly worse than rocksdb as it is not intended to be used the
|
||||
# way it is by conduwuit. sqlite only exists for historical reasons.
|
||||
database_backend = "rocksdb"
|
||||
|
||||
|
||||
### Network
|
||||
|
||||
# The port(s) conduwuit will be running on. You need to set up a reverse proxy such as
|
||||
# Caddy or Nginx so all requests to /_matrix on port 443 and 8448 will be
|
||||
# forwarded to the conduwuit instance running on this port
|
||||
# Docker users: Don't change this, you'll need to map an external port to this.
|
||||
# To listen on multiple ports, specify a vector e.g. [8080, 8448]
|
||||
port = 6167
|
||||
|
||||
# default address (IPv4 or IPv6) conduwuit will listen on. Generally you want this to be
|
||||
# localhost (127.0.0.1 / ::1). If you are using Docker or a container NAT networking setup, you
|
||||
# likely need this to be 0.0.0.0.
|
||||
address = "127.0.0.1"
|
||||
|
||||
# Max request size for file uploads
|
||||
max_request_size = 20_000_000 # in bytes
|
||||
|
||||
# Uncomment unix_socket_path to listen on a UNIX socket at the specified path.
|
||||
# If listening on a UNIX socket, you must remove/comment the 'address' key if defined and add your
|
||||
# reverse proxy to the 'conduwuit' group, unless world RW permissions are specified with unix_socket_perms (666 minimum).
|
||||
#unix_socket_path = "/run/conduwuit/conduwuit.sock"
|
||||
#unix_socket_perms = 660
|
||||
|
||||
# Set this to true for conduwuit to compress HTTP response bodies using zstd.
|
||||
# This option does nothing if conduwuit was not built with `zstd_compression` feature.
|
||||
# Please be aware that enabling HTTP compression may weaken TLS.
|
||||
# Most users should not need to enable this.
|
||||
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
|
||||
zstd_compression = false
|
||||
|
||||
# Set this to true for conduwuit to compress HTTP response bodies using gzip.
|
||||
# This option does nothing if conduwuit was not built with `gzip_compression` feature.
|
||||
# Please be aware that enabling HTTP compression may weaken TLS.
|
||||
# Most users should not need to enable this.
|
||||
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
|
||||
gzip_compression = false
|
||||
|
||||
# Set this to true for conduwuit to compress HTTP response bodies using brotli.
|
||||
# This option does nothing if conduwuit was not built with `brotli_compression` feature.
|
||||
# Please be aware that enabling HTTP compression may weaken TLS.
|
||||
# Most users should not need to enable this.
|
||||
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
|
||||
brotli_compression = false
|
||||
|
||||
# Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you do not want conduwuit to send outbound requests to.
|
||||
# Defaults to RFC1918, unroutable, loopback, multicast, and testnet addresses for security.
|
||||
#
|
||||
# To disable, set this to be an empty vector (`[]`).
|
||||
# Please be aware that this is *not* a guarantee. You should be using a firewall with zones as doing this on the application layer may have bypasses.
|
||||
#
|
||||
# Currently this does not account for proxies in use like Synapse does.
|
||||
ip_range_denylist = [
|
||||
"127.0.0.0/8",
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"192.168.0.0/16",
|
||||
"100.64.0.0/10",
|
||||
"192.0.0.0/24",
|
||||
"169.254.0.0/16",
|
||||
"192.88.99.0/24",
|
||||
"198.18.0.0/15",
|
||||
"192.0.2.0/24",
|
||||
"198.51.100.0/24",
|
||||
"203.0.113.0/24",
|
||||
"224.0.0.0/4",
|
||||
"::1/128",
|
||||
"fe80::/10",
|
||||
"fc00::/7",
|
||||
"2001:db8::/32",
|
||||
"ff00::/8",
|
||||
"fec0::/10",
|
||||
]
|
||||
|
||||
|
||||
### Moderation / Privacy / Security
|
||||
|
||||
# Set to true to allow user type "guest" registrations. Element attempts to register guest users automatically.
|
||||
# Defaults to false
|
||||
allow_guest_registration = false
|
||||
|
||||
# Set to true to log guest registrations in the admin room.
|
||||
# Defaults to false as it may be noisy or unnecessary.
|
||||
log_guest_registrations = false
|
||||
|
||||
# Set to true to allow guest registrations/users to auto join any rooms specified in `auto_join_rooms`
|
||||
# Defaults to false
|
||||
allow_guests_auto_join_rooms = false
|
||||
|
||||
# Vector list of servers that conduwuit will refuse to download remote media from.
|
||||
# No default.
|
||||
# prevent_media_downloads_from = ["example.com", "example.local"]
|
||||
|
||||
# Enables registration. If set to false, no users can register on this
|
||||
# server.
|
||||
# If set to true without a token configured, users can register with no form of 2nd-
|
||||
# step only if you set
|
||||
# `yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse` to
|
||||
# true in your config. If you would like
|
||||
# registration only via token reg, please configure the `registration_token` key.
|
||||
allow_registration = false
|
||||
# Please note that an open registration homeserver with no second-step verification
|
||||
# is highly prone to abuse and potential defederation by homeservers, including
|
||||
# matrix.org.
|
||||
|
||||
# A static registration token that new users will have to provide when creating
|
||||
# an account. If unset and `allow_registration` is true, registration is open
|
||||
# without any condition. YOU NEED TO EDIT THIS.
|
||||
registration_token = "change this token for something specific to your server"
|
||||
|
||||
# controls whether federation is allowed or not
|
||||
# defaults to true
|
||||
# allow_federation = true
|
||||
|
||||
# controls whether users are allowed to create rooms.
|
||||
# appservices and admins are always allowed to create rooms
|
||||
# defaults to true
|
||||
# allow_room_creation = true
|
||||
|
||||
# controls whether non-admin local users are forbidden from sending room invites (local and remote),
|
||||
# and if non-admin users can receive remote room invites. admins are always allowed to send and receive all room invites.
|
||||
# defaults to false
|
||||
# block_non_admin_invites = false
|
||||
|
||||
# List of forbidden username patterns/strings. Values in this list are matched as *contains*.
|
||||
# This is checked upon username availability check, registration, and startup as warnings if any local users in your database
|
||||
# have a forbidden username.
|
||||
# No default.
|
||||
# forbidden_usernames = []
|
||||
|
||||
# List of forbidden room aliases and room IDs as patterns/strings. Values in this list are matched as *contains*.
|
||||
# This is checked upon room alias creation, custom room ID creation if used, and startup as warnings if any room aliases
|
||||
# in your database have a forbidden room alias/ID.
|
||||
# No default.
|
||||
# forbidden_alias_names = []
|
||||
|
||||
# List of forbidden server names that we will block all client room joins, incoming federated room directory requests, incoming federated invites for, and incoming federated joins. This check is applied on the room ID, room alias, sender server name, and sender user's server name.
|
||||
# Basically "global" ACLs. For our user (client) checks, admin users are allowed.
|
||||
# No default.
|
||||
# forbidden_remote_server_names = []
|
||||
|
||||
# List of forbidden server names that we will block all outgoing federated room directory requests for. Useful for preventing our users from wandering into bad servers or spaces.
|
||||
# No default.
|
||||
# forbidden_remote_room_directory_server_names = []
|
||||
|
||||
# Set this to true to allow your server's public room directory to be federated.
|
||||
# Set this to false to protect against /publicRooms spiders, but will forbid external users
|
||||
# from viewing your server's public room directory. If federation is disabled entirely
|
||||
# (`allow_federation`), this is inherently false.
|
||||
allow_public_room_directory_over_federation = false
|
||||
|
||||
# Set this to true to allow your server's public room directory to be queried without client
|
||||
# authentication (access token) through the Client APIs. Set this to false to protect against /publicRooms spiders.
|
||||
allow_public_room_directory_without_auth = false
|
||||
|
||||
# Set this to true to lock down your server's public room directory and only allow admins to publish rooms to the room directory.
|
||||
# Unpublishing is still allowed by all users with this enabled.
|
||||
#
|
||||
# Defaults to false
|
||||
lockdown_public_room_directory = false
|
||||
|
||||
# Set this to true to allow federating device display names / allow external users to see your device display name.
|
||||
# If federation is disabled entirely (`allow_federation`), this is inherently false. For privacy, this is best disabled.
|
||||
allow_device_name_federation = false
|
||||
|
||||
# Vector list of domains allowed to send requests to for URL previews. Defaults to none.
|
||||
# Note: this is a *contains* match, not an explicit match. Putting "google.com" will match "https://google.com" and "http://mymaliciousdomainexamplegoogle.com"
|
||||
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
|
||||
url_preview_domain_contains_allowlist = []
|
||||
|
||||
# Vector list of explicit domains allowed to send requests to for URL previews. Defaults to none.
|
||||
# Note: This is an *explicit* match, not a contains match. Putting "google.com" will match "https://google.com", "http://google.com", but not "https://mymaliciousdomainexamplegoogle.com"
|
||||
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
|
||||
url_preview_domain_explicit_allowlist = []
|
||||
|
||||
# Vector list of URLs allowed to send requests to for URL previews. Defaults to none.
|
||||
# Note that this is a *contains* match, not an explicit match. Putting "google.com" will match "https://google.com/", "https://google.com/url?q=https://mymaliciousdomainexample.com", and "https://mymaliciousdomainexample.com/hi/google.com"
|
||||
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
|
||||
url_preview_url_contains_allowlist = []
|
||||
|
||||
# Vector list of explicit domains not allowed to send requests to for URL previews. Defaults to none.
|
||||
# Note: This is an *explicit* match, not a contains match. Putting "google.com" will match "https://google.com", "http://google.com", but not "https://mymaliciousdomainexamplegoogle.com"
|
||||
# The denylist is checked first before allowlist. Setting this to "*" will not do anything.
|
||||
url_preview_domain_explicit_denylist = []
|
||||
|
||||
# Maximum amount of bytes allowed in a URL preview body size when spidering. Defaults to 384KB (384_000 bytes)
|
||||
url_preview_max_spider_size = 384_000
|
||||
|
||||
# Option to decide whether you would like to run the domain allowlist checks (contains and explicit) on the root domain or not. Does not apply to URL contains allowlist. Defaults to false.
|
||||
# Example: If this is enabled and you have "wikipedia.org" allowed in the explicit and/or contains domain allowlist, it will allow all subdomains under "wikipedia.org" such as "en.m.wikipedia.org" as the root domain is checked and matched.
|
||||
# Useful if the domain contains allowlist is still too broad for you but you still want to allow all the subdomains under a root domain.
|
||||
url_preview_check_root_domain = false
|
||||
|
||||
# Config option to allow or disallow incoming federation requests that obtain the profiles
|
||||
# of our local users from `/_matrix/federation/v1/query/profile`
|
||||
#
|
||||
# This is inherently false if `allow_federation` is disabled
|
||||
#
|
||||
# Defaults to true
|
||||
allow_profile_lookup_federation_requests = true
|
||||
|
||||
# Config option to automatically deactivate the account of any user who attempts to join a:
|
||||
# - banned room
|
||||
# - forbidden room alias
|
||||
# - room alias or ID with a forbidden server name
|
||||
#
|
||||
# This may be useful if all your banned lists consist of toxic rooms or servers that no good faith user would ever attempt to join, and
|
||||
# to automatically remediate the problem without any admin user intervention.
|
||||
#
|
||||
# This will also make the user leave all rooms. Federation (e.g. remote room invites) are ignored here.
|
||||
#
|
||||
# Defaults to false as rooms can be banned for non-moderation-related reasons
|
||||
#auto_deactivate_banned_room_attempts = false
|
||||
|
||||
|
||||
### Misc
|
||||
|
||||
# max log level for conduwuit. allows debug, info, warn, or error
|
||||
# see also: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
||||
# **Caveat**:
|
||||
# For release builds, the tracing crate is configured to only implement levels higher than error to avoid unnecessary overhead in the compiled binary from trace macros.
|
||||
# For debug builds, this restriction is not applied.
|
||||
#
|
||||
# Defaults to "info"
|
||||
#log = "info"
|
||||
|
||||
# controls whether encrypted rooms and events are allowed (default true)
|
||||
#allow_encryption = false
|
||||
|
||||
# if enabled, conduwuit will send a simple GET request periodically to `https://pupbrain.dev/check-for-updates/stable`
|
||||
# for any new announcements made. Despite the name, this is not an update check
|
||||
# endpoint, it is simply an announcement check endpoint.
|
||||
# Defaults to false.
|
||||
#allow_check_for_updates = false
|
||||
|
||||
# Set to false to disable users from joining or creating room versions that aren't 100% officially supported by conduwuit.
|
||||
# conduwuit officially supports room versions 6 - 10. conduwuit has experimental/unstable support for 3 - 5, and 11.
|
||||
# Defaults to true.
|
||||
#allow_unstable_room_versions = true
|
||||
|
||||
# Option to control adding arbitrary text to the end of the user's displayname upon registration with a space before the text.
|
||||
# This was the lightning bolt emoji option, just replaced with support for adding your own custom text or emojis.
|
||||
# To disable, set this to "" (an empty string)
|
||||
# Defaults to "🏳️⚧️" (trans pride flag)
|
||||
#new_user_displayname_suffix = "🏳️⚧️"
|
||||
|
||||
# Option to control whether conduwuit will query your list of trusted notary key servers (`trusted_servers`) for
|
||||
# remote homeserver signing keys it doesn't know *first*, or query the individual servers first before falling back to the trusted
|
||||
# key servers.
|
||||
#
|
||||
# The former/default behaviour makes federated/remote rooms joins generally faster because we're querying a single (or list of) server
|
||||
# that we know works, is reasonably fast, and is reliable for just about all the homeserver signing keys in the room. Querying individual
|
||||
# servers may take longer depending on the general infrastructure of everyone in there, how many dead servers there are, etc.
|
||||
#
|
||||
# However, this does create an increased reliance on one single or multiple large entities as `trusted_servers` should generally
|
||||
# contain long-term and large servers who know a very large number of homeservers.
|
||||
#
|
||||
# If you don't know what any of this means, leave this and `trusted_servers` alone to their defaults.
|
||||
#
|
||||
# Defaults to true as this is the fastest option for federation.
|
||||
#query_trusted_key_servers_first = true
|
||||
|
||||
# List/vector of room **IDs** that conduwuit will make newly registered users join.
|
||||
# The room IDs specified must be rooms that you have joined at least once on the server, and must be public.
|
||||
#
|
||||
# No default.
|
||||
#auto_join_rooms = []
|
||||
|
||||
# Retry failed and incomplete messages to remote servers immediately upon startup. This is called bursting.
|
||||
# If this is disabled, said messages may not be delivered until more messages are queued for that server.
|
||||
# Do not change this option unless server resources are extremely limited or the scale of the server's
|
||||
# deployment is huge. Do not disable this unless you know what you are doing.
|
||||
#startup_netburst = true
|
||||
|
||||
# Limit the startup netburst to the most recent (default: 50) messages queued for each remote server. All older
|
||||
# messages are dropped and not reattempted. The `startup_netburst` option must be enabled for this value to have
|
||||
# any effect. Do not change this value unless you know what you are doing. Set this value to -1 to reattempt
|
||||
# every message without trimming the queues; this may consume significant disk. Set this value to 0 to drop all
|
||||
# messages without any attempt at redelivery.
|
||||
#startup_netburst_keep = 50
|
||||
|
||||
# If the 'perf_measurements' feature is enabled, enables collecting folded stack trace profile of tracing spans using
|
||||
# tracing_flame. The resulting profile can be visualized with inferno[1], speedscope[2], or a number of other tools.
|
||||
# [1]: https://github.com/jonhoo/inferno
|
||||
# [2]: www.speedscope.app
|
||||
# tracing_flame = false
|
||||
|
||||
# If 'tracing_flame' is enabled, sets a filter for which events will be included in the profile.
|
||||
# Supported syntax is documented at https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
||||
# tracing_flame_filter = "trace,h2=off"
|
||||
|
||||
# If 'tracing_flame' is enabled, set the path to write the generated profile.
|
||||
# tracing_flame_output_path = "./tracing.folded"
|
||||
|
||||
### Generic database options
|
||||
|
||||
# Set this to any float value to multiply conduwuit's in-memory LRU caches with.
|
||||
# May be useful if you have significant memory to spare to increase performance.
|
||||
# Defaults to 1.0.
|
||||
#conduit_cache_capacity_modifier = 1.0
|
||||
|
||||
# Set this to any float value in megabytes for conduwuit to tell the database engine that this much memory is available for database-related caches.
|
||||
# May be useful if you have significant memory to spare to increase performance.
|
||||
# Defaults to 256.0
|
||||
#db_cache_capacity_mb = 256.0
|
||||
|
||||
# Interval in seconds when conduwuit will run database cleanup operations.
|
||||
#
|
||||
# For SQLite: this will flush the WAL by executing `PRAGMA wal_checkpoint(RESTART)` (https://www.sqlite.org/pragma.html#pragma_wal_checkpoint)
|
||||
# For RocksDB: this will run `flush_opt` to flush database memtables to SST files on disk (https://docs.rs/rocksdb/latest/rocksdb/struct.DBCommon.html#method.flush_opt)
|
||||
# These operations always run on shutdown.
|
||||
#
|
||||
# Defaults to 30 minutes (1800 seconds) to avoid IO amplification from too frequent cleanups
|
||||
#cleanup_second_interval = 1800
|
||||
|
||||
|
||||
### RocksDB options
|
||||
|
||||
# Set this to true to use RocksDB config options that are tailored to HDDs (slower device storage)
|
||||
#
|
||||
# It is worth noting that by default, conduwuit will use RocksDB with Direct IO enabled. *Generally* speaking this improves performance as it bypasses buffered I/O (system page cache).
|
||||
# However there is a potential chance that Direct IO may cause issues with database operations if your setup is uncommon. This has been observed with FUSE filesystems, and possibly ZFS filesystem.
|
||||
# RocksDB generally deals/corrects these issues but it cannot account for all setups.
|
||||
# If you experience any weird RocksDB issues, try enabling this option as it turns off Direct IO and feel free to report in the conduwuit Matrix room if this option fixes your DB issues.
|
||||
# See https://github.com/facebook/rocksdb/wiki/Direct-IO for more information.
|
||||
#
|
||||
# Defaults to false
|
||||
#rocksdb_optimize_for_spinning_disks = false
|
||||
|
||||
# Enables direct-io to increase database performance. This is enabled by default. Set this option to false if the
|
||||
# database resides on a filesystem which does not support direct-io.
|
||||
#rocksdb_direct_io = true
|
||||
|
||||
# RocksDB log level. This is not the same as conduwuit's log level. This is the log level for the RocksDB engine/library
|
||||
# which show up in your database folder/path as `LOG` files. Defaults to error. conduwuit will typically log RocksDB errors as normal.
|
||||
#rocksdb_log_level = "error"
|
||||
|
||||
# Max RocksDB `LOG` file size before rotating in bytes. Defaults to 4MB.
|
||||
#rocksdb_max_log_file_size = 4194304
|
||||
|
||||
# Time in seconds before RocksDB will forcibly rotate logs. Defaults to 0.
|
||||
#rocksdb_log_time_to_roll = 0
|
||||
|
||||
# Amount of threads that RocksDB will use for parallelism on database operatons such as cleanup, sync, flush, compaction, etc. Set to 0 to use all your logical threads.
|
||||
#
|
||||
# Defaults to your CPU logical thread count.
|
||||
#rocksdb_parallelism_threads = 0
|
||||
|
||||
# Enables idle IO priority for compaction thread. This prevents any unexpected lag in the server's operation and
|
||||
# is usually a good idea. Enabled by default.
|
||||
#rocksdb_compaction_ioprio_idle = true
|
||||
|
||||
# Enables idle CPU priority for compaction thread. This is not enabled by default to prevent compaction from
|
||||
# falling too far behind on busy systems.
|
||||
#rocksdb_compaction_prio_idle = false
|
||||
|
||||
# Maximum number of LOG files RocksDB will keep. This must *not* be set to 0. It must be at least 1.
|
||||
# Defaults to 3 as these are not very useful.
|
||||
#rocksdb_max_log_files = 3
|
||||
|
||||
# Type of RocksDB database compression to use.
|
||||
# Available options are "zstd", "zlib", "bz2", "lz4", or "none"
|
||||
# It is best to use ZSTD as an overall good balance between speed/performance, storage, IO amplification, and CPU usage.
|
||||
# For more performance but less compression (more storage used) and less CPU usage, use LZ4.
|
||||
# See https://github.com/facebook/rocksdb/wiki/Compression for more details.
|
||||
#
|
||||
# "none" will disable compression.
|
||||
#
|
||||
# Defaults to "zstd"
|
||||
#rocksdb_compression_algo = "zstd"
|
||||
|
||||
# Level of compression the specified compression algorithm for RocksDB to use.
|
||||
# Default is 32767, which is internally read by RocksDB as the default magic number and
|
||||
# translated to the library's default compression level as they all differ.
|
||||
# See their `kDefaultCompressionLevel`.
|
||||
#
|
||||
#rocksdb_compression_level = 32767
|
||||
|
||||
# Level of compression the specified compression algorithm for the bottommost level/data for RocksDB to use.
|
||||
# Default is 32767, which is internally read by RocksDB as the default magic number and
|
||||
# translated to the library's default compression level as they all differ.
|
||||
# See their `kDefaultCompressionLevel`.
|
||||
#
|
||||
# Since this is the bottommost level (generally old and least used data), it may be desirable to have a very
|
||||
# high compression level here as it's lesss likely for this data to be used. Research your chosen compression algorithm.
|
||||
#
|
||||
#rocksdb_bottommost_compression_level = 32767
|
||||
|
||||
# Whether to enable RocksDB "bottommost_compression".
|
||||
# At the expense of more CPU usage, this will further compress the database to reduce more storage.
|
||||
# It is recommended to use ZSTD compression with this for best compression results.
|
||||
# See https://github.com/facebook/rocksdb/wiki/Compression for more details.
|
||||
#
|
||||
# Defaults to false as this uses more CPU when compressing.
|
||||
#rocksdb_bottommost_compression = false
|
||||
|
||||
# Database recovery mode (for RocksDB WAL corruption)
|
||||
#
|
||||
# Use this option when the server reports corruption and refuses to start. Set mode 2 (PointInTime)
|
||||
# to cleanly recover from this corruption. The server will continue from the last good state,
|
||||
# several seconds or minutes prior to the crash. Clients may have to run "clear-cache & reload" to
|
||||
# account for the rollback. Upon success, you may reset the mode back to default and restart again.
|
||||
# Please note in some cases the corruption error may not be cleared for at least 30 minutes of
|
||||
# operation in PointInTime mode.
|
||||
#
|
||||
# As a very last ditch effort, if PointInTime does not fix or resolve anything, you can try mode
|
||||
# 3 (SkipAnyCorruptedRecord) but this will leave the server in a potentially inconsistent state.
|
||||
#
|
||||
# The default mode 1 (TolerateCorruptedTailRecords) will automatically drop the last entry in the
|
||||
# database if corrupted during shutdown, but nothing more. It is extraordinarily unlikely this will
|
||||
# desynchronize clients. To disable any form of silent rollback set mode 0 (AbsoluteConsistency).
|
||||
#
|
||||
# The options are:
|
||||
# 0 = AbsoluteConsistency
|
||||
# 1 = TolerateCorruptedTailRecords (default)
|
||||
# 2 = PointInTime (use me if trying to recover)
|
||||
# 3 = SkipAnyCorruptedRecord (you now voided your Conduwuit warranty)
|
||||
#
|
||||
# See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes for more information
|
||||
#
|
||||
# Defaults to 1 (TolerateCorruptedTailRecords)
|
||||
#rocksdb_recovery_mode = 1
|
||||
|
||||
# Controls whether memory buffers are written to storage at the fixed interval set by `cleanup_period_interval`
|
||||
# even when they are not full. Setting this will increase load on the storage backplane and is never advised
|
||||
# under normal circumstances.
|
||||
#rocksdb_periodic_cleanup = false
|
||||
|
||||
|
||||
### Domain Name Resolution and Caching
|
||||
|
||||
# Maximum entries stored in DNS memory-cache. The size of an entry may vary so please take care if
|
||||
# raising this value excessively. Only decrease this when using an external DNS cache. Please note
|
||||
# that systemd does *not* count as an external cache, even when configured to do so.
|
||||
#dns_cache_entries = 32768
|
||||
|
||||
# Minimum time-to-live in seconds for entries in the DNS cache. The default may appear high to most
|
||||
# administrators; this is by design. Only decrease this if you are using an external DNS cache.
|
||||
#dns_min_ttl = 10800
|
||||
|
||||
# Minimum time-to-live in seconds for NXDOMAIN entries in the DNS cache. This value is critical for
|
||||
# the server to federate efficiently. NXDOMAIN's are assumed to not be returning to the federation
|
||||
# and aggressively cached rather than constantly rechecked.
|
||||
#
|
||||
# Defaults to 3 days as these are *very rarely* false negatives.
|
||||
#dns_min_ttl_nxdomain = 259200
|
||||
|
||||
# The number of seconds to wait for a reply to a DNS query. Please note that recursive queries can
|
||||
# take up to several seconds for some domains, so this value should not be too low.
|
||||
#dns_timeout = 10
|
||||
|
||||
# Number of retries after a timeout.
|
||||
#dns_attempts = 10
|
||||
|
||||
# Fallback to TCP on DNS errors. Set this to false if unsupported by nameserver.
|
||||
#dns_tcp_fallback = true
|
||||
|
||||
# Enable to query all nameservers until the domain is found. Referred to as "trust_negative_responses" in hickory_resolver.
|
||||
# This can avoid useless DNS queries if the first nameserver responds with NXDOMAIN or an empty NOERROR response.
|
||||
#
|
||||
# The default is to query one nameserver and stop (false).
|
||||
#query_all_nameservers = true
|
||||
|
||||
# Enables using *only* TCP for querying your specified nameservers instead of UDP.
|
||||
#
|
||||
# You very likely do *not* want this. hickory-resolver already falls back to TCP on UDP errors.
|
||||
# Defaults to false
|
||||
#query_over_tcp_only = false
|
||||
|
||||
# DNS A/AAAA record lookup strategy
|
||||
#
|
||||
# Takes a number of one of the following options:
|
||||
# 1 - Ipv4Only (Only query for A records, no AAAA/IPv6)
|
||||
# 2 - Ipv6Only (Only query for AAAA records, no A/IPv4)
|
||||
# 3 - Ipv4AndIpv6 (Query for A and AAAA records in parallel, uses whatever returns a successful response first)
|
||||
# 4 - Ipv6thenIpv4 (Query for AAAA record, if that fails then query the A record)
|
||||
# 5 - Ipv4thenIpv6 (Query for A record, if that fails then query the AAAA record)
|
||||
#
|
||||
# If you don't have IPv6 networking, then for better performance it may be suitable to set this to Ipv4Only (1) as
|
||||
# you will never ever use the AAAA record contents even if the AAAA record is successful instead of the A record.
|
||||
#
|
||||
# Defaults to 5 - Ipv4ThenIpv6 as this is the most compatible and IPv4 networking is currently the most prevalent.
|
||||
#ip_lookup_strategy = 5
|
||||
|
||||
|
||||
### Request Timeouts, Connection Timeouts, and Connection Pooling
|
||||
|
||||
## Request Timeouts are HTTP response timeouts
|
||||
## Connection Timeouts are TCP connection timeouts
|
||||
##
|
||||
## Connection Pooling Timeouts are timeouts for keeping an open idle connection alive.
|
||||
## Connection pooling and keepalive is very useful for federation or other places where for performance reasons,
|
||||
## we want to keep connections open that we will re-use frequently due to TCP and TLS 1.3 overhead/expensiveness.
|
||||
##
|
||||
## Generally these defaults are the best, but if you find a reason to need to change these they are here.
|
||||
|
||||
# Default/base connection timeout.
|
||||
# This is used only by URL previews and update/news endpoint checks
|
||||
#
|
||||
# Defaults to 10 seconds
|
||||
#request_conn_timeout = 10
|
||||
|
||||
# Default/base request timeout. The time waiting to receive more data from another server.
|
||||
# This is used only by URL previews, update/news, and misc endpoint checks
|
||||
#
|
||||
# Defaults to 35 seconds
|
||||
#request_timeout = 35
|
||||
|
||||
# Default/base request total timeout. The time limit for a whole request. This is set very high to not
|
||||
# cancel healthy requests while serving as a backstop.
|
||||
# This is used only by URL previews and update/news endpoint checks
|
||||
#
|
||||
# Defaults to 320 seconds
|
||||
#request_total_timeout = 320
|
||||
|
||||
# Default/base idle connection pool timeout
|
||||
# This is used only by URL previews and update/news endpoint checks
|
||||
#
|
||||
# Defaults to 5 seconds
|
||||
#request_idle_timeout = 5
|
||||
|
||||
# Default/base max idle connections per host
|
||||
# This is used only by URL previews and update/news endpoint checks
|
||||
#
|
||||
# Defaults to 1 as generally the same open connection can be re-used
|
||||
#request_idle_per_host = 1
|
||||
|
||||
# Federation well-known resolution connection timeout
|
||||
#
|
||||
# Defaults to 6 seconds
|
||||
#well_known_conn_timeout = 6
|
||||
|
||||
# Federation HTTP well-known resolution request timeout
|
||||
#
|
||||
# Defaults to 10 seconds
|
||||
#well_known_timeout = 10
|
||||
|
||||
# Federation client request timeout
|
||||
# You most definitely want this to be high to account for extremely large room joins, slow homeservers, your own resources etc.
|
||||
#
|
||||
# Defaults to 300 seconds
|
||||
#federation_timeout = 300
|
||||
|
||||
# Federation client idle connection pool timeout
|
||||
#
|
||||
# Defaults to 25 seconds
|
||||
#federation_idle_timeout = 25
|
||||
|
||||
# Federation client max idle connections per host
|
||||
#
|
||||
# Defaults to 1 as generally the same open connection can be re-used
|
||||
#federation_idle_per_host = 1
|
||||
|
||||
# Federation sender request timeout
|
||||
# The time it takes for the remote server to process sent transactions can take a while.
|
||||
#
|
||||
# Defaults to 180 seconds
|
||||
#sender_timeout = 180
|
||||
|
||||
# Federation sender idle connection pool timeout
|
||||
#
|
||||
# Defaults to 180 seconds
|
||||
#sender_idle_timeout = 180
|
||||
|
||||
# Federation sender transaction retry backoff limit
|
||||
#
|
||||
# Defaults to 86400 seconds
|
||||
#sender_retry_backoff_limit = 86400
|
||||
|
||||
# Appservice URL request connection timeout
|
||||
#
|
||||
# Defaults to 35 seconds as generally appservices are hosted within the same network
|
||||
#appservice_timeout = 35
|
||||
|
||||
# Appservice URL idle connection pool timeout
|
||||
#
|
||||
# Defaults to 300 seconds
|
||||
#appservice_idle_timeout = 300
|
||||
|
||||
# Notification gateway pusher idle connection pool timeout
|
||||
#
|
||||
# Defaults to 15 seconds
|
||||
#pusher_idle_timeout = 15
|
||||
|
||||
|
||||
### Presence / Typing Indicators / Read Receipts
|
||||
|
||||
# Config option to control local (your server only) presence updates/requests. Defaults to true.
|
||||
# Note that presence on conduwuit is very fast unlike Synapse's.
|
||||
# If using outgoing presence, this MUST be enabled.
|
||||
#
|
||||
#allow_local_presence = true
|
||||
|
||||
# Config option to control incoming federated presence updates/requests. Defaults to true.
|
||||
# This option receives presence updates from other servers, but does not send any unless `allow_outgoing_presence` is true.
|
||||
# Note that presence on conduwuit is very fast unlike Synapse's.
|
||||
#
|
||||
#allow_incoming_presence = true
|
||||
|
||||
# Config option to control outgoing presence updates/requests. Defaults to true.
|
||||
# This option sends presence updates to other servers, but does not receive any unless `allow_incoming_presence` is true.
|
||||
# Note that presence on conduwuit is very fast unlike Synapse's.
|
||||
# If using outgoing presence, you MUST enable `allow_local_presence` as well.
|
||||
#
|
||||
#allow_outgoing_presence = true
|
||||
|
||||
# Config option to enable the presence idle timer for remote users. Disabling is offered as an optimization for
|
||||
# servers participating in many large rooms or when resources are limited. Disabling it may cause incorrect
|
||||
# presence states (i.e. stuck online) to be seen for some remote users. Defaults to true.
|
||||
#presence_timeout_remote_users = true
|
||||
|
||||
# Config option to control how many seconds before presence updates that you are idle. Defaults to 5 minutes.
|
||||
#presence_idle_timeout_s = 300
|
||||
|
||||
# Config option to control how many seconds before presence updates that you are offline. Defaults to 30 minutes.
|
||||
#presence_offline_timeout_s = 1800
|
||||
|
||||
# Config option to control whether we should receive remote incoming read receipts.
|
||||
# Defaults to true.
|
||||
#allow_incoming_read_receipts = true
|
||||
|
||||
# Config option to control whether we should send read receipts to remote servers.
|
||||
# Defaults to true.
|
||||
#allow_outgoing_read_receipts = true
|
||||
|
||||
# Config option to control outgoing typing updates to federation. Defaults to true.
|
||||
#allow_outgoing_typing = true
|
||||
|
||||
# Config option to control incoming typing updates from federation. Defaults to true.
|
||||
#allow_incoming_typing = true
|
||||
|
||||
# Config option to control maximum time federation user can indicate typing.
|
||||
#typing_federation_timeout_s = 30
|
||||
|
||||
# Config option to control minimum time local client can indicate typing. This does not override
|
||||
# a client's request to stop typing. It only enforces a minimum value in case of no stop request.
|
||||
#typing_client_timeout_min_s = 15
|
||||
|
||||
# Config option to control maximum time local client can indicate typing.
|
||||
#typing_client_timeout_max_s = 45
|
||||
|
||||
|
||||
# Other options not in [global]:
|
||||
#
|
||||
#
|
||||
# Enables running conduwuit with direct TLS support
|
||||
# It is strongly recommended you use a reverse proxy instead. This is primarily relevant for test suites like complement that require a private CA setup.
|
||||
# [global.tls]
|
||||
# certs = "/path/to/my/certificate.crt"
|
||||
# key = "/path/to/my/private_key.key"
|
||||
#
|
||||
# Whether to listen and allow for HTTP and HTTPS connections (insecure!)
|
||||
# This config option is only available if conduwuit was built with `axum_dual_protocol` feature (not default feature)
|
||||
# Defaults to false
|
||||
#dual_protocol = false
|
||||
|
||||
|
||||
# If you are using delegation via well-known files and you cannot serve them from your reverse proxy, you can
|
||||
# uncomment these to serve them directly from conduwuit. This requires proxying all requests to conduwuit, not just `/_matrix` to work.
|
||||
#
|
||||
#[global.well_known]
|
||||
#server = "matrix.example.com:443"
|
||||
#client = "https://matrix.example.com"
|
||||
#
|
||||
# A single contact and/or support page for /.well-known/matrix/support
|
||||
# All options here are strings. Currently only supports 1 single contact.
|
||||
# No default.
|
||||
#
|
||||
#support_page = ""
|
||||
#support_role = ""
|
||||
#support_email = ""
|
||||
#support_mxid = ""
|
||||
Vendored
-33
@@ -1,33 +0,0 @@
|
||||
# conduwuit for Debian
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Information about downloading, building and deploying the Debian package, see
|
||||
the "Installing conduwuit" section in the Deploying docs.
|
||||
All following sections until "Setting up the Reverse Proxy" be ignored because
|
||||
this is handled automatically by the packaging.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
When installed, Debconf generates the configuration of the homeserver
|
||||
(host)name, the address and port it listens on. This configuration ends up in
|
||||
`/etc/conduwuit/conduwuit.toml`.
|
||||
|
||||
You can tweak more detailed settings by uncommenting and setting the variables
|
||||
in `/etc/conduwuit/conduwuit.toml`. This involves settings such as the maximum
|
||||
file size for download/upload, enabling federation, etc.
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
The package uses the [`conduwuit.service`](../configuration.md#example-systemd-unit-file) systemd unit file to start and
|
||||
stop conduwuit. It loads the configuration file mentioned above to set up the
|
||||
environment before running the server.
|
||||
|
||||
This package assumes by default that conduwuit will be placed behind a reverse
|
||||
proxy. This default deployment entails just listening
|
||||
on `127.0.0.1` and the free port `6167` and is reachable via a client using the URL
|
||||
<http://localhost:6167>. Matrix federation requires TLS, so you will need to set up
|
||||
some certificates and renewal, for it to work properly.
|
||||
Vendored
-62
@@ -1,62 +0,0 @@
|
||||
[Unit]
|
||||
Description=conduwuit Matrix homeserver
|
||||
Documentation=https://conduwuit.puppyirl.gay/
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
DynamicUser=yes
|
||||
User=conduwuit
|
||||
Group=conduwuit
|
||||
Type=notify
|
||||
|
||||
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml"
|
||||
|
||||
ExecStart=/usr/sbin/conduwuit
|
||||
|
||||
AmbientCapabilities=
|
||||
CapabilityBoundingSet=
|
||||
|
||||
DevicePolicy=closed
|
||||
LockPersonality=yes
|
||||
MemoryDenyWriteExecute=yes
|
||||
NoNewPrivileges=yes
|
||||
ProcSubset=pid
|
||||
ProtectClock=yes
|
||||
ProtectControlGroups=yes
|
||||
ProtectHome=yes
|
||||
ProtectHostname=yes
|
||||
ProtectKernelLogs=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectProc=invisible
|
||||
ProtectSystem=strict
|
||||
PrivateDevices=yes
|
||||
PrivateMounts=yes
|
||||
PrivateTmp=yes
|
||||
PrivateUsers=yes
|
||||
PrivateIPC=yes
|
||||
RemoveIPC=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
RestrictSUIDSGID=yes
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service @resources
|
||||
SystemCallFilter=~@clock @debug @module @mount @reboot @swap @cpu-emulation @obsolete @timer @chown @setuid @privileged @keyring @ipc
|
||||
SystemCallErrorNumber=EPERM
|
||||
StateDirectory=conduwuit
|
||||
|
||||
RuntimeDirectory=conduit
|
||||
RuntimeDirectoryMode=0750
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
TimeoutStopSec=4m
|
||||
TimeoutStartSec=4m
|
||||
|
||||
StartLimitInterval=1m
|
||||
StartLimitBurst=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Source debconf library.
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
# Ask for the Matrix homeserver name, address and port.
|
||||
db_input high conduwuit/hostname || true
|
||||
db_go
|
||||
|
||||
db_input low conduwuit/address || true
|
||||
db_go
|
||||
|
||||
db_input medium conduwuit/port || true
|
||||
db_go
|
||||
|
||||
exit 0
|
||||
Vendored
-29
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit/
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# Create the `conduwuit` user if it does not exist yet.
|
||||
if ! getent passwd conduwuit > /dev/null ; then
|
||||
echo 'Adding system user for the conduwuit Matrix homeserver' 1>&2
|
||||
adduser --system --group --quiet \
|
||||
--home "$CONDUWUIT_DATABASE_PATH" \
|
||||
--disabled-login \
|
||||
--shell "/usr/sbin/nologin" \
|
||||
--force-badname \
|
||||
conduwuit
|
||||
fi
|
||||
|
||||
# Create the database path if it does not exist yet and fix up ownership
|
||||
# and permissions.
|
||||
mkdir -p "$CONDUWUIT_DATABASE_PATH"
|
||||
chown conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH"
|
||||
chmod 700 "$CONDUWUIT_DATABASE_PATH"
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
|
||||
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
|
||||
|
||||
case $1 in
|
||||
purge)
|
||||
# Remove debconf changes from the db
|
||||
db_purge
|
||||
|
||||
# Per https://www.debian.org/doc/debian-policy/ch-files.html#behavior
|
||||
# "configuration files must be preserved when the package is removed, and
|
||||
# only deleted when the package is purged."
|
||||
if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then
|
||||
rm -r "$CONDUWUIT_CONFIG_PATH"
|
||||
fi
|
||||
|
||||
if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then
|
||||
rm -r "$CONDUWUIT_DATABASE_PATH"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
Template: conduwuit/hostname
|
||||
Type: string
|
||||
Default: localhost
|
||||
Description: The server (host)name of the Matrix homeserver
|
||||
This is the hostname the homeserver will be reachable at via a client.
|
||||
.
|
||||
If set to "localhost", you can connect with a client locally and clients
|
||||
from other hosts and also other homeservers will not be able to reach you!
|
||||
|
||||
Template: conduwuit/address
|
||||
Type: string
|
||||
Default: 127.0.0.1
|
||||
Description: The listen address of the Matrix homeserver
|
||||
This is the address the homeserver will listen on. Leave it set to 127.0.0.1
|
||||
when using a reverse proxy.
|
||||
|
||||
Template: conduwuit/port
|
||||
Type: string
|
||||
Default: 6167
|
||||
Description: The port of the Matrix homeserver
|
||||
This port is most often just accessed by a reverse proxy.
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
(import
|
||||
(
|
||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||
fetchTarball {
|
||||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{ src = ./.; }
|
||||
).defaultNix
|
||||
@@ -0,0 +1,2 @@
|
||||
podman build . -f packages/website/Dockerfile -t jade-website-frontend:latest;
|
||||
podman save --format oci-archive jade-website-frontend:latest | gzip | ssh fedora@213.32.25.24 -T "sudo sh -c ' zcat > /opt/images/jade-website-frontend'"
|
||||
@@ -1,18 +0,0 @@
|
||||
# Summary
|
||||
|
||||
- [Introduction](introduction.md)
|
||||
- [Differences from upstream Conduit](differences.md)
|
||||
- [Example configuration](configuration.md)
|
||||
- [Deploying](deploying.md)
|
||||
- [Generic](deploying/generic.md)
|
||||
- [NixOS](deploying/nixos.md)
|
||||
- [Docker](deploying/docker.md)
|
||||
- [Arch Linux](deploying/arch-linux.md)
|
||||
- [Debian](deploying/debian.md)
|
||||
- [TURN](turn.md)
|
||||
- [Appservices](appservices.md)
|
||||
- [Maintenance](maintenance.md)
|
||||
- [Troubleshooting](troubleshooting.md)
|
||||
- [Development](development.md)
|
||||
- [Contributing](contributing.md)
|
||||
- [Testing](development/testing.md)
|
||||
@@ -1,61 +0,0 @@
|
||||
# Setting up Appservices
|
||||
|
||||
## Getting help
|
||||
|
||||
If you run into any problems while setting up an Appservice: ask us in [#conduwuit:puppygock.gay](https://matrix.to/#/#conduwuit:puppygock.gay) or [open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new).
|
||||
|
||||
## Set up the appservice - general instructions
|
||||
|
||||
Follow whatever instructions are given by the appservice. This usually includes
|
||||
downloading, changing its config (setting domain, homeserver url, port etc.)
|
||||
and later starting it.
|
||||
|
||||
At some point the appservice guide should ask you to add a registration yaml
|
||||
file to the homeserver. In Synapse you would do this by adding the path to the
|
||||
homeserver.yaml, but in Conduit you can do this from within Matrix:
|
||||
|
||||
First, go into the #admins room of your homeserver. The first person that
|
||||
registered on the homeserver automatically joins it. Then send a message into
|
||||
the room like this:
|
||||
|
||||
@conduit:your.server.name: register-appservice
|
||||
```
|
||||
paste
|
||||
the
|
||||
contents
|
||||
of
|
||||
the
|
||||
yaml
|
||||
registration
|
||||
here
|
||||
```
|
||||
|
||||
You can confirm it worked by sending a message like this:
|
||||
`@conduit:your.server.name: appservices list`
|
||||
|
||||
The `@conduit` bot should answer with `Appservices (1): your-bridge`
|
||||
|
||||
Then you are done. Conduit will send messages to the appservices and the
|
||||
appservice can send requests to the homeserver. You don't need to restart
|
||||
Conduit, but if it doesn't work, restarting while the appservice is running
|
||||
could help.
|
||||
|
||||
## Appservice-specific instructions
|
||||
|
||||
### Remove an appservice
|
||||
|
||||
To remove an appservice go to your admin room and execute
|
||||
|
||||
`@conduit:your.server.name: appservices unregister <name>`
|
||||
|
||||
where `<name>` one of the output of `appservices list`.
|
||||
|
||||
### Tested appservices
|
||||
|
||||
These appservices have been tested and work with Conduit without any extra steps:
|
||||
|
||||
- [matrix-appservice-discord](https://github.com/Half-Shot/matrix-appservice-discord)
|
||||
- [mautrix-hangouts](https://github.com/mautrix/hangouts/)
|
||||
- [mautrix-telegram](https://github.com/mautrix/telegram/)
|
||||
- [mautrix-signal](https://github.com/mautrix/signal/) from version `0.2.2` forward.
|
||||
- [heisenbridge](https://github.com/hifi/heisenbridge/)
|
||||
@@ -1,11 +0,0 @@
|
||||
# Example configuration
|
||||
|
||||
``` toml
|
||||
{{#include ../conduwuit-example.toml}}
|
||||
```
|
||||
|
||||
# Example systemd unit file
|
||||
|
||||
```
|
||||
{{#include ../debian/conduwuit.service}}
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
{{#include ../CONTRIBUTING.md}}
|
||||
@@ -1,3 +0,0 @@
|
||||
# Deploying
|
||||
|
||||
This chapter describes various ways to deploy Conduwuit.
|
||||
@@ -1,8 +0,0 @@
|
||||
# conduwuit for Arch Linux
|
||||
|
||||
Currently conduwuit is only on the Arch User Repository (AUR).
|
||||
|
||||
The conduwuit AUR packages are community maintained and are not maintained by conduwuit development team, but the AUR package maintainers are in the Matrix room. Please attempt to verify your AUR package's PKGBUILD file looks fine before asking for support.
|
||||
|
||||
- [conduwuit](https://aur.archlinux.org/packages/conduwuit) - latest tagged conduwuit
|
||||
- [conduwuit-git](https://aur.archlinux.org/packages/conduwuit-git) - latest git conduwuit from `main` branch
|
||||
@@ -1 +0,0 @@
|
||||
{{#include ../../debian/README.md}}
|
||||
@@ -1,70 +0,0 @@
|
||||
# Conduit - Behind Traefik Reverse Proxy
|
||||
version: '2.4' # uses '2.4' for cpuset
|
||||
|
||||
services:
|
||||
homeserver:
|
||||
### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image,
|
||||
### then you are ready to go.
|
||||
image: girlbossceo/conduwuit:latest
|
||||
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
|
||||
### build lines. If you want meaningful labels in your built Conduit image, you should run docker compose like this:
|
||||
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker compose up -d
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# CREATED: '2021-03-16T08:18:27Z'
|
||||
# VERSION: '0.1.0'
|
||||
# LOCAL: 'false'
|
||||
# GIT_REF: origin/master
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- db:/var/lib/matrix-conduit
|
||||
#- ./conduwuit.toml:/etc/conduit.toml
|
||||
networks:
|
||||
- proxy
|
||||
environment:
|
||||
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
|
||||
CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit
|
||||
CONDUIT_DATABASE_BACKEND: rocksdb
|
||||
CONDUIT_PORT: 6167
|
||||
CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
|
||||
CONDUIT_ALLOW_REGISTRATION: 'true'
|
||||
CONDUIT_ALLOW_FEDERATION: 'true'
|
||||
CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
|
||||
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
|
||||
#CONDUIT_LOG: warn,state_res=warn
|
||||
CONDUIT_ADDRESS: 0.0.0.0
|
||||
#CONDUIT_CONFIG: './conduwuit.toml' # Uncomment if you mapped config toml above
|
||||
#cpuset: "0-4" # Uncomment to limit to specific CPU cores
|
||||
|
||||
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
|
||||
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
|
||||
# and in the docker compose override file.
|
||||
well-known:
|
||||
image: nginx:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
|
||||
- ./nginx/www:/var/www/ # location of the client and server .well-known-files
|
||||
### Uncomment if you want to use your own Element-Web App.
|
||||
### Note: You need to provide a config.json for Element and you also need a second
|
||||
### Domain or Subdomain for the communication between Element and Conduit
|
||||
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
|
||||
# element-web:
|
||||
# image: vectorim/element-web:latest
|
||||
# restart: unless-stopped
|
||||
# volumes:
|
||||
# - ./element_config.json:/app/config.json
|
||||
# networks:
|
||||
# - proxy
|
||||
# depends_on:
|
||||
# - homeserver
|
||||
|
||||
volumes:
|
||||
db:
|
||||
|
||||
networks:
|
||||
# This is the network Traefik listens to, if your network has a different
|
||||
# name, don't forget to change it here and in the docker-compose.override.yml
|
||||
proxy:
|
||||
external: true
|
||||
@@ -1,45 +0,0 @@
|
||||
# Conduit - Traefik Reverse Proxy Labels
|
||||
version: '2.4' # uses '2.4' for cpuset
|
||||
|
||||
services:
|
||||
homeserver:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
|
||||
|
||||
- "traefik.http.routers.to-conduit.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which Conduit is hosted
|
||||
- "traefik.http.routers.to-conduit.tls=true"
|
||||
- "traefik.http.routers.to-conduit.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.to-conduit.middlewares=cors-headers@docker"
|
||||
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
|
||||
|
||||
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
|
||||
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
|
||||
# and in the docker compose file.
|
||||
well-known:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
|
||||
- "traefik.http.routers.to-matrix-wellknown.rule=Host(`<SUBDOMAIN>.<DOMAIN>`) && PathPrefix(`/.well-known/matrix`)"
|
||||
- "traefik.http.routers.to-matrix-wellknown.tls=true"
|
||||
- "traefik.http.routers.to-matrix-wellknown.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.to-matrix-wellknown.middlewares=cors-headers@docker"
|
||||
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
|
||||
|
||||
|
||||
### Uncomment this if you uncommented Element-Web App in the docker-compose.yml
|
||||
# element-web:
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
# - "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
|
||||
|
||||
# - "traefik.http.routers.to-element-web.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which Element-Web is hosted
|
||||
# - "traefik.http.routers.to-element-web.tls=true"
|
||||
# - "traefik.http.routers.to-element-web.tls.certresolver=letsencrypt"
|
||||
@@ -1,97 +0,0 @@
|
||||
# Conduit - Behind Traefik Reverse Proxy
|
||||
version: '2.4' # uses '2.4' for cpuset
|
||||
|
||||
services:
|
||||
homeserver:
|
||||
### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image,
|
||||
### then you are ready to go.
|
||||
image: girlbossceo/conduwuit:latest
|
||||
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
|
||||
### build lines. If you want meaningful labels in your built Conduit image, you should run docker compose like this:
|
||||
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker compose up -d
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# CREATED: '2021-03-16T08:18:27Z'
|
||||
# VERSION: '0.1.0'
|
||||
# LOCAL: 'false'
|
||||
# GIT_REF: origin/master
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- db:/srv/conduit/.local/share/conduit
|
||||
#- ./conduwuit.toml:/etc/conduit.toml
|
||||
networks:
|
||||
- proxy
|
||||
environment:
|
||||
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
|
||||
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
|
||||
CONDUIT_ALLOW_REGISTRATION : 'true'
|
||||
#CONDUIT_CONFIG: './conduwuit.toml' # Uncomment if you mapped config toml above
|
||||
### Uncomment and change values as desired
|
||||
# CONDUIT_ADDRESS: 0.0.0.0
|
||||
# CONDUIT_PORT: 6167
|
||||
# Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging
|
||||
# CONDUIT_LOG: info # default is: "warn,state_res=warn"
|
||||
# CONDUIT_ALLOW_JAEGER: 'false'
|
||||
# CONDUIT_ALLOW_ENCRYPTION: 'true'
|
||||
# CONDUIT_ALLOW_FEDERATION: 'true'
|
||||
# CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
|
||||
# CONDUIT_DATABASE_PATH: /srv/conduit/.local/share/conduit
|
||||
# CONDUIT_WORKERS: 10
|
||||
# CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
|
||||
#cpuset: "0-4" # Uncomment to limit to specific CPU cores
|
||||
|
||||
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
|
||||
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
|
||||
# and in the docker compose override file.
|
||||
well-known:
|
||||
image: nginx:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
|
||||
- ./nginx/www:/var/www/ # location of the client and server .well-known-files
|
||||
|
||||
### Uncomment if you want to use your own Element-Web App.
|
||||
### Note: You need to provide a config.json for Element and you also need a second
|
||||
### Domain or Subdomain for the communication between Element and Conduit
|
||||
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
|
||||
# element-web:
|
||||
# image: vectorim/element-web:latest
|
||||
# restart: unless-stopped
|
||||
# volumes:
|
||||
# - ./element_config.json:/app/config.json
|
||||
# networks:
|
||||
# - proxy
|
||||
# depends_on:
|
||||
# - homeserver
|
||||
|
||||
traefik:
|
||||
image: "traefik:latest"
|
||||
container_name: "traefik"
|
||||
restart: "unless-stopped"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
# - "./traefik_config:/etc/traefik"
|
||||
- "acme:/etc/traefik/acme"
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
# middleware redirect
|
||||
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
|
||||
# global redirect to https
|
||||
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
|
||||
- "traefik.http.routers.redirs.entrypoints=http"
|
||||
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
|
||||
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
volumes:
|
||||
db:
|
||||
acme:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
@@ -1,55 +0,0 @@
|
||||
# Conduit
|
||||
version: '2.4' # uses '2.4' for cpuset
|
||||
|
||||
services:
|
||||
homeserver:
|
||||
### If you already built the Conduit image with 'docker build' or want to use a registry image,
|
||||
### then you are ready to go.
|
||||
image: girlbossceo/conduwuit:latest
|
||||
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
|
||||
### build lines. If you want meaningful labels in your built Conduit image, you should run docker compose like this:
|
||||
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker compose up -d
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# CREATED: '2021-03-16T08:18:27Z'
|
||||
# VERSION: '0.1.0'
|
||||
# LOCAL: 'false'
|
||||
# GIT_REF: origin/master
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 8448:6167
|
||||
volumes:
|
||||
- db:/var/lib/matrix-conduit
|
||||
#- ./conduwuit.toml:/etc/conduit.toml
|
||||
environment:
|
||||
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
|
||||
CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit
|
||||
CONDUIT_DATABASE_BACKEND: rocksdb
|
||||
CONDUIT_PORT: 6167
|
||||
CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
|
||||
CONDUIT_ALLOW_REGISTRATION: 'true'
|
||||
CONDUIT_ALLOW_FEDERATION: 'true'
|
||||
CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
|
||||
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
|
||||
#CONDUIT_LOG: warn,state_res=warn
|
||||
CONDUIT_ADDRESS: 0.0.0.0
|
||||
#CONDUIT_CONFIG: './conduwuit.toml' # Uncomment if you mapped config toml above
|
||||
#cpuset: "0-4" # Uncomment to limit to specific CPU cores
|
||||
#
|
||||
### Uncomment if you want to use your own Element-Web App.
|
||||
### Note: You need to provide a config.json for Element and you also need a second
|
||||
### Domain or Subdomain for the communication between Element and Conduit
|
||||
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
|
||||
# element-web:
|
||||
# image: vectorim/element-web:latest
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - 8009:80
|
||||
# volumes:
|
||||
# - ./element_config.json:/app/config.json
|
||||
# depends_on:
|
||||
# - homeserver
|
||||
|
||||
volumes:
|
||||
db:
|
||||
@@ -1,113 +0,0 @@
|
||||
# conduwuit for Docker
|
||||
|
||||
## Docker
|
||||
|
||||
To run conduwuit with Docker you can either build the image yourself or pull it from a registry.
|
||||
|
||||
|
||||
### Use a registry
|
||||
|
||||
OCI images for conduwuit are available in the registries listed below.
|
||||
|
||||
| Registry | Image | Size | Notes |
|
||||
| --------------- | --------------------------------------------------------------- | ----------------------------- | ---------------------- |
|
||||
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:latest][gh] | ![Image Size][shield-latest] | Stable tagged image. |
|
||||
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:latest][gl] | ![Image Size][shield-latest] | Stable tagged image. |
|
||||
| Docker Hub | [docker.io/girlbossceo/conduwuit:latest][dh] | ![Image Size][shield-latest] | Stable tagged image. |
|
||||
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:main][gh] | ![Image Size][shield-main] | Stable main branch. |
|
||||
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:main][gl] | ![Image Size][shield-main] | Stable main branch. |
|
||||
| Docker Hub | [docker.io/girlbossceo/conduwuit:main][dh] | ![Image Size][shield-main] | Stable main branch. |
|
||||
|
||||
[dh]: https://hub.docker.com/repository/docker/girlbossceo/conduwuit
|
||||
[gh]: https://github.com/girlbossceo/conduwuit/pkgs/container/conduwuit
|
||||
[gl]: https://gitlab.com/conduwuit/conduwuit/container_registry/6351657
|
||||
[shield-latest]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/latest
|
||||
[shield-main]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/main
|
||||
|
||||
|
||||
Use
|
||||
```bash
|
||||
docker image pull <link>
|
||||
```
|
||||
to pull it to your machine.
|
||||
|
||||
|
||||
### Run
|
||||
|
||||
When you have the image you can simply run it with
|
||||
|
||||
```bash
|
||||
docker run -d -p 8448:6167 \
|
||||
-v db:/var/lib/conduwuit/ \
|
||||
-e CONDUIT_SERVER_NAME="your.server.name" \
|
||||
-e CONDUIT_DATABASE_BACKEND="rocksdb" \
|
||||
-e CONDUIT_ALLOW_REGISTRATION=false \
|
||||
-e CONDUIT_ALLOW_FEDERATION=true \
|
||||
-e CONDUIT_MAX_REQUEST_SIZE="40000000" \
|
||||
-e CONDUIT_TRUSTED_SERVERS="[\"matrix.org\"]" \
|
||||
-e CONDUIT_LOG="warn,ruma_state_res=warn" \
|
||||
--name conduit <link>
|
||||
```
|
||||
|
||||
or you can use [docker compose](#docker-compose).
|
||||
|
||||
The `-d` flag lets the container run in detached mode. You may supply an optional `conduwuit.toml` config file, the example config can be found [here](../configuration.md).
|
||||
You can pass in different env vars to change config values on the fly. You can even configure conduwuit completely by using env vars. For an overview of possible
|
||||
values, please take a look at the [`docker-compose.yml`](docker-compose.yml) file.
|
||||
|
||||
If you just want to test conduwuit for a short time, you can use the `--rm` flag, which will clean up everything related to your container after you stop it.
|
||||
|
||||
### Docker-compose
|
||||
|
||||
If the `docker run` command is not for you or your setup, you can also use one of the provided `docker-compose` files.
|
||||
|
||||
Depending on your proxy setup, you can use one of the following files;
|
||||
- If you already have a `traefik` instance set up, use [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml)
|
||||
- If you don't have a `traefik` instance set up (or any other reverse proxy), use [`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)
|
||||
- For any other reverse proxy, use [`docker-compose.yml`](docker-compose.yml)
|
||||
|
||||
When picking the traefik-related compose file, rename it so it matches `docker-compose.yml`, and
|
||||
rename the override file to `docker-compose.override.yml`. Edit the latter with the values you want
|
||||
for your server.
|
||||
|
||||
Additional info about deploying conduwuit can be found [here](generic.md).
|
||||
|
||||
### Build
|
||||
|
||||
To build the conduwuit image with docker-compose, you first need to open and modify the `docker-compose.yml` file. There you need to comment the `image:` option and uncomment the `build:` option. Then call docker compose with:
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
This will also start the container right afterwards, so if want it to run in detached mode, you also should use the `-d` flag.
|
||||
|
||||
### Run
|
||||
|
||||
If you already have built the image or want to use one from the registries, you can just start the container and everything else in the compose file in detached mode with:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
> **Note:** Don't forget to modify and adjust the compose file to your needs.
|
||||
|
||||
### Use Traefik as Proxy
|
||||
|
||||
As a container user, you probably know about Traefik. It is a easy to use reverse proxy for making
|
||||
containerized app and services available through the web. With the two provided files,
|
||||
[`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
|
||||
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and
|
||||
[`docker-compose.override.yml`](docker-compose.override.yml), it is equally easy to deploy
|
||||
and use conduwuit, with a little caveat. If you already took a look at the files, then you should have
|
||||
seen the `well-known` service, and that is the little caveat. Traefik is simply a proxy and
|
||||
loadbalancer and is not able to serve any kind of content, but for conduwuit to federate, we need to
|
||||
either expose ports `443` and `8448` or serve two endpoints `.well-known/matrix/client` and
|
||||
`.well-known/matrix/server`.
|
||||
|
||||
With the service `well-known` we use a single `nginx` container that will serve those two files.
|
||||
|
||||
|
||||
## Voice communication
|
||||
|
||||
See the [TURN](../turn.md) page.
|
||||
@@ -1,135 +0,0 @@
|
||||
# Generic deployment documentation
|
||||
|
||||
> ## Getting help
|
||||
>
|
||||
> If you run into any problems while setting up conduwuit, ask us
|
||||
> in `#conduwuit:puppygock.gay` or [open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new).
|
||||
|
||||
## Installing conduwuit
|
||||
|
||||
You may simply download the binary that fits your machine. Run `uname -m` to see what you need.
|
||||
|
||||
Prebuilt binaries can be downloaded from the latest tagged release [here](https://github.com/girlbossceo/conduwuit/releases/latest).
|
||||
|
||||
The latest tagged release also includes the Debian packages.
|
||||
|
||||
Alternatively, you may compile the binary yourself. We recommend using [Lix](https://lix.systems) to build conduwuit as this has the most guaranteed
|
||||
reproducibiltiy and easiest to get a build environment and output going.
|
||||
|
||||
Otherwise, follow standard Rust project build guides (installing git and cloning the repo, getting the Rust toolchain via rustup, installing LLVM toolchain + libclang, installing liburing for io_uring and RocksDB, etc).
|
||||
|
||||
## Adding a conduwuit user
|
||||
|
||||
While conduwuit can run as any user it is better to use dedicated users for different services. This also allows
|
||||
you to make sure that the file permissions are correctly set up.
|
||||
|
||||
In Debian or RHEL, you can use this command to create a conduwuit user:
|
||||
|
||||
```bash
|
||||
sudo adduser --system conduwuit --group --disabled-login --no-create-home
|
||||
```
|
||||
|
||||
For distros without `adduser`:
|
||||
|
||||
```bash
|
||||
sudo useradd -r --shell /usr/bin/nologin --no-create-home conduwuit
|
||||
```
|
||||
|
||||
## Forwarding ports in the firewall or the router
|
||||
|
||||
conduwuit uses the ports 443 and 8448 both of which need to be open in the firewall.
|
||||
|
||||
If conduwuit runs behind a router or in a container and has a different public IP address than the host system these public ports need to be forwarded directly or indirectly to the port mentioned in the config.
|
||||
|
||||
## Setting up a systemd service
|
||||
|
||||
The systemd unit for conduwuit can be found [here](../configuration.md#example-systemd-unit-file). You may need to change the `ExecStart=` path to where you placed the conduwuit binary.
|
||||
|
||||
## Creating the conduwuit configuration file
|
||||
|
||||
Now we need to create the conduwuit's config file in `/etc/conduwuit/conduwuit.toml`. The example config can be found at [conduwuit-example.toml](../configuration.md).**Please take a moment to read it. You need to change at least the server name.**
|
||||
|
||||
RocksDB (`rocksdb`) is the only supported database backend. SQLite only exists for historical reasons and is not recommended. Any performance issues, storage issues, database issues, etc will not be assisted if using SQLite and you will be asked to migrate to RocksDB first.
|
||||
|
||||
## Setting the correct file permissions
|
||||
|
||||
If you are using a dedicated user for conduwuit, you will need to allow it to read the config. To do that you can run this command on
|
||||
|
||||
Debian or RHEL:
|
||||
|
||||
```bash
|
||||
sudo chown -R root:root /etc/conduwuit
|
||||
sudo chmod 755 /etc/conduwuit
|
||||
```
|
||||
|
||||
If you use the default database path you also need to run this:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /var/lib/conduwuit/
|
||||
sudo chown -R conduwuit:conduwuit /var/lib/conduwuit/
|
||||
sudo chmod 700 /var/lib/conduwuit/
|
||||
```
|
||||
|
||||
## Setting up the Reverse Proxy
|
||||
|
||||
Refer to the documentation or various guides online of your chosen reverse proxy software. A [Caddy](https://caddyserver.com/) example will be provided as this is the recommended reverse proxy for new users and is very trivial to use (handles TLS, reverse proxy headers, etc transparently with proper defaults).
|
||||
|
||||
### Caddy
|
||||
|
||||
Create `/etc/caddy/conf.d/conduwuit_caddyfile` and enter this (substitute for your server name).
|
||||
|
||||
```caddy
|
||||
your.server.name, your.server.name:8448 {
|
||||
# TCP
|
||||
reverse_proxy 127.0.0.1:6167
|
||||
|
||||
# UNIX socket
|
||||
#reverse_proxy unix//run/conduwuit/conduwuit.sock
|
||||
}
|
||||
```
|
||||
|
||||
That's it! Just start and enable the service and you're set.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl enable --now caddy
|
||||
```
|
||||
|
||||
## You're done!
|
||||
|
||||
Now you can start conduwuit with:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl start conduwuit
|
||||
```
|
||||
|
||||
Set it to start automatically when your system boots with:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl enable conduwuit
|
||||
```
|
||||
|
||||
## How do I know it works?
|
||||
|
||||
You can open [a Matrix client](https://matrix.org/ecosystem/clients), enter your homeserver and try to register.
|
||||
|
||||
You can also use these commands as a quick health check.
|
||||
|
||||
```bash
|
||||
$ curl https://your.server.name/_conduwuit/server_version
|
||||
|
||||
# If using port 8448
|
||||
$ curl https://your.server.name:8448/_conduwuit/server_version
|
||||
```
|
||||
|
||||
- To check if your server can talk with other homeservers, you can use the [Matrix Federation Tester](https://federationtester.matrix.org/).
|
||||
If you can register but cannot join federated rooms check your config again and also check if the port 8448 is open and forwarded correctly.
|
||||
|
||||
# What's next?
|
||||
|
||||
## Audio/Video calls
|
||||
|
||||
For Audio/Video call functionality see the [TURN Guide](../turn.md).
|
||||
|
||||
## Appservices
|
||||
|
||||
If you want to set up an appservice, take a look at the [Appservice Guide](../appservices.md).
|
||||
@@ -1,31 +0,0 @@
|
||||
# conduwuit for NixOS
|
||||
|
||||
conduwuit can be acquired by [Lix][lix] from various places:
|
||||
|
||||
* The `flake.nix` at the root of the repo
|
||||
* The `default.nix` at the root of the repo
|
||||
* From conduwuit's binary cache
|
||||
|
||||
A binary cache for conduwuit that the CI/CD publishes to is available at the
|
||||
following places (both are the same just different names):
|
||||
```
|
||||
https://attic.kennel.juneis.dog/conduit
|
||||
conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
|
||||
|
||||
https://attic.kennel.juneis.dog/conduwuit
|
||||
conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
|
||||
```
|
||||
|
||||
If specifying a URL in your flake, please use the GitHub remote: `github:girlbossceo/conduwuit`
|
||||
|
||||
The `flake.nix` and `default.nix` do not (currently) provide a NixOS module, so
|
||||
(for now) [`services.matrix-conduit`][module] from Nixpkgs should be used to
|
||||
configure conduwuit.
|
||||
|
||||
If you want to run the latest code, you should get Conduwuit from the `flake.nix`
|
||||
or `default.nix` and set [`services.matrix-conduit.package`][package]
|
||||
appropriately.
|
||||
|
||||
[lix]: https://lix.systems/
|
||||
[module]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit
|
||||
[package]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit.package
|
||||
@@ -1,23 +0,0 @@
|
||||
# Development
|
||||
|
||||
Information about developing the project. If you are only interested in using
|
||||
it, you can safely ignore this section. If you plan on contributing, see the
|
||||
[contributor's guide](contributing.md).
|
||||
|
||||
## Debugging with `tokio-console`
|
||||
|
||||
[`tokio-console`][1] can be a useful tool for debugging and profiling. To make
|
||||
a `tokio-console`-enabled build of Conduwuit, enable the `tokio_console` feature,
|
||||
disable the default `release_max_log_level` feature, and set the
|
||||
`--cfg tokio_unstable` flag to enable experimental tokio APIs. A build might
|
||||
look like this:
|
||||
|
||||
```bash
|
||||
RUSTFLAGS="--cfg tokio_unstable" cargo build \
|
||||
--release \
|
||||
--no-default-features \
|
||||
--features
|
||||
backend_rocksdb,systemd,element_hacks,sentry_telemetry,gzip_compression,brotli_compression,zstd_compression,tokio_console
|
||||
```
|
||||
|
||||
[1]: https://docs.rs/tokio-console/latest/tokio_console/
|
||||
@@ -1,20 +0,0 @@
|
||||
# Testing
|
||||
|
||||
## Complement
|
||||
|
||||
Have a look at [Complement's repository][complement] for an explanation of what
|
||||
it is.
|
||||
|
||||
To test against Complement, with [Lix][lix] and direnv installed and set up, you can:
|
||||
|
||||
* Run `./bin/complement "$COMPLEMENT_SRC" ./path/to/logs.jsonl ./path/to/results.jsonl`
|
||||
to build a Complement image, run the tests, and output the logs and results
|
||||
to the specified paths. This will also output the OCI image at `result`
|
||||
* Run `nix build .#complement` from the root of the repository to just build a
|
||||
Complement OCI image outputted to `result` (it's a `.tar.gz` file)
|
||||
* Or download the latest Complement OCI image from the CI workflow artifacts output
|
||||
from the commit/revision you want to test (e.g. from main) [here][ci-workflows]
|
||||
|
||||
[lix]: https://lix.systems/
|
||||
[ci-workflows]: https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml?query=event%3Apush+is%3Asuccess+actor%3Agirlbossceo
|
||||
[complement]: https://github.com/matrix-org/complement
|
||||
@@ -1,159 +0,0 @@
|
||||
#### **Note: This list may not up to date. There are rapidly more and more improvements, fixes, changes, etc being made that it is becoming more difficult to maintain this list. I recommend that you give conduwuit a try and see the differences for yourself. If you have any concerns, feel free to join the conduwuit Matrix room and ask any pre-usage questions.**
|
||||
|
||||
### list of features, bug fixes, etc that conduwuit does that Conduit does not:
|
||||
|
||||
Outgoing typing indicators, outgoing read receipts, **and** outgoing presence!
|
||||
|
||||
## Performance:
|
||||
- Concurrency support for key fetching for faster remote room joins and room joins that will error less frequently
|
||||
- Send `Cache-Control` response header with `immutable` and 1 year cache length for all media requests (download and thumbnail) to instruct clients to cache media, and reduce server load from media requests that could be otherwise cached
|
||||
- Add feature flags and config options to enable/build with zstd, brotli, and/or gzip HTTP body compression (response and request)
|
||||
- Eliminate all usage of the thread-blocking `getaddrinfo(3)` call upon DNS queries, significantly improving federation latency/ping and cache DNS results (NXDOMAINs, successful queries, etc) using hickory-dns / hickory-resolver
|
||||
- Vastly improve RocksDB default settings to use new features that help with performance significantly, uses settings tailored to SSDs, various ways to tweak RocksDB, and a conduwuit setting to tell RocksDB to use settings that are tailored to HDDs or slow spinning rust storage or buggy filesystems.
|
||||
- Add a Cargo build profile for aggressive build-time performance optimisations for release builds (1 codegen unit, no debug, fat LTO, etc, and optimise all crates with same)
|
||||
- Implement database flush and cleanup conduwuit operations when using RocksDB
|
||||
- Implement RocksDB write buffer corking and coalescing in database write-heavy areas
|
||||
- Perform connection pooling and keepalives where necessary to significantly improve federation performance and latency
|
||||
- Various config options to tweak connection pooling, request timeouts, connection timeouts, DNS timeouts and settings, etc with good defaults which also help huge with performance via reusing connections and retrying where needed
|
||||
- Implement building conduwuit with jemalloc (which extends to the RocksDB jemalloc feature for maximum gains) or hardened_malloc light variant, and produce CI builds with jemalloc for performance (Nix doesn't seem to build [hardened_malloc-rs](https://github.com/girlbossceo/hardened_malloc-rs) properly)
|
||||
- Add support for caching DNS results with hickory-dns / hickory-resolver in conduwuit (not a replacement for a proper resolver cache, but still far better than nothing)
|
||||
- Add config option for using DNS over TCP, and config option for controlling A/AAAA record lookup strategy (e.g. don't query AAAA records if you don't have IPv6 connectivity)
|
||||
- Overall significant database, Client-Server, and federation performance and latency improvements (check out the ping room leaderboards if you don't believe me :>)
|
||||
- Add config options for RocksDB compression and bottommost compression, including choosing the algorithm and compression level
|
||||
- Use [loole](https://github.com/mahdi-shojaee/loole) MPSC channels instead of tokio MPSC channels for huge performance boosts in sending channels (mainly relevant for federation) and presence channels
|
||||
- Use `tracing`/`log`'s `release_max_level_info` feature to improve performance, build speeds, binary size, and CPU usage in release builds by avoid compiling debug/trace log level macros that users will generally never use (can be disabled with a build-time feature flag)
|
||||
- Enable RocksDB async read I/O via `io_uring` by default
|
||||
|
||||
|
||||
## General Fixes:
|
||||
- Raise and improve all the various request timeouts making some things like room joins and client bugs error less or none at all than they should, and make them all user configurable
|
||||
- Add missing `reason` field to user ban events (`/ban`)
|
||||
- Fixed spec compliance issue with room version 8 - 11 joins (https://github.com/matrix-org/synapse/issues/16717 / https://github.com/matrix-org/matrix-spec/issues/1708)
|
||||
- Safer and cleaner shutdowns on both database side as we run cleanup on shutdown and exits database loop better (no potential hanging issues in database loop), overall cleaner shutdown logic
|
||||
- Stop sending `make_join` requests on room joins if 15 servers respond with `M_UNSUPPORTED_ROOM_VERSION` or `M_INVALID_ROOM_VERSION`
|
||||
- Stop sending `make_join` requests if 50 servers cannot provide `make_join` for us
|
||||
- Respect *most* client parameters for `/media/` requests (`allow_redirect` still needs work)
|
||||
- Increased graceful shutdown timeout from a low 60 seconds to 180 seconds to avoid killing connections and let the remaining ones finish processing
|
||||
- Return joined member count of rooms for push rules/conditions instead of a hardcoded value of 10
|
||||
- Make `CONDUIT_CONFIG` optional, relevant for container users that configure only by environment variables and no longer need to set `CONDUIT_CONFIG` to an empty string.
|
||||
- Allow HEAD and PATCH (MSC4138) HTTP requests in CORS for clients (despite not being explicity mentioned in Matrix spec, HTTP spec says all HEAD requests need to behave the same as GET requests, Synapse supports HEAD requests)
|
||||
- Resolve and remove some "features" from upstream that result in concurrency hazards, exponential backoff issues, or arbitrary performance limiters
|
||||
- Find more servers for outbound federation `/hierarchy` requests instead of just the room ID server name
|
||||
- Support for suggesting servers to join through at `/_matrix/client/v3/directory/room/{roomAlias}`
|
||||
- Support for suggesting servers to join through us at `/_matrix/federation/v1/query/directory`
|
||||
- Add workaround for [Out Of Your Element](https://gitdab.com/cadence/out-of-your-element) appservice bridge to make it functional on conduwuit (bug has already been reported)
|
||||
|
||||
|
||||
## Moderation:
|
||||
- (Also see [Admin Room](#admin-room) for all the admin commands pertaining to moderation, there's a lot!)
|
||||
- Add support for room banning/blocking by ID using admin command
|
||||
- Add support for serving `support` well-known from `[well_known.support]` (MSC1929)
|
||||
- Config option to forbid publishing rooms to the room directory (`lockdown_public_room_directory`) except for admins
|
||||
- Admin commands to delete room aliases and unpublish rooms from our room directory
|
||||
- For all [`/report`](https://spec.matrix.org/v1.9/client-server-api/#post_matrixclientv3roomsroomidreporteventid) requests: check if the reported event ID belongs to the reported room ID, raise report reasoning character limit to 750, fix broken formatting, make a small delayed random response per spec suggestion on privacy, and check if the sender user is in the reported room.
|
||||
- Support blocking servers from downloading remote media from, returning a 404
|
||||
- Don't allow `m.call.invite` events to be sent in public rooms (prevents calling the entire room)
|
||||
- On new public room creations, only allow moderators to send `m.call.invite`, `org.matrix.msc3401.call`, and `org.matrix.msc3401.call.member` events
|
||||
- Add support for a "global ACLs" feature (`forbidden_remote_server_names`) that blocks inbound remote room invites, room joins by room ID on server name, room joins by room alias on server name, incoming federated joins, and incoming federated room directory requests. This is very helpful for blocking servers that are purely toxic/bad and serve no value in allowing our users to suffer from things like room invite spam or such. Please note that this is not a substitute for room ACLs.
|
||||
- Add support for a config option to forbid our local users from sending federated room directory requests for (`forbidden_remote_room_directory_server_names`). Similar to above, useful for blocking servers that help prevent our users from wandering into bad areas of Matrix via room directories of those malicious servers.
|
||||
- Add config option for auto remediating/deactivating local non-admin users who attempt to join bad/forbidden rooms (`auto_deactivate_banned_room_attempts`)
|
||||
|
||||
|
||||
## Privacy/Security:
|
||||
- Add config option for device name federation with a privacy-friendly default (disabled)
|
||||
- Add config option for requiring authentication to the `/publicRooms` endpoint (room directory) with a default enabled for privacy
|
||||
- Add config option for federating `/publicRooms` endpoint (room directory) to other servers with a default disabled for privacy
|
||||
- Uses proper `argon2` crate by RustCrypto instead of questionable `rust-argon2` crate
|
||||
- Generate passwords with 25 characters instead of 15
|
||||
- Config option `ip_range_denylist` to support refusing to send requests (typically federation) to specific IP ranges, typically RFC 1918, non-routable, testnet, etc addresses like Synapse for security (note: this is not a guaranteed protection, and you should be using a firewall with zones if you want guaranteed protection as doing this on the application level is prone to bypasses).
|
||||
- Config option to block non-admin users from sending room invites or receiving remote room invites. Admin users are still allowed.
|
||||
- Config option to disable incoming and/or outgoing remote read receipts
|
||||
- Config option to disable incoming and/or outgoing remote typing indicators
|
||||
- Config option to disable incoming, outgoing, and/or local presence
|
||||
- Sanitise file names for the `Content-Disposition` header for all media requests (thumbnails, downloads, uploads)
|
||||
- Return `inline` or `attachment` based on the detected file MIME type for the `Content-Disposition` and only allow images/videos/text/audio to be `inline`
|
||||
- Send secure default HTTP headers such as a strong restrictive CSP, deny iframes, disable `X-XSS-Protection`, disable interest cohort in `Permission-Policy`, etc to mitigate any potential attack surface such as from untrusted media
|
||||
|
||||
|
||||
## Administration/Logging:
|
||||
- Commandline argument to specify the path to a config file instead of relying on `CONDUIT_CONFIG`
|
||||
- Revamped admin room infrastructure and commands
|
||||
- Substantially clean up, improve, and fix logging (less noisy dead server logging, registration attempts, more useful troubleshooting logging, proper error propagation, etc)
|
||||
- Configurable RocksDB logging (`LOG` files) with proper defaults (rotate, max size, verbosity, etc) to stop LOG files from accumulating so much
|
||||
- Explicit startup error if your configuration allows open registration without a token or such like Synapse with a way to bypass it if needed
|
||||
- Replace the lightning bolt emoji option with support for setting any arbitrary text (e.g. another emoji) to suffix to all new user registrations, with a conduwuit default of 🏳️⚧️
|
||||
- Implement config option to auto join rooms upon registration
|
||||
- Warn on unknown config options specified
|
||||
- Add `/_conduwuit/server_version` route to return the version of conduwuit without relying on the federation API `/_matrix/federation/v1/version`
|
||||
- Add configurable RocksDB recovery modes to aid in recovering corrupted RocksDB databases
|
||||
- Support config options via `CONDUWUIT_` prefix and accessing non-global struct config options with the `__` split (e.g. `CONDUWUIT_WELL_KNOWN__SERVER`)
|
||||
- Add support for listening on multiple TCP ports
|
||||
- Disable update check by default as it's not useful for conduwuit
|
||||
- **Opt-in** Sentry.io telemetry and metrics, mainly used for crash reporting
|
||||
|
||||
|
||||
## Maintenance/Stability:
|
||||
- GitLab CI ported to GitHub Actions
|
||||
- Repo is mirrored to GitHub, GitLab, git.gay, git.girlcock.ceo, sourcehut, and Codeberg (see README.md for their links)
|
||||
- Docker container images published to GitLab Container Registry, GitHub Container Registry, and Dockerhub
|
||||
- Extensively revamp the example config to be extremely helpful and useful to both new users and power users
|
||||
- Fixed every single clippy (default lints) and rustc warnings, including some that were performance related or potential safety issues / unsoundness
|
||||
- Add a **lot** of other clippy and rustc lints and a rustfmt.toml file
|
||||
- Has [Renovate](https://docs.renovatebot.com/), [Trivy](https://github.com/aquasecurity/trivy-action), and keeps ALL dependencies as up to date as possible
|
||||
- Attempts and interest in removing extreme and unnecessary panics/unwraps/expects that can lead to denial of service or such (upstream and upstream contributors want this unusual behaviour for some reason)
|
||||
- Purge unmaintained/irrelevant/broken database backends (heed, sled, persy) and other unnecessary code or overhead
|
||||
- webp support for images
|
||||
- Add cargo audit support to CI
|
||||
- CI tests with all features
|
||||
- Add timestamp by commit date support to building OCI images for keeping image build reproducibility and still have a meaningful "last modified date" for OCI image metadata
|
||||
- Update rusqlite/sqlite (not that you should be using it)
|
||||
- Startup check if conduwuit running in a container and is listening on 127.0.0.1 (generally containers are using NAT networking and 0.0.0.0 is the intended listening address)
|
||||
|
||||
|
||||
## Admin Room:
|
||||
- Fix admin room handler to not panic/crash if the admin room command response fails (e.g. too large message)
|
||||
- Add command to dynamically change conduwuit's tracing log level filter on the fly
|
||||
- Add admin command to fetch a server's `/.well-known/matrix/support` file
|
||||
- Add debug admin command to force update user device lists (could potentially resolve some E2EE flukes)
|
||||
- Implement **RocksDB online backups**, listing RocksDB backups, and listing database file counts all via admin commands
|
||||
- Add various database visibility commands such as being able to query the getters and iterators used in conduwuit, a very helpful online debugging utility
|
||||
- Forbid the admin room from being made public or world readable history
|
||||
- Add `!admin` as a way to call the admin bot
|
||||
- Extend clear cache admin command to support clearing more caches such as DNS and TLS name overrides
|
||||
- Admin debug command to send a federation request/ping to a server's `/_matrix/federation/v1/version` endpoint and measures the latency it took
|
||||
- Add admin command to bulk delete media via a codeblock list of MXC URLs.
|
||||
- Add admin command to delete both the thumbnail and media MXC URLs from an event ID (e.g. from an abuse report)
|
||||
- Add admin command to list all the rooms a local user is joined in
|
||||
- Add admin command to delete all remote media in the past X minutes as a form of deleting media that you don't want on your server that a remote user posted in a room
|
||||
- Add admin command to return a room's state
|
||||
- Admin debug command to fetch a PDU from a remote server and inserts it into our database/timeline as backfill
|
||||
- Add admin command to delete media via a specific MXC. This deletes the MXC from our database, and the file locally.
|
||||
- Add admin commands for banning (blocking) room IDs from our local users joining (admins are always allowed) and evicts all our local users from that room, in addition to bulk room banning support, and blocks room invites (remote and local) to the banned room, as a moderation feature
|
||||
- Add admin commands to output jemalloc memory stats and memory usage
|
||||
- Add admin command to get conduwuit's uptime
|
||||
- Add admin command to get rooms a *remote* user shares with us
|
||||
|
||||
|
||||
## Misc:
|
||||
- Support for creating rooms with custom room IDs like Maunium Synapse (`room_id` request body field to `/createRoom`)
|
||||
- Query parameter `?format=event|content` for returning either the room state event's content (default) for the full room state event on ` /_matrix/client/v3/rooms/{roomId}/state/{eventType}[/{stateKey}]` requests (see https://github.com/matrix-org/matrix-spec/issues/1047)
|
||||
- Add **optional** feature flag to use SHA256 key names for media instead of base64 to overcome filesystem file name length limitations (OS error file name too long)
|
||||
- Send a User-Agent on all of our requests
|
||||
- Send `avatar_url` on invite room membership events/changes
|
||||
- Support sending [`well_known` response to client login responses](https://spec.matrix.org/v1.10/client-server-api/#post_matrixclientv3login) if using config option `[well_known.client]`
|
||||
- Implement `include_state` search criteria support for `/search` requests (response now can include room states)
|
||||
- Declare various missing Matrix versions and features at `/_matrix/client/versions`
|
||||
- Implement legacy Matrix `/v1/` media endpoints that some clients and servers may still call
|
||||
- Config option to change Conduit's behaviour of homeserver key fetching (`query_trusted_key_servers_first`). This option sets whether conduwuit will query trusted notary key servers first before the individual homeserver(s), or vice versa which may help in joining certain rooms.
|
||||
- Implement unstable MSC2666 support for querying mutual rooms with a user
|
||||
- Assume well-knowns are broken if they exceed past 10000 characters.
|
||||
- Add support for the Matrix spec compliance test suite [Complement](https://github.com/matrix-org/complement/) via the Nix flake and various other fixes for it
|
||||
- Add support for listening on both HTTP and HTTPS if using direct TLS with conduwuit for usecases such as Complement
|
||||
- Implement running and diff'ing Complement results in CI
|
||||
- Interest in supporting other operating systems such as macOS, BSDs, and Windows, and getting them added into CI and doing builds for them
|
||||
- Add config option for disabling RocksDB Direct IO if needed
|
||||
- Add various documentation on maintaining conduwuit, using RocksDB online backups, some troubleshooting, using admin commands, etc
|
||||
- (Developers): Add support for tokio-console
|
||||
- (Developers): Add support for tracing flame graphs
|
||||
- Add `release-debuginfo` Cargo build profile
|
||||
- No cryptocurrency donations allowed, conduwuit is fully maintained by independent queer maintainers, and with a strong priority on inclusitivity and comfort for protected groups 🏳️⚧️
|
||||
@@ -1,21 +0,0 @@
|
||||
# Conduwuit
|
||||
|
||||
{{#include ../README.md:catchphrase}}
|
||||
|
||||
{{#include ../README.md:body}}
|
||||
|
||||
#### What's different about your fork than upstream Conduit?
|
||||
|
||||
See the [differences](differences.md) page
|
||||
|
||||
#### How can I deploy my own?
|
||||
|
||||
- [Deployment options](deploying.md)
|
||||
|
||||
If you want to connect an Appservice to Conduwuit, take a look at the [appservices documentation](appservices.md).
|
||||
|
||||
#### How can I contribute?
|
||||
|
||||
See the [contributor's guide](contributing.md)
|
||||
|
||||
{{#include ../README.md:footer}}
|
||||
@@ -1,63 +0,0 @@
|
||||
# Maintaining your conduwuit setup
|
||||
|
||||
## Moderation
|
||||
|
||||
conduwuit has moderation through admin room commands. "binary commands" (medium priority) and an admin API (low priority) is planned. Some moderation-related config options are available in the example config such as "global ACLs" and blocking media requests to certain servers. See the example config for the moderation config options under the "Moderation / Privacy / Security" section.
|
||||
|
||||
conduwuit has moderation admin commands for:
|
||||
- managing room aliases (`!admin rooms alias`)
|
||||
- managing room directory (`!admin rooms directory`)
|
||||
- managing room banning/blocking and user removal (`!admin rooms moderation`)
|
||||
- managing user accounts (`!admin users`)
|
||||
- fetching `/.well-known/matrix/support` from servers (`!admin federation`)
|
||||
- blocking incoming federation for certain rooms (not the same as room banning) (`!admin federation`)
|
||||
- deleting media (see [the media section](#media))
|
||||
|
||||
Any commands with `-list` in them will require a codeblock in the message with each object being newline delimited. An example of doing this is:
|
||||
|
||||
````
|
||||
!admin rooms moderation ban-list-of-rooms
|
||||
```
|
||||
!roomid1:server.name
|
||||
!roomid2:server.name
|
||||
!roomid3:server.name
|
||||
```
|
||||
````
|
||||
|
||||
## Database
|
||||
|
||||
If using RocksDB, there's very little you need to do. Compaction is ran automatically based on various defined thresholds tuned for conduwuit to be high performance with the least I/O amplifcation or overhead. Manually running compaction is not recommended, or compaction via a timer. RocksDB is built with io_uring support via liburing for async read I/O.
|
||||
|
||||
Some RocksDB settings can be adjusted such as the compression method chosen. See the RocksDB section in the [example config](configuration.md). btrfs users may benefit from disabling compression on RocksDB if CoW is in use.
|
||||
|
||||
RocksDB troubleshooting can be found [in the RocksDB section of troubleshooting](troubleshooting.md).
|
||||
|
||||
## Backups
|
||||
|
||||
Currently only RocksDB supports online backups. If you'd like to backup your database online without any downtime, see the `!admin server` command for the backup commands and the `database_backup_path` config options in the example config. Please note that the format of the database backup is not the exact same. This is unfortunately a bad design choice by Facebook as we are using the database backup engine API from RocksDB, however the data is still there and can still be joined together.
|
||||
|
||||
To restore a backup from an online RocksDB backup:
|
||||
- shutdown conduwuit
|
||||
- create a new directory for merging together the data
|
||||
- in the online backup created, copy all `.sst` files in `$DATABASE_BACKUP_PATH/shared_checksum` to your new directory
|
||||
- trim all the strings so instead of `######_sxxxxxxxxx.sst`, it reads `######.sst`. A way of doing this with sed and bash is `for file in *.sst; do mv "$file" "$(echo "$file" | sed 's/_s.*/.sst/')"; done`
|
||||
- copy all the files in `$DATABASE_BACKUP_PATH/1` to your new directory
|
||||
- set your `database_path` config option to your new directory, or replace your old one with the new one you crafted
|
||||
- start up conduwuit again and it should open as normal
|
||||
|
||||
If you'd like to do an offline backup, shutdown conduwuit and copy your `database_path` directory elsewhere. This can be restored with no modifications needed.
|
||||
|
||||
Backing up media is also just copying the `media/` directory from your database directory.
|
||||
|
||||
## Media
|
||||
|
||||
Media still needs various work, however conduwuit implements media deletion via:
|
||||
- MXC URI
|
||||
- Delete list of MXC URIs
|
||||
- Delete remote media in the past `N` seconds/minutes
|
||||
|
||||
See the `!admin media` command for further information. All media in conduwuit is stored at `$DATABASE_DIR/media`. This will be configurable soon.
|
||||
|
||||
If you are finding yourself needing extensive granular control over media, we recommend looking into [Matrix Media Repo](https://github.com/t2bot/matrix-media-repo). conduwuit intends to implement various utilities for media, but MMR is dedicated to extensive media management.
|
||||
|
||||
Built-in S3 support is also planned, but for now using a "S3 filesystem" on `media/` works. conduwuit also sends a `Cache-Control` header of 1 year and immutable for all media requests (download and thumbnail) to reduce unnecessary media requests from browsers.
|
||||
@@ -1,62 +0,0 @@
|
||||
# Troubleshooting conduwuit
|
||||
|
||||
> ## Docker users ⚠️
|
||||
>
|
||||
> Docker is extremely UX unfriendly. Because of this, a ton of issues or support is actually Docker support, not conduwuit support. We also cannot document the ever-growing list of Docker issues here.
|
||||
>
|
||||
> If you intend on asking for support and you are using Docker, **PLEASE** triple validate your issues are **NOT** because you have a misconfiguration in your Docker setup.
|
||||
>
|
||||
> If there are things like Compose file issues or Dockerhub image issues, those can still be mentioned as long as they're something we can fix.
|
||||
|
||||
## Rocksdb / database issues
|
||||
|
||||
#### Direct IO
|
||||
|
||||
Some filesystems may not like RocksDB using [Direct IO](https://github.com/facebook/rocksdb/wiki/Direct-IO). Direct IO is for non-buffered I/O which improves conduwuit performance, but at least FUSE is a filesystem potentially known to not like this. See the [example config](configuration.md) for disabling it if needed. Issues from Direct IO on unsupported filesystems are usually shown as startup errors.
|
||||
|
||||
#### Database corruption
|
||||
|
||||
If your database is corrupted and is failing to start (e.g. checksum mismatch), it may be recoverable but careful steps must be taken, and there is no guarantee it may be recoverable.
|
||||
|
||||
RocksDB has the following recovery modes:
|
||||
|
||||
- `TolerateCorruptedTailRecords`
|
||||
- `AbsoluteConsistency`
|
||||
- `PointInTime`
|
||||
- `SkipAnyCorruptedRecord`
|
||||
|
||||
By default, conduwuit uses `TolerateCorruptedTailRecords` as generally these may be due to bad federation and we can re-fetch the correct data over federation. The RocksDB default is `PointInTime` which will attempt to restore a "snapshot" of the data when it was last known to be good. This data can be either a few seconds old, or multiple minutes prior. `PointInTime` may not be suitable for default usage due to clients and servers possibly not being able to handle sudden "backwards time travels", and `AbsoluteConsistency` may be too strict.
|
||||
|
||||
`AbsoluteConsistency` will fail to start the database if any sign of corruption is detected. `SkipAnyCorruptedRecord` will skip all forms of corruption unless it forbids the database from opening (e.g. too severe). Usage of `SkipAnyCorruptedRecord` voids any support as this may cause more damage and/or leave your database in a permanently inconsistent state, but it may do something if `PointInTime` does not work as a last ditch effort.
|
||||
|
||||
With this in mind:
|
||||
- First start conduwuit with the `PointInTime` recovery method. See the [example config](configuration.md) for how to do this using `rocksdb_recovery_mode`
|
||||
- If your database successfully opens, clients are recommended to clear their client cache to account for the rollback
|
||||
- Leave your conduwuit running in `PointInTime` for at least 30-60 minutes so as much possible corruption is restored
|
||||
- If all goes will, you should be able to restore back to using `TolerateCorruptedTailRecords` and you have successfully recovered your database
|
||||
|
||||
## Media
|
||||
|
||||
#### "File name too long"
|
||||
|
||||
If you are running into the "file name is too long" OS error for media requests, your filesystem cannot handle file name lengths >=255 characters. This is unfortuntely due to Conduit (upstream) using base64 for file name keys which is very problematic for some filesystems as the base64 input is untrusted and long file names or specific inputs can cause this. If you would like to avoid this, you may build conduwuit yourself with the `sha256_media` feature. **This will lose database compatibility with upstream**.
|
||||
|
||||
## Debugging
|
||||
|
||||
Note that users should not really be debugging things. If you find yourself debugging and find the issue, please let us know and/or how we can fix it. Various debug commands can be found in `!admin debug`.
|
||||
|
||||
#### Debug/Trace log level
|
||||
|
||||
conduwuit builds without debug or trace log levels by default for at least performance reasons. This may change in the future and/or binaries providing such configurations may be provided. If you need to access debug/trace log levels, you will need to build without the `release_max_log_level` feature.
|
||||
|
||||
#### Changing log level dynamically
|
||||
|
||||
conduwuit supports changing the tracing log environment filter on-the-fly using the admin command `!admin debug change-log-level`. This accepts a string **without quotes** the same format as the `log` config option.
|
||||
|
||||
#### Pinging servers
|
||||
|
||||
conduwuit can ping other servers using `!admin debug ping`. This takes a server name and goes through the server discovery process and queries `/_matrix/federation/v1/version`. Errors are outputted.
|
||||
|
||||
#### Allocator memory stats
|
||||
|
||||
If using jemalloc (for now) and built with jemallocator's `stats` feature, you can see conduwuit's jemalloc memory stats by using `!admin debug memory-stats`
|
||||
@@ -1,55 +0,0 @@
|
||||
# Setting up TURN/STURN
|
||||
|
||||
In order to make or receive calls, a TURN server is required. conduwuit suggests using [Coturn](https://github.com/coturn/coturn) for this purpose, which is also available as a Docker image.
|
||||
|
||||
### Configuration
|
||||
|
||||
Create a configuration file called `coturn.conf` containing:
|
||||
|
||||
```conf
|
||||
use-auth-secret
|
||||
static-auth-secret=<a secret key>
|
||||
realm=<your server domain>
|
||||
```
|
||||
A common way to generate a suitable alphanumeric secret key is by using `pwgen -s 64 1`.
|
||||
|
||||
These same values need to be set in conduwuit. You can either modify conduwuit.toml to include these lines:
|
||||
|
||||
```
|
||||
turn_uris = ["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]
|
||||
turn_secret = "<secret key from coturn configuration>"
|
||||
```
|
||||
|
||||
or append the following to the docker environment variables dependig on which configuration method you used earlier:
|
||||
|
||||
```yml
|
||||
CONDUIT_TURN_URIS: '["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]'
|
||||
CONDUIT_TURN_SECRET: "<secret key from coturn configuration>"
|
||||
```
|
||||
|
||||
Restart conduwuit to apply these changes.
|
||||
|
||||
### Run
|
||||
Run the [Coturn](https://hub.docker.com/r/coturn/coturn) image using
|
||||
```bash
|
||||
docker run -d --network=host -v $(pwd)/coturn.conf:/etc/coturn/turnserver.conf coturn/coturn
|
||||
```
|
||||
|
||||
or docker-compose. For the latter, paste the following section into a file called `docker-compose.yml`
|
||||
and run `docker compose up -d` in the same directory.
|
||||
|
||||
```yml
|
||||
version: 3
|
||||
services:
|
||||
turn:
|
||||
container_name: coturn-server
|
||||
image: docker.io/coturn/coturn
|
||||
restart: unless-stopped
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- ./coturn.conf:/etc/coturn/turnserver.conf
|
||||
```
|
||||
|
||||
To understand why the host networking mode is used and explore alternative configuration options, please visit [Coturn's Docker documentation](https://github.com/coturn/coturn/blob/master/docker/coturn/README.md).
|
||||
|
||||
For security recommendations see Synapse's [Coturn documentation](https://element-hq.github.io/synapse/latest/turn-howto.html).
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
interpreter = ["bash", "-euo", "pipefail", "-c"]
|
||||
|
||||
[[task]]
|
||||
name = "engage"
|
||||
group = "versions"
|
||||
script = "engage --version"
|
||||
|
||||
[[task]]
|
||||
name = "nix"
|
||||
group = "versions"
|
||||
script = "nix --version"
|
||||
|
||||
[[task]]
|
||||
name = "direnv"
|
||||
group = "versions"
|
||||
script = "direnv --version"
|
||||
|
||||
[[task]]
|
||||
name = "rustc"
|
||||
group = "versions"
|
||||
script = "rustc --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo"
|
||||
group = "versions"
|
||||
script = "cargo --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-fmt"
|
||||
group = "versions"
|
||||
script = "cargo fmt --version"
|
||||
|
||||
[[task]]
|
||||
name = "rustdoc"
|
||||
group = "versions"
|
||||
script = "rustdoc --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-clippy"
|
||||
group = "versions"
|
||||
script = "cargo clippy -- --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-audit"
|
||||
group = "versions"
|
||||
script = "cargo audit --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-deb"
|
||||
group = "versions"
|
||||
script = "cargo deb --version"
|
||||
|
||||
[[task]]
|
||||
name = "lychee"
|
||||
group = "versions"
|
||||
script = "lychee --version"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-audit"
|
||||
group = "security"
|
||||
script = "cargo audit -D warnings -D unmaintained -D unsound -D yanked --ignore RUSTSEC-2020-0016"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-fmt"
|
||||
group = "lints"
|
||||
script = "cargo fmt --check -- --color=always"
|
||||
|
||||
[[task]]
|
||||
name = "cargo-doc"
|
||||
group = "lints"
|
||||
script = """
|
||||
RUSTDOCFLAGS="-D warnings" cargo doc \
|
||||
--workspace \
|
||||
--all-features \
|
||||
--no-deps \
|
||||
--document-private-items \
|
||||
--color always
|
||||
"""
|
||||
|
||||
[[task]]
|
||||
name = "clippy/default"
|
||||
group = "lints"
|
||||
script = """
|
||||
cargo clippy \
|
||||
--workspace \
|
||||
--all-targets \
|
||||
--color=always \
|
||||
-- \
|
||||
-D warnings
|
||||
"""
|
||||
|
||||
[[task]]
|
||||
name = "clippy/all"
|
||||
group = "lints"
|
||||
script = """
|
||||
cargo clippy \
|
||||
--workspace \
|
||||
--all-targets \
|
||||
--all-features \
|
||||
--color=always \
|
||||
-- \
|
||||
-D warnings
|
||||
"""
|
||||
|
||||
[[task]]
|
||||
name = "clippy/jemalloc"
|
||||
group = "lints"
|
||||
script = """
|
||||
cargo clippy \
|
||||
--workspace \
|
||||
--features jemalloc \
|
||||
--all-targets \
|
||||
--color=always \
|
||||
-- \
|
||||
-D warnings
|
||||
"""
|
||||
|
||||
[[task]]
|
||||
name = "clippy/hardened_malloc"
|
||||
group = "lints"
|
||||
script = """
|
||||
cargo clippy \
|
||||
--workspace \
|
||||
--features hardened_malloc \
|
||||
--all-targets \
|
||||
--color=always \
|
||||
-- \
|
||||
-D warnings
|
||||
"""
|
||||
|
||||
[[task]]
|
||||
name = "lychee"
|
||||
group = "lints"
|
||||
script = "lychee --verbose --offline docs *.md"
|
||||
|
||||
[[task]]
|
||||
name = "cargo"
|
||||
group = "tests"
|
||||
script = """
|
||||
cargo test \
|
||||
--workspace \
|
||||
--all-targets \
|
||||
--all-features \
|
||||
--color=always \
|
||||
-- \
|
||||
--color=always
|
||||
"""
|
||||
Generated
-303
@@ -1,303 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"attic": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711742460,
|
||||
"narHash": "sha256-0O4v6e4a1toxXZ2gf5INhg4WPE5C5T+SVvsBt+45Mcc=",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "attic",
|
||||
"rev": "4dbdbee45728d8ce5788db6461aaaa89d98081f0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "zhaofengli",
|
||||
"ref": "main",
|
||||
"repo": "attic",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"complement": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1714661560,
|
||||
"narHash": "sha256-E1ZiUbOgo7rWo8zt2M2vzCVSykCxK0Ot2dUAxTL6cpU=",
|
||||
"owner": "matrix-org",
|
||||
"repo": "complement",
|
||||
"rev": "370a014dca0f720614e0c8f68b9a3e66ecf7f516",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "matrix-org",
|
||||
"ref": "main",
|
||||
"repo": "complement",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"attic",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1702918879,
|
||||
"narHash": "sha256-tWJqzajIvYcaRWxn+cLUB9L9Pv4dQ3Bfit/YjU5ze3g=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "7195c00c272fdd92fc74e7d5a0a2844b9fadb2fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715274763,
|
||||
"narHash": "sha256-3Iv1PGHJn9sV3HO4FlOVaaztOxa9uGLfOmUWrH7v7+A=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "27025ab71bdca30e7ed0a16c88fd74c5970fc7f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"ref": "master",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715322226,
|
||||
"narHash": "sha256-ezoe/FwfJpA7sskLoLP2iwfwkYnscEFCP6Vk5kPwh9k=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "297c756ba6249d483c1dafe42378560458842173",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "main",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"ref": "master",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"ref": "main",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1710156097,
|
||||
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"ref": "main",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1711401922,
|
||||
"narHash": "sha256-QoQqXoj8ClGo0sqD/qWKFWezgEwUL0SUh37/vY2jNhc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "07262b18b97000d16a4bdb003418bd2fb067a932",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1711460390,
|
||||
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1715266358,
|
||||
"narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f1010e0469db743d14519a1efd37e23f8513d714",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rocksdb": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1714770052,
|
||||
"narHash": "sha256-NCPYF2wYBsB9OHEkZSOYoPlxjC9BBMhJp8EM5M1o3Mc=",
|
||||
"owner": "girlbossceo",
|
||||
"repo": "rocksdb",
|
||||
"rev": "db6df0b185774778457dabfcbd822cb81760cade",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "girlbossceo",
|
||||
"ref": "v9.1.1",
|
||||
"repo": "rocksdb",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"attic": "attic",
|
||||
"complement": "complement",
|
||||
"crane": "crane_2",
|
||||
"fenix": "fenix",
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rocksdb": "rocksdb"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1715255944,
|
||||
"narHash": "sha256-vLLgYpdtKBaGYTamNLg1rbRo1bPXp4Jgded/gnprPVw=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "5bf2f85c8054d80424899fa581db1b192230efb5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
{
|
||||
inputs = {
|
||||
attic.url = "github:zhaofengli/attic?ref=main";
|
||||
complement = { url = "github:matrix-org/complement?ref=main"; flake = false; };
|
||||
crane = { url = "github:ipetkov/crane?ref=master"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
fenix = { url = "github:nix-community/fenix?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
flake-compat = { url = "github:edolstra/flake-compat?ref=master"; flake = false; };
|
||||
flake-utils.url = "github:numtide/flake-utils?ref=main";
|
||||
nix-filter.url = "github:numtide/nix-filter?ref=main";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||
# https://github.com/girlbossceo/rocksdb/commit/db6df0b185774778457dabfcbd822cb81760cade
|
||||
rocksdb = { url = "github:girlbossceo/rocksdb?ref=v9.1.1"; flake = false; };
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgsHost = inputs.nixpkgs.legacyPackages.${system};
|
||||
|
||||
# The Rust toolchain to use
|
||||
toolchain = inputs.fenix.packages.${system}.fromToolchainFile {
|
||||
file = ./rust-toolchain.toml;
|
||||
|
||||
# See also `rust-toolchain.toml`
|
||||
sha256 = "sha256-+syqAd2kX8KVa8/U2gz3blIQTTsYYt3U63xBWaGOSc8";
|
||||
};
|
||||
|
||||
scope = pkgs: pkgs.lib.makeScope pkgs.newScope (self: {
|
||||
book = self.callPackage ./nix/pkgs/book {};
|
||||
complement = self.callPackage ./nix/pkgs/complement {};
|
||||
craneLib = ((inputs.crane.mkLib pkgs).overrideToolchain toolchain);
|
||||
inherit inputs;
|
||||
main = self.callPackage ./nix/pkgs/main {};
|
||||
oci-image = self.callPackage ./nix/pkgs/oci-image {};
|
||||
rocksdb = pkgs.rocksdb.overrideAttrs (old: {
|
||||
src = inputs.rocksdb;
|
||||
version = pkgs.lib.removePrefix
|
||||
"v"
|
||||
(builtins.fromJSON (builtins.readFile ./flake.lock))
|
||||
.nodes.rocksdb.original.ref;
|
||||
});
|
||||
});
|
||||
|
||||
scopeHost = (scope pkgsHost);
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = scopeHost.main;
|
||||
jemalloc = scopeHost.main.override { features = ["jemalloc"]; };
|
||||
hmalloc = scopeHost.main.override { features = ["hardened_malloc"]; };
|
||||
|
||||
oci-image = scopeHost.oci-image;
|
||||
oci-image-jemalloc = scopeHost.oci-image.override {
|
||||
main = scopeHost.main.override {
|
||||
features = ["jemalloc"];
|
||||
};
|
||||
};
|
||||
oci-image-hmalloc = scopeHost.oci-image.override {
|
||||
main = scopeHost.main.override {
|
||||
features = ["hardened_malloc"];
|
||||
};
|
||||
};
|
||||
|
||||
book = scopeHost.book;
|
||||
|
||||
complement = scopeHost.complement;
|
||||
}
|
||||
//
|
||||
builtins.listToAttrs
|
||||
(builtins.concatLists
|
||||
(builtins.map
|
||||
(crossSystem:
|
||||
let
|
||||
binaryName = "static-${crossSystem}";
|
||||
pkgsCrossStatic =
|
||||
(import inputs.nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = {
|
||||
config = crossSystem;
|
||||
};
|
||||
}).pkgsStatic;
|
||||
scopeCrossStatic = scope pkgsCrossStatic;
|
||||
in
|
||||
[
|
||||
# An output for a statically-linked binary
|
||||
{
|
||||
name = binaryName;
|
||||
value = scopeCrossStatic.main;
|
||||
}
|
||||
|
||||
# An output for a statically-linked binary with jemalloc
|
||||
{
|
||||
name = "${binaryName}-jemalloc";
|
||||
value = scopeCrossStatic.main.override {
|
||||
features = ["jemalloc"];
|
||||
};
|
||||
}
|
||||
|
||||
# An output for a statically-linked binary with hardened_malloc
|
||||
{
|
||||
name = "${binaryName}-hmalloc";
|
||||
value = scopeCrossStatic.main.override {
|
||||
features = ["hardened_malloc"];
|
||||
};
|
||||
}
|
||||
|
||||
# An output for an OCI image based on that binary
|
||||
{
|
||||
name = "oci-image-${crossSystem}";
|
||||
value = scopeCrossStatic.oci-image;
|
||||
}
|
||||
|
||||
# An output for an OCI image based on that binary with jemalloc
|
||||
{
|
||||
name = "oci-image-${crossSystem}-jemalloc";
|
||||
value = scopeCrossStatic.oci-image.override {
|
||||
main = scopeCrossStatic.main.override {
|
||||
features = ["jemalloc"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
# An output for an OCI image based on that binary with hardened_malloc
|
||||
{
|
||||
name = "oci-image-${crossSystem}-hmalloc";
|
||||
value = scopeCrossStatic.oci-image.override {
|
||||
main = scopeCrossStatic.main.override {
|
||||
features = ["hardened_malloc"];
|
||||
};
|
||||
};
|
||||
}
|
||||
]
|
||||
)
|
||||
[
|
||||
"x86_64-unknown-linux-musl"
|
||||
"aarch64-unknown-linux-musl"
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
devShells.default = pkgsHost.mkShell {
|
||||
env = scopeHost.main.env // {
|
||||
# Rust Analyzer needs to be able to find the path to default crate
|
||||
# sources, and it can read this environment variable to do so. The
|
||||
# `rust-src` component is required in order for this to work.
|
||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
|
||||
# Convenient way to access a pinned version of Complement's source
|
||||
# code.
|
||||
COMPLEMENT_SRC = inputs.complement.outPath;
|
||||
};
|
||||
|
||||
# Development tools
|
||||
packages = [
|
||||
# Always use nightly rustfmt because most of its options are unstable
|
||||
#
|
||||
# This needs to come before `toolchain` in this list, otherwise
|
||||
# `$PATH` will have stable rustfmt instead.
|
||||
inputs.fenix.packages.${system}.latest.rustfmt
|
||||
|
||||
toolchain
|
||||
]
|
||||
++ (with pkgsHost; [
|
||||
engage
|
||||
cargo-audit
|
||||
|
||||
# Needed for producing Debian packages
|
||||
cargo-deb
|
||||
|
||||
# Needed for Complement
|
||||
go
|
||||
olm
|
||||
|
||||
# Needed for our script for Complement
|
||||
jq
|
||||
|
||||
# Needed for finding broken markdown links
|
||||
lychee
|
||||
|
||||
# Useful for editing the book locally
|
||||
mdbook
|
||||
])
|
||||
++ (if !pkgsHost.stdenv.isDarwin then [
|
||||
# Needed for building with io_uring
|
||||
pkgsHost.liburing
|
||||
] else [])
|
||||
++
|
||||
scopeHost.main.nativeBuildInputs;
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
podman build -t misc-webserver -f "Dockerfile"
|
||||
podman save --format oci-archive localhost/misc-webserver:latest | gzip | ssh fedora@213.32.25.24 -T "zcat | sudo podman load"
|
||||
@@ -1,33 +0,0 @@
|
||||
{ inputs
|
||||
|
||||
# Dependencies
|
||||
, main
|
||||
, mdbook
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit (main) pname version;
|
||||
|
||||
src = inputs.nix-filter {
|
||||
root = inputs.self;
|
||||
include = [
|
||||
"book.toml"
|
||||
"conduwuit-example.toml"
|
||||
"CONTRIBUTING.md"
|
||||
"README.md"
|
||||
"debian/conduwuit.service"
|
||||
"debian/README.md"
|
||||
"docs"
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
mdbook
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
mdbook build
|
||||
mv public $out
|
||||
'';
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
[global]
|
||||
address = "0.0.0.0"
|
||||
allow_device_name_federation = true
|
||||
allow_guest_registration = true
|
||||
allow_public_room_directory_over_federation = true
|
||||
allow_public_room_directory_without_auth = true
|
||||
allow_registration = true
|
||||
allow_unstable_room_versions = true
|
||||
database_backend = "rocksdb"
|
||||
database_path = "/database"
|
||||
log = "trace"
|
||||
port = [8008, 8448]
|
||||
trusted_servers = []
|
||||
yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse = true
|
||||
|
||||
[global.tls]
|
||||
certs = "/certificate.crt"
|
||||
dual_protocol = true
|
||||
key = "/private_key.key"
|
||||
@@ -1,92 +0,0 @@
|
||||
# Dependencies
|
||||
{ bashInteractive
|
||||
, buildEnv
|
||||
, coreutils
|
||||
, dockerTools
|
||||
, gawk
|
||||
, lib
|
||||
, main
|
||||
, openssl
|
||||
, stdenv
|
||||
, tini
|
||||
, writeShellScriptBin
|
||||
}:
|
||||
|
||||
let
|
||||
main' = main.override {
|
||||
profile = "dev";
|
||||
features = ["axum_dual_protocol"];
|
||||
};
|
||||
|
||||
start = writeShellScriptBin "start" ''
|
||||
set -euxo pipefail
|
||||
|
||||
${lib.getExe openssl} genrsa -out private_key.key 2048
|
||||
${lib.getExe openssl} req \
|
||||
-new \
|
||||
-sha256 \
|
||||
-key private_key.key \
|
||||
-subj "/C=US/ST=CA/O=MyOrg, Inc./CN=$SERVER_NAME" \
|
||||
-out signing_request.csr
|
||||
cp ${./v3.ext} v3.ext
|
||||
echo "DNS.1 = $SERVER_NAME" >> v3.ext
|
||||
echo "IP.1 = $(${lib.getExe gawk} 'END{print $1}' /etc/hosts)" \
|
||||
>> v3.ext
|
||||
${lib.getExe openssl} x509 \
|
||||
-req \
|
||||
-extfile v3.ext \
|
||||
-in signing_request.csr \
|
||||
-CA /complement/ca/ca.crt \
|
||||
-CAkey /complement/ca/ca.key \
|
||||
-CAcreateserial \
|
||||
-out certificate.crt \
|
||||
-days 1 \
|
||||
-sha256
|
||||
|
||||
${lib.getExe' coreutils "env"} \
|
||||
CONDUIT_SERVER_NAME="$SERVER_NAME" \
|
||||
CONDUIT_WELL_KNOWN_SERVER="$SERVER_NAME:8448" \
|
||||
CONDUIT_WELL_KNOWN_SERVER="$SERVER_NAME:8008" \
|
||||
${lib.getExe main'}
|
||||
'';
|
||||
in
|
||||
|
||||
dockerTools.buildImage {
|
||||
name = "complement-${main.pname}";
|
||||
tag = "main";
|
||||
|
||||
copyToRoot = buildEnv {
|
||||
name = "root";
|
||||
pathsToLink = [
|
||||
"/bin"
|
||||
];
|
||||
paths = [
|
||||
bashInteractive
|
||||
coreutils
|
||||
main'
|
||||
start
|
||||
];
|
||||
};
|
||||
|
||||
config = {
|
||||
Cmd = [
|
||||
"${lib.getExe start}"
|
||||
];
|
||||
|
||||
Entrypoint = if !stdenv.isDarwin
|
||||
# Use the `tini` init system so that signals (e.g. ctrl+c/SIGINT)
|
||||
# are handled as expected
|
||||
then [ "${lib.getExe' tini "tini"}" "--" ]
|
||||
else [];
|
||||
|
||||
Env = [
|
||||
"SSL_CERT_FILE=/complement/ca/ca.crt"
|
||||
"CONDUWUIT_CONFIG=${./config.toml}"
|
||||
];
|
||||
|
||||
ExposedPorts = {
|
||||
"8008/tcp" = {};
|
||||
"8448/tcp" = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
basicConstraints=CA:FALSE
|
||||
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
@@ -1,100 +0,0 @@
|
||||
{ lib
|
||||
, pkgsBuildHost
|
||||
, rust
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
lib.optionalAttrs stdenv.hostPlatform.isStatic {
|
||||
ROCKSDB_STATIC = "";
|
||||
}
|
||||
//
|
||||
{
|
||||
CARGO_BUILD_RUSTFLAGS =
|
||||
lib.concatStringsSep
|
||||
" "
|
||||
([]
|
||||
# This disables PIE for static builds, which isn't great in terms
|
||||
# of security. Unfortunately, my hand is forced because nixpkgs'
|
||||
# `libstdc++.a` is built without `-fPIE`, which precludes us from
|
||||
# leaving PIE enabled.
|
||||
++ lib.optionals
|
||||
stdenv.hostPlatform.isStatic
|
||||
[ "-C" "relocation-model=static" ]
|
||||
++ lib.optionals
|
||||
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
|
||||
[ "-l" "c" ]
|
||||
++ lib.optionals
|
||||
# This check has to match the one [here][0]. We only need to set
|
||||
# these flags when using a different linker. Don't ask me why,
|
||||
# though, because I don't know. All I know is it breaks otherwise.
|
||||
#
|
||||
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L37-L40
|
||||
(
|
||||
# Nixpkgs doesn't check for x86_64 here but we do, because I
|
||||
# observed a failure building statically for x86_64 without
|
||||
# including it here. Linkers are weird.
|
||||
(stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64)
|
||||
&& stdenv.hostPlatform.isStatic
|
||||
&& !stdenv.isDarwin
|
||||
&& !stdenv.cc.bintools.isLLVM
|
||||
)
|
||||
[
|
||||
"-l"
|
||||
"stdc++"
|
||||
"-L"
|
||||
"${stdenv.cc.cc.lib}/${stdenv.hostPlatform.config}/lib"
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
# What follows is stolen from [here][0]. Its purpose is to properly
|
||||
# configure compilers and linkers for various stages of the build, and
|
||||
# even covers the case of build scripts that need native code compiled and
|
||||
# run on the build platform (I think).
|
||||
#
|
||||
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L57-L80
|
||||
//
|
||||
(
|
||||
let
|
||||
inherit (rust.lib) envVars;
|
||||
in
|
||||
lib.optionalAttrs
|
||||
(stdenv.targetPlatform.rust.rustcTarget
|
||||
!= stdenv.hostPlatform.rust.rustcTarget)
|
||||
(
|
||||
let
|
||||
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
|
||||
in
|
||||
{
|
||||
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
|
||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
|
||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" =
|
||||
envVars.linkerForTarget;
|
||||
}
|
||||
)
|
||||
//
|
||||
(
|
||||
let
|
||||
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
|
||||
in
|
||||
{
|
||||
"CC_${cargoEnvVarTarget}" = envVars.ccForHost;
|
||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForHost;
|
||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForHost;
|
||||
CARGO_BUILD_TARGET = rustcTarget;
|
||||
}
|
||||
)
|
||||
//
|
||||
(
|
||||
let
|
||||
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
|
||||
in
|
||||
{
|
||||
"CC_${cargoEnvVarTarget}" = envVars.ccForBuild;
|
||||
"CXX_${cargoEnvVarTarget}" = envVars.cxxForBuild;
|
||||
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForBuild;
|
||||
HOST_CC = "${pkgsBuildHost.stdenv.cc}/bin/cc";
|
||||
HOST_CXX = "${pkgsBuildHost.stdenv.cc}/bin/c++";
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -1,108 +0,0 @@
|
||||
# Dependencies (keep sorted)
|
||||
{ craneLib
|
||||
, inputs
|
||||
, lib
|
||||
, libiconv
|
||||
, pkgsBuildHost
|
||||
, rocksdb
|
||||
, rust
|
||||
, stdenv
|
||||
|
||||
# Options (keep sorted)
|
||||
, default_features ? true
|
||||
, features ? []
|
||||
, profile ? "release"
|
||||
}:
|
||||
|
||||
let
|
||||
buildDepsOnlyEnv =
|
||||
let
|
||||
rocksdb' = rocksdb.override {
|
||||
enableJemalloc = builtins.elem "jemalloc" features;
|
||||
};
|
||||
in
|
||||
{
|
||||
CARGO_PROFILE = profile;
|
||||
ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include";
|
||||
ROCKSDB_LIB_DIR = "${rocksdb'}/lib";
|
||||
}
|
||||
//
|
||||
(import ./cross-compilation-env.nix {
|
||||
# Keep sorted
|
||||
inherit
|
||||
lib
|
||||
pkgsBuildHost
|
||||
rust
|
||||
stdenv;
|
||||
});
|
||||
|
||||
buildPackageEnv = {
|
||||
CONDUWUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev or "";
|
||||
} // buildDepsOnlyEnv;
|
||||
|
||||
commonAttrs = {
|
||||
inherit
|
||||
(craneLib.crateNameFromCargoToml {
|
||||
cargoToml = "${inputs.self}/Cargo.toml";
|
||||
})
|
||||
pname
|
||||
version;
|
||||
|
||||
src = let filter = inputs.nix-filter.lib; in filter {
|
||||
root = inputs.self;
|
||||
|
||||
# Keep sorted
|
||||
include = [
|
||||
"Cargo.lock"
|
||||
"Cargo.toml"
|
||||
"hot_lib"
|
||||
"src"
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
# bindgen needs the build platform's libclang. Apparently due to "splicing
|
||||
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
|
||||
# right thing here.
|
||||
pkgsBuildHost.rustPlatform.bindgenHook
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
# https://github.com/NixOS/nixpkgs/issues/206242
|
||||
libiconv
|
||||
|
||||
# https://stackoverflow.com/questions/69869574/properly-adding-darwin-apple-sdk-to-a-nix-shell
|
||||
# https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
|
||||
pkgsBuildHost.darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
};
|
||||
in
|
||||
|
||||
craneLib.buildPackage ( commonAttrs // {
|
||||
cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // {
|
||||
env = buildDepsOnlyEnv;
|
||||
});
|
||||
|
||||
cargoExtraArgs = ""
|
||||
+ lib.optionalString
|
||||
(!default_features)
|
||||
"--no-default-features "
|
||||
+ lib.optionalString
|
||||
(features != [])
|
||||
"--features " + (builtins.concatStringsSep "," features);
|
||||
|
||||
# This is redundant with CI
|
||||
cargoTestCommand = "";
|
||||
cargoCheckCommand = "";
|
||||
doCheck = false;
|
||||
|
||||
# https://crane.dev/faq/rebuilds-bindgen.html
|
||||
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
|
||||
|
||||
env = buildPackageEnv;
|
||||
|
||||
passthru = {
|
||||
env = buildPackageEnv;
|
||||
};
|
||||
|
||||
meta.mainProgram = commonAttrs.pname;
|
||||
})
|
||||
@@ -1,28 +0,0 @@
|
||||
{ inputs
|
||||
|
||||
# Dependencies
|
||||
, dockerTools
|
||||
, lib
|
||||
, main
|
||||
, stdenv
|
||||
, tini
|
||||
}:
|
||||
|
||||
dockerTools.buildLayeredImage {
|
||||
name = main.pname;
|
||||
tag = "main";
|
||||
created = "@${toString inputs.self.lastModified}";
|
||||
contents = [
|
||||
dockerTools.caCertificates
|
||||
];
|
||||
config = {
|
||||
Entrypoint = if !stdenv.isDarwin
|
||||
# Use the `tini` init system so that signals (e.g. ctrl+c/SIGINT)
|
||||
# are handled as expected
|
||||
then [ "${lib.getExe' tini "tini"}" "--" ]
|
||||
else [];
|
||||
Cmd = [
|
||||
"${lib.getExe main}"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "workspace-root",
|
||||
"private": true,
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"mdsvex@0.11.2": "patches/mdsvex@0.11.2.patch"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@9.0.6+sha512.f6d863130973207cb7a336d6b439a242a26ac8068077df530d6a86069419853dc1ffe64029ec594a9c505a3a410d19643c870aba6776330f5cfddcf10a9c1617"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
node_modules
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "remark-callouts",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"main": "dist/index.esm.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.esm.js",
|
||||
"require": "./dist/index.cjs.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"prepublish": "rollup -c",
|
||||
"dev": "rollup -c -w",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"@types/node": "^20.14.2",
|
||||
"@types/svg-parser": "^2.0.6",
|
||||
"@types/trim": "^0.1.3",
|
||||
"@types/unist": "^3.0.2",
|
||||
"mdast": "^3.0.0",
|
||||
"rollup": "^4.18.0",
|
||||
"rollup-plugin-dts": "^6.1.1",
|
||||
"unified": "^6.2.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-from-markdown": "^1.3.1",
|
||||
"svg-parser": "^2.0.4",
|
||||
"trim": "^0.0.1",
|
||||
"unist-util-visit": "^4.1.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// rollup.config.js
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import { dts } from "rollup-plugin-dts";
|
||||
import pkg from './package.json' with { type: "json" };
|
||||
|
||||
export default [
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [
|
||||
{ file: pkg.exports.require, format: 'cjs' },
|
||||
{ file: pkg.exports.import, format: 'es' }
|
||||
],
|
||||
plugins: [typescript()]
|
||||
},
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [{ file: pkg.exports.types, format: 'es' }],
|
||||
plugins: [dts()],
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,324 @@
|
||||
import { visit } from "unist-util-visit";
|
||||
import { fromMarkdown } from "mdast-util-from-markdown";
|
||||
// @ts-ignore
|
||||
import type { Plugin } from "unified";
|
||||
import type { Node, Data, Parent } from "unist";
|
||||
import type { Blockquote, Heading, Text, BlockContent } from "mdast";
|
||||
import { parse } from "svg-parser";
|
||||
// import { calloutTypes } from "./calloutTypes";
|
||||
|
||||
// escape regex special characters
|
||||
function escapeRegExp(s: string) {
|
||||
return s.replace(new RegExp(`[-[\\]{}()*+?.\\\\^$|/]`, "g"), "\\$&");
|
||||
}
|
||||
|
||||
import tok from "./tokeniseCallout"
|
||||
|
||||
function trim(str: string){
|
||||
return str.replace(/^\s*|\s*$/g, '');
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
// classNameMaps: {
|
||||
// block: ClassNameMap;
|
||||
// title: ClassNameMap;
|
||||
// };
|
||||
// dataMaps: {
|
||||
// block: (data: Data) => Data;
|
||||
// title: (data: Data) => Data;
|
||||
// };
|
||||
// types: { [index: string]: string | object };
|
||||
}
|
||||
|
||||
export const defaultConfig: Config = {
|
||||
// classNameMaps: {
|
||||
// block: "callout",
|
||||
// title: "callout-title",
|
||||
// },
|
||||
// dataMaps: {
|
||||
// block: (data) => data,
|
||||
// title: (data) => data,
|
||||
// },
|
||||
// types: { ...calloutTypes },
|
||||
};
|
||||
|
||||
type ClassNames = string | string[];
|
||||
type ClassNameMap = ClassNames | ((title: string) => ClassNames);
|
||||
function formatClassNameMap(gen: ClassNameMap) {
|
||||
return (title: string) => {
|
||||
const classNames = typeof gen == "function" ? gen(title) : gen;
|
||||
return typeof classNames == "object" ? classNames.join(" ") : classNames;
|
||||
};
|
||||
}
|
||||
|
||||
export const callouts: Plugin = function (providedConfig?: Partial<Config>) {
|
||||
const config: Config = { ...defaultConfig, ...providedConfig };
|
||||
// const defaultKeywords: string = Object.keys(config.types)
|
||||
// .map(escapeRegExp)
|
||||
// .join("|");
|
||||
// @ts-ignore
|
||||
const Parser = this.Parser
|
||||
const blockTokenizers = Parser.prototype.blockTokenizers
|
||||
const blockMethods = Parser.prototype.blockMethods
|
||||
// console.log(blockMethods, blockTokenizers)
|
||||
|
||||
|
||||
blockTokenizers.callout = tok
|
||||
// console.log(blockTokenizers.blockquote.toString())
|
||||
var insertPoint = blockMethods.indexOf('fencedCode') + 1
|
||||
blockMethods.splice(insertPoint, 0, 'callout')
|
||||
|
||||
// @ts-ignore
|
||||
const Compiler = this.Compiler
|
||||
|
||||
if (Compiler != null) {
|
||||
const visitors = Compiler.prototype.visitors
|
||||
if (visitors) {
|
||||
visitors.callout = function (node: { keyword: string; title: string; }) {
|
||||
var values = this.block(node).split('\n');
|
||||
var result = [];
|
||||
var length = values.length;
|
||||
var index = -1;
|
||||
var value;
|
||||
|
||||
while (++index < length) {
|
||||
value = values[index];
|
||||
result[index] = (value ? ' ' : '') + value;
|
||||
}
|
||||
|
||||
return '> [!'+node.keyword+'] ' + node.title + '\n' + result.join('\n>');
|
||||
}
|
||||
}
|
||||
}
|
||||
// return function (tree) {
|
||||
// visit(tree, (node: Node, index, parent: Parent) => {
|
||||
// // Filter required elems
|
||||
// if (node.type !== "blockquote") return;
|
||||
|
||||
// /** add breaks to text without needing spaces or escapes (turns enters into <br>)
|
||||
// * code taken directly from remark-breaks,
|
||||
// * see https://github.com/remarkjs/remark-breaks for more info on what this does.
|
||||
// */
|
||||
// // visit(node, "text", (node: Text, index: number, parent: Parent) => {
|
||||
// // const result = [];
|
||||
// // let start = 0;
|
||||
|
||||
// // find.lastIndex = 0;
|
||||
|
||||
// // let match = find.exec(node.value);
|
||||
|
||||
// // while (match) {
|
||||
// // const position = match.index;
|
||||
|
||||
// // if (start !== position) {
|
||||
// // result.push({
|
||||
// // type: "text",
|
||||
// // value: node.value.slice(start, position),
|
||||
// // });
|
||||
// // }
|
||||
|
||||
// // result.push({ type: "break" });
|
||||
// // start = position + match[0].length;
|
||||
// // match = find.exec(node.value);
|
||||
// // }
|
||||
|
||||
// // if (result.length > 0 && parent && typeof index === "number") {
|
||||
// // if (start < node.value.length) {
|
||||
// // result.push({ type: "text", value: node.value.slice(start) });
|
||||
// // }
|
||||
|
||||
// // parent.children.splice(index, 1, ...result);
|
||||
// // return index + result.length;
|
||||
// // }
|
||||
// // });
|
||||
|
||||
// /** add classnames to headings within blockquotes,
|
||||
// * mainly to identify when using other plugins that
|
||||
// * might interfere. for eg, rehype-auto-link-headings.
|
||||
// */
|
||||
// visit(node, "heading", (node) => {
|
||||
// const heading = node as Heading;
|
||||
// heading.data = {
|
||||
// hProperties: {
|
||||
// className: "blockquote-heading",
|
||||
// },
|
||||
// };
|
||||
// });
|
||||
|
||||
// // wrap blockquote in a div
|
||||
// const wrapper = {
|
||||
// ...node,
|
||||
// type: "element",
|
||||
// tagName: "div",
|
||||
// data: {
|
||||
// hProperties: {},
|
||||
// },
|
||||
// children: [node],
|
||||
// };
|
||||
|
||||
// parent.children.splice(Number(index), 1, wrapper);
|
||||
|
||||
// const blockquote = wrapper.children[0] as Blockquote;
|
||||
|
||||
// blockquote.data = {
|
||||
// hProperties: {
|
||||
// className: "blockquote",
|
||||
// },
|
||||
// };
|
||||
// console.log(blockquote)
|
||||
|
||||
// // check for callout syntax starts here
|
||||
// if (
|
||||
// blockquote.children.length <= 0 ||
|
||||
// blockquote.children[0].type !== "paragraph"
|
||||
// )
|
||||
// return;
|
||||
// const paragraph = blockquote.children[0];
|
||||
// console.log(paragraph)
|
||||
|
||||
// if (
|
||||
// paragraph.children.length <= 0 ||
|
||||
// paragraph.children[0].type !== "text"
|
||||
// )
|
||||
// return;
|
||||
|
||||
// const [t, ...rest] = paragraph.children;
|
||||
|
||||
// const regex = new RegExp(
|
||||
// `^\\[!(?<keyword>(.*?))\\][\t\f ]?(?<title>.*?)$`,
|
||||
// "gi"
|
||||
// );
|
||||
// const m = regex.exec(t.value);
|
||||
|
||||
// // if no callout syntax, forget about it.
|
||||
// if (!m) return;
|
||||
|
||||
// const [key, title] = [m.groups?.keyword, m.groups?.title];
|
||||
|
||||
// // if there's nothing inside the brackets, is it really a callout ?
|
||||
// if (!key) return;
|
||||
|
||||
// const keyword = key.toLowerCase();
|
||||
// // const isOneOfKeywords: boolean = new RegExp(defaultKeywords).test(
|
||||
// // keyword
|
||||
// // );
|
||||
|
||||
// if (title) {
|
||||
// const mdast = fromMarkdown(title.trim()).children[0];
|
||||
// if (mdast.type === "heading") {
|
||||
// mdast.data = {
|
||||
// ...mdast.data,
|
||||
// hProperties: {
|
||||
// className: "blockquote-heading",
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
// blockquote.children.unshift(mdast as BlockContent);
|
||||
// } else {
|
||||
// t.value =
|
||||
// typeof keyword.charAt(0) === "string"
|
||||
// ? keyword.charAt(0).toUpperCase() + keyword.slice(1)
|
||||
// : keyword;
|
||||
// }
|
||||
|
||||
// const entry: { [index: string]: string } = {};
|
||||
|
||||
// // if (isOneOfKeywords) {
|
||||
// // if (typeof config?.types[keyword] === "string") {
|
||||
// // const e = String(config?.types[keyword]);
|
||||
// // Object.assign(entry, config?.types[e]);
|
||||
// // } else {
|
||||
// // Object.assign(entry, config?.types[keyword]);
|
||||
// // }
|
||||
// // } else {
|
||||
// // Object.assign(entry, config?.types["note"]);
|
||||
// // }
|
||||
|
||||
// let parsedSvg;
|
||||
|
||||
// if (entry && entry.svg) {
|
||||
// parsedSvg = parse(entry.svg);
|
||||
// }
|
||||
|
||||
// // create icon and title node wrapped in div
|
||||
// const titleNode: object = {
|
||||
// type: "element",
|
||||
// children: [
|
||||
// {
|
||||
// type: "element",
|
||||
// tagName: "span",
|
||||
// data: {
|
||||
// hName: "span",
|
||||
// hProperties: {
|
||||
// style: `color:${entry?.color}`,
|
||||
// className: "callout-icon",
|
||||
// },
|
||||
// hChildren: parsedSvg?.children ? parsedSvg.children : [],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// type: "element",
|
||||
// children: title ? [blockquote.children[0]] : [t],
|
||||
// data: {
|
||||
// hName: "strong",
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// data: {
|
||||
// ...blockquote.children[0]?.data,
|
||||
// hProperties: {
|
||||
// className: `${formatClassNameMap(config.classNameMaps.title)(
|
||||
// keyword
|
||||
// )} ${"note"}`,
|
||||
// style: `background-color: ${entry?.color}1a;`,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
|
||||
// // remove the callout paragraph from the content body
|
||||
// if (title) {
|
||||
// blockquote.children.shift();
|
||||
// }
|
||||
|
||||
// if (rest.length > 0) {
|
||||
// rest.shift();
|
||||
// paragraph.children = rest;
|
||||
// } else {
|
||||
// blockquote.children.shift();
|
||||
// }
|
||||
|
||||
// // wrap blockquote content in div
|
||||
// const contentNode: object = {
|
||||
// type: "element",
|
||||
// children: blockquote.children,
|
||||
// data: {
|
||||
// hProperties: {
|
||||
// className: "callout-content",
|
||||
// style:
|
||||
// parent.type !== "root"
|
||||
// ? `border-right:1px solid ${entry?.color}33;
|
||||
// border-bottom:1px solid ${entry?.color}33;`
|
||||
// : "",
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
|
||||
// if (blockquote.children.length > 0)
|
||||
// blockquote.children = [contentNode] as BlockContent[];
|
||||
// blockquote.children.unshift(titleNode as BlockContent);
|
||||
|
||||
// // Add classes for the callout block
|
||||
// blockquote.data = config.dataMaps.block({
|
||||
// ...blockquote.data,
|
||||
// hProperties: {
|
||||
// className: formatClassNameMap(config.classNameMaps.block)(
|
||||
// keyword.toLowerCase()
|
||||
// ),
|
||||
// style: `border-left-color:${entry?.color};`,
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
};
|
||||
|
||||
export default callouts;
|
||||
@@ -0,0 +1,245 @@
|
||||
'use strict';
|
||||
|
||||
import trim from "trim";
|
||||
|
||||
|
||||
export default blockquote;
|
||||
|
||||
var C_NEWLINE = '\n';
|
||||
var C_TAB = '\t';
|
||||
var C_SPACE = ' ';
|
||||
var C_GT = '>';
|
||||
// TODO:
|
||||
// - Grow/shrink support
|
||||
// - Customise AST output
|
||||
|
||||
/* Tokenise a blockquote. */
|
||||
function blockquote(eat: { (arg0: string): any; (arg0: string): any; now: any; }, value: string, silent: boolean) {
|
||||
var self = this;
|
||||
var offsets = self.offset;
|
||||
var tokenizers = self.blockTokenizers;
|
||||
var interruptors = [
|
||||
['indentedCode', { commonmark: true }],
|
||||
['fencedCode', { commonmark: true }],
|
||||
['atxHeading', { commonmark: true }],
|
||||
['setextHeading', { commonmark: true }],
|
||||
['thematicBreak', { commonmark: true }],
|
||||
['html', { commonmark: true }],
|
||||
['list', { commonmark: true }],
|
||||
['definition', { commonmark: false }],
|
||||
['footnote', { commonmark: false }]
|
||||
];
|
||||
var now = eat.now();
|
||||
var currentLine = now.line;
|
||||
var length = value.length;
|
||||
var values = [];
|
||||
var contents = [];
|
||||
var indents = [];
|
||||
var add;
|
||||
var index = 0;
|
||||
var character;
|
||||
var rest;
|
||||
var nextIndex;
|
||||
var content;
|
||||
var line;
|
||||
var startIndex;
|
||||
var prefixed;
|
||||
var exit;
|
||||
|
||||
while (index < length) {
|
||||
character = value.charAt(index);
|
||||
|
||||
if (character !== C_SPACE && character !== C_TAB) {
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (value.charAt(index) !== C_GT) {
|
||||
return;
|
||||
}
|
||||
|
||||
const regex = /^>\s*\[!(?<keyword>(.*?))\][\t\f ]?(?<title>.*?)$/i;
|
||||
nextIndex = value.indexOf(C_NEWLINE, index);
|
||||
content = value.slice(index, nextIndex);
|
||||
const m = regex.exec(content); // value.slice(index)
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
if (!m.groups?.keyword) return;
|
||||
|
||||
if (silent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
let titleLine = true
|
||||
while (index < length) {
|
||||
nextIndex = value.indexOf(C_NEWLINE, index);
|
||||
startIndex = index;
|
||||
prefixed = false;
|
||||
|
||||
if (nextIndex === -1) {
|
||||
nextIndex = length;
|
||||
}
|
||||
|
||||
while (index < length) {
|
||||
character = value.charAt(index);
|
||||
|
||||
if (character !== C_SPACE && character !== C_TAB) {
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (value.charAt(index) === C_GT) {
|
||||
index++;
|
||||
prefixed = true;
|
||||
|
||||
if (value.charAt(index) === C_SPACE) {
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
index = startIndex;
|
||||
}
|
||||
|
||||
// regex.lastIndex = index
|
||||
|
||||
content = value.slice(index, nextIndex);
|
||||
|
||||
if (!prefixed && !trim(content)) {
|
||||
index = startIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!prefixed) {
|
||||
rest = value.slice(index);
|
||||
|
||||
/* Check if the following code contains a possible
|
||||
* block. */
|
||||
if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
line = startIndex === index ? content : value.slice(startIndex, nextIndex);
|
||||
|
||||
indents.push(index - startIndex);
|
||||
values.push(line);
|
||||
if (titleLine) {
|
||||
titleLine = false
|
||||
} else {
|
||||
contents.push(content);
|
||||
}
|
||||
|
||||
index = nextIndex + 1;
|
||||
}
|
||||
|
||||
index = -1;
|
||||
length = indents.length;
|
||||
add = eat(values.join(C_NEWLINE));
|
||||
|
||||
while (++index < length) {
|
||||
offsets[currentLine] = (offsets[currentLine] || 0) + indents[index];
|
||||
currentLine++;
|
||||
}
|
||||
|
||||
exit = self.enterBlock();
|
||||
const title = self.tokenizeInline(m.groups?.title, now);
|
||||
contents = self.tokenizeBlock(contents.join(C_NEWLINE), now);
|
||||
exit();
|
||||
// console.log(title,)
|
||||
return add({
|
||||
type: 'callout',
|
||||
children: [{
|
||||
type: "heading",
|
||||
children: title,
|
||||
data: { hName: 'svelte:fragment',
|
||||
hProperties: {
|
||||
slot: "title"
|
||||
} }
|
||||
}, {
|
||||
type: "block",
|
||||
children: contents,
|
||||
data: { hName: 'svelte:fragment',
|
||||
hProperties: {
|
||||
slot: "body"
|
||||
} }
|
||||
}],
|
||||
keyword: m.groups?.keyword,
|
||||
data: {
|
||||
hName: 'Components.Callout',
|
||||
hProperties: {
|
||||
"calloutType": m.groups?.keyword
|
||||
},
|
||||
}
|
||||
});
|
||||
// return add({
|
||||
// type: 'callout',
|
||||
// children: [{
|
||||
// type: "heading",
|
||||
// children: title,
|
||||
// data: { hName: 'div',
|
||||
// hProperties: {
|
||||
// className: "callout-title"
|
||||
// } }
|
||||
// }, {
|
||||
// type: "block",
|
||||
// children: contents,
|
||||
// data: { hName: 'div',
|
||||
// hProperties: {
|
||||
// className: "callout-content"
|
||||
// } }
|
||||
// }],
|
||||
// keyword: m.groups?.keyword,
|
||||
// data: {
|
||||
// hName: 'div',
|
||||
// hProperties: {
|
||||
// className: "callout",
|
||||
// "data-callout": m.groups?.keyword
|
||||
// },
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function interrupt(interruptors, tokenizers, ctx, params) {
|
||||
var bools = ['pedantic', 'commonmark'];
|
||||
var count = bools.length;
|
||||
var length = interruptors.length;
|
||||
var index = -1;
|
||||
var interruptor;
|
||||
var config;
|
||||
var fn;
|
||||
var offset;
|
||||
var bool;
|
||||
var ignore;
|
||||
|
||||
while (++index < length) {
|
||||
interruptor = interruptors[index];
|
||||
config = interruptor[1] || {};
|
||||
fn = interruptor[0];
|
||||
offset = -1;
|
||||
ignore = false;
|
||||
|
||||
while (++offset < count) {
|
||||
bool = bools[offset];
|
||||
|
||||
if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) {
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tokenizers[fn].apply(ctx, params)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": true,
|
||||
"allowJs": true,
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
node_modules
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "vite-plugin-thumbhash-svg",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"main": "dist/index.esm.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.esm.js",
|
||||
"require": "./dist/index.cjs.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"prepublish": "rollup -c",
|
||||
"dev": "rollup -c -w",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/node": "^20.14.2",
|
||||
"rollup": "^4.18.0",
|
||||
"rollup-plugin-dts": "^6.1.1",
|
||||
"vite": "^5.3.1"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@napi-rs/canvas": "^0.1.53",
|
||||
"@resvg/resvg-js": "^2.6.2",
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
"thumbhash-node": "^0.1.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// rollup.config.js
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import { dts } from "rollup-plugin-dts";
|
||||
import pkg from './package.json' with { type: "json" };
|
||||
|
||||
export default [
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [
|
||||
{ file: pkg.exports.require, format: 'cjs' },
|
||||
{ file: pkg.exports.import, format: 'es' }
|
||||
],
|
||||
plugins: [typescript()]
|
||||
},
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [{ file: pkg.exports.types, format: 'es' }],
|
||||
plugins: [dts()],
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,236 @@
|
||||
import { createFilter } from '@rollup/pluginutils'
|
||||
import { basename } from 'node:path'
|
||||
import { relative } from 'node:path/posix'
|
||||
import { readFile, access } from 'node:fs/promises'
|
||||
import { constants } from 'node:fs'
|
||||
import { extname } from 'node:path';
|
||||
|
||||
import { loadImage, createCanvas, ImageData } from '@napi-rs/canvas'
|
||||
import { Resvg } from '@resvg/resvg-js'
|
||||
import { rgbaToThumbHash, thumbHashToRGBA } from 'thumbhash-node'
|
||||
import type { Plugin, ResolvedConfig } from 'vite'
|
||||
|
||||
export type OutputExtension = 'png' | 'jpg' | 'webp' | 'avif'
|
||||
|
||||
export type Options =
|
||||
| {
|
||||
include?: Array<string | RegExp> | string | RegExp
|
||||
exclude?: Array<string | RegExp> | string | RegExp
|
||||
outputExtension?: OutputExtension
|
||||
}
|
||||
| undefined
|
||||
|
||||
interface LoaderParams {
|
||||
thumbSrc: string
|
||||
thumbWidth: number
|
||||
thumbHeight: number
|
||||
originalSrc: string
|
||||
originalWidth: number
|
||||
originalHeight: number
|
||||
}
|
||||
|
||||
const loader = (params: LoaderParams) => {
|
||||
return `export default ${JSON.stringify(params)}`
|
||||
}
|
||||
|
||||
async function loadImageAndConvertToRgba(path: string) {
|
||||
const maxSize = 100
|
||||
const imgPath = path
|
||||
let image;
|
||||
// console.log(path, extname(path))
|
||||
if (extname(path) === ".svg") {
|
||||
const svg = await readFile(imgPath);
|
||||
const resvg = new Resvg(svg)
|
||||
const render = resvg.render()
|
||||
image = await loadImage(render.asPng())
|
||||
} else {
|
||||
// canvas handles all file loading for us
|
||||
image = await loadImage(imgPath)
|
||||
|
||||
}
|
||||
const width = image.width
|
||||
const height = image.height
|
||||
|
||||
const scale = maxSize / Math.max(width, height)
|
||||
const resizedWidth = Math.round(width * scale)
|
||||
const resizedHeight = Math.round(height * scale)
|
||||
|
||||
const canvas = createCanvas(resizedWidth, resizedHeight)
|
||||
const ctx = canvas.getContext('2d')
|
||||
ctx.drawImage(image, 0, 0, resizedWidth, resizedHeight)
|
||||
|
||||
const imageData = ctx.getImageData(0, 0, resizedWidth, resizedHeight)
|
||||
const rgba = new Uint8Array(imageData.data)
|
||||
|
||||
return {
|
||||
originalWidth: width,
|
||||
originalHeight: height,
|
||||
height: imageData.height,
|
||||
width: imageData.width,
|
||||
rgba,
|
||||
}
|
||||
}
|
||||
|
||||
const fromRGBAToImageBuffer = (
|
||||
rgba: Uint8Array,
|
||||
mimeType: MimeType,
|
||||
width: number,
|
||||
height: number
|
||||
) => {
|
||||
const thumb = rgbaToThumbHash(width, height, rgba)
|
||||
const transformedRgba = thumbHashToRGBA(thumb)
|
||||
const imageData = new ImageData(
|
||||
new Uint8ClampedArray(transformedRgba.rgba),
|
||||
transformedRgba.width,
|
||||
transformedRgba.height
|
||||
)
|
||||
|
||||
const canvas = createCanvas(transformedRgba.width, transformedRgba.height)
|
||||
const context = canvas.getContext('2d')
|
||||
//@ts-ignore
|
||||
context.putImageData(imageData, 0, 0)
|
||||
//@ts-ignore
|
||||
const buffer = canvas.toBuffer(mimeType)
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
type MimeType = 'image/webp' | 'image/jpeg' | 'image/avif' | 'image/png'
|
||||
|
||||
const extToMimeTypeMap: Record<OutputExtension, MimeType> = {
|
||||
avif: 'image/avif',
|
||||
jpg: 'image/jpeg',
|
||||
png: 'image/png',
|
||||
webp: 'image/webp',
|
||||
}
|
||||
|
||||
export const blurRE = /(?:\?|&)th(umb)?(?:&|$)/
|
||||
const isThumbHash = (id: string) => {
|
||||
return !!id.match(blurRE)
|
||||
}
|
||||
|
||||
const cleanId = (id: string) => id.replace(blurRE, '')
|
||||
|
||||
const buildViteAsset = (referenceId: string) => `__VITE_ASSET__${referenceId}__`
|
||||
|
||||
const buildDataURL = (buf: Buffer, mimeType: MimeType) => {
|
||||
const dataPrefix = `data:${mimeType};base64,`
|
||||
|
||||
const dataURL = `${dataPrefix}${buf.toString('base64')}`
|
||||
|
||||
return dataURL
|
||||
}
|
||||
|
||||
async function exists(path: string) {
|
||||
try {
|
||||
await access(path, constants.F_OK)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const thumbHash = (options: Options = {}): Plugin => {
|
||||
const { include, exclude, outputExtension = 'png' } = options
|
||||
|
||||
const bufferMimeType = extToMimeTypeMap[outputExtension]
|
||||
|
||||
const filter = createFilter(include, exclude)
|
||||
|
||||
let config: ResolvedConfig
|
||||
|
||||
const cache = new Map<string, importItem>()
|
||||
type importItem = {
|
||||
thumbSrc: string;
|
||||
thumbWidth: number;
|
||||
thumbHeight: number;
|
||||
originalSrc: string;
|
||||
originalWidth: number;
|
||||
originalHeight: number;
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'vite-plugin-thumbhash',
|
||||
enforce: 'pre',
|
||||
|
||||
configResolved(cfg) {
|
||||
config = cfg
|
||||
},
|
||||
|
||||
|
||||
async load(id) {
|
||||
if (!filter(id)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (isThumbHash(id)) {
|
||||
const cleanedId = cleanId(id)
|
||||
|
||||
if (cache.has(id)) {
|
||||
let loadedSource = cache.get(id) as importItem
|
||||
if (config.command !== 'serve') {
|
||||
const originalRefId = this.emitFile({
|
||||
type: 'asset',
|
||||
name: basename(cleanedId),
|
||||
source: await readFile(cleanedId),
|
||||
})
|
||||
loadedSource.originalSrc = buildViteAsset(originalRefId);
|
||||
}
|
||||
return loader(loadedSource)
|
||||
}
|
||||
|
||||
const { rgba, width, height, originalHeight, originalWidth } =
|
||||
await loadImageAndConvertToRgba(cleanedId)
|
||||
|
||||
const buffer = fromRGBAToImageBuffer(
|
||||
rgba,
|
||||
bufferMimeType,
|
||||
width,
|
||||
height
|
||||
)
|
||||
|
||||
const dataURL = buildDataURL(buffer, bufferMimeType)
|
||||
|
||||
// const referenceId = this.emitFile({
|
||||
// type: 'asset',
|
||||
// name: basename(cleanedId).replace(
|
||||
// /\.(jpg)|(jpeg)|(png)|(webp)|(avif)|(svg)/g,
|
||||
// `.${outputExtension}`
|
||||
// ),
|
||||
// source: buffer,
|
||||
// })
|
||||
const originalSrc = relative(config.root, cleanedId);
|
||||
const loadedSource = {
|
||||
thumbSrc: dataURL,
|
||||
thumbWidth: width,
|
||||
thumbHeight: height,
|
||||
originalSrc,
|
||||
originalWidth: originalWidth,
|
||||
originalHeight: originalHeight,
|
||||
}
|
||||
|
||||
cache.set(id, loadedSource)
|
||||
|
||||
if (config.command !== 'serve') {
|
||||
const originalRefId = this.emitFile({
|
||||
type: 'asset',
|
||||
name: basename(cleanedId),
|
||||
source: await readFile(cleanedId),
|
||||
})
|
||||
loadedSource.originalSrc = buildViteAsset(originalRefId);
|
||||
}
|
||||
|
||||
return loader(loadedSource)
|
||||
|
||||
|
||||
|
||||
// import.meta.ROLLUP_FILE_URL_
|
||||
|
||||
}
|
||||
|
||||
return null
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export { thumbHash }
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": true,
|
||||
"allowJs": true,
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
.vercel
|
||||
.output
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
output
|
||||
Dockerfile
|
||||
@@ -0,0 +1,20 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env.sentry-build-plugin
|
||||
.env
|
||||
.env.*.local
|
||||
!.env.example
|
||||
.vercel
|
||||
.output
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
output
|
||||
Notes-1.0.0.tgz
|
||||
# Sentry Config File
|
||||
.sentryclirc
|
||||
|
||||
# Sentry Config File
|
||||
.env.sentry-build-plugin
|
||||
@@ -0,0 +1 @@
|
||||
engine-strict=true
|
||||
@@ -0,0 +1,33 @@
|
||||
# build the sapper app
|
||||
FROM node:latest AS base
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
ENV CI=1
|
||||
RUN corepack enable
|
||||
COPY ./../.. /app/
|
||||
WORKDIR /app
|
||||
|
||||
# FROM base AS prod-deps
|
||||
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
FROM base AS deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
# RUN cd packages/website; --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
FROM deps as build
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
RUN cd packages/website; pnpm run build
|
||||
|
||||
RUN cd packages/website; node server-esbuild.js
|
||||
|
||||
FROM node:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/packages/website/output .
|
||||
COPY --from=build /app/packages/website/build/client ./client/
|
||||
COPY --from=build /app/packages/website/build/prerendered ./prerendered/
|
||||
COPY --from=base /app/packages/website/package.json ./package.json
|
||||
|
||||
ENV NODE_ENV production
|
||||
EXPOSE 3000
|
||||
CMD ["node", "."]
|
||||
@@ -0,0 +1,44 @@
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
padding: '10px 20px',
|
||||
// alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexDirection: 'column',
|
||||
backgroundImage: 'linear-gradient(to bottom, #dbf4ff, #eff3fc)',
|
||||
fontSize: 60,
|
||||
// letterSpacing: -2,
|
||||
fontWeight: 700,
|
||||
// textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
<div style={{
|
||||
fontSize: 15,
|
||||
fontWeight: 600,
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: 1,
|
||||
margin: '25px 0 10px',
|
||||
color: 'gray',
|
||||
}}>jade.ellis.link
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
backgroundImage: 'linear-gradient(90deg, rgb(30, 42, 85), rgb(22, 61, 120))',
|
||||
backgroundClip: 'text',
|
||||
'-webkit-background-clip': 'text',
|
||||
color: 'transparent',
|
||||
}}>The Potential Pitfalls of Pagination</div>
|
||||
<aside style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 500,
|
||||
color:'#202020',
|
||||
margin: '10px 0 10px',
|
||||
}}>
|
||||
Published on
|
||||
· By Jade Ellis
|
||||
· 4 min read
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": true
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": false,
|
||||
"ignore": []
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "tab"
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
const rootDomain = process.env.VITE_DOMAIN; // or your server IP for dev
|
||||
import { SENTRY_HOST } from './src/lib/config.js';
|
||||
import { SENTRY_REPORT_URL } from './src/lib/config.js';
|
||||
|
||||
const self = "'self'";
|
||||
const none = "'none'";
|
||||
/**
|
||||
* @type {import("@sveltejs/kit").CspDirectives}
|
||||
*/
|
||||
const cspDirectives = {
|
||||
'base-uri': [self],
|
||||
'child-src': [self, "blob:"],
|
||||
'connect-src': [self, "https://*.google-analytics.com", "https://" + SENTRY_HOST],
|
||||
// 'connect-src': [self, 'ws://localhost:*', 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
||||
'img-src': [self, 'data:',
|
||||
'https://*.googletagmanager.com'],
|
||||
'font-src': [self, 'data:'],
|
||||
'form-action': [self],
|
||||
'frame-ancestors': [self],
|
||||
'frame-src': [
|
||||
self,
|
||||
// "https://*.stripe.com",
|
||||
// "https://*.facebook.com",
|
||||
// "https://*.facebook.net",
|
||||
// 'https://hcaptcha.com',
|
||||
// 'https://*.hcaptcha.com',
|
||||
],
|
||||
'manifest-src': [self],
|
||||
'media-src': [self, 'data:'],
|
||||
'object-src': [none],
|
||||
'style-src': [self, "unsafe-inline"],
|
||||
// 'style-src': [self, "'unsafe-inline'", 'https://hcaptcha.com', 'https://*.hcaptcha.com'],
|
||||
'default-src': [
|
||||
'self',
|
||||
...(rootDomain ? [rootDomain, `ws://${rootDomain}`] : []),
|
||||
// 'https://*.google.com',
|
||||
// 'https://*.googleapis.com',
|
||||
// 'https://*.firebase.com',
|
||||
// 'https://*.gstatic.com',
|
||||
// 'https://*.cloudfunctions.net',
|
||||
// 'https://*.algolia.net',
|
||||
// 'https://*.facebook.com',
|
||||
// 'https://*.facebook.net',
|
||||
// 'https://*.stripe.com',
|
||||
// 'https://*.sentry.io',
|
||||
],
|
||||
'script-src': [
|
||||
self,
|
||||
// "unsafe-inline", // chrome suggestion
|
||||
'https://*.googletagmanager.com'
|
||||
// 'https://*.stripe.com',
|
||||
// 'https://*.facebook.com',
|
||||
// 'https://*.facebook.net',
|
||||
// 'https://hcaptcha.com',
|
||||
// 'https://*.hcaptcha.com',
|
||||
// 'https://*.sentry.io',
|
||||
// 'https://polyfill.io',
|
||||
],
|
||||
'worker-src': [self, "blob:"],
|
||||
// remove report-to & report-uri if you do not want to use Sentry reporting
|
||||
'report-to': ["csp-endpoint"],
|
||||
'report-uri': [
|
||||
SENTRY_REPORT_URL,
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
export default cspDirectives;
|
||||
@@ -0,0 +1,387 @@
|
||||
// https://github.com/String10/Hakuba/blob/master/package.json
|
||||
// import { defineMDSveXConfig as defineConfig } from "mdsvex";
|
||||
// import type { Plugin, Settings } from 'unified';
|
||||
|
||||
import remarkGfm from "remark-gfm";
|
||||
import remarkFrontmatter from "remark-frontmatter";
|
||||
import remarkWikiLink from "remark-wiki-link";
|
||||
|
||||
import remarkMath from "remark-math"
|
||||
// @ts-ignore
|
||||
import remarkAbbr from "remark-abbr"
|
||||
import remarkFootnotes from 'remark-footnotes'
|
||||
import remarkCallouts from "remark-callouts";
|
||||
|
||||
import rehypeKatexSvelte from 'rehype-katex-svelte';
|
||||
// import github from "remark-github";
|
||||
|
||||
import rehypeSlug from 'rehype-slug';
|
||||
import remarkReadingTime from "remark-reading-time";
|
||||
// import rehypeToc from '@jsdevtools/rehype-toc';
|
||||
import { createHighlighter } from "@bitmachina/highlighter";
|
||||
|
||||
import { parse, format } from "node:path";
|
||||
|
||||
import slugify from 'slugify';
|
||||
|
||||
export const NOTE_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="2" x2="22" y2="6"></line><path d="M7.5 20.5 19 9l-4-4L3.5 16.5 2 22z"></path></svg>';
|
||||
|
||||
export const QUOTE_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"></path><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"></path></svg>';
|
||||
|
||||
export const INFO_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';
|
||||
|
||||
export const ICONS = {
|
||||
note: NOTE_ICON,
|
||||
quote: QUOTE_ICON,
|
||||
info: INFO_ICON,
|
||||
};
|
||||
|
||||
import { globSync } from 'glob'
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const projects = globSync('node_modules/Notes/Projects/*.md')
|
||||
.map((filepath) => {
|
||||
return parse(filepath)
|
||||
})
|
||||
.map((path) => {
|
||||
return format({
|
||||
// ...path,
|
||||
name: slugify(path.name, { lower: true }),
|
||||
// base: undefined,
|
||||
// root: "",
|
||||
// ext: undefined,
|
||||
// dir: path.dir.replace("/node_modules/Notes/Projects", "")
|
||||
})
|
||||
})
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
const permalinks = projects.map((p) => "/projects/" + p)
|
||||
|
||||
// console.log(permalinks)
|
||||
|
||||
/**
|
||||
* @param {string} pageName
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function pageResolver(pageName) {
|
||||
const slug = slugify(pageName, { lower: true });
|
||||
return ["/", "/projects/"].map((p) => p + slug);
|
||||
}
|
||||
import { grammars } from 'tm-grammars'
|
||||
// console.log()
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
function getGrammar(name) {
|
||||
const metadata = grammars.find((grammar) => grammar.name == name)
|
||||
if (!metadata) {
|
||||
throw "Grammar not found"
|
||||
}
|
||||
return {
|
||||
...metadata,
|
||||
id: name,
|
||||
|
||||
grammar: JSON.parse(readFileSync(fileURLToPath(import.meta.resolve('tm-grammars/grammars/' + name + '.json')), 'utf8')),
|
||||
}
|
||||
}
|
||||
|
||||
const hrefTemplate = (/** @type {string} */ permalink) => permalink
|
||||
|
||||
// function customizeTOC(toc) {
|
||||
// // console.log(toc)
|
||||
|
||||
// return {
|
||||
// type: 'root',
|
||||
// children: [{
|
||||
// type: "element",
|
||||
// // tagName: "svelte:component",
|
||||
// // properties: { this: "{tocComponent}" },
|
||||
// tagName: "div",
|
||||
// properties: {},
|
||||
// children: [toc],
|
||||
// }]
|
||||
// };
|
||||
// }
|
||||
/**
|
||||
* @param {{level: number, title: string}[]} headings
|
||||
*/
|
||||
function buildNestedHeadings(headings) {
|
||||
/**
|
||||
* @type {{level: number, title: string, children: unknown}[]}
|
||||
*/
|
||||
const result = [];
|
||||
const stack = [{ level: 0, children: result }];
|
||||
|
||||
for (const heading of headings) {
|
||||
while (
|
||||
stack.length > 1 &&
|
||||
heading.level <= stack[stack.length - 1].level
|
||||
) {
|
||||
stack.pop();
|
||||
}
|
||||
const parent = stack[stack.length - 1];
|
||||
const newHeading = {
|
||||
...heading,
|
||||
children: [],
|
||||
level: heading.level,
|
||||
};
|
||||
parent.children.push(newHeading);
|
||||
stack.push(newHeading);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
import { visit } from 'unist-util-visit';
|
||||
import { toString as mdast_tree_to_string } from 'mdast-util-to-string'
|
||||
|
||||
|
||||
import GithubSlugger from 'github-slugger'
|
||||
/**
|
||||
* @param {{ prefix?: string; }} opts
|
||||
*/
|
||||
function add_toc_remark(opts) {
|
||||
const slugs = new GithubSlugger()
|
||||
const prefix = opts?.prefix || "";
|
||||
return async function transformer(tree, vFile) {
|
||||
slugs.reset()
|
||||
|
||||
vFile.data.flattenedHeadings = [];
|
||||
|
||||
visit(tree, 'heading', (node) => {
|
||||
const title = mdast_tree_to_string(node);
|
||||
vFile.data.flattenedHeadings.push({
|
||||
level: node.depth,
|
||||
title,
|
||||
id: prefix + slugs.slug(title)
|
||||
});
|
||||
});
|
||||
|
||||
if (!vFile.data.fm) vFile.data.fm = {};
|
||||
vFile.data.fm.flattenedHeadings = vFile.data.flattenedHeadings;
|
||||
vFile.data.fm.headings = buildNestedHeadings(vFile.data.flattenedHeadings);
|
||||
};
|
||||
}
|
||||
|
||||
function add_data_to_fm(_opts) {
|
||||
return async function transformer(tree, vFile) {
|
||||
if (!vFile.data.fm) vFile.data.fm = {};
|
||||
|
||||
vFile.data.fm.readingTime = vFile.data.readingTime;
|
||||
};
|
||||
}
|
||||
import { toString as hast_tree_to_string } from 'hast-util-to-string'
|
||||
/**
|
||||
* Determines whether the given node is an HTML element.
|
||||
*/
|
||||
function isHtmlElementNode(node) {
|
||||
return typeof node === "object" &&
|
||||
node.type === "element" &&
|
||||
typeof node.tagName === "string" &&
|
||||
"properties" in node &&
|
||||
typeof node.properties === "object";
|
||||
}
|
||||
const HEADINGS = ["h1", "h2", "h3", "h4", "h5", "h6"]
|
||||
/**
|
||||
* Determines whether the given node is an HTML heading node, according to the specified options
|
||||
*/
|
||||
function isHeadingNode(node) {
|
||||
return isHtmlElementNode(node) && HEADINGS.includes(node.tagName);
|
||||
}
|
||||
function add_toc_rehype(self, opts) {
|
||||
return async function transformer(tree, vFile) {
|
||||
// console.log(tree)
|
||||
vFile.data.headings = [];
|
||||
|
||||
visit(tree, isHeadingNode, (node) => {
|
||||
// console.log(node)
|
||||
vFile.data.headings.push({
|
||||
level: node.depth,
|
||||
title: hast_tree_to_string(node),
|
||||
});
|
||||
});
|
||||
|
||||
if (!vFile.data.fm) vFile.data.fm = {};
|
||||
vFile.data.fm.headings = vFile.data.headings;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
import toCamel from "just-camel-case";
|
||||
const RE_SCRIPT_START =
|
||||
/<script(?:\s+?[a-zA-z]+(=(?:["']){0,1}[a-zA-Z0-9]+(?<!module)(?:["']){0,1}){0,1})*\s*?>/;
|
||||
function vite_images_rehype(opts) {
|
||||
return async function transformer(tree, vFile) {
|
||||
const urls = new Map();
|
||||
const url_count = new Map();
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
*/
|
||||
function transformUrl(url) {
|
||||
// url = decodeURIComponent(url)
|
||||
// console.log("decoded", url)
|
||||
|
||||
// filenames can start with digits,
|
||||
// prepend underscore to guarantee valid module name
|
||||
let camel = `_${toCamel(url)}`;
|
||||
const count = url_count.get(camel);
|
||||
const dupe = urls.get(url);
|
||||
|
||||
if (count && !dupe) {
|
||||
url_count.set(camel, count + 1);
|
||||
camel = `${camel}_${count}`;
|
||||
} else if (!dupe) {
|
||||
url_count.set(camel, 1);
|
||||
}
|
||||
|
||||
urls.set(url, {
|
||||
path: url,
|
||||
id: camel
|
||||
});
|
||||
|
||||
return camel;
|
||||
|
||||
|
||||
}
|
||||
// console.log(tree)
|
||||
// vFile.data.headings = [];
|
||||
|
||||
// console.log(tree)
|
||||
visit(tree, { tagName: "img" }, (node) => {
|
||||
let url = node.properties.src;
|
||||
url = (url.includes("?") ? url + "&" : url + "?") + "url";
|
||||
|
||||
node.properties.src = `{${transformUrl(url)}}`
|
||||
// new URL('./img.png', import.meta.url).href
|
||||
// vFile.data.headings.push({
|
||||
// level: node.depth,
|
||||
// title: hast_tree_to_string(node),
|
||||
// });
|
||||
});
|
||||
visit(tree, { tagName: "Components.img" }, (node) => {
|
||||
let url = node.properties.src;
|
||||
const thumb = (url.includes("?") ? url + "&" : url + "?") + "thumb";
|
||||
url = (url.includes("?") ? url + "&" : url + "?") + "url";
|
||||
|
||||
node.properties.src = `{${transformUrl(url)}}`
|
||||
node.properties.thumb = `{${transformUrl(thumb)}}`
|
||||
// node.properties.src = `{new URL('${url}', import.meta.url)}`
|
||||
// new URL('./img.png', import.meta.url).href
|
||||
// vFile.data.headings.push({
|
||||
// level: node.depth,
|
||||
// title: hast_tree_to_string(node),
|
||||
// });
|
||||
});
|
||||
|
||||
let scripts = "";
|
||||
urls.forEach((x) => (scripts += `import ${x.id} from "./${x.path}";\n`));
|
||||
// urls.forEach((x) => (scripts += `const ${x.id} = new URL("${x.path}", import.meta.url);\n`));
|
||||
// console.log(scripts)
|
||||
// urls.forEach((x) => {
|
||||
// if (x.meta) {
|
||||
// let a = ["src", "width", "height"]
|
||||
// scripts += `import {${a.map((a) => a + " as " + x.id + "_" + a).join(",")}} from "${x.path.includes("?") ? x.path + "&as=metadata" : x.path + "?as=metadata:src;width;height"}";\n`
|
||||
// }
|
||||
// });
|
||||
|
||||
let is_script = false;
|
||||
|
||||
visit(tree, { type: "raw" }, (node) => {
|
||||
// console.log(node)
|
||||
if (RE_SCRIPT_START.test(node.value)) {
|
||||
// console.log("inserting")
|
||||
is_script = true;
|
||||
node.value = node.value.replace(RE_SCRIPT_START, (script) => {
|
||||
return `${script}\n${scripts}`;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!is_script) {
|
||||
tree.children.push({
|
||||
type: 'raw',
|
||||
value: `<script>\n${scripts}</script>`,
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @type {import("mdsvex").MdsvexOptions}
|
||||
*/
|
||||
const config = {
|
||||
extensions: [".svelte.md", ".md", ".svx"],
|
||||
|
||||
// fences: true,
|
||||
// ruleSpaces: false,
|
||||
smartypants: {
|
||||
dashes: "oldschool",
|
||||
},
|
||||
|
||||
layout: {
|
||||
_: "./src/lib/mdlayouts/default.svelte"
|
||||
},
|
||||
|
||||
highlight: {
|
||||
// @ts-ignore
|
||||
highlighter: await createHighlighter({ theme: "github-dark", langs: ["http", "jsx", "javascript", "typescript", "rust"].map(getGrammar) }),
|
||||
alias: {
|
||||
ts: "typescript",
|
||||
mdx: "markdown",
|
||||
svelte: "svelte",
|
||||
svx: "svx",
|
||||
mdsvex: "svx",
|
||||
sig: "ts",
|
||||
}
|
||||
},
|
||||
|
||||
remarkPlugins: [
|
||||
// remarkFrontmatter,
|
||||
// [github, {repository}],
|
||||
remarkMath,
|
||||
remarkAbbr,
|
||||
[remarkFootnotes, { inlineNotes: true }],
|
||||
remarkGfm,
|
||||
[remarkCallouts, {}],
|
||||
[remarkWikiLink, {
|
||||
// @ts-ignore
|
||||
aliasDivider: "|",
|
||||
permalinks,
|
||||
pageResolver,
|
||||
hrefTemplate,
|
||||
|
||||
// wikiLinkClassName,
|
||||
// newClassName,
|
||||
}],
|
||||
// [citePlugin, {
|
||||
// syntax: {
|
||||
// // see micromark-extension-cite
|
||||
// enableAltSyntax: false,
|
||||
// enablePandocSyntax: true,
|
||||
// },
|
||||
// toMarkdown: {
|
||||
// // see mdast-util-cite
|
||||
// standardizeAltSyntax: false,
|
||||
// enableAuthorSuppression: true,
|
||||
// useNodeValue: false,
|
||||
// },
|
||||
// }],
|
||||
// [remarkBibliography, { bibliography }],
|
||||
// [remarkMermaid, {}]
|
||||
remarkReadingTime,
|
||||
add_data_to_fm,
|
||||
[add_toc_remark, { prefix: "h-" }]
|
||||
],
|
||||
rehypePlugins: [
|
||||
// @ts-ignore
|
||||
rehypeKatexSvelte,
|
||||
// @ts-ignore
|
||||
[rehypeSlug, { prefix: "h-" }],
|
||||
vite_images_rehype
|
||||
],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"name": "website",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"fix": "biome lint --write . && biome format --write . && biome check . --write"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@bitmachina/highlighter": "1.0.0-alpha.6",
|
||||
"@fontsource/fira-mono": "^5.1.0",
|
||||
"@json-feed-types/1_1": "^1.0.2",
|
||||
"@rollup/pluginutils": "^5.1.3",
|
||||
"@sentry/esbuild-plugin": "^2.22.6",
|
||||
"@sveltejs/adapter-auto": "^3.3.1",
|
||||
"@sveltejs/adapter-node": "^5.2.9",
|
||||
"@sveltejs/kit": "^2.8.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.1",
|
||||
"@types/fnv-plus": "^1.3.2",
|
||||
"@types/node": "^20.17.7",
|
||||
"@types/polka": "^0.5.7",
|
||||
"@types/sharedworker": "^0.0.115",
|
||||
"dotenv": "^16.4.5",
|
||||
"esbuild": "^0.23.1",
|
||||
"github-slugger": "^2.0.0",
|
||||
"glob": "^10.4.5",
|
||||
"hast-util-to-string": "^3.0.1",
|
||||
"just-camel-case": "^6.2.0",
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"mdsvex": "^0.11.2",
|
||||
"rehype-katex-svelte": "~1.2.0",
|
||||
"rehype-slug": "^6.0.0",
|
||||
"remark-abbr": "^1.4.2",
|
||||
"remark-callouts": "workspace:^",
|
||||
"remark-footnotes": "^2.0.0",
|
||||
"remark-frontmatter": "^5.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-github": "^12.0.0",
|
||||
"remark-math": "^3.0.1",
|
||||
"remark-reading-time": "^2.0.1",
|
||||
"remark-wiki-link": "^0.0.4",
|
||||
"rollup": "^4.27.4",
|
||||
"rollup-plugin-type-as-json-schema": "^0.2.6",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"schema-dts": "^1.1.2",
|
||||
"sharp": "^0.33.5",
|
||||
"svelte": "^5.2.7",
|
||||
"svelte-check": "^4.1.0",
|
||||
"svelte-seo": "^1.6.1",
|
||||
"sveltekit-html-minifier": "^1.0.4",
|
||||
"svgo": "^3.3.2",
|
||||
"tm-grammars": "^1.19.5",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"unified": "^11.0.5",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vite": "^5.4.2",
|
||||
"vite-plugin-image-optimizer": "^1.1.8",
|
||||
"vite-plugin-thumbhash": "^0.1.6",
|
||||
"vite-plugin-thumbhash-svg": "workspace:^"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@codemirror/commands": "^6.7.1",
|
||||
"@codemirror/lang-javascript": "^6.2.2",
|
||||
"@codemirror/language": "^6.10.3",
|
||||
"@codemirror/lint": "^6.8.3",
|
||||
"@codemirror/state": "^6.4.1",
|
||||
"@codemirror/view": "^6.35.0",
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@octokit/types": "^13.6.1",
|
||||
"@resvg/resvg-js": "^2.6.2",
|
||||
"@sentry/sveltekit": "^8.40.0",
|
||||
"@steeze-ui/svelte-icon": "^1.6.2",
|
||||
"@tabler/icons-svelte": "^3.22.0",
|
||||
"@tusbar/cache-control": "^1.0.2",
|
||||
"@uiw/codemirror-theme-github": "^4.23.6",
|
||||
"Notes": "file:Notes-1.0.0.tgz",
|
||||
"acorn": "^8.14.0",
|
||||
"codemirror": "^6.0.1",
|
||||
"fnv-plus": "^1.3.1",
|
||||
"magic-string": "^0.30.13",
|
||||
"octokit": "^3.2.1",
|
||||
"satori": "^0.10.14",
|
||||
"slugify": "^1.6.6",
|
||||
"super-sitemap": "^0.14.20",
|
||||
"svelte-codemirror-editor": "^1.4.1",
|
||||
"terser": "^5.36.0",
|
||||
"xmlbuilder2": "^3.1.1"
|
||||
},
|
||||
"targets": {
|
||||
"module": {
|
||||
"context": "node",
|
||||
"engines": {
|
||||
"node": ">= 20"
|
||||
},
|
||||
"outputFormat": "esmodule",
|
||||
"optimize": true,
|
||||
"includeNodeModules": true
|
||||
}
|
||||
},
|
||||
"@parcel/resolver-default": {
|
||||
"packageExports": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
|
||||
import esbuild from "esbuild";
|
||||
|
||||
// https://github.com/evanw/esbuild/pull/2067
|
||||
const ESM_REQUIRE_SHIM = `
|
||||
await (async () => {
|
||||
const { dirname } = await import("path");
|
||||
const { fileURLToPath } = await import("url");
|
||||
|
||||
/**
|
||||
* Shim entry-point related paths.
|
||||
*/
|
||||
if (typeof globalThis.__filename === "undefined") {
|
||||
globalThis.__filename = fileURLToPath(import.meta.url);
|
||||
}
|
||||
if (typeof globalThis.__dirname === "undefined") {
|
||||
globalThis.__dirname = dirname(globalThis.__filename);
|
||||
}
|
||||
/**
|
||||
* Shim require if needed.
|
||||
*/
|
||||
if (typeof globalThis.require === "undefined") {
|
||||
const { default: module } = await import("module");
|
||||
globalThis.require = module.createRequire(import.meta.url);
|
||||
}
|
||||
})();
|
||||
`;
|
||||
const banner = {
|
||||
"js": ESM_REQUIRE_SHIM
|
||||
};
|
||||
|
||||
esbuild.build({
|
||||
sourcemap: true, // Source map generation must be turned on
|
||||
platform: "node", // Node.js platform
|
||||
target: "node22.0", // Node.js version
|
||||
entryPoints: ["./build/index.js"], // Entry point file
|
||||
outdir: "./output", // Output directory
|
||||
bundle: true, // Generate an external bundle
|
||||
splitting: true, // Enable code splitting
|
||||
format: "esm", // Output format
|
||||
loader: {
|
||||
".node": "copy",
|
||||
},
|
||||
alias: {
|
||||
"perf_hooks": "node:perf_hooks",
|
||||
},
|
||||
banner,
|
||||
plugins: [
|
||||
// Put the Sentry esbuild plugin after all other plugins
|
||||
sentryEsbuildPlugin({
|
||||
org: "jade-ellis",
|
||||
project: "jade-website-sveltekit",
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
sourcemaps: {
|
||||
// Specify the directory containing build artifacts
|
||||
assets: "./output/**",
|
||||
}
|
||||
}),
|
||||
],
|
||||
});
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
import type { Middleware } from "polka"
|
||||
type Req = Parameters<Middleware>[0]
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
interface Platform {
|
||||
req: Req
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
<script async defer src="https://www.googletagmanager.com/gtag/js?id=G-Q2R5PQL59Z"></script>
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
import { SENTRY_DSN } from '$lib/config';
|
||||
import { init as initSentry, handleErrorWithSentry, makeBrowserOfflineTransport, makeFetchTransport, feedbackIntegration } from '@sentry/sveltekit';
|
||||
|
||||
initSentry({
|
||||
dsn: SENTRY_DSN,
|
||||
environment: import.meta.env.MODE,
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// This sets the sample rate to be 10%. You may want this to be 100% while
|
||||
// in development and sample at a lower rate in production
|
||||
replaysSessionSampleRate: 0.0,
|
||||
|
||||
// If the entire session is not sampled, use the below sample rate to sample
|
||||
// sessions when an error occurs.
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
|
||||
integrations: [feedbackIntegration({
|
||||
autoInject: false,
|
||||
})],
|
||||
|
||||
// replay:
|
||||
// - https://github.com/getsentry/sentry-javascript/tree/develop/packages/replay-worker
|
||||
// https://docs.sentry.io/platforms/javascript/guides/solidstart/session-replay/configuration/#using-a-custom-compression-worker
|
||||
// To enable offline events caching, use makeBrowserOfflineTransport to wrap
|
||||
// existing transports and queue events using the browsers' IndexedDB storage
|
||||
transport: makeBrowserOfflineTransport(makeFetchTransport),
|
||||
});
|
||||
|
||||
// If you have a custom error handler, pass it to `handleErrorWithSentry`
|
||||
export const handleError = handleErrorWithSentry();
|
||||
@@ -0,0 +1,61 @@
|
||||
import { sequence } from '@sveltejs/kit/hooks';
|
||||
import { init as initSentry, handleErrorWithSentry, sentryHandle } from '@sentry/sveltekit';
|
||||
import type { Handle } from "@sveltejs/kit";
|
||||
import { randomBytes } from 'crypto';
|
||||
import { SENTRY_DSN, SENTRY_REPORT_URL } from '$lib/config';
|
||||
// import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
||||
|
||||
initSentry({
|
||||
dsn: SENTRY_DSN,
|
||||
environment: import.meta.env.MODE,
|
||||
tracesSampleRate: 1.0,
|
||||
// profilesSampleRate: 1.0,
|
||||
|
||||
integrations: [
|
||||
],
|
||||
})
|
||||
|
||||
const securityHeaders = {
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-XSS-Protection': '0',
|
||||
|
||||
"Referrer-Policy": "no-referrer-when-downgrade",
|
||||
|
||||
"Permissions-Policy": "payment=(), geolocation=(self), fullscreen=(self)",
|
||||
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp',
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Resource-Policy': 'same-origin',
|
||||
|
||||
'Report-To': '{"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"' + SENTRY_REPORT_URL + '"}],"include_subdomains":true}',
|
||||
}
|
||||
|
||||
export const handle: Handle = async (input) => {
|
||||
const sentryNonce = randomBytes(16).toString('hex');
|
||||
return await sequence(
|
||||
sentryHandle({
|
||||
// injectFetchProxyScript: false,
|
||||
fetchProxyScriptNonce: sentryNonce,
|
||||
}),
|
||||
async ({ event, resolve }) => {
|
||||
const response = await resolve(event);
|
||||
const csp = response.headers.get("Content-Security-Policy");
|
||||
if (csp) {
|
||||
response.headers.set("Content-Security-Policy", csp.replace("script-src", "script-src 'nonce-" + sentryNonce + "'"));
|
||||
}
|
||||
|
||||
Object.entries(securityHeaders).forEach(
|
||||
([header, value]) => {
|
||||
if (!response.headers.has(header)) {
|
||||
response.headers.set(header, value)
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
response.headers.delete("x-sveltekit-page")
|
||||
|
||||
return response;
|
||||
}
|
||||
)(input)
|
||||
}
|
||||
export const handleError = handleErrorWithSentry();
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import { IconExclamationCircle } from "@tabler/icons-svelte";
|
||||
interface Props {
|
||||
calloutType: string;
|
||||
icon?: import('svelte').Snippet;
|
||||
title?: import('svelte').Snippet;
|
||||
body?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
calloutType,
|
||||
icon,
|
||||
title,
|
||||
body
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="callout" data-callout={calloutType}>
|
||||
<div class="callout-title">
|
||||
{#if icon}
|
||||
<div class="callout-icon">{@render icon?.()}</div>
|
||||
{:else}
|
||||
<div class="callout-icon"><IconExclamationCircle /></div>
|
||||
{/if}
|
||||
<div class="callout-title-inner">
|
||||
{#if title}{@render title()}{:else}{calloutType.replace(/\w\S*/g, function (txt) {
|
||||
return (
|
||||
txt.charAt(0).toUpperCase() +
|
||||
txt.substring(1).toLowerCase()
|
||||
);
|
||||
})}{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if body}
|
||||
<div class="callout-body">{@render body?.()}</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,301 @@
|
||||
<script lang="ts" module>
|
||||
type Attrs = {
|
||||
[name: string]: string;
|
||||
};
|
||||
type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
// look at https://github.com/sveltejs/learn.svelte.dev/blob/main/src/routes/tutorial/%5Bslug%5D/Editor.svelte
|
||||
// import { javascript } from "@codemirror/lang-javascript";
|
||||
import { onDestroy, onMount, createEventDispatcher } from "svelte";
|
||||
import { theme } from "$lib/theme";
|
||||
import { githubLight, githubDark } from "$lib/themes/github";
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import {
|
||||
EditorState,
|
||||
StateEffect,
|
||||
type Extension,
|
||||
} from "@codemirror/state";
|
||||
|
||||
import { type LanguageSupport } from "@codemirror/language";
|
||||
import { get_base_extensions } from "./editorExtensions";
|
||||
|
||||
|
||||
|
||||
interface Props {
|
||||
value?: string;
|
||||
contentAttributes?: AttrSource | null;
|
||||
lang?: LanguageSupport | null;
|
||||
useTab?: boolean;
|
||||
tabSize?: number;
|
||||
lineWrapping?: boolean;
|
||||
editable?: boolean;
|
||||
readonly?: boolean;
|
||||
placeholder?: string | HTMLElement | null | undefined;
|
||||
header?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
value = $bindable(""),
|
||||
contentAttributes = null,
|
||||
lang = null,
|
||||
useTab = true,
|
||||
tabSize = 2,
|
||||
lineWrapping = false,
|
||||
editable = true,
|
||||
readonly = false,
|
||||
placeholder = undefined,
|
||||
header
|
||||
}: Props = $props();
|
||||
|
||||
const is_browser = typeof window !== "undefined";
|
||||
|
||||
let element: HTMLDivElement = $state();
|
||||
let view: EditorView = $state();
|
||||
|
||||
|
||||
|
||||
let update_from_prop = false;
|
||||
let update_from_state = false;
|
||||
let first_config = true;
|
||||
let first_update = true;
|
||||
|
||||
let langPlugin = null;
|
||||
|
||||
let extensions: Extension[] = [];
|
||||
|
||||
|
||||
if (langPlugin !== null) extensions.push(langPlugin);
|
||||
if (contentAttributes !== null)
|
||||
extensions.push(EditorView.contentAttributes.of(contentAttributes));
|
||||
|
||||
onMount(() => {
|
||||
view = create_editor_view();
|
||||
dispatch("ready", view);
|
||||
});
|
||||
onDestroy(() => view?.destroy());
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
change: string;
|
||||
ready: EditorView;
|
||||
reconfigure: EditorView;
|
||||
}>();
|
||||
|
||||
function create_editor_view(): EditorView {
|
||||
return new EditorView({
|
||||
parent: element,
|
||||
state: create_editor_state(value),
|
||||
dispatch(transaction) {
|
||||
view.update([transaction]);
|
||||
|
||||
if (!update_from_prop && transaction.docChanged) {
|
||||
on_change();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function reconfigure(): void {
|
||||
if (first_config) {
|
||||
first_config = false;
|
||||
return;
|
||||
}
|
||||
|
||||
view.dispatch({
|
||||
effects: StateEffect.reconfigure.of(state_extensions),
|
||||
});
|
||||
|
||||
dispatch("reconfigure", view);
|
||||
}
|
||||
|
||||
function update(value: string | null | undefined): void {
|
||||
if (first_update) {
|
||||
first_update = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_from_state) {
|
||||
update_from_state = false;
|
||||
return;
|
||||
}
|
||||
|
||||
update_from_prop = true;
|
||||
|
||||
if (value === undefined) {
|
||||
return;
|
||||
}
|
||||
const currentValue = view ? view.state.doc.toString() : "";
|
||||
if (view && value !== currentValue) {
|
||||
view.dispatch({
|
||||
changes: {
|
||||
from: 0,
|
||||
to: currentValue.length,
|
||||
insert: value || "",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
update_from_prop = false;
|
||||
}
|
||||
|
||||
function handle_change(): void {
|
||||
const new_value = view.state.doc.toString();
|
||||
if (new_value === value) return;
|
||||
|
||||
update_from_state = true;
|
||||
|
||||
value = new_value;
|
||||
dispatch("change", value);
|
||||
}
|
||||
|
||||
function create_editor_state(
|
||||
value: string | null | undefined,
|
||||
): EditorState {
|
||||
return EditorState.create({
|
||||
doc: value ?? undefined,
|
||||
extensions: state_extensions,
|
||||
});
|
||||
}
|
||||
|
||||
// $: console.log(value)
|
||||
|
||||
// import { linter, lintGutter } from "@codemirror/lint";
|
||||
// import * as eslint from "eslint-linter-browserify";
|
||||
|
||||
// lintGutter(),
|
||||
// linter(esLint(new eslint.Linter(), config)),
|
||||
run(() => {
|
||||
view && update(value);
|
||||
});
|
||||
let state_extensions = $derived([
|
||||
...get_base_extensions(
|
||||
useTab,
|
||||
tabSize,
|
||||
lineWrapping,
|
||||
placeholder,
|
||||
editable,
|
||||
readonly,
|
||||
lang,
|
||||
),
|
||||
$theme == "dark" ? githubDark : githubLight,
|
||||
...extensions,
|
||||
]);
|
||||
run(() => {
|
||||
view && state_extensions && reconfigure();
|
||||
});
|
||||
let on_change = $derived(handle_change);
|
||||
</script>
|
||||
|
||||
<div class="editor-wrapper card" class:no-header={!header}>
|
||||
{#if header}
|
||||
<div class="header">
|
||||
{@render header?.()}
|
||||
</div>
|
||||
{/if}
|
||||
{#if is_browser}
|
||||
<div class="codemirror-wrapper editor" bind:this={element}></div>
|
||||
{:else}
|
||||
<div class="scm-waiting editor">
|
||||
<div class="scm-waiting__loading scm-loading">
|
||||
<div class="scm-loading__spinner"></div>
|
||||
<p class="scm-loading__text">Loading editor...</p>
|
||||
</div>
|
||||
<div class="cm-editor"><pre class="scm-pre">{value}</pre></div>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
<!-- <CodeMirror
|
||||
{value}
|
||||
class="editor"
|
||||
theme={$theme == "dark" ? githubDark : githubLight}
|
||||
{extensions}
|
||||
{readonly}
|
||||
on:change
|
||||
/> -->
|
||||
</div>
|
||||
|
||||
<!-- <CodeMirror basic={true} bind:value lang={javascript({})} class="editor" /> -->
|
||||
|
||||
<style>
|
||||
.editor-wrapper {
|
||||
/* min-height: 200px; */
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background-color: var(--surface-secondary-color);
|
||||
}
|
||||
|
||||
.codemirror-wrapper :global(.cm-focused) {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.scm-waiting {
|
||||
position: relative;
|
||||
}
|
||||
.scm-waiting__loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background-color: var(--shadow-color);
|
||||
}
|
||||
|
||||
.scm-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scm-loading__spinner {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border-radius: 100%;
|
||||
border: solid 2px var(--theme);
|
||||
border-top-color: transparent;
|
||||
margin-right: 0.75rem;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
.scm-loading__text {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.scm-pre {
|
||||
font-size: 0.85rem;
|
||||
margin: 0;
|
||||
padding: 4px 2px 4px 6px;
|
||||
font-family: monospace;
|
||||
tab-size: 2;
|
||||
-moz-tab-size: 2;
|
||||
resize: none;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
:global(.editor-wrapper .cm-scroller, .editor-wrapper .cm-editor) {
|
||||
min-height: 200px;
|
||||
border-bottom-left-radius: var(--border-radius);
|
||||
border-bottom-right-radius: var(--border-radius);
|
||||
/* box-shadow: var(--shadow);
|
||||
background-color: var(--surface-color); */
|
||||
}
|
||||
:global(
|
||||
.editor-wrapper.no-header .cm-scroller,
|
||||
.editor-wrapper.no-header .cm-editor
|
||||
) {
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
:global(pre.cm-editor) {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script lang="ts">
|
||||
import manifest from "./site.webmanifest?url";
|
||||
import logo from "./logo.svg?url";
|
||||
</script>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href={logo}>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
|
||||
<link rel="manifest" href={manifest}>
|
||||
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#0064e0">
|
||||
|
||||
<meta name="msapplication-TileColor" content="#1e2a55">
|
||||
<meta name="theme-color" content="#1e2a55">
|
||||
@@ -0,0 +1,137 @@
|
||||
<script lang="ts">
|
||||
import * as Sentry from "@sentry/sveltekit";
|
||||
import url from "./logo.svg?url";
|
||||
import { SITE_URL } from "$lib/metadata";
|
||||
|
||||
/** @type {Record<string, { href: string; title: string; }[]>} */
|
||||
const links = {
|
||||
Connect: [
|
||||
{
|
||||
href: "https://matrix.to/#/@jade:ellis.link",
|
||||
title: "Matrix",
|
||||
},
|
||||
{ href: "https://github.com/JadedBlueEyes", title: "GitHub" },
|
||||
{ href: "https://tech.lgbt/@JadedBlueEyes", title: "Mastodon" },
|
||||
{
|
||||
href: "https://bsky.app/profile/jade.ellis.link",
|
||||
title: "Bluesky",
|
||||
},
|
||||
{
|
||||
href: "https://www.linkedin.com/in/jadedblueeyes",
|
||||
title: "LinkedIn",
|
||||
},
|
||||
],
|
||||
Feeds: [
|
||||
{ href: SITE_URL + "/blog/rss.xml", title: "RSS (Atom)" },
|
||||
{ href: SITE_URL + "/blog/feed.json", title: "JSON Feed" },
|
||||
]
|
||||
};
|
||||
const sendFeedback = async () => {
|
||||
const feedback = Sentry.getFeedback();
|
||||
if (!feedback) {
|
||||
return;
|
||||
}
|
||||
const form = await feedback.createForm({});
|
||||
form.appendToDom();
|
||||
form.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="background">
|
||||
<footer class="container">
|
||||
<div class="logo">
|
||||
<a class="footer-link-home" href={SITE_URL}>
|
||||
<img
|
||||
src={url}
|
||||
class="footer-logo"
|
||||
alt=""
|
||||
width="28"
|
||||
height="28"
|
||||
/>
|
||||
<span class="site-name">Jade Ellis</span>
|
||||
</a>
|
||||
|
||||
<button onclick={sendFeedback} class="feedback-button">Report a bug</button>
|
||||
</div>
|
||||
|
||||
{#each Object.entries(links) as [title, inner_links]}
|
||||
<div class="links">
|
||||
<h2>{title}</h2>
|
||||
{#each inner_links as { href, title }}
|
||||
<a {href}>{title}</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<div class="copyright">© 2024 Jade Ellis</div>
|
||||
<!-- <div class="feedback">
|
||||
</div> -->
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.background {
|
||||
background-color: var(--surface-color);
|
||||
margin-block-start: 4em;
|
||||
}
|
||||
footer {
|
||||
padding: 12px var(--spacing);
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: 1fr;
|
||||
grid-row-gap: 6rem;
|
||||
}
|
||||
.container {
|
||||
--container-max-width: calc(var(--page-width) + 6rem + 16px);
|
||||
}
|
||||
|
||||
footer h2 {
|
||||
font-size: var(--sk-text-m);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.links a {
|
||||
display: block;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
@media (min-width: 500px) {
|
||||
footer {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
footer .logo {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
grid-column: span 1;
|
||||
}
|
||||
|
||||
.feedback {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-logo {
|
||||
width: 3rem;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.footer-link-home {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.feedback-button {
|
||||
margin: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
<script lang="ts">
|
||||
import type { Endpoints } from "@octokit/types";
|
||||
|
||||
import { browser } from "$app/environment";
|
||||
interface Props {
|
||||
releaseData: Endpoints["GET /repos/{owner}/{repo}/releases/latest"]["response"]["data"];
|
||||
}
|
||||
|
||||
let { releaseData }: Props = $props();
|
||||
// console.log(releaseData);
|
||||
</script>
|
||||
|
||||
<div class="release">
|
||||
{#if releaseData?.assets && browser && navigator}
|
||||
{#if navigator.platform.startsWith("Win")}
|
||||
{@const asset = (releaseData?.assets || []).filter((a) =>
|
||||
a.name.endsWith(".exe"),
|
||||
)[0]}
|
||||
{#if asset}
|
||||
<a href={asset.browser_download_url}>Download for Windows</a>
|
||||
{/if}
|
||||
{:else if navigator.platform.startsWith("Mac")}
|
||||
{@const asset = (releaseData?.assets || []).filter((a) =>
|
||||
a.name.endsWith(".dmg"),
|
||||
)[0]}
|
||||
{#if asset}
|
||||
<a href={asset.browser_download_url}>Download for MacOS</a>
|
||||
{/if}
|
||||
{:else if navigator.platform.startsWith("Linux") && navigator.platform.includes("x86_64")}
|
||||
{@const asset = (releaseData?.assets || []).filter((a) =>
|
||||
a.name.endsWith(".AppImage"),
|
||||
)[0]}
|
||||
{#if asset}
|
||||
<a href={asset.browser_download_url}>Download AppImage</a>
|
||||
{/if}
|
||||
{:else}
|
||||
<span>No download found for your device</span>
|
||||
{/if}
|
||||
{:else if releaseData?.assets}
|
||||
<span>Finding download for your device</span>
|
||||
{/if}
|
||||
<p>Latest release: <a href={releaseData.html_url}>{releaseData.name}</a></p>
|
||||
</div>
|
||||
@@ -0,0 +1,123 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
|
||||
import url from "./logo.svg?url";
|
||||
import { SITE_URL } from "$lib/metadata";
|
||||
let logo: HTMLDivElement = $state();
|
||||
let wiggleCount = 0;
|
||||
function wiggle() {
|
||||
wiggleCount++;
|
||||
logo.style.animationPlayState = "running";
|
||||
}
|
||||
function wiggleIteration() {
|
||||
wiggleCount--;
|
||||
if (wiggleCount === 0) {
|
||||
logo.style.animationPlayState = "paused";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="hero card edge h-card">
|
||||
<div
|
||||
class="logo"
|
||||
onclick={preventDefault(wiggle)}
|
||||
onanimationiteration={wiggleIteration}
|
||||
bind:this={logo}
|
||||
>
|
||||
<a href={SITE_URL} class="u-url u-uid" rel="me"
|
||||
><img class="u-photo" src={url} alt="Logo" width="128" height="128" /></a
|
||||
>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1 class="title p-name">
|
||||
<span class="p-given-name">Jade</span>
|
||||
<span class="p-family-name">Ellis</span>
|
||||
</h1>
|
||||
<div role="doc-subtitle">
|
||||
<span class="p-nickname">JadedBlueEyes</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="description p-note">
|
||||
Student, Computer Scientist and Creative
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.hero {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--spacing);
|
||||
margin: 48px auto;
|
||||
max-width: 320px;
|
||||
padding: 3rem 0.5rem;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: calc(var(--spacing) / 2);
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
margin: 0;
|
||||
}
|
||||
[role="doc-subtitle"] {
|
||||
padding-block-start: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.description {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 540px) {
|
||||
.hero {
|
||||
flex-direction: row;
|
||||
margin: 96px auto;
|
||||
max-width: 520px;
|
||||
}
|
||||
.title,
|
||||
[role="doc-subtitle"],
|
||||
.description {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes wiggle {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
25% {
|
||||
transform: rotate(5deg);
|
||||
}
|
||||
75% {
|
||||
transform: rotate(-5deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
animation-name: wiggle;
|
||||
animation-duration: 0.2s;
|
||||
/* animation-iteration-count: 1; */
|
||||
|
||||
animation-iteration-count: infinite;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,91 @@
|
||||
<script lang="ts">
|
||||
import url from "./logo.svg?url";
|
||||
import { SITE_URL } from "$lib/metadata";
|
||||
// https://www.aleksandrhovhannisyan.com/
|
||||
// https://github.com/AleksandrHovhannisyan/aleksandrhovhannisyan.com/tree/master
|
||||
</script>
|
||||
|
||||
<header id="navbar">
|
||||
<div class="container">
|
||||
<nav aria-label="Primary">
|
||||
<a href="#page-content" class="screen-reader-only skip-navigation"
|
||||
>Skip to content</a
|
||||
>
|
||||
<ul class="navbar-links">
|
||||
<li>
|
||||
<a class="navbar-link-home" href={SITE_URL}>
|
||||
<img
|
||||
src={url}
|
||||
class="navbar-logo"
|
||||
alt=""
|
||||
width="28"
|
||||
height="28"
|
||||
/>
|
||||
<span class="site-name">Jade Ellis</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li><a href="/about/" class="navbar-link">About</a></li>
|
||||
<li><a href="/art/" class="navbar-link">Art</a></li> -->
|
||||
<li><a href="/blog" class="navbar-link">Blog</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
#navbar {
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
padding-block: 12px;
|
||||
|
||||
background-color: var(--surface-color);
|
||||
overflow-x: auto;
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
.container {
|
||||
--container-max-width: calc(var(--page-width) + 6rem + 16px);
|
||||
}
|
||||
#navbar a {
|
||||
text-decoration: none;
|
||||
}
|
||||
#navbar nav {
|
||||
white-space: nowrap;
|
||||
flex: 1 0 auto;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
.navbar-logo {
|
||||
width: 3rem;
|
||||
height: 100%;
|
||||
}
|
||||
.navbar-links {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25em;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.navbar-links > :first-child {
|
||||
margin-inline-end: auto;
|
||||
}
|
||||
.navbar-link-home {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.skip-navigation {
|
||||
top: 50%;
|
||||
transform: translate(8px, -50%);
|
||||
padding: 8px;
|
||||
background-color: var(--color-navbar-bg);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,81 @@
|
||||
<script lang="ts">
|
||||
import TocItem from "./TocItem.svelte";
|
||||
type FlatHeading = { level: number; title: string };
|
||||
interface Props {
|
||||
headings: nestedListNode[];
|
||||
class?: string;
|
||||
}
|
||||
|
||||
let { headings }: Props = $props();
|
||||
|
||||
// creates a `class` property, even
|
||||
// though it is a reserved word
|
||||
export const listType = "ul";
|
||||
|
||||
let open = $state(false);
|
||||
/** @type {import('./$types').Snapshot<string>} */
|
||||
export const snapshot = {
|
||||
capture: () => open,
|
||||
restore: (value: boolean) => (open = value),
|
||||
};
|
||||
|
||||
// console.log(headings);
|
||||
</script>
|
||||
|
||||
{#if headings?.length > 0}
|
||||
<aside class="toc">
|
||||
<details bind:open>
|
||||
<summary accesskey="c" title="(Alt + C)">Table of Contents</summary>
|
||||
<div class="inner">
|
||||
<svelte:element
|
||||
this={listType}
|
||||
class="toc-level {'toc-level-' + headings[0].level}"
|
||||
>
|
||||
{#each headings as node}
|
||||
<TocItem {node} {listType} />
|
||||
{/each}
|
||||
</svelte:element>
|
||||
</div>
|
||||
</details>
|
||||
</aside>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
aside {
|
||||
margin-block: calc(var(--spacing) / 4);
|
||||
}
|
||||
details {
|
||||
/* margin: var(--spacing) 2px; */
|
||||
margin: 0 2px;
|
||||
border: 1px solid var(--surface-secondary-color);
|
||||
background: var(--surface-color);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0.4em;
|
||||
}
|
||||
details summary {
|
||||
cursor: zoom-in;
|
||||
margin-inline-start: 10px;
|
||||
user-select: none;
|
||||
}
|
||||
details[open] summary {
|
||||
cursor: zoom-out;
|
||||
}
|
||||
summary {
|
||||
font-weight: 500;
|
||||
}
|
||||
.inner {
|
||||
padding: 0 10px;
|
||||
opacity: 0.9;
|
||||
margin-block-start: calc(var(--spacing) / 4);
|
||||
margin-block-end: calc(var(--spacing) / 2);
|
||||
margin-inline: calc(var(--spacing) / 2);
|
||||
}
|
||||
.inner :global(ul) {
|
||||
margin: 0;
|
||||
margin-inline-start: calc(var(--spacing));
|
||||
padding: 0;
|
||||
}
|
||||
summary:focus {
|
||||
outline: 0;
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user