mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-28 03:17:32 +00:00
Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48cbe20aeb | ||
|
|
95d87bd209 | ||
|
|
8bce2c4481 | ||
|
|
60904ed069 | ||
|
|
24aaf660ab | ||
|
|
5d00f3bfa1 | ||
|
|
f872210b20 | ||
|
|
3dd04bd9df | ||
|
|
af45c348a4 | ||
|
|
36dabecb82 | ||
|
|
50cd1081ba | ||
|
|
14df55e5c5 | ||
|
|
d9d0d1a465 | ||
|
|
81b6b3547c | ||
|
|
0bbc3c4e05 | ||
|
|
0f09fa3d31 | ||
|
|
3d5355dfc3 | ||
|
|
2547eb3a90 | ||
|
|
51ba41823f | ||
|
|
542dff50bd | ||
|
|
9c147b182f | ||
|
|
7e76ca45c1 | ||
|
|
5126cb4554 | ||
|
|
4d05d0f677 | ||
|
|
0673ac1a6c | ||
|
|
ad11417145 | ||
|
|
0de904ffe4 | ||
|
|
d74b9de221 | ||
|
|
e7ac5988cb | ||
|
|
571f05017c | ||
|
|
a339e73eb5 | ||
|
|
72b78ed6d4 | ||
|
|
baa89586e2 | ||
|
|
7ad8ff2e45 | ||
|
|
2046b1e2f6 | ||
|
|
2cb980cd4c | ||
|
|
27e0ef7b2e | ||
|
|
7091882887 | ||
|
|
a81546374d | ||
|
|
7950e2cc7f |
No files matched your search
@@ -0,0 +1,104 @@
|
|||||||
|
name: create-manifest
|
||||||
|
description: |
|
||||||
|
Create and push a multi-platform Docker manifest from individual platform digests.
|
||||||
|
Handles downloading digests, creating manifest lists, and pushing to registry.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
digest_pattern:
|
||||||
|
description: Glob pattern to match digest artifacts (e.g. "digests-linux-{amd64,arm64}")
|
||||||
|
required: true
|
||||||
|
tag_suffix:
|
||||||
|
description: Suffix to add to all Docker tags (e.g. "-maxperf")
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
images:
|
||||||
|
description: Container registry images (newline-separated)
|
||||||
|
required: true
|
||||||
|
registry_user:
|
||||||
|
description: Registry username for authentication
|
||||||
|
required: false
|
||||||
|
registry_password:
|
||||||
|
description: Registry password for authentication
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
version:
|
||||||
|
description: The version tag created for the manifest
|
||||||
|
value: ${{ steps.meta.outputs.version }}
|
||||||
|
tags:
|
||||||
|
description: All tags created for the manifest
|
||||||
|
value: ${{ steps.meta.outputs.tags }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Download digests
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
uses: forgejo/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/digests
|
||||||
|
pattern: ${{ inputs.digest_pattern }}
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Login to builtin registry
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.BUILTIN_REGISTRY }}
|
||||||
|
username: ${{ inputs.registry_user }}
|
||||||
|
password: ${{ inputs.registry_password }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
||||||
|
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
||||||
|
endpoint: ${{ env.BUILDKIT_ENDPOINT || '' }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags) for Docker
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}},prefix=v,suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.0.') }},prefix=v,suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }},prefix=v,suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=ref,event=branch,prefix=${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref && 'branch-' || '' }},suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=ref,event=pr,suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=sha,format=short,suffix=${{ inputs.tag_suffix }}
|
||||||
|
type=raw,value=latest${{ inputs.tag_suffix }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
images: ${{ inputs.images }}
|
||||||
|
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
||||||
|
env:
|
||||||
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
|
||||||
|
|
||||||
|
- name: Create manifest list and push
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
working-directory: /tmp/digests
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
IMAGES: ${{ inputs.images }}
|
||||||
|
run: |
|
||||||
|
IFS=$'\n'
|
||||||
|
IMAGES_LIST=($IMAGES)
|
||||||
|
ANNOTATIONS_LIST=($DOCKER_METADATA_OUTPUT_ANNOTATIONS)
|
||||||
|
TAGS_LIST=($DOCKER_METADATA_OUTPUT_TAGS)
|
||||||
|
for REPO in "${IMAGES_LIST[@]}"; do
|
||||||
|
docker buildx imagetools create \
|
||||||
|
$(for tag in "${TAGS_LIST[@]}"; do echo "--tag"; echo "$tag"; done) \
|
||||||
|
$(for annotation in "${ANNOTATIONS_LIST[@]}"; do echo "--annotation"; echo "$annotation"; done) \
|
||||||
|
$(for reference in *; do printf "$REPO@sha256:%s\n" $reference; done)
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Inspect image
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
IMAGES: ${{ inputs.images }}
|
||||||
|
run: |
|
||||||
|
IMAGES_LIST=($IMAGES)
|
||||||
|
for REPO in "${IMAGES_LIST[@]}"; do
|
||||||
|
docker buildx imagetools inspect $REPO:${{ steps.meta.outputs.version }}
|
||||||
|
done
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
name: prepare-docker-build
|
||||||
|
description: |
|
||||||
|
Prepare the Docker build environment for Continuwuity builds.
|
||||||
|
Sets up Rust toolchain, Docker Buildx, caching, and extracts metadata for Docker builds.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
platform:
|
||||||
|
description: Target platform (e.g. linux/amd64, linux/arm64)
|
||||||
|
required: true
|
||||||
|
slug:
|
||||||
|
description: Platform slug for artifact naming (e.g. linux-amd64, linux-arm64)
|
||||||
|
required: true
|
||||||
|
target_cpu:
|
||||||
|
description: Target CPU architecture (e.g. haswell, empty for base)
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
profile:
|
||||||
|
description: Cargo build profile (release or release-max-perf)
|
||||||
|
required: true
|
||||||
|
images:
|
||||||
|
description: Container registry images (newline-separated)
|
||||||
|
required: true
|
||||||
|
registry_user:
|
||||||
|
description: Registry username for authentication
|
||||||
|
required: false
|
||||||
|
registry_password:
|
||||||
|
description: Registry password for authentication
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
cpu_suffix:
|
||||||
|
description: CPU suffix for artifact naming
|
||||||
|
value: ${{ steps.cpu-suffix.outputs.suffix }}
|
||||||
|
metadata_labels:
|
||||||
|
description: Docker labels for the image
|
||||||
|
value: ${{ steps.meta.outputs.labels }}
|
||||||
|
metadata_annotations:
|
||||||
|
description: Docker annotations for the image
|
||||||
|
value: ${{ steps.meta.outputs.annotations }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Set CPU suffix variable
|
||||||
|
id: cpu-suffix
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ -n "${{ inputs.target_cpu }}" ]]; then
|
||||||
|
echo "suffix=-${{ inputs.target_cpu }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "CPU_SUFFIX=-${{ inputs.target_cpu }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "suffix=" >> $GITHUB_OUTPUT
|
||||||
|
echo "CPU_SUFFIX=" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Echo matrix configuration
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Platform: ${{ inputs.platform }}"
|
||||||
|
echo "Slug: ${{ inputs.slug }}"
|
||||||
|
echo "Target CPU: ${{ inputs.target_cpu }}"
|
||||||
|
echo "Profile: ${{ inputs.profile }}"
|
||||||
|
|
||||||
|
- name: Install rust
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
id: rust-toolchain
|
||||||
|
uses: ./.forgejo/actions/rust-toolchain
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
||||||
|
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
||||||
|
endpoint: ${{ env.BUILDKIT_ENDPOINT || '' }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Login to builtin registry
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.BUILTIN_REGISTRY }}
|
||||||
|
username: ${{ inputs.registry_user }}
|
||||||
|
password: ${{ inputs.registry_password }}
|
||||||
|
|
||||||
|
- name: Extract metadata (labels, annotations) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ inputs.images }}
|
||||||
|
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
||||||
|
env:
|
||||||
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
||||||
|
|
||||||
|
- name: Get short git commit SHA
|
||||||
|
id: sha
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||||
|
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
|
||||||
|
echo "Short SHA: $calculatedSha"
|
||||||
|
|
||||||
|
- name: Get Git commit timestamps
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
timestamp=$(git log -1 --pretty=%ct)
|
||||||
|
echo "TIMESTAMP=$timestamp" >> $GITHUB_ENV
|
||||||
|
echo "Commit timestamp: $timestamp"
|
||||||
|
|
||||||
|
- uses: ./.forgejo/actions/timelord
|
||||||
|
id: timelord
|
||||||
|
|
||||||
|
- name: Cache Rust registry
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
.cargo/git
|
||||||
|
.cargo/git/checkouts
|
||||||
|
.cargo/registry
|
||||||
|
.cargo/registry/src
|
||||||
|
key: rust-registry-image-${{hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo target
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
id: cache-cargo-target
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
cargo-target${{ env.CPU_SUFFIX }}-${{ inputs.slug }}-${{ inputs.profile }}
|
||||||
|
key: cargo-target${{ env.CPU_SUFFIX }}-${{ inputs.slug }}-${{ inputs.profile }}-${{hashFiles('**/Cargo.lock') }}-${{steps.rust-toolchain.outputs.rustc_version}}
|
||||||
|
|
||||||
|
- name: Cache apt cache
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
id: cache-apt
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
var-cache-apt-${{ inputs.slug }}
|
||||||
|
key: var-cache-apt-${{ inputs.slug }}
|
||||||
|
|
||||||
|
- name: Cache apt lib
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
id: cache-apt-lib
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
var-lib-apt-${{ inputs.slug }}
|
||||||
|
key: var-lib-apt-${{ inputs.slug }}
|
||||||
|
|
||||||
|
- name: inject cache into docker
|
||||||
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
|
uses: https://github.com/reproducible-containers/buildkit-cache-dance@v3.3.0
|
||||||
|
with:
|
||||||
|
cache-map: |
|
||||||
|
{
|
||||||
|
".cargo/registry": "/usr/local/cargo/registry",
|
||||||
|
".cargo/git/db": "/usr/local/cargo/git/db",
|
||||||
|
"cargo-target${{ env.CPU_SUFFIX }}-${{ inputs.slug }}-${{ inputs.profile }}": {
|
||||||
|
"target": "/app/target",
|
||||||
|
"id": "cargo-target${{ env.CPU_SUFFIX }}-${{ inputs.slug }}-${{ inputs.profile }}"
|
||||||
|
},
|
||||||
|
"var-cache-apt-${{ inputs.slug }}": "/var/cache/apt",
|
||||||
|
"var-lib-apt-${{ inputs.slug }}": "/var/lib/apt",
|
||||||
|
"${{ steps.timelord.outputs.database-path }}":"/timelord"
|
||||||
|
}
|
||||||
|
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
|
||||||
@@ -9,7 +9,7 @@ runs:
|
|||||||
- name: Install sccache
|
- name: Install sccache
|
||||||
uses: https://git.tomfos.tr/tom/sccache-action@v1
|
uses: https://git.tomfos.tr/tom/sccache-action@v1
|
||||||
- name: Configure sccache
|
- name: Configure sccache
|
||||||
uses: https://github.com/actions/github-script@v7
|
uses: https://github.com/actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
|
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ runs:
|
|||||||
|
|
||||||
- name: Check for LLVM cache
|
- name: Check for LLVM cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/bin/clang-*
|
/usr/bin/clang-*
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache Cargo registry and git
|
- name: Cache Cargo registry and git
|
||||||
id: registry-cache
|
id: registry-cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/registry/index
|
.cargo/registry/index
|
||||||
@@ -79,7 +79,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache toolchain binaries
|
- name: Cache toolchain binaries
|
||||||
id: toolchain-cache
|
id: toolchain-cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/bin
|
.cargo/bin
|
||||||
@@ -94,7 +94,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache build artifacts
|
- name: Cache build artifacts
|
||||||
id: build-cache
|
id: build-cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
target/**/deps
|
target/**/deps
|
||||||
|
|||||||
@@ -1,46 +1,104 @@
|
|||||||
name: timelord
|
name: timelord
|
||||||
description: |
|
description: |
|
||||||
Use timelord to set file timestamps
|
Use timelord to set file timestamps with git-warp-time fallback for cache misses
|
||||||
inputs:
|
inputs:
|
||||||
key:
|
key:
|
||||||
description: |
|
description: |
|
||||||
The key to use for caching the timelord data.
|
The key to use for caching the timelord data.
|
||||||
This should be unique to the repository and the runner.
|
required: false
|
||||||
required: true
|
default: ''
|
||||||
default: timelord-v0
|
|
||||||
path:
|
path:
|
||||||
description: |
|
description: |
|
||||||
The path to the directory to be timestamped.
|
The path to the directory to be timestamped.
|
||||||
This should be the root of the repository.
|
required: false
|
||||||
required: true
|
default: ''
|
||||||
default: .
|
|
||||||
|
outputs:
|
||||||
|
database-path:
|
||||||
|
description: Path to timelord database
|
||||||
|
value: '${{ env.TIMELORD_CACHE_PATH }}'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Cache timelord-cli installation
|
- name: Set defaults
|
||||||
id: cache-timelord-bin
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/bin/timelord
|
|
||||||
key: timelord-cli-v3.0.1
|
|
||||||
- name: Install timelord-cli
|
|
||||||
uses: https://github.com/cargo-bins/cargo-binstall@main
|
|
||||||
if: steps.cache-timelord-bin.outputs.cache-hit != 'true'
|
|
||||||
- run: cargo binstall timelord-cli@3.0.1
|
|
||||||
shell: bash
|
shell: bash
|
||||||
if: steps.cache-timelord-bin.outputs.cache-hit != 'true'
|
run: |
|
||||||
|
echo "TIMELORD_KEY=${{ inputs.key || format('timelord-v1-{0}-{1}', github.repository, hashFiles('**/*.rs', '**/Cargo.toml', '**/Cargo.lock')) }}" >> $GITHUB_ENV
|
||||||
|
echo "TIMELORD_PATH=${{ inputs.path || '.' }}" >> $GITHUB_ENV
|
||||||
|
echo "TIMELORD_CACHE_PATH=$HOME/.cache/timelord" >> $GITHUB_ENV
|
||||||
|
echo "PATH=/usr/share/rust/.cargo/bin:$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Load timelord files
|
- name: Restore binary cache
|
||||||
uses: actions/cache/restore@v3
|
id: binary-cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: /timelord/
|
path: |
|
||||||
key: ${{ inputs.key }}
|
/usr/share/rust/.cargo/bin
|
||||||
- name: Run timelord to set timestamps
|
~/.cargo/bin
|
||||||
|
key: timelord-binaries-v2
|
||||||
|
|
||||||
|
- name: Check if binaries need installation
|
||||||
shell: bash
|
shell: bash
|
||||||
run: timelord sync --source-dir ${{ inputs.path }} --cache-dir /timelord/
|
id: check-binaries
|
||||||
- name: Save timelord
|
run: |
|
||||||
uses: actions/cache/save@v3
|
NEED_INSTALL=false
|
||||||
|
if [ ! -e /usr/share/rust/.cargo/bin/timelord ] && [ ! -e ~/.cargo/bin/timelord ]; then
|
||||||
|
echo "timelord-cli not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation"
|
||||||
|
NEED_INSTALL=true
|
||||||
|
fi
|
||||||
|
if [ ! -e /usr/share/rust/.cargo/bin/git-warp-time ] && [ ! -e ~/.cargo/bin/git-warp-time ]; then
|
||||||
|
echo "git-warp-time not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation"
|
||||||
|
NEED_INSTALL=true
|
||||||
|
fi
|
||||||
|
echo "need-install=$NEED_INSTALL" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install timelord-cli and git-warp-time
|
||||||
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
|
uses: https://github.com/taiki-e/install-action@v2
|
||||||
with:
|
with:
|
||||||
path: /timelord/
|
tool: git-warp-time,timelord-cli@3.0.1
|
||||||
key: ${{ inputs.key }}
|
|
||||||
|
- name: Save binary cache
|
||||||
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/usr/share/rust/.cargo/bin
|
||||||
|
~/.cargo/bin
|
||||||
|
key: timelord-binaries-v2
|
||||||
|
|
||||||
|
|
||||||
|
- name: Restore timelord cache with fallbacks
|
||||||
|
id: timelord-restore
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
|
restore-keys: |
|
||||||
|
timelord-v1-${{ github.repository }}-
|
||||||
|
|
||||||
|
- name: Initialize timestamps on complete cache miss
|
||||||
|
if: steps.timelord-restore.outputs.cache-hit != 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Complete timelord cache miss - running git-warp-time"
|
||||||
|
git fetch --unshallow
|
||||||
|
if [ "${{ env.TIMELORD_PATH }}" = "." ]; then
|
||||||
|
git-warp-time --quiet
|
||||||
|
else
|
||||||
|
git-warp-time --quiet ${{ env.TIMELORD_PATH }}
|
||||||
|
fi
|
||||||
|
echo "Git timestamps restored"
|
||||||
|
|
||||||
|
- name: Run timelord sync
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
|
||||||
|
- name: Save updated timelord cache immediately
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
name: upload-docker-artifacts
|
||||||
|
description: |
|
||||||
|
Upload Docker build artifacts including binary and digest files.
|
||||||
|
Handles artifact naming and conditional digest uploads for registry publishing.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
slug:
|
||||||
|
description: Platform slug for artifact naming (e.g. linux-amd64, linux-arm64)
|
||||||
|
required: true
|
||||||
|
cpu_suffix:
|
||||||
|
description: CPU suffix for artifact naming (e.g. -haswell)
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
artifact_suffix:
|
||||||
|
description: Suffix for binary artifacts (e.g. -maxperf)
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
digest_suffix:
|
||||||
|
description: Suffix for digest artifacts (e.g. -maxperf)
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
digest:
|
||||||
|
description: The digest of the built Docker image
|
||||||
|
required: true
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
binary_artifact_name:
|
||||||
|
description: The name of the uploaded binary artifact
|
||||||
|
value: conduwuit${{ inputs.cpu_suffix }}-${{ inputs.slug }}${{ inputs.artifact_suffix }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Export digest
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ inputs.digest }}"
|
||||||
|
echo "🔍 Build step digest output: '$digest'"
|
||||||
|
if [[ -z "$digest" ]]; then
|
||||||
|
echo "❌ ERROR: No digest found from build step"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
digest_file="/tmp/digests/${digest#sha256:}"
|
||||||
|
echo "📁 Creating digest file: $digest_file"
|
||||||
|
touch "$digest_file"
|
||||||
|
echo "✅ Digest file created successfully"
|
||||||
|
echo "📋 Contents of /tmp/digests:"
|
||||||
|
ls -la /tmp/digests/
|
||||||
|
|
||||||
|
- name: Rename extracted binary
|
||||||
|
shell: bash
|
||||||
|
run: mv /tmp/binaries/sbin/conduwuit /tmp/binaries/conduwuit${{ inputs.cpu_suffix }}-${{ inputs.slug }}${{ inputs.artifact_suffix }}
|
||||||
|
|
||||||
|
- name: Upload binary artifact
|
||||||
|
uses: forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: conduwuit${{ inputs.cpu_suffix }}-${{ inputs.slug }}${{ inputs.artifact_suffix }}
|
||||||
|
path: /tmp/binaries/conduwuit${{ inputs.cpu_suffix }}-${{ inputs.slug }}${{ inputs.artifact_suffix }}
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
|
uses: forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: digests${{ inputs.digest_suffix }}-${{ inputs.slug }}${{ inputs.cpu_suffix }}
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 5
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
|
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
|
||||||
uses: https://github.com/actions/setup-node@v4
|
uses: https://github.com/actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- ".forgejo/workflows/element.yml"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- ".forgejo/workflows/element.yml"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "element-${{ github.ref }}"
|
group: "element-${{ github.ref }}"
|
||||||
@@ -16,7 +24,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📦 Setup Node.js
|
- name: 📦 Setup Node.js
|
||||||
uses: https://github.com/actions/setup-node@v4
|
uses: https://github.com/actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
|
|
||||||
@@ -101,7 +109,7 @@ jobs:
|
|||||||
cat ./element-web/webapp/config.json
|
cat ./element-web/webapp/config.json
|
||||||
|
|
||||||
- name: 📤 Upload Artifact
|
- name: 📤 Upload Artifact
|
||||||
uses: https://code.forgejo.org/actions/upload-artifact@v3
|
uses: forgejo/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: element-web
|
name: element-web
|
||||||
path: ./element-web/webapp/
|
path: ./element-web/webapp/
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
@@ -29,49 +29,12 @@ on:
|
|||||||
env:
|
env:
|
||||||
BUILTIN_REGISTRY: forgejo.ellis.link
|
BUILTIN_REGISTRY: forgejo.ellis.link
|
||||||
BUILTIN_REGISTRY_ENABLED: "${{ ((vars.BUILTIN_REGISTRY_USER && secrets.BUILTIN_REGISTRY_PASSWORD) || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)) && 'true' || 'false' }}"
|
BUILTIN_REGISTRY_ENABLED: "${{ ((vars.BUILTIN_REGISTRY_USER && secrets.BUILTIN_REGISTRY_PASSWORD) || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)) && 'true' || 'false' }}"
|
||||||
|
IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
define-variables:
|
build-release:
|
||||||
runs-on: ubuntu-latest
|
name: "Build ${{ matrix.slug }} (release)"
|
||||||
|
|
||||||
outputs:
|
|
||||||
images: ${{ steps.var.outputs.images }}
|
|
||||||
images_list: ${{ steps.var.outputs.images_list }}
|
|
||||||
build_matrix: ${{ steps.var.outputs.build_matrix }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setting variables
|
|
||||||
uses: https://github.com/actions/github-script@v7
|
|
||||||
id: var
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const githubRepo = '${{ github.repository }}'.toLowerCase()
|
|
||||||
const repoId = githubRepo.split('/')[1]
|
|
||||||
|
|
||||||
core.setOutput('github_repository', githubRepo)
|
|
||||||
const builtinImage = '${{ env.BUILTIN_REGISTRY }}/' + githubRepo
|
|
||||||
let images = []
|
|
||||||
if (process.env.BUILTIN_REGISTRY_ENABLED === "true") {
|
|
||||||
images.push(builtinImage)
|
|
||||||
} else {
|
|
||||||
// Fallback to official registry for forks/PRs without credentials
|
|
||||||
images.push('forgejo.ellis.link/continuwuation/continuwuity')
|
|
||||||
}
|
|
||||||
core.setOutput('images', images.join("\n"))
|
|
||||||
core.setOutput('images_list', images.join(","))
|
|
||||||
const platforms = ['linux/amd64', 'linux/arm64']
|
|
||||||
core.setOutput('build_matrix', JSON.stringify({
|
|
||||||
platform: platforms,
|
|
||||||
target_cpu: ['base'],
|
|
||||||
include: platforms.map(platform => { return {
|
|
||||||
platform,
|
|
||||||
slug: platform.replace('/', '-')
|
|
||||||
}})
|
|
||||||
}))
|
|
||||||
|
|
||||||
build-image:
|
|
||||||
runs-on: dind
|
runs-on: dind
|
||||||
needs: define-variables
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
@@ -79,133 +42,28 @@ jobs:
|
|||||||
id-token: write
|
id-token: write
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
{
|
include:
|
||||||
"target_cpu": ["base"],
|
- platform: "linux/amd64"
|
||||||
"profile": ["release"],
|
slug: "linux-amd64"
|
||||||
"include":
|
- platform: "linux/arm64"
|
||||||
[
|
slug: "linux-arm64"
|
||||||
{ "platform": "linux/amd64", "slug": "linux-amd64" },
|
|
||||||
{ "platform": "linux/arm64", "slug": "linux-arm64" },
|
|
||||||
],
|
|
||||||
"platform": ["linux/amd64", "linux/arm64"],
|
|
||||||
}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Echo strategy
|
|
||||||
run: echo '${{ toJSON(fromJSON(needs.define-variables.outputs.build_matrix)) }}'
|
|
||||||
- name: Echo matrix
|
|
||||||
run: echo '${{ toJSON(matrix) }}'
|
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Install rust
|
- name: Prepare Docker build environment
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
id: prepare
|
||||||
id: rust-toolchain
|
uses: ./.forgejo/actions/prepare-docker-build
|
||||||
uses: ./.forgejo/actions/rust-toolchain
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
with:
|
||||||
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
platform: ${{ matrix.platform }}
|
||||||
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
slug: ${{ matrix.slug }}
|
||||||
endpoint: ${{ env.BUILDKIT_ENDPOINT || '' }}
|
target_cpu: ""
|
||||||
- name: Set up QEMU
|
profile: "release"
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
images: ${{ env.IMAGE_PATH }}
|
||||||
uses: docker/setup-qemu-action@v3
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
||||||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
- name: Login to builtin registry
|
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.BUILTIN_REGISTRY }}
|
|
||||||
username: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
|
||||||
password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
|
|
||||||
- name: Extract metadata (labels, annotations) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{needs.define-variables.outputs.images}}
|
|
||||||
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
|
||||||
env:
|
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
|
||||||
|
|
||||||
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
|
|
||||||
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
|
|
||||||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
|
|
||||||
# It will not push images generated from a pull request
|
|
||||||
- name: Get short git commit SHA
|
|
||||||
id: sha
|
|
||||||
run: |
|
|
||||||
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
|
||||||
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
|
|
||||||
echo "Short SHA: $calculatedSha"
|
|
||||||
- name: Get Git commit timestamps
|
|
||||||
run: |
|
|
||||||
timestamp=$(git log -1 --pretty=%ct)
|
|
||||||
echo "TIMESTAMP=$timestamp" >> $GITHUB_ENV
|
|
||||||
echo "Commit timestamp: $timestamp"
|
|
||||||
|
|
||||||
- uses: ./.forgejo/actions/timelord
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
with:
|
|
||||||
key: timelord-v0
|
|
||||||
path: .
|
|
||||||
|
|
||||||
- name: Cache Rust registry
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
.cargo/git
|
|
||||||
.cargo/git/checkouts
|
|
||||||
.cargo/registry
|
|
||||||
.cargo/registry/src
|
|
||||||
key: rust-registry-image-${{hashFiles('**/Cargo.lock') }}
|
|
||||||
- name: Cache cargo target
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
id: cache-cargo-target
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
cargo-target-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}
|
|
||||||
key: cargo-target-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}-${{hashFiles('**/Cargo.lock') }}-${{steps.rust-toolchain.outputs.rustc_version}}
|
|
||||||
- name: Cache apt cache
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
id: cache-apt
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
var-cache-apt-${{ matrix.slug }}
|
|
||||||
key: var-cache-apt-${{ matrix.slug }}
|
|
||||||
- name: Cache apt lib
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
id: cache-apt-lib
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
var-lib-apt-${{ matrix.slug }}
|
|
||||||
key: var-lib-apt-${{ matrix.slug }}
|
|
||||||
- name: inject cache into docker
|
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
|
||||||
uses: https://github.com/reproducible-containers/buildkit-cache-dance@v3.3.0
|
|
||||||
with:
|
|
||||||
cache-map: |
|
|
||||||
{
|
|
||||||
".cargo/registry": "/usr/local/cargo/registry",
|
|
||||||
".cargo/git/db": "/usr/local/cargo/git/db",
|
|
||||||
"cargo-target-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}": {
|
|
||||||
"target": "/app/target",
|
|
||||||
"id": "cargo-target-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}"
|
|
||||||
},
|
|
||||||
"var-cache-apt-${{ matrix.slug }}": "/var/cache/apt",
|
|
||||||
"var-lib-apt-${{ matrix.slug }}": "/var/lib/apt"
|
|
||||||
}
|
|
||||||
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image by digest
|
- name: Build and push Docker image by digest
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
@@ -217,117 +75,130 @@ jobs:
|
|||||||
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
|
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
|
||||||
GIT_REMOTE_URL=${{github.event.repository.html_url }}
|
GIT_REMOTE_URL=${{github.event.repository.html_url }}
|
||||||
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
|
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
|
||||||
|
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
||||||
|
TARGET_CPU=
|
||||||
|
RUST_PROFILE=release
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
||||||
annotations: ${{ steps.meta.outputs.annotations }}
|
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
# cache-to: type=gha,mode=max
|
# cache-to: type=gha,mode=max
|
||||||
sbom: true
|
sbom: true
|
||||||
outputs: |
|
outputs: |
|
||||||
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', needs.define-variables.outputs.images_list) || format('type=image,"name={0}",push=false', needs.define-variables.outputs.images_list) }}
|
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
|
||||||
type=local,dest=/tmp/binaries
|
type=local,dest=/tmp/binaries
|
||||||
env:
|
env:
|
||||||
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||||
|
- name: Upload Docker artifacts
|
||||||
# For publishing multi-platform manifests
|
uses: ./.forgejo/actions/upload-docker-artifacts
|
||||||
- name: Export digest
|
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
|
||||||
run: |
|
|
||||||
mkdir -p /tmp/digests
|
|
||||||
digest="${{ steps.build.outputs.digest }}"
|
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
|
||||||
|
|
||||||
# Binary extracted via local output for all builds
|
|
||||||
- name: Rename extracted binary
|
|
||||||
run: mv /tmp/binaries/sbin/conduwuit /tmp/binaries/conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}
|
|
||||||
|
|
||||||
- name: Upload binary artifact
|
|
||||||
uses: forgejo/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}
|
slug: ${{ matrix.slug }}
|
||||||
path: /tmp/binaries/conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }}
|
cpu_suffix: ${{ steps.prepare.outputs.cpu_suffix }}
|
||||||
if-no-files-found: error
|
artifact_suffix: ""
|
||||||
|
digest_suffix: ""
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
|
|
||||||
- name: Upload digest
|
merge-release:
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
name: "Create Multi-arch Release Manifest"
|
||||||
uses: forgejo/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: digests-${{ matrix.slug }}
|
|
||||||
path: /tmp/digests/*
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
merge:
|
|
||||||
runs-on: dind
|
runs-on: dind
|
||||||
needs: [define-variables, build-image]
|
needs: build-release
|
||||||
steps:
|
steps:
|
||||||
- name: Download digests
|
- name: Checkout repository
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
uses: actions/checkout@v5
|
||||||
uses: forgejo/download-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
path: /tmp/digests
|
persist-credentials: false
|
||||||
pattern: digests-*
|
- name: Create multi-platform manifest
|
||||||
merge-multiple: true
|
uses: ./.forgejo/actions/create-docker-manifest
|
||||||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
|
|
||||||
- name: Login to builtin registry
|
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.BUILTIN_REGISTRY }}
|
digest_pattern: "digests-linux-{amd64,arm64}"
|
||||||
username: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
tag_suffix: ""
|
||||||
password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
images: ${{ env.IMAGE_PATH }}
|
||||||
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
||||||
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
build-maxperf:
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
name: "Build ${{ matrix.slug }} (max-perf)"
|
||||||
uses: docker/setup-buildx-action@v3
|
runs-on: dind
|
||||||
with:
|
needs: build-release
|
||||||
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
permissions:
|
||||||
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
contents: read
|
||||||
endpoint: ${{ env.BUILDKIT_ENDPOINT || '' }}
|
packages: write
|
||||||
|
attestations: write
|
||||||
|
id-token: write
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: "linux/amd64"
|
||||||
|
slug: "linux-amd64"
|
||||||
|
target_cpu: "haswell"
|
||||||
|
- platform: "linux/arm64"
|
||||||
|
slug: "linux-arm64"
|
||||||
|
target_cpu: ""
|
||||||
|
|
||||||
- name: Extract metadata (tags) for Docker
|
steps:
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
- name: Checkout repository
|
||||||
id: meta
|
uses: actions/checkout@v5
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
with:
|
||||||
tags: |
|
persist-credentials: false
|
||||||
type=semver,pattern={{version}},prefix=v
|
- name: Prepare max-perf Docker build environment
|
||||||
type=semver,pattern={{major}}.{{minor}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.0.') }},prefix=v
|
id: prepare
|
||||||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }},prefix=v
|
uses: ./.forgejo/actions/prepare-docker-build
|
||||||
type=ref,event=branch,prefix=${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref && 'branch-' || '' }}
|
with:
|
||||||
type=ref,event=pr
|
platform: ${{ matrix.platform }}
|
||||||
type=sha,format=long
|
slug: ${{ matrix.slug }}
|
||||||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
target_cpu: ${{ matrix.target_cpu }}
|
||||||
images: ${{needs.define-variables.outputs.images}}
|
profile: "release-max-perf"
|
||||||
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
images: ${{ env.IMAGE_PATH }}
|
||||||
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
||||||
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push max-perf Docker image by digest
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: "docker/Dockerfile"
|
||||||
|
build-args: |
|
||||||
|
GIT_COMMIT_HASH=${{ github.sha }}
|
||||||
|
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
|
||||||
|
GIT_REMOTE_URL=${{github.event.repository.html_url }}
|
||||||
|
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
|
||||||
|
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
||||||
|
TARGET_CPU=${{ matrix.target_cpu }}
|
||||||
|
RUST_PROFILE=release-max-perf
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
||||||
|
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
||||||
|
cache-from: type=gha
|
||||||
|
# cache-to: type=gha,mode=max
|
||||||
|
sbom: true
|
||||||
|
outputs: |
|
||||||
|
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
|
||||||
|
type=local,dest=/tmp/binaries
|
||||||
env:
|
env:
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||||
|
- name: Upload max-perf Docker artifacts
|
||||||
|
uses: ./.forgejo/actions/upload-docker-artifacts
|
||||||
|
with:
|
||||||
|
slug: ${{ matrix.slug }}
|
||||||
|
cpu_suffix: ${{ steps.prepare.outputs.cpu_suffix }}
|
||||||
|
artifact_suffix: "-maxperf"
|
||||||
|
digest_suffix: "-maxperf"
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
|
|
||||||
- name: Create manifest list and push
|
merge-maxperf:
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
name: "Create Max-Perf Manifest"
|
||||||
working-directory: /tmp/digests
|
runs-on: dind
|
||||||
env:
|
needs: build-maxperf
|
||||||
IMAGES: ${{needs.define-variables.outputs.images}}
|
steps:
|
||||||
shell: bash
|
- name: Checkout repository
|
||||||
run: |
|
uses: actions/checkout@v5
|
||||||
IFS=$'\n'
|
with:
|
||||||
IMAGES_LIST=($IMAGES)
|
persist-credentials: false
|
||||||
ANNOTATIONS_LIST=($DOCKER_METADATA_OUTPUT_ANNOTATIONS)
|
- name: Create max-perf manifest
|
||||||
TAGS_LIST=($DOCKER_METADATA_OUTPUT_TAGS)
|
uses: ./.forgejo/actions/create-docker-manifest
|
||||||
for REPO in "${IMAGES_LIST[@]}"; do
|
with:
|
||||||
docker buildx imagetools create \
|
digest_pattern: "digests-maxperf-linux-{amd64-haswell,arm64}"
|
||||||
$(for tag in "${TAGS_LIST[@]}"; do echo "--tag"; echo "$tag"; done) \
|
tag_suffix: "-maxperf"
|
||||||
$(for annotation in "${ANNOTATIONS_LIST[@]}"; do echo "--annotation"; echo "$annotation"; done) \
|
images: ${{ env.IMAGE_PATH }}
|
||||||
$(for reference in *; do printf "$REPO@sha256:%s\n" $reference; done)
|
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
||||||
done
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Inspect image
|
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
|
||||||
env:
|
|
||||||
IMAGES: ${{needs.define-variables.outputs.images}}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
IMAGES_LIST=($IMAGES)
|
|
||||||
for REPO in "${IMAGES_LIST[@]}"; do
|
|
||||||
docker buildx imagetools inspect $REPO:${{ steps.meta.outputs.version }}
|
|
||||||
done
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
name: Maintenance / Renovate
|
name: Maintenance / Renovate
|
||||||
|
|
||||||
|
enable-email-notifications: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# Run at 5am UTC daily to avoid late-night dev
|
# Run at 5am UTC daily to avoid late-night dev
|
||||||
@@ -10,10 +12,10 @@ on:
|
|||||||
dryRun:
|
dryRun:
|
||||||
description: 'Dry run mode'
|
description: 'Dry run mode'
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: ''
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- null
|
- ''
|
||||||
- 'extract'
|
- 'extract'
|
||||||
- 'lookup'
|
- 'lookup'
|
||||||
- 'full'
|
- 'full'
|
||||||
@@ -23,6 +25,7 @@ on:
|
|||||||
default: 'info'
|
default: 'info'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
|
- 'debug'
|
||||||
- 'info'
|
- 'info'
|
||||||
- 'warning'
|
- 'warning'
|
||||||
- 'critical'
|
- 'critical'
|
||||||
@@ -40,11 +43,11 @@ jobs:
|
|||||||
name: Renovate
|
name: Renovate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/renovatebot/renovate:41
|
image: ghcr.io/renovatebot/renovate:41.113.4@sha256:472f1a1d07a823da002be9ddf8507275517d3dc1bdcba4606ee3e62f1c27204a
|
||||||
options: --tmpfs /tmp:exec
|
options: --tmpfs /tmp:exec
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
show-progress: false
|
show-progress: false
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ jobs:
|
|||||||
run: /usr/local/renovate/node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
|
run: /usr/local/renovate/node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
|
||||||
|
|
||||||
- name: Restore renovate repo cache
|
- name: Restore renovate repo cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/repository
|
/tmp/renovate/cache/renovate/repository
|
||||||
@@ -61,7 +64,7 @@ jobs:
|
|||||||
repo-cache-
|
repo-cache-
|
||||||
|
|
||||||
- name: Restore renovate package cache
|
- name: Restore renovate package cache
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
@@ -69,8 +72,17 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
package-cache-
|
package-cache-
|
||||||
|
|
||||||
|
- name: Restore renovate OSV cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/tmp/osv
|
||||||
|
key: osv-cache-${{ github.run_id }}
|
||||||
|
restore-keys: |
|
||||||
|
osv-cache-
|
||||||
|
|
||||||
- name: Self-hosted Renovate
|
- name: Self-hosted Renovate
|
||||||
uses: https://github.com/renovatebot/github-action@v43.0.11
|
run: renovate
|
||||||
env:
|
env:
|
||||||
LOG_LEVEL: ${{ inputs.logLevel || 'info' }}
|
LOG_LEVEL: ${{ inputs.logLevel || 'info' }}
|
||||||
RENOVATE_DRY_RUN: ${{ inputs.dryRun || 'false' }}
|
RENOVATE_DRY_RUN: ${{ inputs.dryRun || 'false' }}
|
||||||
@@ -84,28 +96,37 @@ jobs:
|
|||||||
|
|
||||||
RENOVATE_REQUIRE_CONFIG: 'required'
|
RENOVATE_REQUIRE_CONFIG: 'required'
|
||||||
RENOVATE_ONBOARDING: 'false'
|
RENOVATE_ONBOARDING: 'false'
|
||||||
|
RENOVATE_INHERIT_CONFIG: 'true'
|
||||||
RENOVATE_PR_COMMITS_PER_RUN_LIMIT: 3
|
|
||||||
|
|
||||||
RENOVATE_GITHUB_TOKEN_WARN: 'false'
|
RENOVATE_GITHUB_TOKEN_WARN: 'false'
|
||||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
GITHUB_COM_TOKEN: ${{ secrets.GH_PUBLIC_RO }}
|
GITHUB_COM_TOKEN: ${{ secrets.GH_PUBLIC_RO || secrets.GH_TOKEN }}
|
||||||
|
|
||||||
RENOVATE_REPOSITORY_CACHE: 'enabled'
|
RENOVATE_REPOSITORY_CACHE: 'enabled'
|
||||||
RENOVATE_X_SQLITE_PACKAGE_CACHE: true
|
RENOVATE_X_SQLITE_PACKAGE_CACHE: 'true'
|
||||||
|
OSV_OFFLINE_ROOT_DIR: /tmp/osv
|
||||||
|
|
||||||
- name: Save renovate repo cache
|
- name: Save renovate repo cache
|
||||||
if: always() && env.RENOVATE_DRY_RUN != 'full'
|
if: always()
|
||||||
uses: https://github.com/actions/cache@v4
|
uses:
|
||||||
|
actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/repository
|
/tmp/renovate/cache/renovate/repository
|
||||||
key: repo-cache-${{ github.run_id }}
|
key: repo-cache-${{ github.run_id }}
|
||||||
|
|
||||||
- name: Save renovate package cache
|
- name: Save renovate package cache
|
||||||
if: always() && env.RENOVATE_DRY_RUN != 'full'
|
if: always()
|
||||||
uses: https://github.com/actions/cache@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
key: package-cache-${{ github.run_id }}
|
key: package-cache-${{ github.run_id }}
|
||||||
|
|
||||||
|
- name: Save renovate OSV cache
|
||||||
|
if: always()
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/tmp/osv
|
||||||
|
key: osv-cache-${{ github.run_id }}
|
||||||
@@ -13,6 +13,9 @@ extend-ignore-re = [
|
|||||||
"[0-9+][A-Za-z0-9+]{30,}[a-z0-9+]",
|
"[0-9+][A-Za-z0-9+]{30,}[a-z0-9+]",
|
||||||
"\\$[A-Z0-9+][A-Za-z0-9+]{6,}[a-z0-9+]",
|
"\\$[A-Z0-9+][A-Za-z0-9+]{6,}[a-z0-9+]",
|
||||||
"\\b[a-z0-9+/=][A-Za-z0-9+/=]{7,}[a-z0-9+/=][A-Z]\\b",
|
"\\b[a-z0-9+/=][A-Za-z0-9+/=]{7,}[a-z0-9+/=][A-Z]\\b",
|
||||||
|
|
||||||
|
# In the renovate config
|
||||||
|
".ontainer"
|
||||||
]
|
]
|
||||||
|
|
||||||
[default.extend-words]
|
[default.extend-words]
|
||||||
|
|||||||
Generated
+248
-260
File diff suppressed because it is too large.
Load diff
+6
-5
@@ -45,7 +45,7 @@ version = "0.3"
|
|||||||
features = ["ffi", "std", "union"]
|
features = ["ffi", "std", "union"]
|
||||||
|
|
||||||
[workspace.dependencies.const-str]
|
[workspace.dependencies.const-str]
|
||||||
version = "0.6.2"
|
version = "0.7.0"
|
||||||
|
|
||||||
[workspace.dependencies.ctor]
|
[workspace.dependencies.ctor]
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@@ -166,8 +166,8 @@ default-features = false
|
|||||||
features = ["raw_value"]
|
features = ["raw_value"]
|
||||||
|
|
||||||
# Used for appservice registration files
|
# Used for appservice registration files
|
||||||
[workspace.dependencies.serde_yaml]
|
[workspace.dependencies.serde_yml]
|
||||||
version = "0.9.34"
|
version = "0.0.12"
|
||||||
|
|
||||||
# Used to load forbidden room/user regex from config
|
# Used to load forbidden room/user regex from config
|
||||||
[workspace.dependencies.serde_regex]
|
[workspace.dependencies.serde_regex]
|
||||||
@@ -352,7 +352,7 @@ version = "0.1.2"
|
|||||||
[workspace.dependencies.ruma]
|
[workspace.dependencies.ruma]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/ruwuma"
|
git = "https://forgejo.ellis.link/continuwuation/ruwuma"
|
||||||
#branch = "conduwuit-changes"
|
#branch = "conduwuit-changes"
|
||||||
rev = "8fb268fa2771dfc3a1c8075ef1246e7c9a0a53fd"
|
rev = "78135227dceb9ce5eb9515b4ae85d452cdcabac8"
|
||||||
features = [
|
features = [
|
||||||
"compat",
|
"compat",
|
||||||
"rand",
|
"rand",
|
||||||
@@ -387,6 +387,7 @@ features = [
|
|||||||
"unstable-msc4210", # remove legacy mentions
|
"unstable-msc4210", # remove legacy mentions
|
||||||
"unstable-extensible-events",
|
"unstable-extensible-events",
|
||||||
"unstable-pdu",
|
"unstable-pdu",
|
||||||
|
"unstable-msc4155"
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies.rust-rocksdb]
|
[workspace.dependencies.rust-rocksdb]
|
||||||
@@ -602,7 +603,7 @@ rev = "e4ae7628fe4fcdacef9788c4c8415317a4489941"
|
|||||||
# Use 1-indexed line numbers when displaying parse error messages
|
# Use 1-indexed line numbers when displaying parse error messages
|
||||||
[patch.crates-io.resolv-conf]
|
[patch.crates-io.resolv-conf]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/resolv-conf"
|
git = "https://forgejo.ellis.link/continuwuation/resolv-conf"
|
||||||
rev = "56251316cc4127bcbf36e68ce5e2093f4d33e227"
|
rev = "ebbbec1cb965b487a0150f5d007e96c05e3d72af"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Our crates
|
# Our crates
|
||||||
|
|||||||
+14
-5
@@ -48,11 +48,13 @@ EOF
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.13.0
|
ENV BINSTALL_VERSION=1.15.4
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
ENV LDDTREE_VERSION=0.3.7
|
ENV LDDTREE_VERSION=0.3.7
|
||||||
|
# renovate: datasource=crate depName=timelord-cli
|
||||||
|
ENV TIMELORD_VERSION=3.0.1
|
||||||
|
|
||||||
# Install unpackaged tools
|
# Install unpackaged tools
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
@@ -60,6 +62,7 @@ RUN <<EOF
|
|||||||
curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
cargo binstall --no-confirm cargo-sbom --version $CARGO_SBOM_VERSION
|
cargo binstall --no-confirm cargo-sbom --version $CARGO_SBOM_VERSION
|
||||||
cargo binstall --no-confirm lddtree --version $LDDTREE_VERSION
|
cargo binstall --no-confirm lddtree --version $LDDTREE_VERSION
|
||||||
|
cargo binstall --no-confirm timelord-cli --version $TIMELORD_VERSION
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Set up xx (cross-compilation scripts)
|
# Set up xx (cross-compilation scripts)
|
||||||
@@ -81,8 +84,9 @@ RUN rustc --version \
|
|||||||
&& xx-cargo --setup-target-triple
|
&& xx-cargo --setup-target-triple
|
||||||
|
|
||||||
# Build binary
|
# Build binary
|
||||||
# We disable incremental compilation to save disk space, as it only produces a minimal speedup for this case.
|
# Configure incremental compilation based on build context
|
||||||
RUN echo "CARGO_INCREMENTAL=0" >> /etc/environment
|
ARG CARGO_INCREMENTAL=0
|
||||||
|
RUN echo "CARGO_INCREMENTAL=${CARGO_INCREMENTAL}" >> /etc/environment
|
||||||
|
|
||||||
# Configure pkg-config
|
# Configure pkg-config
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
@@ -133,6 +137,11 @@ FROM toolchain AS builder
|
|||||||
# Get source
|
# Get source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Restore timestamps from timelord cache if available
|
||||||
|
RUN --mount=type=cache,target=/timelord/ \
|
||||||
|
echo "Restoring timestamps from timelord cache"; \
|
||||||
|
timelord sync --source-dir /app --cache-dir /timelord;
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
# Verify environment configuration
|
# Verify environment configuration
|
||||||
@@ -172,8 +181,8 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|||||||
jq -r ".packages[] | select(.name == \"$PACKAGE\") | .targets[] | select( .kind | map(. == \"bin\") | any ) | .name"))
|
jq -r ".packages[] | select(.name == \"$PACKAGE\") | .targets[] | select( .kind | map(. == \"bin\") | any ) | .name"))
|
||||||
for BINARY in "${BINARIES[@]}"; do
|
for BINARY in "${BINARIES[@]}"; do
|
||||||
echo $BINARY
|
echo $BINARY
|
||||||
xx-verify $TARGET_DIR/$(xx-cargo --print-target-triple)/release/$BINARY
|
xx-verify $TARGET_DIR/$(xx-cargo --print-target-triple)/${RUST_PROFILE}/$BINARY
|
||||||
cp $TARGET_DIR/$(xx-cargo --print-target-triple)/release/$BINARY /out/sbin/$BINARY
|
cp $TARGET_DIR/$(xx-cargo --print-target-triple)/${RUST_PROFILE}/$BINARY /out/sbin/$BINARY
|
||||||
done
|
done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.13.0
|
ENV BINSTALL_VERSION=1.15.4
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
|
|||||||
Generated
+79
-123
@@ -10,11 +10,11 @@
|
|||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1751403276,
|
"lastModified": 1756403898,
|
||||||
"narHash": "sha256-V0EPQNsQko1a8OqIWc2lLviLnMpR1m08Ej00z5RVTfs=",
|
"narHash": "sha256-S4SJDmVTtbcXaJkYrMFkcA5SDrpfRHlBbzwp6IRRPAw=",
|
||||||
"owner": "zhaofengli",
|
"owner": "zhaofengli",
|
||||||
"repo": "attic",
|
"repo": "attic",
|
||||||
"rev": "896ad88fa57ad5dbcd267c0ac51f1b71ccfcb4dd",
|
"rev": "2524dd1c007bc7a0a9e9c863a1b02de8d54b319b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -29,14 +29,14 @@
|
|||||||
"devenv": "devenv",
|
"devenv": "devenv",
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
"git-hooks": "git-hooks",
|
"git-hooks": "git-hooks",
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748883665,
|
"lastModified": 1756385612,
|
||||||
"narHash": "sha256-R0W7uAg+BLoHjMRMQ8+oiSbTq8nkGz5RDpQ+ZfxxP3A=",
|
"narHash": "sha256-+NU5MMhuPHHRyvZZWNFG7zt+leRSPsJu1MwhOUzkPUk=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "cachix",
|
"repo": "cachix",
|
||||||
"rev": "f707778d902af4d62d8dd92c269f8e70de09acbe",
|
"rev": "dc24688cd67518c3711d511fa369c0f5a131063a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -58,16 +58,21 @@
|
|||||||
],
|
],
|
||||||
"git-hooks": [
|
"git-hooks": [
|
||||||
"cachix",
|
"cachix",
|
||||||
"devenv"
|
"devenv",
|
||||||
|
"git-hooks"
|
||||||
],
|
],
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": [
|
||||||
|
"cachix",
|
||||||
|
"devenv",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744206633,
|
"lastModified": 1748883665,
|
||||||
"narHash": "sha256-pb5aYkE8FOoa4n123slgHiOf1UbNSnKe5pEZC+xXD5g=",
|
"narHash": "sha256-R0W7uAg+BLoHjMRMQ8+oiSbTq8nkGz5RDpQ+ZfxxP3A=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "cachix",
|
"repo": "cachix",
|
||||||
"rev": "8a60090640b96f9df95d1ab99e5763a586be1404",
|
"rev": "f707778d902af4d62d8dd92c269f8e70de09acbe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -78,18 +83,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"attic",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722960479,
|
"lastModified": 1751562746,
|
||||||
"narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=",
|
"narHash": "sha256-smpugNIkmDeicNz301Ll1bD7nFOty97T79m4GUMUczA=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4",
|
"rev": "aed2020fd3dc26e1e857d4107a5a67a33ab6c1fd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -100,11 +99,11 @@
|
|||||||
},
|
},
|
||||||
"crane_2": {
|
"crane_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750266157,
|
"lastModified": 1757183466,
|
||||||
"narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=",
|
"narHash": "sha256-kTdCCMuRE+/HNHES5JYsbRHmgtr+l9mOtf5dpcMppVc=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "e37c943371b73ed87faf33f7583860f81f1d5a48",
|
"rev": "d599ae4847e7f87603e7082d73ca673aa93c916d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -132,11 +131,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748273445,
|
"lastModified": 1754404745,
|
||||||
"narHash": "sha256-5V0dzpNgQM0CHDsMzh+ludYeu1S+Y+IMjbaskSSdFh0=",
|
"narHash": "sha256-BdbW/iTImczgcuATgQIa9sPGuYIBxVq2xqcvICsa2AQ=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "devenv",
|
"repo": "devenv",
|
||||||
"rev": "668a50d8b7bdb19a0131f53c9f6c25c9071e1ffb",
|
"rev": "6563b21105168f90394dfaf58284b078af2d7275",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -153,11 +152,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1755585599,
|
"lastModified": 1757400094,
|
||||||
"narHash": "sha256-tl/0cnsqB/Yt7DbaGMel2RLa7QG5elA8lkaOXli6VdY=",
|
"narHash": "sha256-5Rcs6juMoMTaMJSR1glravl4QB9yLAFBD8s7KLi4kdQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "6ed03ef4c8ec36d193c18e06b9ecddde78fb7e42",
|
"rev": "0682b9b518792c9428865c511a4c40c9ad85c243",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -170,11 +169,11 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696426674,
|
"lastModified": 1747046372,
|
||||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -224,11 +223,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722555600,
|
"lastModified": 1751413152,
|
||||||
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -247,11 +246,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712014858,
|
"lastModified": 1733312601,
|
||||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -292,11 +291,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747372754,
|
"lastModified": 1750779888,
|
||||||
"narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=",
|
"narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
|
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -327,31 +326,24 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libgit2": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1697646580,
|
|
||||||
"narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=",
|
|
||||||
"owner": "libgit2",
|
|
||||||
"repo": "libgit2",
|
|
||||||
"rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "libgit2",
|
|
||||||
"repo": "libgit2",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix": {
|
"nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": [
|
"flake-compat": [
|
||||||
"cachix",
|
"cachix",
|
||||||
"devenv"
|
"devenv",
|
||||||
|
"flake-compat"
|
||||||
],
|
],
|
||||||
"flake-parts": "flake-parts_2",
|
"flake-parts": "flake-parts_2",
|
||||||
"libgit2": "libgit2",
|
"git-hooks-nix": [
|
||||||
"nixpkgs": "nixpkgs_3",
|
"cachix",
|
||||||
|
"devenv",
|
||||||
|
"git-hooks"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"cachix",
|
||||||
|
"devenv",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
"nixpkgs-23-11": [
|
"nixpkgs-23-11": [
|
||||||
"cachix",
|
"cachix",
|
||||||
"devenv"
|
"devenv"
|
||||||
@@ -359,23 +351,19 @@
|
|||||||
"nixpkgs-regression": [
|
"nixpkgs-regression": [
|
||||||
"cachix",
|
"cachix",
|
||||||
"devenv"
|
"devenv"
|
||||||
],
|
|
||||||
"pre-commit-hooks": [
|
|
||||||
"cachix",
|
|
||||||
"devenv"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745930071,
|
"lastModified": 1752773918,
|
||||||
"narHash": "sha256-bYyjarS3qSNqxfgc89IoVz8cAFDkF9yPE63EJr+h50s=",
|
"narHash": "sha256-dOi/M6yNeuJlj88exI+7k154z+hAhFcuB8tZktiW7rg=",
|
||||||
"owner": "domenkozar",
|
"owner": "cachix",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"rev": "b455edf3505f1bf0172b39a735caef94687d0d9c",
|
"rev": "031c3cf42d2e9391eee373507d8c12e0f9606779",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "domenkozar",
|
"owner": "cachix",
|
||||||
"ref": "devenv-2.24",
|
"ref": "devenv-2.30",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -404,11 +392,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729742964,
|
"lastModified": 1737420293,
|
||||||
"narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=",
|
"narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-github-actions",
|
"repo": "nix-github-actions",
|
||||||
"rev": "e04df33f62cdcf93d73e9a04142464753a16db67",
|
"rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -419,11 +407,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726042813,
|
"lastModified": 1751949589,
|
||||||
"narHash": "sha256-LnNKCCxnwgF+575y0pxUdlGZBO/ru1CtGHIqQVfvjlA=",
|
"narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "159be5db480d1df880a0135ca0bfed84c2f88353",
|
"rev": "9b008d60392981ad674e04016d25619281550a9d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -435,27 +423,27 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724316499,
|
"lastModified": 1751741127,
|
||||||
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=",
|
"narHash": "sha256-t75Shs76NgxjZSgvvZZ9qOmz5zuBE8buUaYD28BMTxg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841",
|
"rev": "29e290002bfff26af1db6f64d070698019460302",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-24.05",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733212471,
|
"lastModified": 1754214453,
|
||||||
"narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
|
"narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
|
"rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -467,43 +455,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717432640,
|
"lastModified": 1757034884,
|
||||||
"narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=",
|
"narHash": "sha256-PgLSZDBEWUHpfTRfFyklmiiLBE1i1aGCtz4eRA3POao=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "88269ab3044128b7c2f4c7d68448b2fb50456870",
|
"rev": "ca77296380960cd497a765102eeb1356eb80fed0",
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "release-24.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_4": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1748190013,
|
|
||||||
"narHash": "sha256-R5HJFflOfsP5FBtk+zE8FpL8uqE7n62jqOsADvVshhE=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "62b852f6c6742134ade1abdd2a21685fd617a291",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_5": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1751498133,
|
|
||||||
"narHash": "sha256-QWJ+NQbMU+NcU2xiyo7SNox1fAuwksGlQhpzBl76g1I=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "d55716bb59b91ae9d1ced4b1ccdea7a442ecbfdb",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -522,17 +478,17 @@
|
|||||||
"flake-compat": "flake-compat_3",
|
"flake-compat": "flake-compat_3",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nix-filter": "nix-filter",
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs_5"
|
"nixpkgs": "nixpkgs_3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1755504847,
|
"lastModified": 1757362324,
|
||||||
"narHash": "sha256-VX0B9hwhJypCGqncVVLC+SmeMVd/GAYbJZ0MiiUn2Pk=",
|
"narHash": "sha256-/PAhxheUq4WBrW5i/JHzcCqK5fGWwLKdH6/Lu1tyS18=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "a905e3b21b144d77e1b304e49f3264f6f8d4db75",
|
"rev": "9edc9cbe5d8e832b5864e09854fa94861697d2fd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+44
-15
@@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended"],
|
"extends": ["config:recommended", "replacements:all"],
|
||||||
|
"osvVulnerabilityAlerts": true,
|
||||||
"lockFileMaintenance": {
|
"lockFileMaintenance": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"schedule": ["at any time"]
|
"schedule": ["at any time"]
|
||||||
},
|
},
|
||||||
|
"platformAutomerge": true,
|
||||||
"nix": {
|
"nix": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
@@ -29,10 +31,15 @@
|
|||||||
},
|
},
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"description": "Batch minor and patch GitHub Actions updates",
|
"description": "Batch patch-level Rust dependency updates",
|
||||||
"matchManagers": ["github-actions"],
|
"matchManagers": ["cargo"],
|
||||||
"matchUpdateTypes": ["minor", "patch"],
|
"matchUpdateTypes": ["patch"],
|
||||||
"groupName": "github-actions-non-major"
|
"groupName": "rust-patch-updates"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Limit concurrent Cargo PRs",
|
||||||
|
"matchManagers": ["cargo"],
|
||||||
|
"prConcurrentLimit": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Group Rust toolchain updates into a single PR",
|
"description": "Group Rust toolchain updates into a single PR",
|
||||||
@@ -40,20 +47,42 @@
|
|||||||
"matchPackageNames": ["rust", "rustc", "cargo"],
|
"matchPackageNames": ["rust", "rustc", "cargo"],
|
||||||
"groupName": "rust-toolchain"
|
"groupName": "rust-toolchain"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Batch minor and patch GitHub Actions updates",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"matchUpdateTypes": ["minor", "patch"],
|
||||||
|
"groupName": "github-actions-non-major"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Pin forgejo artifact actions to prevent breaking changes",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"matchPackageNames": ["forgejo/upload-artifact", "forgejo/download-artifact"],
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Auto-merge renovatebot docker image updates",
|
||||||
|
"matchDatasources": ["docker"],
|
||||||
|
"matchPackageNames": ["ghcr.io/renovatebot/renovate"],
|
||||||
|
"automerge": true,
|
||||||
|
"automergeStrategy": "fast-forward"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Group lockfile updates into a single PR",
|
"description": "Group lockfile updates into a single PR",
|
||||||
"matchUpdateTypes": ["lockFileMaintenance"],
|
"matchUpdateTypes": ["lockFileMaintenance"],
|
||||||
"groupName": "lockfile-maintenance"
|
"groupName": "lockfile-maintenance"
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Batch patch-level Rust dependency updates",
|
|
||||||
"matchManagers": ["cargo"],
|
|
||||||
"matchUpdateTypes": ["patch"],
|
|
||||||
"groupName": "rust-patch-updates"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchManagers": ["cargo"],
|
|
||||||
"prConcurrentLimit": 5
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"customManagers": [
|
||||||
|
{
|
||||||
|
"customType": "regex",
|
||||||
|
"description": "Update _VERSION variables in Dockerfiles",
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$/",
|
||||||
|
"/(^|/|\\.)([Dd]ocker|[Cc]ontainer)file$/"
|
||||||
|
],
|
||||||
|
"matchStrings": [
|
||||||
|
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s+(?:ENV|ARG)\\s+[A-Za-z0-9_]+?_VERSION[ =][\"']?(?<currentValue>.+?)[\"']?\\s"
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ futures.workspace = true
|
|||||||
log.workspace = true
|
log.workspace = true
|
||||||
ruma.workspace = true
|
ruma.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_yaml.workspace = true
|
serde_yml.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub(super) async fn register(&self) -> Result {
|
|||||||
|
|
||||||
let range = 1..checked!(body_len - 1)?;
|
let range = 1..checked!(body_len - 1)?;
|
||||||
let appservice_config_body = body[range].join("\n");
|
let appservice_config_body = body[range].join("\n");
|
||||||
let parsed_config = serde_yaml::from_str(&appservice_config_body);
|
let parsed_config = serde_yml::from_str(&appservice_config_body);
|
||||||
match parsed_config {
|
match parsed_config {
|
||||||
| Err(e) => return Err!("Could not parse appservice config as YAML: {e}"),
|
| Err(e) => return Err!("Could not parse appservice config as YAML: {e}"),
|
||||||
| Ok(registration) => match self
|
| Ok(registration) => match self
|
||||||
@@ -57,7 +57,7 @@ pub(super) async fn show_appservice_config(&self, appservice_identifier: String)
|
|||||||
{
|
{
|
||||||
| None => return Err!("Appservice does not exist."),
|
| None => return Err!("Appservice does not exist."),
|
||||||
| Some(config) => {
|
| Some(config) => {
|
||||||
let config_str = serde_yaml::to_string(&config)?;
|
let config_str = serde_yml::to_string(&config)?;
|
||||||
write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```")
|
write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-32
@@ -405,41 +405,36 @@ pub(crate) async fn register_route(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if (!is_guest && body.inhibit_login)
|
// Generate new device id if the user didn't specify one
|
||||||
|
let no_device = body.inhibit_login
|
||||||
|| body
|
|| body
|
||||||
.appservice_info
|
.appservice_info
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|appservice| appservice.registration.device_management)
|
.is_some_and(|aps| aps.registration.device_management);
|
||||||
{
|
let (token, device) = if !no_device {
|
||||||
return Ok(register::v3::Response {
|
// Don't create a device for inhibited logins
|
||||||
access_token: None,
|
let device_id = if is_guest { None } else { body.device_id.clone() }
|
||||||
user_id,
|
.unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into());
|
||||||
device_id: None,
|
|
||||||
refresh_token: None,
|
|
||||||
expires_in: None,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate new device id if the user didn't specify one
|
// Generate new token for the device
|
||||||
let device_id = if is_guest { None } else { body.device_id.clone() }
|
let new_token = utils::random_string(TOKEN_LENGTH);
|
||||||
.unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into());
|
|
||||||
|
|
||||||
// Generate new token for the device
|
// Create device for this account
|
||||||
let token = utils::random_string(TOKEN_LENGTH);
|
services
|
||||||
|
.users
|
||||||
// Create device for this account
|
.create_device(
|
||||||
services
|
&user_id,
|
||||||
.users
|
&device_id,
|
||||||
.create_device(
|
&new_token,
|
||||||
&user_id,
|
body.initial_device_display_name.clone(),
|
||||||
&device_id,
|
Some(client.to_string()),
|
||||||
&token,
|
)
|
||||||
body.initial_device_display_name.clone(),
|
.await?;
|
||||||
Some(client.to_string()),
|
debug_info!(%user_id, %device_id, "User account was created");
|
||||||
)
|
(Some(new_token), Some(device_id))
|
||||||
.await?;
|
} else {
|
||||||
|
(None, None)
|
||||||
debug_info!(%user_id, %device_id, "User account was created");
|
};
|
||||||
|
|
||||||
let device_display_name = body.initial_device_display_name.as_deref().unwrap_or("");
|
let device_display_name = body.initial_device_display_name.as_deref().unwrap_or("");
|
||||||
|
|
||||||
@@ -583,9 +578,9 @@ pub(crate) async fn register_route(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(register::v3::Response {
|
Ok(register::v3::Response {
|
||||||
access_token: Some(token),
|
access_token: token,
|
||||||
user_id,
|
user_id,
|
||||||
device_id: Some(device_id),
|
device_id: device,
|
||||||
refresh_token: None,
|
refresh_token: None,
|
||||||
expires_in: None,
|
expires_in: None,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ pub(crate) async fn get_context_route(
|
|||||||
let state_at = events_after
|
let state_at = events_after
|
||||||
.last()
|
.last()
|
||||||
.map(ref_at!(1))
|
.map(ref_at!(1))
|
||||||
.map_or(body.event_id.as_ref(), |pdu| pdu.event_id.as_ref());
|
.map_or_else(|| body.event_id.as_ref(), |pdu| pdu.event_id.as_ref());
|
||||||
|
|
||||||
let state_ids = services
|
let state_ids = services
|
||||||
.rooms
|
.rooms
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result,
|
Err, Result,
|
||||||
@@ -226,7 +224,8 @@ pub(crate) async fn get_avatar_url_route(
|
|||||||
|
|
||||||
/// # `GET /_matrix/client/v3/profile/{userId}`
|
/// # `GET /_matrix/client/v3/profile/{userId}`
|
||||||
///
|
///
|
||||||
/// Returns the displayname, avatar_url, blurhash, and tz of the user.
|
/// Returns the displayname, avatar_url, blurhash, and custom profile fields of
|
||||||
|
/// the user.
|
||||||
///
|
///
|
||||||
/// - If user is on another server and we do not have a local copy already,
|
/// - If user is on another server and we do not have a local copy already,
|
||||||
/// fetch profile over federation.
|
/// fetch profile over federation.
|
||||||
@@ -260,9 +259,6 @@ pub(crate) async fn get_profile_route(
|
|||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
.set_blurhash(&body.user_id, response.blurhash.clone());
|
.set_blurhash(&body.user_id, response.blurhash.clone());
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_timezone(&body.user_id, response.tz.clone());
|
|
||||||
|
|
||||||
for (profile_key, profile_key_value) in &response.custom_profile_fields {
|
for (profile_key, profile_key_value) in &response.custom_profile_fields {
|
||||||
services.users.set_profile_key(
|
services.users.set_profile_key(
|
||||||
@@ -276,7 +272,6 @@ pub(crate) async fn get_profile_route(
|
|||||||
displayname: response.displayname,
|
displayname: response.displayname,
|
||||||
avatar_url: response.avatar_url,
|
avatar_url: response.avatar_url,
|
||||||
blurhash: response.blurhash,
|
blurhash: response.blurhash,
|
||||||
tz: response.tz,
|
|
||||||
custom_profile_fields: response.custom_profile_fields,
|
custom_profile_fields: response.custom_profile_fields,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -288,21 +283,11 @@ pub(crate) async fn get_profile_route(
|
|||||||
return Err!(Request(NotFound("Profile was not found.")));
|
return Err!(Request(NotFound("Profile was not found.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut custom_profile_fields: BTreeMap<String, serde_json::Value> = services
|
let (avatar_url, blurhash, displayname, custom_profile_fields) = join4(
|
||||||
.users
|
|
||||||
.all_profile_keys(&body.user_id)
|
|
||||||
.collect()
|
|
||||||
.await;
|
|
||||||
|
|
||||||
// services.users.timezone will collect the MSC4175 timezone key if it exists
|
|
||||||
custom_profile_fields.remove("us.cloke.msc4175.tz");
|
|
||||||
custom_profile_fields.remove("m.tz");
|
|
||||||
|
|
||||||
let (avatar_url, blurhash, displayname, tz) = join4(
|
|
||||||
services.users.avatar_url(&body.user_id).ok(),
|
services.users.avatar_url(&body.user_id).ok(),
|
||||||
services.users.blurhash(&body.user_id).ok(),
|
services.users.blurhash(&body.user_id).ok(),
|
||||||
services.users.displayname(&body.user_id).ok(),
|
services.users.displayname(&body.user_id).ok(),
|
||||||
services.users.timezone(&body.user_id).ok(),
|
services.users.all_profile_keys(&body.user_id).collect(),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@@ -310,7 +295,6 @@ pub(crate) async fn get_profile_route(
|
|||||||
avatar_url,
|
avatar_url,
|
||||||
blurhash,
|
blurhash,
|
||||||
displayname,
|
displayname,
|
||||||
tz,
|
|
||||||
custom_profile_fields,
|
custom_profile_fields,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-20
@@ -1,4 +1,4 @@
|
|||||||
use std::{fmt::Write as _, ops::Mul, time::Duration};
|
use std::{fmt::Write as _, time::Duration};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
@@ -12,7 +12,6 @@ use ruma::{
|
|||||||
room::{report_content, report_room},
|
room::{report_content, report_room},
|
||||||
},
|
},
|
||||||
events::{Mentions, room::message::RoomMessageEventContent},
|
events::{Mentions, room::message::RoomMessageEventContent},
|
||||||
int,
|
|
||||||
};
|
};
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
@@ -25,7 +24,6 @@ struct Report {
|
|||||||
user_id: Option<OwnedUserId>,
|
user_id: Option<OwnedUserId>,
|
||||||
report_type: String,
|
report_type: String,
|
||||||
reason: Option<String>,
|
reason: Option<String>,
|
||||||
score: Option<ruma::Int>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
||||||
@@ -50,6 +48,15 @@ pub(crate) async fn report_room_route(
|
|||||||
|
|
||||||
delay_response().await;
|
delay_response().await;
|
||||||
|
|
||||||
|
// We log this early in case the room ID does actually exist, in which case
|
||||||
|
// admins who scan their logs can see the report and choose to investigate at
|
||||||
|
// their discretion.
|
||||||
|
info!(
|
||||||
|
"Received room report by user {sender_user} for room {} with reason: \"{}\"",
|
||||||
|
body.room_id,
|
||||||
|
body.reason.as_deref().unwrap_or("")
|
||||||
|
);
|
||||||
|
|
||||||
if !services
|
if !services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
@@ -60,11 +67,6 @@ pub(crate) async fn report_room_route(
|
|||||||
"Room does not exist to us, no local users have joined at all"
|
"Room does not exist to us, no local users have joined at all"
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
info!(
|
|
||||||
"Received room report by user {sender_user} for room {} with reason: \"{}\"",
|
|
||||||
body.room_id,
|
|
||||||
body.reason.as_deref().unwrap_or("")
|
|
||||||
);
|
|
||||||
|
|
||||||
let report = Report {
|
let report = Report {
|
||||||
sender: sender_user.to_owned(),
|
sender: sender_user.to_owned(),
|
||||||
@@ -73,7 +75,6 @@ pub(crate) async fn report_room_route(
|
|||||||
user_id: None,
|
user_id: None,
|
||||||
report_type: "room".to_owned(),
|
report_type: "room".to_owned(),
|
||||||
reason: body.reason.clone(),
|
reason: body.reason.clone(),
|
||||||
score: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.admin.send_message(build_report(report)).await.ok();
|
services.admin.send_message(build_report(report)).await.ok();
|
||||||
@@ -109,7 +110,6 @@ pub(crate) async fn report_event_route(
|
|||||||
&body.room_id,
|
&body.room_id,
|
||||||
sender_user,
|
sender_user,
|
||||||
body.reason.as_ref(),
|
body.reason.as_ref(),
|
||||||
body.score,
|
|
||||||
&pdu,
|
&pdu,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -127,7 +127,6 @@ pub(crate) async fn report_event_route(
|
|||||||
user_id: None,
|
user_id: None,
|
||||||
report_type: "event".to_owned(),
|
report_type: "event".to_owned(),
|
||||||
reason: body.reason.clone(),
|
reason: body.reason.clone(),
|
||||||
score: body.score,
|
|
||||||
};
|
};
|
||||||
services.admin.send_message(build_report(report)).await.ok();
|
services.admin.send_message(build_report(report)).await.ok();
|
||||||
|
|
||||||
@@ -166,7 +165,6 @@ pub(crate) async fn report_user_route(
|
|||||||
user_id: Some(body.user_id.clone()),
|
user_id: Some(body.user_id.clone()),
|
||||||
report_type: "user".to_owned(),
|
report_type: "user".to_owned(),
|
||||||
reason: body.reason.clone(),
|
reason: body.reason.clone(),
|
||||||
score: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
@@ -192,7 +190,6 @@ async fn is_event_report_valid(
|
|||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
sender_user: &UserId,
|
sender_user: &UserId,
|
||||||
reason: Option<&String>,
|
reason: Option<&String>,
|
||||||
score: Option<ruma::Int>,
|
|
||||||
pdu: &PduEvent,
|
pdu: &PduEvent,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
debug_info!(
|
debug_info!(
|
||||||
@@ -204,10 +201,6 @@ async fn is_event_report_valid(
|
|||||||
return Err!(Request(NotFound("Event ID does not belong to the reported room",)));
|
return Err!(Request(NotFound("Event ID does not belong to the reported room",)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if score.is_some_and(|s| s > int!(0) || s < int!(-100)) {
|
|
||||||
return Err!(Request(InvalidParam("Invalid score, must be within 0 to -100",)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if reason.as_ref().is_some_and(|s| s.len() > 750) {
|
if reason.as_ref().is_some_and(|s| s.len() > 750) {
|
||||||
return Err!(Request(
|
return Err!(Request(
|
||||||
InvalidParam("Reason too long, should be 750 characters or fewer",)
|
InvalidParam("Reason too long, should be 750 characters or fewer",)
|
||||||
@@ -240,9 +233,6 @@ fn build_report(report: Report) -> RoomMessageEventContent {
|
|||||||
if report.event_id.is_some() {
|
if report.event_id.is_some() {
|
||||||
let _ = writeln!(text, "- Reported Event ID: `{}`", report.event_id.unwrap());
|
let _ = writeln!(text, "- Reported Event ID: `{}`", report.event_id.unwrap());
|
||||||
}
|
}
|
||||||
if let Some(score) = report.score {
|
|
||||||
let _ = writeln!(text, "- User-supplied offensiveness score: {}%", score.mul(int!(-1)));
|
|
||||||
}
|
|
||||||
if let Some(reason) = report.reason {
|
if let Some(reason) = report.reason {
|
||||||
let _ = writeln!(text, "- Report Reason: {reason}");
|
let _ = writeln!(text, "- Report Reason: {reason}");
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-135
@@ -2,18 +2,14 @@ use std::collections::BTreeMap;
|
|||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{Err, Error, Result};
|
use conduwuit::{Err, Result};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedRoomId,
|
OwnedRoomId,
|
||||||
api::{
|
api::{
|
||||||
client::{
|
client::{
|
||||||
error::ErrorKind,
|
|
||||||
membership::mutual_rooms,
|
membership::mutual_rooms,
|
||||||
profile::{
|
profile::{delete_profile_key, get_profile_key, set_profile_key},
|
||||||
delete_profile_key, delete_timezone_key, get_profile_key, get_timezone_key,
|
|
||||||
set_profile_key, set_timezone_key,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
federation,
|
federation,
|
||||||
},
|
},
|
||||||
@@ -60,62 +56,6 @@ pub(crate) async fn get_mutual_rooms_route(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `DELETE /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
|
||||||
///
|
|
||||||
/// Deletes the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
|
||||||
///
|
|
||||||
/// - Also makes sure other users receive the update using presence EDUs
|
|
||||||
pub(crate) async fn delete_timezone_key_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<delete_timezone_key::unstable::Request>,
|
|
||||||
) -> Result<delete_timezone_key::unstable::Response> {
|
|
||||||
let sender_user = body.sender_user();
|
|
||||||
|
|
||||||
if *sender_user != body.user_id && body.appservice_info.is_none() {
|
|
||||||
return Err!(Request(Forbidden("You cannot update the profile of another user")));
|
|
||||||
}
|
|
||||||
|
|
||||||
services.users.set_timezone(&body.user_id, None);
|
|
||||||
|
|
||||||
if services.config.allow_local_presence {
|
|
||||||
// Presence update
|
|
||||||
services
|
|
||||||
.presence
|
|
||||||
.ping_presence(&body.user_id, &PresenceState::Online)
|
|
||||||
.await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(delete_timezone_key::unstable::Response {})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
|
||||||
///
|
|
||||||
/// Updates the `tz` (timezone) of a user, as per MSC4133 and MSC4175.
|
|
||||||
///
|
|
||||||
/// - Also makes sure other users receive the update using presence EDUs
|
|
||||||
pub(crate) async fn set_timezone_key_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<set_timezone_key::unstable::Request>,
|
|
||||||
) -> Result<set_timezone_key::unstable::Response> {
|
|
||||||
let sender_user = body.sender_user();
|
|
||||||
|
|
||||||
if *sender_user != body.user_id && body.appservice_info.is_none() {
|
|
||||||
return Err!(Request(Forbidden("You cannot update the profile of another user")));
|
|
||||||
}
|
|
||||||
|
|
||||||
services.users.set_timezone(&body.user_id, body.tz.clone());
|
|
||||||
|
|
||||||
if services.config.allow_local_presence {
|
|
||||||
// Presence update
|
|
||||||
services
|
|
||||||
.presence
|
|
||||||
.ping_presence(&body.user_id, &PresenceState::Online)
|
|
||||||
.await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(set_timezone_key::unstable::Response {})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/{field}`
|
/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/{field}`
|
||||||
///
|
///
|
||||||
/// Updates the profile key-value field of a user, as per MSC4133.
|
/// Updates the profile key-value field of a user, as per MSC4133.
|
||||||
@@ -150,19 +90,14 @@ pub(crate) async fn set_profile_key_route(
|
|||||||
)));
|
)));
|
||||||
};
|
};
|
||||||
|
|
||||||
if body
|
|
||||||
.kv_pair
|
|
||||||
.keys()
|
|
||||||
.any(|key| key.starts_with("u.") && !profile_key_value.is_string())
|
|
||||||
{
|
|
||||||
return Err!(Request(BadJson("u.* profile key fields must be strings")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if body.kv_pair.keys().any(|key| key.len() > 128) {
|
if body.kv_pair.keys().any(|key| key.len() > 128) {
|
||||||
return Err!(Request(BadJson("Key names cannot be longer than 128 bytes")));
|
return Err!(Request(BadJson("Key names cannot be longer than 128 bytes")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.key_name == "displayname" {
|
if body.key_name == "displayname" {
|
||||||
|
let Some(display_name) = profile_key_value.as_str() else {
|
||||||
|
return Err!(Request(BadJson("displayname must be a string")));
|
||||||
|
};
|
||||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
@@ -174,12 +109,15 @@ pub(crate) async fn set_profile_key_route(
|
|||||||
update_displayname(
|
update_displayname(
|
||||||
&services,
|
&services,
|
||||||
&body.user_id,
|
&body.user_id,
|
||||||
Some(profile_key_value.to_string()),
|
Some(display_name.to_owned()),
|
||||||
&all_joined_rooms,
|
&all_joined_rooms,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
} else if body.key_name == "avatar_url" {
|
} else if body.key_name == "avatar_url" {
|
||||||
let mxc = ruma::OwnedMxcUri::from(profile_key_value.to_string());
|
let Some(avatar_url) = profile_key_value.as_str() else {
|
||||||
|
return Err!(Request(BadJson("avatar_url must be a string")));
|
||||||
|
};
|
||||||
|
let mxc = ruma::OwnedMxcUri::from(avatar_url);
|
||||||
|
|
||||||
let all_joined_rooms: Vec<OwnedRoomId> = services
|
let all_joined_rooms: Vec<OwnedRoomId> = services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -268,70 +206,12 @@ pub(crate) async fn delete_profile_key_route(
|
|||||||
Ok(delete_profile_key::unstable::Response {})
|
Ok(delete_profile_key::unstable::Response {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz`
|
|
||||||
///
|
|
||||||
/// Returns the `timezone` of the user as per MSC4133 and MSC4175.
|
|
||||||
///
|
|
||||||
/// - If user is on another server and we do not have a local copy already fetch
|
|
||||||
/// `timezone` over federation
|
|
||||||
pub(crate) async fn get_timezone_key_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<get_timezone_key::unstable::Request>,
|
|
||||||
) -> Result<get_timezone_key::unstable::Response> {
|
|
||||||
if !services.globals.user_is_local(&body.user_id) {
|
|
||||||
// Create and update our local copy of the user
|
|
||||||
if let Ok(response) = services
|
|
||||||
.sending
|
|
||||||
.send_federation_request(
|
|
||||||
body.user_id.server_name(),
|
|
||||||
federation::query::get_profile_information::v1::Request {
|
|
||||||
user_id: body.user_id.clone(),
|
|
||||||
field: None, // we want the full user's profile to update locally as well
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
if !services.users.exists(&body.user_id).await {
|
|
||||||
services.users.create(&body.user_id, None, None).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_displayname(&body.user_id, response.displayname.clone());
|
|
||||||
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_avatar_url(&body.user_id, response.avatar_url.clone());
|
|
||||||
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_blurhash(&body.user_id, response.blurhash.clone());
|
|
||||||
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_timezone(&body.user_id, response.tz.clone());
|
|
||||||
|
|
||||||
return Ok(get_timezone_key::unstable::Response { tz: response.tz });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !services.users.exists(&body.user_id).await {
|
|
||||||
// Return 404 if this user doesn't exist and we couldn't fetch it over
|
|
||||||
// federation
|
|
||||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Profile was not found."));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(get_timezone_key::unstable::Response {
|
|
||||||
tz: services.users.timezone(&body.user_id).await.ok(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/{userId}/{field}}`
|
/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/{userId}/{field}}`
|
||||||
///
|
///
|
||||||
/// Gets the profile key-value field of a user, as per MSC4133.
|
/// Gets the profile key-value field of a user, as per MSC4133.
|
||||||
///
|
///
|
||||||
/// - If user is on another server and we do not have a local copy already fetch
|
/// - If user is on another server and we do not have a local copy already fetch
|
||||||
/// `timezone` over federation
|
/// the value over federation
|
||||||
pub(crate) async fn get_profile_key_route(
|
pub(crate) async fn get_profile_key_route(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_profile_key::unstable::Request>,
|
body: Ruma<get_profile_key::unstable::Request>,
|
||||||
@@ -367,10 +247,6 @@ pub(crate) async fn get_profile_key_route(
|
|||||||
.users
|
.users
|
||||||
.set_blurhash(&body.user_id, response.blurhash.clone());
|
.set_blurhash(&body.user_id, response.blurhash.clone());
|
||||||
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.set_timezone(&body.user_id, response.tz.clone());
|
|
||||||
|
|
||||||
match response.custom_profile_fields.get(&body.key_name) {
|
match response.custom_profile_fields.get(&body.key_name) {
|
||||||
| Some(value) => {
|
| Some(value) => {
|
||||||
profile_key_value.insert(body.key_name.clone(), value.clone());
|
profile_key_value.insert(body.key_name.clone(), value.clone());
|
||||||
|
|||||||
@@ -22,12 +22,9 @@ use crate::{client, server};
|
|||||||
pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
||||||
let config = &server.config;
|
let config = &server.config;
|
||||||
let mut router = router
|
let mut router = router
|
||||||
.ruma_route(&client::get_timezone_key_route)
|
|
||||||
.ruma_route(&client::get_profile_key_route)
|
.ruma_route(&client::get_profile_key_route)
|
||||||
.ruma_route(&client::set_profile_key_route)
|
.ruma_route(&client::set_profile_key_route)
|
||||||
.ruma_route(&client::delete_profile_key_route)
|
.ruma_route(&client::delete_profile_key_route)
|
||||||
.ruma_route(&client::set_timezone_key_route)
|
|
||||||
.ruma_route(&client::delete_timezone_key_route)
|
|
||||||
.ruma_route(&client::appservice_ping)
|
.ruma_route(&client::appservice_ping)
|
||||||
.ruma_route(&client::get_supported_versions_route)
|
.ruma_route(&client::get_supported_versions_route)
|
||||||
.ruma_route(&client::get_register_available_route)
|
.ruma_route(&client::get_register_available_route)
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ use ruma::{
|
|||||||
client::{
|
client::{
|
||||||
directory::get_public_rooms,
|
directory::get_public_rooms,
|
||||||
error::ErrorKind,
|
error::ErrorKind,
|
||||||
profile::{
|
profile::{get_avatar_url, get_display_name, get_profile, get_profile_key},
|
||||||
get_avatar_url, get_display_name, get_profile, get_profile_key, get_timezone_key,
|
|
||||||
},
|
|
||||||
voip::get_turn_server_info,
|
voip::get_turn_server_info,
|
||||||
},
|
},
|
||||||
federation::{authentication::XMatrix, openid::get_openid_userinfo},
|
federation::{authentication::XMatrix, openid::get_openid_userinfo},
|
||||||
@@ -89,8 +87,7 @@ pub(super) async fn auth(
|
|||||||
| &get_profile::v3::Request::METADATA
|
| &get_profile::v3::Request::METADATA
|
||||||
| &get_profile_key::unstable::Request::METADATA
|
| &get_profile_key::unstable::Request::METADATA
|
||||||
| &get_display_name::v3::Request::METADATA
|
| &get_display_name::v3::Request::METADATA
|
||||||
| &get_avatar_url::v3::Request::METADATA
|
| &get_avatar_url::v3::Request::METADATA => {
|
||||||
| &get_timezone_key::unstable::Request::METADATA => {
|
|
||||||
if services.server.config.require_auth_for_profile_requests {
|
if services.server.config.require_auth_for_profile_requests {
|
||||||
match token {
|
match token {
|
||||||
| Token::Appservice(_) | Token::User(_) => {
|
| Token::Appservice(_) | Token::User(_) => {
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ pub(crate) async fn get_profile_information_route(
|
|||||||
let mut displayname = None;
|
let mut displayname = None;
|
||||||
let mut avatar_url = None;
|
let mut avatar_url = None;
|
||||||
let mut blurhash = None;
|
let mut blurhash = None;
|
||||||
let mut tz = None;
|
|
||||||
let mut custom_profile_fields = BTreeMap::new();
|
let mut custom_profile_fields = BTreeMap::new();
|
||||||
|
|
||||||
match &body.field {
|
match &body.field {
|
||||||
@@ -107,7 +106,6 @@ pub(crate) async fn get_profile_information_route(
|
|||||||
displayname = services.users.displayname(&body.user_id).await.ok();
|
displayname = services.users.displayname(&body.user_id).await.ok();
|
||||||
avatar_url = services.users.avatar_url(&body.user_id).await.ok();
|
avatar_url = services.users.avatar_url(&body.user_id).await.ok();
|
||||||
blurhash = services.users.blurhash(&body.user_id).await.ok();
|
blurhash = services.users.blurhash(&body.user_id).await.ok();
|
||||||
tz = services.users.timezone(&body.user_id).await.ok();
|
|
||||||
custom_profile_fields = services
|
custom_profile_fields = services
|
||||||
.users
|
.users
|
||||||
.all_profile_keys(&body.user_id)
|
.all_profile_keys(&body.user_id)
|
||||||
@@ -116,15 +114,10 @@ pub(crate) async fn get_profile_information_route(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// services.users.timezone will collect the MSC4175 timezone key if it exists
|
|
||||||
custom_profile_fields.remove("us.cloke.msc4175.tz");
|
|
||||||
custom_profile_fields.remove("m.tz");
|
|
||||||
|
|
||||||
Ok(get_profile_information::v1::Response {
|
Ok(get_profile_information::v1::Response {
|
||||||
displayname,
|
displayname,
|
||||||
avatar_url,
|
avatar_url,
|
||||||
blurhash,
|
blurhash,
|
||||||
tz,
|
|
||||||
custom_profile_fields,
|
custom_profile_fields,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
+1
-1
@@ -92,7 +92,7 @@ ruma.workspace = true
|
|||||||
sanitize-filename.workspace = true
|
sanitize-filename.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_regex.workspace = true
|
serde_regex.workspace = true
|
||||||
serde_yaml.workspace = true
|
serde_yml.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smallstr.workspace = true
|
smallstr.workspace = true
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Yaml(#[from] serde_yaml::Error),
|
Yaml(#[from] serde_yml::Error),
|
||||||
|
|
||||||
// ruma/conduwuit
|
// ruma/conduwuit
|
||||||
#[error("Arithmetic operation failed: {0}")]
|
#[error("Arithmetic operation failed: {0}")]
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ fn init_user_agent() -> String { format!("{}/{}", name(), version()) }
|
|||||||
|
|
||||||
fn init_version() -> String {
|
fn init_version() -> String {
|
||||||
conduwuit_build_metadata::version_tag()
|
conduwuit_build_metadata::version_tag()
|
||||||
.map_or(SEMANTIC.to_owned(), |extra| format!("{SEMANTIC} ({extra})"))
|
.map_or_else(|| SEMANTIC.to_owned(), |extra| format!("{SEMANTIC} ({extra})"))
|
||||||
}
|
}
|
||||||
@@ -585,10 +585,11 @@ where
|
|||||||
(target_membership == MembershipState::Join).then_some(&power_levels.users_default)
|
(target_membership == MembershipState::Join).then_some(&power_levels.users_default)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut join_rules = JoinRule::Invite;
|
let join_rules = if let Some(jr) = &join_rules_event {
|
||||||
if let Some(jr) = &join_rules_event {
|
from_json_str::<RoomJoinRulesEventContent>(jr.content().get())?.join_rule
|
||||||
join_rules = from_json_str::<RoomJoinRulesEventContent>(jr.content().get())?.join_rule;
|
} else {
|
||||||
}
|
JoinRule::Invite
|
||||||
|
};
|
||||||
|
|
||||||
let power_levels_event_id = power_levels_event.as_ref().map(Event::event_id);
|
let power_levels_event_id = power_levels_event.as_ref().map(Event::event_id);
|
||||||
let sender_membership_event_id = sender_membership_event.as_ref().map(Event::event_id);
|
let sender_membership_event_id = sender_membership_event.as_ref().map(Event::event_id);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ impl BoolExt for bool {
|
|||||||
fn into_option(self) -> Option<()> { self.then_some(()) }
|
fn into_option(self) -> Option<()> { self.then_some(()) }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn into_result(self) -> Result<(), ()> { self.ok_or(()) }
|
fn into_result(self) -> Result<(), ()> { BoolExt::ok_or(self, ()) }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
|
fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
|
||||||
@@ -77,7 +77,7 @@ impl BoolExt for bool {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E> {
|
fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E> {
|
||||||
self.ok_or(err).map(|()| f())
|
BoolExt::ok_or(self, err).map(|()| f())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ rustyline-async.workspace = true
|
|||||||
rustyline-async.optional = true
|
rustyline-async.optional = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_yaml.workspace = true
|
serde_yml.workspace = true
|
||||||
sha2.workspace = true
|
sha2.workspace = true
|
||||||
termimad.workspace = true
|
termimad.workspace = true
|
||||||
termimad.optional = true
|
termimad.optional = true
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ impl Service {
|
|||||||
.id_appserviceregistrations
|
.id_appserviceregistrations
|
||||||
.get(id)
|
.get(id)
|
||||||
.await
|
.await
|
||||||
.and_then(|ref bytes| serde_yaml::from_slice(bytes).map_err(Into::into))
|
.and_then(|ref bytes| serde_yml::from_slice(bytes).map_err(Into::into))
|
||||||
.map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}")))
|
.map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -29,20 +29,19 @@ impl crate::Service for Service {
|
|||||||
let db = Data::new(&args);
|
let db = Data::new(&args);
|
||||||
let config = &args.server.config;
|
let config = &args.server.config;
|
||||||
|
|
||||||
let turn_secret =
|
let turn_secret = config.turn_secret_file.as_ref().map_or_else(
|
||||||
config
|
|| config.turn_secret.clone(),
|
||||||
.turn_secret_file
|
|path| {
|
||||||
.as_ref()
|
std::fs::read_to_string(path).unwrap_or_else(|e| {
|
||||||
.map_or(config.turn_secret.clone(), |path| {
|
error!("Failed to read the TURN secret file: {e}");
|
||||||
std::fs::read_to_string(path).unwrap_or_else(|e| {
|
|
||||||
error!("Failed to read the TURN secret file: {e}");
|
|
||||||
|
|
||||||
config.turn_secret.clone()
|
config.turn_secret.clone()
|
||||||
})
|
})
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
let registration_token = config.registration_token_file.as_ref().map_or(
|
let registration_token = config.registration_token_file.as_ref().map_or_else(
|
||||||
config.registration_token.clone(),
|
|| config.registration_token.clone(),
|
||||||
|path| {
|
|path| {
|
||||||
let Ok(token) = std::fs::read_to_string(path).inspect_err(|e| {
|
let Ok(token) = std::fs::read_to_string(path).inspect_err(|e| {
|
||||||
error!("Failed to read the registration token file: {e}");
|
error!("Failed to read the registration token file: {e}");
|
||||||
|
|||||||
@@ -439,13 +439,7 @@ impl Service {
|
|||||||
notifi.counts = NotificationCounts::default();
|
notifi.counts = NotificationCounts::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
if event_id_only {
|
if !event_id_only {
|
||||||
self.send_request(
|
|
||||||
&http.url,
|
|
||||||
send_event_notification::v1::Request::new(notifi),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
} else {
|
|
||||||
if *event.kind() == TimelineEventType::RoomEncrypted
|
if *event.kind() == TimelineEventType::RoomEncrypted
|
||||||
|| tweaks
|
|| tweaks
|
||||||
.iter()
|
.iter()
|
||||||
@@ -480,14 +474,11 @@ impl Service {
|
|||||||
.get_canonical_alias(event.room_id())
|
.get_canonical_alias(event.room_id())
|
||||||
.await
|
.await
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
self.send_request(
|
|
||||||
&http.url,
|
|
||||||
send_event_notification::v1::Request::new(notifi),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.send_request(&http.url, send_event_notification::v1::Request::new(notifi))
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
// TODO: Handle email
|
// TODO: Handle email
|
||||||
|
|||||||
+35
-31
@@ -1102,6 +1102,34 @@ impl Service {
|
|||||||
Ok(user_id)
|
Ok(user_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn parse_profile_kv(
|
||||||
|
&self,
|
||||||
|
user_id: &UserId,
|
||||||
|
key: &str,
|
||||||
|
value: Vec<u8>,
|
||||||
|
) -> Result<serde_json::Value> {
|
||||||
|
match serde_json::from_slice(&value) {
|
||||||
|
| Ok(value) => Ok(value),
|
||||||
|
| Err(error) => {
|
||||||
|
// Due to an old bug, some conduwuit databases have `us.cloke.msc4175.tz` user
|
||||||
|
// profile fields with raw strings instead of quoted JSON ones.
|
||||||
|
if key == "us.cloke.msc4175.tz" {
|
||||||
|
// TODO insert a hint about this being a cold path
|
||||||
|
debug_warn!(
|
||||||
|
"Fixing corrupt `us.cloke.msc4175.tz` field in the profile of {}",
|
||||||
|
user_id
|
||||||
|
);
|
||||||
|
let raw_tz = serde_json::Value::String(String::from_utf8(value)?);
|
||||||
|
self.set_profile_key(user_id, "us.cloke.msc4175.tz", Some(raw_tz.clone()));
|
||||||
|
Ok(raw_tz)
|
||||||
|
} else {
|
||||||
|
Err(error.into())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets a specific user profile key
|
/// Gets a specific user profile key
|
||||||
pub async fn profile_key(
|
pub async fn profile_key(
|
||||||
&self,
|
&self,
|
||||||
@@ -1113,7 +1141,7 @@ impl Service {
|
|||||||
.useridprofilekey_value
|
.useridprofilekey_value
|
||||||
.qry(&key)
|
.qry(&key)
|
||||||
.await
|
.await
|
||||||
.deserialized()
|
.and_then(|handle| self.parse_profile_kv(user_id, profile_key, handle.to_vec()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets all the user's profile keys and values in an iterator
|
/// Gets all the user's profile keys and values in an iterator
|
||||||
@@ -1121,14 +1149,18 @@ impl Service {
|
|||||||
&'a self,
|
&'a self,
|
||||||
user_id: &'a UserId,
|
user_id: &'a UserId,
|
||||||
) -> impl Stream<Item = (String, serde_json::Value)> + 'a + Send {
|
) -> impl Stream<Item = (String, serde_json::Value)> + 'a + Send {
|
||||||
type KeyVal = ((Ignore, String), serde_json::Value);
|
type KeyVal<'a> = ((Ignore, String), &'a [u8]);
|
||||||
|
|
||||||
let prefix = (user_id, Interfix);
|
let prefix = (user_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.useridprofilekey_value
|
.useridprofilekey_value
|
||||||
.stream_prefix(&prefix)
|
.stream_prefix(&prefix)
|
||||||
.ignore_err()
|
.ignore_err()
|
||||||
.map(|((_, key), val): KeyVal| (key, val))
|
.map(|((_, key), value): KeyVal<'_>| {
|
||||||
|
let value = self.parse_profile_kv(user_id, &key, value.to_vec())?;
|
||||||
|
Ok((key, value))
|
||||||
|
})
|
||||||
|
.ignore_err()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets a new profile key value, removes the key if value is None
|
/// Sets a new profile key value, removes the key if value is None
|
||||||
@@ -1148,34 +1180,6 @@ impl Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the timezone of a user.
|
|
||||||
pub async fn timezone(&self, user_id: &UserId) -> Result<String> {
|
|
||||||
// TODO: transparently migrate unstable key usage to the stable key once MSC4133
|
|
||||||
// and MSC4175 are stable, likely a remove/insert in this block.
|
|
||||||
|
|
||||||
// first check the unstable prefix then check the stable prefix
|
|
||||||
let unstable_key = (user_id, "us.cloke.msc4175.tz");
|
|
||||||
let stable_key = (user_id, "m.tz");
|
|
||||||
self.db
|
|
||||||
.useridprofilekey_value
|
|
||||||
.qry(&unstable_key)
|
|
||||||
.or_else(|_| self.db.useridprofilekey_value.qry(&stable_key))
|
|
||||||
.await
|
|
||||||
.deserialized()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets a new timezone or removes it if timezone is None.
|
|
||||||
pub fn set_timezone(&self, user_id: &UserId, timezone: Option<String>) {
|
|
||||||
// TODO: insert to the stable MSC4175 key when it's stable
|
|
||||||
let key = (user_id, "us.cloke.msc4175.tz");
|
|
||||||
|
|
||||||
if let Some(timezone) = timezone {
|
|
||||||
self.db.useridprofilekey_value.put_raw(key, &timezone);
|
|
||||||
} else {
|
|
||||||
self.db.useridprofilekey_value.del(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "ldap"))]
|
#[cfg(not(feature = "ldap"))]
|
||||||
pub async fn search_ldap(&self, _user_id: &UserId) -> Result<Vec<(String, bool)>> {
|
pub async fn search_ldap(&self, _user_id: &UserId) -> Result<Vec<(String, bool)>> {
|
||||||
Err!(FeatureDisabled("ldap"))
|
Err!(FeatureDisabled("ldap"))
|
||||||
|
|||||||
Reference in new issue
Block a user