mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-30 04:17:32 +00:00
Compare commits
383
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1b7710984 | ||
|
|
514c3bbcbf | ||
|
|
da7d8c9821 | ||
|
|
45809b7970 | ||
|
|
910925b906 | ||
|
|
28263982cd | ||
|
|
52a4b9d586 | ||
|
|
786890baa0 | ||
|
|
3282ba8eab | ||
|
|
f66c1d8f35 | ||
|
|
3d004b1923 | ||
|
|
06afe4f1a3 | ||
|
|
53d6887b86 | ||
|
|
8c77bd61e5 | ||
|
|
e649af33b9 | ||
|
|
e2fe166d63 | ||
|
|
4ee0bb7533 | ||
|
|
9a9cc94702 | ||
|
|
58a6e1232c | ||
|
|
c0cb4afd8a | ||
|
|
69163b5391 | ||
|
|
d4f6c053bc | ||
|
|
4f72326b07 | ||
|
|
b7e449f490 | ||
|
|
2a1d7e49d9 | ||
|
|
b7792f9e86 | ||
|
|
adfe9f9f53 | ||
|
|
8fe1715019 | ||
|
|
9a91dce600 | ||
|
|
eee4ef50d2 | ||
|
|
62e0b53f52 | ||
|
|
5fa3d5f6c8 | ||
|
|
9b80a99aa7 | ||
|
|
bd525c100f | ||
|
|
e6225f3265 | ||
|
|
54c94ca9ad | ||
|
|
017d4b3894 | ||
|
|
3b3eaf8744 | ||
|
|
0a634907f2 | ||
|
|
2f2848728f | ||
|
|
19a83c6891 | ||
|
|
2bfd678c71 | ||
|
|
e936d18324 | ||
|
|
90797fa3cd | ||
|
|
5eea8fe880 | ||
|
|
12491dcc26 | ||
|
|
2eff454787 | ||
|
|
e5dc5bedfc | ||
|
|
496ca52987 | ||
|
|
72f4c3cc53 | ||
|
|
6a8a114197 | ||
|
|
549864a052 | ||
|
|
52026bb0f1 | ||
|
|
aed8e7d769 | ||
|
|
32fb6f247a | ||
|
|
90e14abecb | ||
|
|
6ced2511e4 | ||
|
|
93407ade03 | ||
|
|
6742d9237a | ||
|
|
a32c7d0d9a | ||
|
|
761a6a53d0 | ||
|
|
c56c035c15 | ||
|
|
c804bf5780 | ||
|
|
b87afeef80 | ||
|
|
d0c7a62ce7 | ||
|
|
47582d1922 | ||
|
|
36a30f16b1 | ||
|
|
52ec6bc6da | ||
|
|
74788dcb19 | ||
|
|
b35b72c34a | ||
|
|
c1fc76040a | ||
|
|
d1449d6575 | ||
|
|
9fdeb61c1a | ||
|
|
7c7d6762e2 | ||
|
|
eda46d63a8 | ||
|
|
9fc9063c83 | ||
|
|
430347fc66 | ||
|
|
9df5c68d3c | ||
|
|
3ca068c985 | ||
|
|
138ec05cf2 | ||
|
|
c7e5c8df22 | ||
|
|
91afbd122f | ||
|
|
daaf09cb26 | ||
|
|
e8d6fa565e | ||
|
|
47af5d3a39 | ||
|
|
63b5fd04be | ||
|
|
d59a5c63f9 | ||
|
|
16aaeae21c | ||
|
|
e60310eacc | ||
|
|
7b98ae54b5 | ||
|
|
d67d6ca895 | ||
|
|
86d9e9e6a9 | ||
|
|
b37480d6b2 | ||
|
|
0d806a2038 | ||
|
|
19700a081e | ||
|
|
ed1b175fa4 | ||
|
|
a91fc7041a | ||
|
|
18c59e036f | ||
|
|
df3f646c92 | ||
|
|
fb6e5d2838 | ||
|
|
33be65a865 | ||
|
|
975ec24167 | ||
|
|
e8378e86fd | ||
|
|
57366ac90a | ||
|
|
9f8a716dc1 | ||
|
|
27367bac18 | ||
|
|
5199cde870 | ||
|
|
b6bc7dfc16 | ||
|
|
945ea5a78a | ||
|
|
d719fe2048 | ||
|
|
458e0b53ac | ||
|
|
2d65d47498 | ||
|
|
e4922814b9 | ||
|
|
064028689c | ||
|
|
124241238e | ||
|
|
967e2cc54f | ||
|
|
6fdeadc356 | ||
|
|
478560daae | ||
|
|
0310b4b2c5 | ||
|
|
3eb4257ae8 | ||
|
|
f1d3db0ea3 | ||
|
|
e7b302955f | ||
|
|
85122c62cd | ||
|
|
ba0ffee7cf | ||
|
|
86e1101b40 | ||
|
|
fdcb7e3957 | ||
|
|
c54e56a73e | ||
|
|
fed9a599d9 | ||
|
|
0bb97a53c5 | ||
|
|
9b76c9a085 | ||
|
|
6f20b7bc3f | ||
|
|
580d9b0318 | ||
|
|
ae572ec108 | ||
|
|
b1c5b3d000 | ||
|
|
0c9230f35e | ||
|
|
77dab8fd20 | ||
|
|
10b5ca8e3a | ||
|
|
f9eed42cb7 | ||
|
|
19f4c24c00 | ||
|
|
0a162b7bc4 | ||
|
|
0d1b130127 | ||
|
|
5e0e82e7e8 | ||
|
|
4bf0816bcc | ||
|
|
ecbe035b36 | ||
|
|
4d30ee5d33 | ||
|
|
4844c6ae3e | ||
|
|
6603798d60 | ||
|
|
199f6eb67b | ||
|
|
aa2f506996 | ||
|
|
a3994fe1a3 | ||
|
|
6312ff8088 | ||
|
|
17cff1fb36 | ||
|
|
aff6315ae1 | ||
|
|
574d3e9164 | ||
|
|
21e93f8feb | ||
|
|
4b2f032ae6 | ||
|
|
8a495a7d7f | ||
|
|
cee51d5717 | ||
|
|
0483d3e155 | ||
|
|
2a4b9f9323 | ||
|
|
63a1a3d9ab | ||
|
|
f19f5c71a5 | ||
|
|
b009ffd31c | ||
|
|
b6baf66399 | ||
|
|
6dac46e1ad | ||
|
|
4d40e20fdd | ||
|
|
3b6858e936 | ||
|
|
3b455218f5 | ||
|
|
de24fcbb8c | ||
|
|
2adb9a7941 | ||
|
|
d81f4df61c | ||
|
|
6b259d15ee | ||
|
|
eeef60d540 | ||
|
|
a01035e63a | ||
|
|
52c1544e6f | ||
|
|
ed38212391 | ||
|
|
86fe98c90d | ||
|
|
4078062331 | ||
|
|
40935cf96a | ||
|
|
182c5a120e | ||
|
|
8e71ed7b63 | ||
|
|
7ca00e4ab9 | ||
|
|
b8ca06029f | ||
|
|
2efe8f2ec0 | ||
|
|
d1aa911739 | ||
|
|
4673282ca1 | ||
|
|
0c03195aec | ||
|
|
439bc2784d | ||
|
|
689a1ce59b | ||
|
|
c141503ccb | ||
|
|
bcadecdc3b | ||
|
|
ab3be337cb | ||
|
|
aa1281a9e0 | ||
|
|
115a2e802e | ||
|
|
968328d788 | ||
|
|
f1cde5f323 | ||
|
|
832ee8650b | ||
|
|
c0666a1793 | ||
|
|
ddb4ef539f | ||
|
|
3faedc4581 | ||
|
|
a3544353ba | ||
|
|
b0612397d3 | ||
|
|
31737e127e | ||
|
|
486dcd208c | ||
|
|
a945a4b2ad | ||
|
|
c28ea44e11 | ||
|
|
3e4d6b2565 | ||
|
|
29ce21cd2e | ||
|
|
d461c6977a | ||
|
|
5a0d6461d1 | ||
|
|
2ec7394785 | ||
|
|
8a5708b9f9 | ||
|
|
cd46070bd3 | ||
|
|
9930e549a0 | ||
|
|
36ed20cb04 | ||
|
|
3907589b6c | ||
|
|
2a598af888 | ||
|
|
f34f84832b | ||
|
|
0efa6ed1f2 | ||
|
|
2bf5876778 | ||
|
|
31982e84de | ||
|
|
970958652a | ||
|
|
c94a395bf0 | ||
|
|
43adff926f | ||
|
|
04fce56381 | ||
|
|
4df2097e6c | ||
|
|
8b85b04d10 | ||
|
|
9e0bcd3be8 | ||
|
|
9509080e0d | ||
|
|
61066bb0c6 | ||
|
|
573d5bc50e | ||
|
|
162e6eb92f | ||
|
|
cef4ebe38e | ||
|
|
316a0b7d58 | ||
|
|
2bcc56704b | ||
|
|
7f64de9727 | ||
|
|
aea03f2f99 | ||
|
|
8edf9552b8 | ||
|
|
d5f69c8a31 | ||
|
|
9ea9b0e04c | ||
|
|
e8db01fc8d | ||
|
|
f80e1e89a5 | ||
|
|
b9dca84acf | ||
|
|
e3ec1066c4 | ||
|
|
1445a8d446 | ||
|
|
9547c438d6 | ||
|
|
51d0e615f5 | ||
|
|
eeb937416c | ||
|
|
0d5aa7ede1 | ||
|
|
ba9dc27773 | ||
|
|
abf5a155ba | ||
|
|
4696cbb751 | ||
|
|
ebea06b687 | ||
|
|
62b58e1a6a | ||
|
|
1ba90deeba | ||
|
|
71ed283141 | ||
|
|
a7ae7b2e75 | ||
|
|
0d45ae7e21 | ||
|
|
61e121ad5c | ||
|
|
31960beb75 | ||
|
|
bdd9b6b50c | ||
|
|
216033cf20 | ||
|
|
95ddb1bbe5 | ||
|
|
1ad4ca0f67 | ||
|
|
95790d8152 | ||
|
|
02c61b3840 | ||
|
|
6ee501ac69 | ||
|
|
252ebb4642 | ||
|
|
0fb95df7a5 | ||
|
|
a72eda19f1 | ||
|
|
4fc808114f | ||
|
|
e3a9549824 | ||
|
|
073c033ab8 | ||
|
|
6e42be95bc | ||
|
|
1a77f57af5 | ||
|
|
d427df0238 | ||
|
|
f9f3ebe571 | ||
|
|
5969c1ae94 | ||
|
|
523016a42b | ||
|
|
7c42f6075b | ||
|
|
bc37f7fc5b | ||
|
|
0932c929c3 | ||
|
|
8f4e95b4b9 | ||
|
|
e84d1f02af | ||
|
|
772a326ac1 | ||
|
|
6276a632cc | ||
|
|
bb48bd50bb | ||
|
|
3fb7586875 | ||
|
|
e8cfde49ae | ||
|
|
7af4b392b3 | ||
|
|
2bdc498f18 | ||
|
|
9dfd143cc6 | ||
|
|
721ebbf340 | ||
|
|
0a5d136a32 | ||
|
|
0ece17b6a0 | ||
|
|
7d945bbd5d | ||
|
|
42039b2090 | ||
|
|
dd7ca6b12e | ||
|
|
b1c6be012a | ||
|
|
835308628e | ||
|
|
c1486f425e | ||
|
|
c80896dcb0 | ||
|
|
77b12692bb | ||
|
|
57237e831a | ||
|
|
d62c48ebf7 | ||
|
|
e2e85b962a | ||
|
|
788697d563 | ||
|
|
64ecd762be | ||
|
|
5cb0db6f31 | ||
|
|
58e41d48c7 | ||
|
|
67466b015b | ||
|
|
0ea68f27a2 | ||
|
|
a3e57dbab4 | ||
|
|
7ece15bb1a | ||
|
|
336b32dead | ||
|
|
1faa09b6ce | ||
|
|
d7a51c7107 | ||
|
|
30c9d6d2df | ||
|
|
74841b6711 | ||
|
|
dabbdc7517 | ||
|
|
793d399477 | ||
|
|
15d69aefbb | ||
|
|
77b1652f4a | ||
|
|
5f9594363d | ||
|
|
5cba4b126f | ||
|
|
d8a7f7c7ca | ||
|
|
d3fca86dec | ||
|
|
5f88abf341 | ||
|
|
416814094c | ||
|
|
5b8799e71f | ||
|
|
cc5349ee57 | ||
|
|
7b68572b2e | ||
|
|
057eb9f644 | ||
|
|
253603edbc | ||
|
|
b771b9d160 | ||
|
|
eb829c2951 | ||
|
|
d32b39181a | ||
|
|
72b99a1f84 | ||
|
|
ae37f218a2 | ||
|
|
40cecca103 | ||
|
|
2a80a82f74 | ||
|
|
fbf4eac2dc | ||
|
|
4784010702 | ||
|
|
1c88854a54 | ||
|
|
e0fe71c708 | ||
|
|
0f0dcb4f58 | ||
|
|
367c42ad28 | ||
|
|
c8e0f7ebd3 | ||
|
|
fdc9aec534 | ||
|
|
5f9cc83b18 | ||
|
|
47051af392 | ||
|
|
c1a6e649da | ||
|
|
1d172be503 | ||
|
|
f01e119890 | ||
|
|
4d27a935d6 | ||
|
|
512a96f832 | ||
|
|
6715f63acc | ||
|
|
3764faeefc | ||
|
|
5d4b7bfea3 | ||
|
|
4df08779e3 | ||
|
|
6b835a327d | ||
|
|
7dd61cd560 | ||
|
|
d9535eccf1 | ||
|
|
a97f91e079 | ||
|
|
f0401b4fc7 | ||
|
|
cda64b880a | ||
|
|
1f6cab9e2e | ||
|
|
afa80576f4 | ||
|
|
5a63eb729c | ||
|
|
27da50136e | ||
|
|
db724b67ff | ||
|
|
14a0d2f538 | ||
|
|
3b9932e09c | ||
|
|
02409c06b8 | ||
|
|
bb51db0d7d | ||
|
|
834f2caffe | ||
|
|
202786c46b | ||
|
|
035bfea93c | ||
|
|
185f8c42dc | ||
|
|
d5fc81d39e | ||
|
|
1cd0228d87 | ||
|
|
4968d4c8b7 | ||
|
|
bb6ec1f352 |
No files matched your search
@@ -44,7 +44,7 @@ runs:
|
|||||||
|
|
||||||
- name: Login to builtin registry
|
- name: Login to builtin registry
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
|
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.BUILTIN_REGISTRY }}
|
registry: ${{ env.BUILTIN_REGISTRY }}
|
||||||
username: ${{ inputs.registry_user }}
|
username: ${{ inputs.registry_user }}
|
||||||
@@ -52,7 +52,7 @@ runs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
||||||
with:
|
with:
|
||||||
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
||||||
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
||||||
@@ -61,7 +61,7 @@ runs:
|
|||||||
- name: Extract metadata (tags) for Docker
|
- name: Extract metadata (tags) for Docker
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6
|
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
|
||||||
with:
|
with:
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=auto
|
latest=auto
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ runs:
|
|||||||
uses: ./.forgejo/actions/rust-toolchain
|
uses: ./.forgejo/actions/rust-toolchain
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
||||||
with:
|
with:
|
||||||
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
|
||||||
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
|
||||||
@@ -75,11 +75,11 @@ runs:
|
|||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
|
||||||
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
|
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4
|
||||||
|
|
||||||
- name: Login to builtin registry
|
- name: Login to builtin registry
|
||||||
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
|
||||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
|
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.BUILTIN_REGISTRY }}
|
registry: ${{ env.BUILTIN_REGISTRY }}
|
||||||
username: ${{ inputs.registry_user }}
|
username: ${{ inputs.registry_user }}
|
||||||
@@ -87,7 +87,7 @@ runs:
|
|||||||
|
|
||||||
- name: Extract metadata (labels, annotations) for Docker
|
- name: Extract metadata (labels, annotations) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6
|
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
|
||||||
with:
|
with:
|
||||||
images: ${{ inputs.images }}
|
images: ${{ inputs.images }}
|
||||||
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
# default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ runs:
|
|||||||
echo "version=$(rustup --version)" >> $GITHUB_OUTPUT
|
echo "version=$(rustup --version)" >> $GITHUB_OUTPUT
|
||||||
- name: Cache rustup toolchains
|
- name: Cache rustup toolchains
|
||||||
if: steps.rustup-version.outputs.version == ''
|
if: steps.rustup-version.outputs.version == ''
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.rustup
|
~/.rustup
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ runs:
|
|||||||
|
|
||||||
- name: Check for LLVM cache
|
- name: Check for LLVM cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/bin/clang-*
|
/usr/bin/clang-*
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache toolchain binaries
|
- name: Cache toolchain binaries
|
||||||
id: toolchain-cache
|
id: toolchain-cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/bin
|
.cargo/bin
|
||||||
@@ -76,7 +76,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache Cargo registry and git
|
- name: Cache Cargo registry and git
|
||||||
id: registry-cache
|
id: registry-cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/registry/index
|
.cargo/registry/index
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ runs:
|
|||||||
|
|
||||||
- name: Restore binary cache
|
- name: Restore binary cache
|
||||||
id: binary-cache
|
id: binary-cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/share/rust/.cargo/bin
|
/usr/share/rust/.cargo/bin
|
||||||
@@ -71,13 +71,13 @@ runs:
|
|||||||
|
|
||||||
- name: Install timelord-cli and git-warp-time
|
- name: Install timelord-cli and git-warp-time
|
||||||
if: steps.check-binaries.outputs.need-install == 'true'
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
uses: https://github.com/taiki-e/install-action@3771e22aa892e03fd35585fae288baad1755695c # v2
|
uses: https://github.com/taiki-e/install-action@9bcaee1dcae34154180f412e2fa69355a7cda9f6 # v2
|
||||||
with:
|
with:
|
||||||
tool: git-warp-time,timelord-cli@3.0.1
|
tool: git-warp-time,timelord-cli@3.0.1
|
||||||
|
|
||||||
- name: Save binary cache
|
- name: Save binary cache
|
||||||
if: steps.check-binaries.outputs.need-install == 'true'
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/share/rust/.cargo/bin
|
/usr/share/rust/.cargo/bin
|
||||||
@@ -87,7 +87,7 @@ runs:
|
|||||||
|
|
||||||
- name: Restore timelord cache with fallbacks
|
- name: Restore timelord cache with fallbacks
|
||||||
id: timelord-restore
|
id: timelord-restore
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: ${{ env.TIMELORD_CACHE_PATH }}
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
key: ${{ env.TIMELORD_KEY }}
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
@@ -114,7 +114,7 @@ runs:
|
|||||||
timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
|
timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
|
||||||
- name: Save updated timelord cache immediately
|
- name: Save updated timelord cache immediately
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: ${{ env.TIMELORD_CACHE_PATH }}
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
key: ${{ env.TIMELORD_KEY }}
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
@@ -10,7 +10,7 @@ on:
|
|||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 0 * * *'
|
- cron: '30 0 * * 1'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -41,26 +41,15 @@ jobs:
|
|||||||
# else
|
# else
|
||||||
# echo "No workaround needed for llvm-project#153385"
|
# echo "No workaround needed for llvm-project#153385"
|
||||||
# fi
|
# fi
|
||||||
- name: Pick compatible clang version
|
|
||||||
id: clang-version
|
|
||||||
run: |
|
|
||||||
# both latest need to use clang-23, but oldstable and previous can just use clang
|
|
||||||
if [[ "${{ matrix.container }}" == "ubuntu-latest" ]]; then
|
|
||||||
echo "Using clang-23 package for ${{ matrix.container }}"
|
|
||||||
echo "version=clang-23" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Using default clang package for ${{ matrix.container }}"
|
|
||||||
echo "version=clang" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Checkout repository with full history
|
- name: Checkout repository with full history
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ github.ref_name }}
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Cache Cargo registry
|
- name: Cache Cargo registry
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
@@ -93,10 +82,10 @@ jobs:
|
|||||||
# VERSION is the package version, COMPONENT is used in
|
# VERSION is the package version, COMPONENT is used in
|
||||||
# apt's repository config like a git repo branch
|
# apt's repository config like a git repo branch
|
||||||
VERSION=$BASE_VERSION
|
VERSION=$BASE_VERSION
|
||||||
if [[ ${{ forge.ref_name }} =~ ^v+[0-9]\.+[0-9]\.+[0-9]$ ]]; then
|
if [[ ${{ forge.ref_name }} =~ ^v+[0-9]+\.+[0-9]+\.+[0-9]+$ ]]; then
|
||||||
# Use the "stable" component for tagged semver releases
|
# Use the "stable" component for tagged semver releases
|
||||||
COMPONENT="stable"
|
COMPONENT="stable"
|
||||||
elif [[ ${{ forge.ref_name }} =~ ^v+[0-9]\.+[0-9]\.+[0-9] ]]; then
|
elif [[ ${{ forge.ref_name }} =~ ^v+[0-9]+\.+[0-9]+\.+[0-9]+ ]]; then
|
||||||
# Use the "unstable" component for tagged semver pre-releases
|
# Use the "unstable" component for tagged semver pre-releases
|
||||||
COMPONENT="unstable"
|
COMPONENT="unstable"
|
||||||
else
|
else
|
||||||
@@ -130,7 +119,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
# Build dependencies for rocksdb
|
# Build dependencies for rocksdb
|
||||||
apt-get install -y liburing-dev ${{ steps.clang-version.outputs.version }}
|
apt-get install -y liburing-dev clang
|
||||||
|
|
||||||
- name: Run cargo-deb
|
- name: Run cargo-deb
|
||||||
id: cargo-deb
|
id: cargo-deb
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ on:
|
|||||||
# - '.forgejo/workflows/build-fedora.yml'
|
# - '.forgejo/workflows/build-fedora.yml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 0 * * *'
|
- cron: '30 0 * * 2'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -30,14 +30,14 @@ jobs:
|
|||||||
echo "Fedora version: $VERSION"
|
echo "Fedora version: $VERSION"
|
||||||
|
|
||||||
- name: Checkout repository with full history
|
- name: Checkout repository with full history
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ github.ref_name }}
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
|
||||||
- name: Cache DNF packages
|
- name: Cache DNF packages
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/var/cache/dnf
|
/var/cache/dnf
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
dnf-fedora${{ steps.fedora.outputs.version }}-
|
dnf-fedora${{ steps.fedora.outputs.version }}-
|
||||||
|
|
||||||
- name: Cache Cargo registry
|
- name: Cache Cargo registry
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
cargo-fedora${{ steps.fedora.outputs.version }}-
|
cargo-fedora${{ steps.fedora.outputs.version }}-
|
||||||
|
|
||||||
- name: Cache Rust build dependencies
|
- name: Cache Rust build dependencies
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/rpmbuild/BUILD/*/target/release/deps
|
~/rpmbuild/BUILD/*/target/release/deps
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
name: Build / Static via Nix
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "build-nix-${{ forge.ref }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '30 0 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: "Build ${{ matrix.filename }} Binary"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- package: default-static-x86_64
|
||||||
|
filename: conduwuit-linux-static-amd64
|
||||||
|
- package: default-static-aarch64
|
||||||
|
filename: conduwuit-linux-static-arm64
|
||||||
|
|
||||||
|
- package: max-perf-static-aarch64
|
||||||
|
filename: conduwuit-linux-static-arm64-maxperf
|
||||||
|
- package: max-perf-haswell-static-x86_64
|
||||||
|
filename: conduwuit-haswell-linux-static-amd64-maxperf
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
|
||||||
|
|
||||||
|
- name: Install Lix
|
||||||
|
uses: https://github.com/samueldr/lix-gha-installer-action@a0fee77b2a98bb7c5c0ed7ae6d6ad4903dbdad0d
|
||||||
|
with:
|
||||||
|
extra_nix_config: experimental-features = nix-command flakes flake-self-attrs
|
||||||
|
|
||||||
|
- name: Build static binary
|
||||||
|
run: |
|
||||||
|
nix build .#${{ matrix.package }}
|
||||||
|
install -D result/bin/conduwuit /tmp/binaries/${{ matrix.filename }}
|
||||||
|
|
||||||
|
- name: Upload binary artifact
|
||||||
|
uses: forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.filename }}
|
||||||
|
path: /tmp/binaries/${{ matrix.filename }}
|
||||||
|
|
||||||
|
release-binaries:
|
||||||
|
name: "Release Binaries"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
steps:
|
||||||
|
- name: Download binary artifacts
|
||||||
|
uses: forgejo/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: conduwuit*
|
||||||
|
path: binaries
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Create Release and Upload
|
||||||
|
uses: https://github.com/softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
files: binaries/*
|
||||||
@@ -14,23 +14,19 @@ jobs:
|
|||||||
name: Check changelog is added
|
name: Check changelog is added
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
sparse-checkout: .
|
|
||||||
|
|
||||||
- name: Check for changelog entry
|
- name: Check for changelog entry
|
||||||
id: check_files
|
id: check_files
|
||||||
run: |
|
run: |
|
||||||
git fetch origin ${GITHUB_BASE_REF}
|
AUTH=$(echo -n "x-access-token:${{ secrets.GITHUB_TOKEN }}" | base64 -w 0)
|
||||||
|
git config --global http.${{ github.server_url }}/.extraheader "Authorization: basic $AUTH"
|
||||||
|
git clone "${{ github.event.repository.clone_url }}" repo.git --bare
|
||||||
|
|
||||||
|
git -C repo.git fetch origin pull/${{ github.event.pull_request.number }}/head
|
||||||
|
|
||||||
# Check for Added (A) or Modified (M) files in changelog.d
|
# Check for Added (A) or Modified (M) files in changelog.d
|
||||||
CHANGELOG_CHANGES=$(git diff --name-status origin/${GITHUB_BASE_REF}...HEAD -- changelog.d/)
|
CHANGELOG_CHANGES=$(git -C repo.git diff --name-status ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- changelog.d/)
|
||||||
|
|
||||||
SRC_CHANGES=$(git diff --name-status origin/${GITHUB_BASE_REF}...HEAD -- src/)
|
SRC_CHANGES=$(git -C repo.git diff --name-status ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- src/)
|
||||||
|
|
||||||
echo "Changes in changelog.d/:"
|
echo "Changes in changelog.d/:"
|
||||||
echo "$CHANGELOG_CHANGES"
|
echo "$CHANGELOG_CHANGES"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
node-version: 22
|
node-version: 22
|
||||||
|
|
||||||
- name: Cache npm dependencies
|
- name: Cache npm dependencies
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-${{ hashFiles('package-lock.json') }}
|
key: continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-${{ hashFiles('package-lock.json') }}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
DOCKER_MIRROR_TOKEN: ${{ secrets.DOCKER_MIRROR_TOKEN }}
|
DOCKER_MIRROR_TOKEN: ${{ secrets.DOCKER_MIRROR_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
# repositories: continuwuity
|
# repositories: continuwuity
|
||||||
|
|
||||||
- name: Install regsync
|
- name: Install regsync
|
||||||
uses: https://github.com/regclient/actions/regsync-installer@c70ad64367908075211b10dcd2ab9fad4bfa1816 # main
|
uses: https://github.com/regclient/actions/regsync-installer@9a2d4216180dbb3e2dccfa60d2dd4afd98e42ec5 # main
|
||||||
|
|
||||||
- name: Check what images need mirroring
|
- name: Check what images need mirroring
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
rust: ${{ steps.filter.outputs.rust }}
|
rust: ${{ steps.filter.outputs.rust }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Prepare Docker build environment
|
- name: Prepare Docker build environment
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
- 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@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7
|
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: "docker/Dockerfile"
|
file: "docker/Dockerfile"
|
||||||
@@ -100,7 +100,7 @@ jobs:
|
|||||||
needs: build-release
|
needs: build-release
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Create multi-platform manifest
|
- name: Create multi-platform manifest
|
||||||
@@ -133,7 +133,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Prepare max-perf Docker build environment
|
- name: Prepare max-perf Docker build environment
|
||||||
@@ -149,7 +149,7 @@ jobs:
|
|||||||
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
||||||
- name: Build and push max-perf Docker image by digest
|
- name: Build and push max-perf Docker image by digest
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7
|
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: "docker/Dockerfile"
|
file: "docker/Dockerfile"
|
||||||
@@ -187,7 +187,7 @@ jobs:
|
|||||||
needs: build-maxperf
|
needs: build-maxperf
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Create max-perf manifest
|
- name: Create max-perf manifest
|
||||||
@@ -216,7 +216,7 @@ jobs:
|
|||||||
path: binaries
|
path: binaries
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- name: Create Release and Upload
|
- name: Create Release and Upload
|
||||||
uses: https://github.com/softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
|
uses: https://github.com/softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
files: binaries/*
|
files: binaries/*
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ jobs:
|
|||||||
name: Renovate
|
name: Renovate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/renovatebot/renovate:43.181.0@sha256:aa64263a30f1ef92a661f1c3421ab13f0268131ffd5bfc8e16bdd98977a67eed
|
image: ghcr.io/renovatebot/renovate:43.246.1@sha256:5965c08f8ca5baff8dc9bf3a32c44ca71fef843ad94880e9696d46e1d722b0fa
|
||||||
options: --tmpfs /tmp:exec
|
options: --tmpfs /tmp:exec
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
show-progress: false
|
show-progress: false
|
||||||
|
|
||||||
@@ -55,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: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/repository
|
/tmp/renovate/cache/renovate/repository
|
||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
renovate-repo-cache-
|
renovate-repo-cache-
|
||||||
|
|
||||||
- name: Restore renovate package cache
|
- name: Restore renovate package cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
renovate-package-cache-
|
renovate-package-cache-
|
||||||
|
|
||||||
- name: Restore renovate OSV cache
|
- name: Restore renovate OSV cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/osv
|
/tmp/osv
|
||||||
@@ -117,7 +117,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Save renovate package cache
|
- name: Save renovate package cache
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
@@ -125,7 +125,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Save renovate OSV cache
|
- name: Save renovate OSV cache
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/osv
|
/tmp/osv
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
update-flake-hashes:
|
update-flake-hashes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||||
with:
|
with:
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
token: ${{ secrets.FORGEJO_TOKEN }}
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: Get new toolchain hash
|
- name: Get new toolchain hash
|
||||||
run: |
|
run: |
|
||||||
# Set the current sha256 to an empty hash to make `nix build` calculate a new one
|
# Set the current sha256 to an empty hash to make `nix build` calculate a new one
|
||||||
awk '/fromToolchainFile *\{/{found=1; print; next} found && /sha256 =/{sub(/sha256 = .*/, "sha256 = lib.fakeSha256;"); found=0} 1' nix/rust.nix > temp.nix
|
awk '/fromToolchainName *\{/{found=1; print; next} found && /sha256 =/{sub(/sha256 = .*/, "sha256 = lib.fakeSha256;"); found=0} 1' nix/rust.nix > temp.nix
|
||||||
mv temp.nix nix/rust.nix
|
mv temp.nix nix/rust.nix
|
||||||
|
|
||||||
# Build continuwuity and filter for the new hash
|
# Build continuwuity and filter for the new hash
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
sed -i "s|lib.fakeSha256|\"$new_hash\"|" nix/rust.nix
|
sed -i "s|lib.fakeSha256|\"$new_hash\"|" nix/rust.nix
|
||||||
|
|
||||||
echo "New hash:"
|
echo "New hash:"
|
||||||
awk -F'"' '/fromToolchainFile/{found=1; next} found && /sha256 =/{print $2; found=0}' nix/rust.nix
|
awk -F'"' '/fromToolchainName/{found=1; next} found && /sha256 =/{print $2; found=0}' nix/rust.nix
|
||||||
echo "Expected new hash:"
|
echo "Expected new hash:"
|
||||||
cat new_toolchain_hash.txt
|
cat new_toolchain_hash.txt
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
github: [JadedBlueEyes, nexy7574, gingershaped]
|
github: [JadedBlueEyes, timedoutuk, gingershaped]
|
||||||
custom:
|
custom:
|
||||||
- https://timedout.uk/donate.html
|
- https://timedout.uk/donate.html
|
||||||
- https://jade.ellis.link/sponsors
|
- https://jade.ellis.link/sponsors
|
||||||
@@ -24,7 +24,7 @@ repos:
|
|||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
|
|
||||||
- repo: https://github.com/crate-ci/typos
|
- repo: https://github.com/crate-ci/typos
|
||||||
rev: v1.46.2
|
rev: v1.47.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: typos
|
- id: typos
|
||||||
- id: typos
|
- id: typos
|
||||||
|
|||||||
Generated
+1025
-314
File diff suppressed because it is too large.
Load diff
+16
-9
@@ -12,7 +12,7 @@ license = "Apache-2.0"
|
|||||||
# See also `rust-toolchain.toml`
|
# See also `rust-toolchain.toml`
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
|
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
|
||||||
version = "0.5.9"
|
version = "26.6.0-alpha.1"
|
||||||
|
|
||||||
[workspace.metadata.crane]
|
[workspace.metadata.crane]
|
||||||
name = "conduwuit"
|
name = "conduwuit"
|
||||||
@@ -45,7 +45,7 @@ version = "1.0.6"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
||||||
[workspace.dependencies.cargo_toml]
|
[workspace.dependencies.cargo_toml]
|
||||||
version = "0.22"
|
version = "1.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["features"]
|
features = ["features"]
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ default-features = false
|
|||||||
features = ["util"]
|
features = ["util"]
|
||||||
|
|
||||||
[workspace.dependencies.tower-http]
|
[workspace.dependencies.tower-http]
|
||||||
version = "0.6.8"
|
version = "0.7.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"add-extension",
|
"add-extension",
|
||||||
@@ -164,7 +164,7 @@ features = ["raw_value"]
|
|||||||
|
|
||||||
# Used for appservice registration files
|
# Used for appservice registration files
|
||||||
[workspace.dependencies.serde-saphyr]
|
[workspace.dependencies.serde-saphyr]
|
||||||
version = "0.0.26"
|
version = "0.0.28"
|
||||||
|
|
||||||
# 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]
|
||||||
@@ -296,7 +296,7 @@ default-features = false
|
|||||||
features = ["env", "toml"]
|
features = ["env", "toml"]
|
||||||
|
|
||||||
[workspace.dependencies.hickory-resolver]
|
[workspace.dependencies.hickory-resolver]
|
||||||
version = "0.25.2"
|
version = "0.26.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"serde",
|
"serde",
|
||||||
@@ -316,7 +316,7 @@ default-features = false
|
|||||||
|
|
||||||
# Used to make working with iterators easier, was already a transitive depdendency
|
# Used to make working with iterators easier, was already a transitive depdendency
|
||||||
[workspace.dependencies.itertools]
|
[workspace.dependencies.itertools]
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
|
|
||||||
# to parse user-friendly time durations in admin commands
|
# to parse user-friendly time durations in admin commands
|
||||||
#TODO: overlaps chrono?
|
#TODO: overlaps chrono?
|
||||||
@@ -344,7 +344,7 @@ version = "1.1.1"
|
|||||||
[workspace.dependencies.ruma]
|
[workspace.dependencies.ruma]
|
||||||
# version = "0.14.1"
|
# version = "0.14.1"
|
||||||
git = "https://github.com/ruma/ruma.git"
|
git = "https://github.com/ruma/ruma.git"
|
||||||
rev = "9c9dccc93f054bbd28f23f630223fffa6289ecbc"
|
rev = "3ecd80b92794d2d93f657a7b3db62d4be237526b"
|
||||||
features = [
|
features = [
|
||||||
"appservice-api-c",
|
"appservice-api-c",
|
||||||
"client-api",
|
"client-api",
|
||||||
@@ -356,6 +356,7 @@ features = [
|
|||||||
"ring-compat",
|
"ring-compat",
|
||||||
"compat-upload-signatures",
|
"compat-upload-signatures",
|
||||||
"compat-optional-txn-pdus",
|
"compat-optional-txn-pdus",
|
||||||
|
"compat-get-3pids",
|
||||||
"unstable-msc2666",
|
"unstable-msc2666",
|
||||||
"unstable-msc2867",
|
"unstable-msc2867",
|
||||||
"unstable-msc2870",
|
"unstable-msc2870",
|
||||||
@@ -373,12 +374,12 @@ features = [
|
|||||||
"unstable-msc4195",
|
"unstable-msc4195",
|
||||||
"unstable-msc4203",
|
"unstable-msc4203",
|
||||||
"unstable-msc4310",
|
"unstable-msc4310",
|
||||||
"unstable-msc4373",
|
|
||||||
"unstable-msc4380",
|
"unstable-msc4380",
|
||||||
"unstable-msc4143",
|
"unstable-msc4143",
|
||||||
"unstable-msc4293",
|
"unstable-msc4293",
|
||||||
"unstable-msc4406",
|
"unstable-msc4406",
|
||||||
"unstable-msc4439",
|
"unstable-msc4439",
|
||||||
|
"unstable-msc4466",
|
||||||
"unstable-extensible-events",
|
"unstable-extensible-events",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -402,6 +403,9 @@ default-features = false
|
|||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
[workspace.dependencies.openidconnect]
|
||||||
|
version = "4.0.1"
|
||||||
|
|
||||||
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
|
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
|
||||||
[workspace.dependencies.opentelemetry]
|
[workspace.dependencies.opentelemetry]
|
||||||
version = "0.32.0"
|
version = "0.32.0"
|
||||||
@@ -534,7 +538,7 @@ version = "2.1.1"
|
|||||||
features = ["std"]
|
features = ["std"]
|
||||||
|
|
||||||
[workspace.dependencies.minicbor-serde]
|
[workspace.dependencies.minicbor-serde]
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
features = ["std"]
|
features = ["std"]
|
||||||
|
|
||||||
[workspace.dependencies.maplit]
|
[workspace.dependencies.maplit]
|
||||||
@@ -559,6 +563,9 @@ features = ["std"]
|
|||||||
[workspace.dependencies.nonzero_ext]
|
[workspace.dependencies.nonzero_ext]
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
||||||
|
[workspace.dependencies.serde_urlencoded]
|
||||||
|
version = "0.7.1"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches
|
# Patches
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ We appreciate the efforts of security researchers and the community in identifyi
|
|||||||
1. **Contact members of the team directly** over E2EE private message.
|
1. **Contact members of the team directly** over E2EE private message.
|
||||||
- [@jade:ellis.link](https://matrix.to/#/@jade:ellis.link)
|
- [@jade:ellis.link](https://matrix.to/#/@jade:ellis.link)
|
||||||
- [@nex:nexy7574.co.uk](https://matrix.to/#/@nex:nexy7574.co.uk)
|
- [@nex:nexy7574.co.uk](https://matrix.to/#/@nex:nexy7574.co.uk)
|
||||||
|
- [@ginger:gingershaped.computer](https://matrix.to/#/@ginger:gingershaped.computer)
|
||||||
2. **Email the security team** at [security@continuwuity.org](mailto:security@continuwuity.org). This is not E2EE, so don't include sensitive details.
|
2. **Email the security team** at [security@continuwuity.org](mailto:security@continuwuity.org). This is not E2EE, so don't include sensitive details.
|
||||||
3. **Do not disclose the vulnerability publicly** until it has been addressed
|
3. **Do not disclose the vulnerability publicly** until it has been addressed
|
||||||
4. **Provide detailed information** about the vulnerability, including:
|
4. **Provide detailed information** about the vulnerability, including:
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Appservice device management as outlined in MSC4190 (part of Matrix 1.17) is now fully supported. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Users may now be forbidden from deactivating their own accounts with the new `allow_deactivation` config option. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added support for Matrix 1.16's `state_after` feature, allowing clients which understand it to sync room state changes more reliably. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added support for authenticating clients using the new OAuth 2.0 login API. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added support for MSC4466, which allows clients to customize how changes to a user's global profile are propagated. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Devices which set their presence as "offline" will no longer be considered for presence updates. Contributed by @timedout.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Updated [MSC4284: Policy Servers](https://github.com/matrix-org/matrix-spec-proposals/pull/4284) implementation to support the newly stabilised proposal. Contributed by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added config option for default room ACLs. Contributed by @eve.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Implemented event rejection, which should resolve and prevent future netsplits of the kinds observed
|
||||||
|
within some Continuwuity rooms.
|
||||||
|
Also resolved several bugs related to both soft-failing events, and event backfilling, which should
|
||||||
|
improve state resolution stability.
|
||||||
|
The `!admin debug get-pdu` command was updated to disambiguate event acceptance status, and
|
||||||
|
`!admin debug show-auth-chain` was added to visually display event auth chains, which may assist
|
||||||
|
developers in debugging strangely complex events.
|
||||||
|
|
||||||
|
Contributed by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added example configuration using caddy-docker-proxy in the livekit setup section of the docs. Contributed by @Cease
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Fixed admin commands being ignored when they had leading whitespace before admin commands. Contributed by @kitvonsnookerz.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Fixed several bugs in the `POST /_matrix/client/v3/rooms/{roomId}/upgrade` endpoint. Contributed by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added full support for [MSC4168: Update `m.space.*` state on room upgrade](https://github.com/matrix-org/matrix-spec-proposals/pull/4168). Contributed by @nex.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Improved the performance and reliability of fetching missing events, improving network partition recovery. Contributed
|
||||||
|
by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Remove support for MSC4373, as the MSC is now closed. Contributed by @vel.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added static builds using Nix, allowing for Continuwuity on musl. During this, we also introduced a `max-perf-haswell` package, separating it from `max-perf`, so you may want to swap to this if you are on NixOS. Contributed by @Henry-Hiles (QuadRadical).
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added support for MSC4380 invite blocking, which has become part of the Matrix specification in v1.18. Contributed by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added `!admin debug get-state-at` command
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Added support for linking an external identity provider with OIDC. Contributed by @ginger.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Adjusted legacy sync logic to no longer use the `roomsynctoken_shortstatehash` database column. Once this change has been confirmed to be stable and reliable, a future update will remove it entirely, significantly decreasing database sizes. Contributed by @ginger.
|
||||||
+184
-34
@@ -297,7 +297,7 @@
|
|||||||
|
|
||||||
# This item is undocumented. Please contribute documentation for it.
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
#
|
#
|
||||||
#max_fetch_prev_events = 192
|
#max_fetch_prev_events = 1024
|
||||||
|
|
||||||
# How many incoming federation transactions the server is willing to be
|
# How many incoming federation transactions the server is willing to be
|
||||||
# processing at any given time before it becomes overloaded and starts
|
# processing at any given time before it becomes overloaded and starts
|
||||||
@@ -372,21 +372,18 @@
|
|||||||
#
|
#
|
||||||
#federation_timeout = 60
|
#federation_timeout = 60
|
||||||
|
|
||||||
# MSC4284 Policy server request timeout (seconds). Generally policy
|
# Policy server request timeout (seconds). Generally policy
|
||||||
# servers should respond near instantly, however may slow down under
|
# servers should respond near instantly, however may slow down under
|
||||||
# load. If a policy server doesn't respond in a short amount of time, the
|
# load. If a policy server doesn't respond in a short amount of time, the
|
||||||
# room it is configured in may become unusable if this limit is set too
|
# room it is configured in may become unusable if this limit is set too
|
||||||
# high. 10 seconds is a good default, however dropping this to 3-5 seconds
|
# high. 30 seconds is a good default, however lower values may be
|
||||||
# can be acceptable.
|
# acceptable if temporary send failures are an okay trade-off.
|
||||||
#
|
#
|
||||||
# Please be aware that policy requests are *NOT* currently re-tried, so if
|
|
||||||
# a spam check request fails, the event will be assumed to be not spam,
|
|
||||||
# which in some cases may result in spam being sent to or received from
|
|
||||||
# the room that would typically be prevented.
|
|
||||||
#
|
#
|
||||||
# About policy servers: https://matrix.org/blog/2025/04/introducing-policy-servers/
|
# About policy servers: https://matrix.org/blog/2025/04/introducing-policy-servers/
|
||||||
|
# (Stabilized in Matrix v1.18)
|
||||||
#
|
#
|
||||||
#policy_server_request_timeout = 10
|
#policy_server_request_timeout = 30
|
||||||
|
|
||||||
# Federation client idle connection pool timeout (seconds).
|
# Federation client idle connection pool timeout (seconds).
|
||||||
#
|
#
|
||||||
@@ -524,17 +521,15 @@
|
|||||||
#
|
#
|
||||||
#recaptcha_private_site_key =
|
#recaptcha_private_site_key =
|
||||||
|
|
||||||
# Policy documents, such as terms and conditions or a privacy policy,
|
# Controls whether users are allowed to deactivate their own accounts
|
||||||
# which users must agree to when registering an account.
|
# through the account management panel or their Matrix clients. Server
|
||||||
|
# admins can always deactivate users using the relevant admin commands.
|
||||||
#
|
#
|
||||||
# Example:
|
# Note that, in some jurisdictions, you may be legally required to honor
|
||||||
# ```ignore
|
# users who request to deactivate their accounts if you set this option
|
||||||
# [global.registration_terms.privacy_policy]
|
# to `false`.
|
||||||
# en = { name = "Privacy Policy", url = "https://homeserver.example/en/privacy_policy.html" }
|
|
||||||
# es = { name = "Política de Privacidad", url = "https://homeserver.example/es/privacy_policy.html" }
|
|
||||||
# ```
|
|
||||||
#
|
#
|
||||||
#registration_terms = {}
|
#allow_deactivation = true
|
||||||
|
|
||||||
# Controls whether encrypted rooms and events are allowed.
|
# Controls whether encrypted rooms and events are allowed.
|
||||||
#
|
#
|
||||||
@@ -624,6 +619,38 @@
|
|||||||
#
|
#
|
||||||
#default_room_version = "12"
|
#default_room_version = "12"
|
||||||
|
|
||||||
|
# A default allow value for the Access Control List when creating a room.
|
||||||
|
#
|
||||||
|
# If a list is provided, new rooms will be created with
|
||||||
|
# a m.room.server_acl event. Only servers which match one of the patterns
|
||||||
|
# in the list will be permitted to participate in the room.
|
||||||
|
#
|
||||||
|
# ACLs in existing rooms will not be updated automatically. This is not
|
||||||
|
# a substitute for moderation bots.
|
||||||
|
#
|
||||||
|
#default_room_acl_allow =
|
||||||
|
|
||||||
|
# A default deny value for the Access Control List when creating a room.
|
||||||
|
#
|
||||||
|
# If a list is provided, new rooms will be created with
|
||||||
|
# a m.room.server_acl event. Servers which match one of the patterns
|
||||||
|
# in the list will be NOT permitted to participate in the room.
|
||||||
|
#
|
||||||
|
# This config cannot be used if the default_room_acl_allow config is used.
|
||||||
|
#
|
||||||
|
# ACLs in existing rooms will not be updated automatically. This is not
|
||||||
|
# a substitute for moderation bots.
|
||||||
|
#
|
||||||
|
#default_room_acl_deny =
|
||||||
|
|
||||||
|
# The number of forward extremities to tolerate in a room before
|
||||||
|
# attempting to manually squash them with a "dummy event". Setting this
|
||||||
|
# above 20 will hinder its efficacy, and setting it below 5 will cause
|
||||||
|
# more dummy events to be sent than necessary (which increases federation
|
||||||
|
# traffic).
|
||||||
|
#
|
||||||
|
#dummy_event_threshold = 10
|
||||||
|
|
||||||
# Enable OpenTelemetry OTLP tracing export. This replaces the deprecated
|
# Enable OpenTelemetry OTLP tracing export. This replaces the deprecated
|
||||||
# Jaeger exporter. Traces will be sent via OTLP to a collector (such as
|
# Jaeger exporter. Traces will be sent via OTLP to a collector (such as
|
||||||
# Jaeger) that supports the OpenTelemetry Protocol.
|
# Jaeger) that supports the OpenTelemetry Protocol.
|
||||||
@@ -1407,6 +1434,11 @@
|
|||||||
#
|
#
|
||||||
#send_messages_from_ignored_users_to_client = false
|
#send_messages_from_ignored_users_to_client = false
|
||||||
|
|
||||||
|
# Send "org.matrix.dummy_event" events to the client. This is a debugging
|
||||||
|
# option.
|
||||||
|
#
|
||||||
|
#send_dummy_events_to_clients = false
|
||||||
|
|
||||||
# Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you
|
# Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you
|
||||||
# do not want continuwuity to send outbound requests to. Defaults to
|
# do not want continuwuity to send outbound requests to. Defaults to
|
||||||
# RFC1918, unroutable, loopback, multicast, and testnet addresses for
|
# RFC1918, unroutable, loopback, multicast, and testnet addresses for
|
||||||
@@ -1570,19 +1602,6 @@
|
|||||||
#
|
#
|
||||||
#block_non_admin_invites = false
|
#block_non_admin_invites = false
|
||||||
|
|
||||||
# Enable or disable making requests to MSC4284 Policy Servers.
|
|
||||||
# It is recommended you keep this enabled unless you experience frequent
|
|
||||||
# connectivity issues, such as in a restricted networking environment.
|
|
||||||
#
|
|
||||||
#enable_msc4284_policy_servers = true
|
|
||||||
|
|
||||||
# Enable running locally generated events through configured MSC4284
|
|
||||||
# policy servers. You may wish to disable this if your server is
|
|
||||||
# single-user for a slight speed benefit in some rooms, but otherwise
|
|
||||||
# should leave it enabled.
|
|
||||||
#
|
|
||||||
#policy_server_check_own_events = true
|
|
||||||
|
|
||||||
# Allow admins to enter commands in rooms other than "#admins" (admin
|
# Allow admins to enter commands in rooms other than "#admins" (admin
|
||||||
# room) by prefixing your message with "\!admin" or "\\!admin" followed up
|
# room) by prefixing your message with "\!admin" or "\\!admin" followed up
|
||||||
# a normal continuwuity admin command. The reply will be publicly visible
|
# a normal continuwuity admin command. The reply will be publicly visible
|
||||||
@@ -1849,6 +1868,11 @@
|
|||||||
#
|
#
|
||||||
#support_page =
|
#support_page =
|
||||||
|
|
||||||
|
# The ed25519 public key for the policy server available at this server's
|
||||||
|
# name. Must be unpadded base64.
|
||||||
|
#
|
||||||
|
#policy_server_public_key =
|
||||||
|
|
||||||
# Role string for server support contacts, to be served as part of the
|
# Role string for server support contacts, to be served as part of the
|
||||||
# MSC1929 server support endpoint at /.well-known/matrix/support.
|
# MSC1929 server support endpoint at /.well-known/matrix/support.
|
||||||
#
|
#
|
||||||
@@ -1959,8 +1983,10 @@
|
|||||||
#
|
#
|
||||||
#sender =
|
#sender =
|
||||||
|
|
||||||
# Whether to require that users provide an email address when they
|
# Whether to allow public registration with an email address.
|
||||||
# register.
|
#
|
||||||
|
# Note that, if this option is enabled, anyone will be able to register an
|
||||||
|
# account with just an email address.
|
||||||
#
|
#
|
||||||
# If either this option or `require_email_for_token_registration` are set,
|
# If either this option or `require_email_for_token_registration` are set,
|
||||||
# users will not be allowed to remove their email address.
|
# users will not be allowed to remove their email address.
|
||||||
@@ -1968,6 +1994,130 @@
|
|||||||
#require_email_for_registration = false
|
#require_email_for_registration = false
|
||||||
|
|
||||||
# Whether to require that users who register with a registration token
|
# Whether to require that users who register with a registration token
|
||||||
# provide an email address.
|
# provide an email address. This option is independent of
|
||||||
|
# `require_email_for_registration`.
|
||||||
#
|
#
|
||||||
#require_email_for_token_registration = false
|
#require_email_for_token_registration = false
|
||||||
|
|
||||||
|
#[global.registration_terms]
|
||||||
|
|
||||||
|
# The language code to provide to clients along with the policy documents.
|
||||||
|
#
|
||||||
|
#language = "en"
|
||||||
|
|
||||||
|
# Policy documents, such as terms and conditions or a privacy policy,
|
||||||
|
# which users must agree to when registering an account.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# ```ignore
|
||||||
|
# [global.registration_terms.documents]
|
||||||
|
# privacy_policy = { name = "Privacy Policy", url = "https://homeserver.example/en/privacy_policy.html" }
|
||||||
|
# ```
|
||||||
|
#
|
||||||
|
#documents =
|
||||||
|
|
||||||
|
#[global.oauth]
|
||||||
|
|
||||||
|
# The compatibility mode to use for OAuth.
|
||||||
|
#
|
||||||
|
# - "disabled": OAuth will be unavailable. Users will only be able to log
|
||||||
|
# in using legacy authentication.
|
||||||
|
# - "hybrid": OAuth and legacy authentication will both be available. Some
|
||||||
|
# clients may only use one or the other.
|
||||||
|
# - "exclusive": Only OAuth will be available. Clients which require
|
||||||
|
# legacy authentication will be unable to log in.
|
||||||
|
#
|
||||||
|
#compatibility_mode = "hybrid"
|
||||||
|
|
||||||
|
#[global.oauth.oidc]
|
||||||
|
# Uncommenting this section will enable Continuwuity's support for
|
||||||
|
# authenticating users using an OpenID Connect-compatible identity provider.
|
||||||
|
# This is referred to as "delegated authentication".
|
||||||
|
#
|
||||||
|
# IMPORTANT NOTE: When delegated authentication is active, Continuwuity will behave as if
|
||||||
|
# the `global.oauth.compatibility_mode` setting is set to `exclusive`.
|
||||||
|
# Matrix clients which do not support OAuth login (also referred to as "next-gen auth") will NOT be able
|
||||||
|
# to log in while delegated authentication is active.
|
||||||
|
|
||||||
|
|
||||||
|
# The OIDC issuer URL. Continuwuity will use OpenID Connect Discovery to
|
||||||
|
# automatically fetch the identity provider's metadata from this URL.
|
||||||
|
# Generally you should set this to the base domain your identity provider
|
||||||
|
# runs on.
|
||||||
|
#
|
||||||
|
#discovery_url =
|
||||||
|
|
||||||
|
# The OAuth client ID for Continuwuity to use when communicating with the
|
||||||
|
# identity provider.
|
||||||
|
#
|
||||||
|
#client_id =
|
||||||
|
|
||||||
|
# The OAuth client secret for Continuwuity to use when communicating with
|
||||||
|
# the identity provider.
|
||||||
|
#
|
||||||
|
#client_secret =
|
||||||
|
|
||||||
|
# A path to a file which Continuwuity will read the client secret from.
|
||||||
|
# If this option is set, it will override `client_secret`.
|
||||||
|
#
|
||||||
|
# The server will fail to start if the file cannot be read.
|
||||||
|
#
|
||||||
|
#client_secret_file =
|
||||||
|
|
||||||
|
# Additional scopes Continuwuity should request from the IDP. This may be
|
||||||
|
# necessary to access certain claims. Continuwuity always requests the
|
||||||
|
# `openid` scope.
|
||||||
|
#
|
||||||
|
#additional_scopes = []
|
||||||
|
|
||||||
|
# Whether the user should be prompted to choose a localpart
|
||||||
|
# when signing in for the first time. If this is `false`, Continuwuity
|
||||||
|
# will attempt to use the value of the `preferred_username_claim`
|
||||||
|
# (see below) as the user's localpart. Authentication will
|
||||||
|
# fail if this claim is missing or is not a valid localpart.
|
||||||
|
#
|
||||||
|
#prompt_for_localpart = true
|
||||||
|
|
||||||
|
# The claim to use for the user's localpart, if `prompt_for_localpart` is
|
||||||
|
# false.
|
||||||
|
#
|
||||||
|
#preferred_username_claim = "preferred_username"
|
||||||
|
|
||||||
|
# The claim which will be used to set the user's email address,
|
||||||
|
# either on initial registration or on every login depending on
|
||||||
|
# the value of `profile_key_import_mode`. Continuwuity assumes that
|
||||||
|
# the IDP has taken care of verifying that the user controls the email
|
||||||
|
# address it provides.
|
||||||
|
#
|
||||||
|
# This option does nothing if SMTP is not configured.
|
||||||
|
#
|
||||||
|
# If this option is set, and `profile_key_import_mode` is `on_login`,
|
||||||
|
# users will not be able to change their email addresses themselves.
|
||||||
|
#
|
||||||
|
#email_claim = "email"
|
||||||
|
|
||||||
|
# Defines how claims returned from the IDP should be mapped to a user's
|
||||||
|
# profile data. The profile field named in each key will be set from the
|
||||||
|
# claim named in the corresponding value when the user first registers,
|
||||||
|
# and possibly on subsequent logins as well, depending on the value of
|
||||||
|
# `profile_key_import_mode` (see below).
|
||||||
|
#
|
||||||
|
# Per-room overrides to the user's display name or avatar will be
|
||||||
|
# preserved by the import process.
|
||||||
|
#
|
||||||
|
# SECURITY NOTE: If the `avatar_url` field is set, Continuwuity will
|
||||||
|
# perform a HTTP GET to the URL in the mapped claim and use the returned
|
||||||
|
# file as the user's profile picture. Make sure your users are not able
|
||||||
|
# to set the value of the mapped claim to an arbitrary URL.
|
||||||
|
#
|
||||||
|
#profile_key_map = { displayname = "name" }
|
||||||
|
|
||||||
|
# When profile keys should be imported from the IDP's claims.
|
||||||
|
#
|
||||||
|
# - "on_registration": Listed keys will be imported once, when the user
|
||||||
|
# logs in for the first time and their shadow account is created.
|
||||||
|
# - "on_login": Listed keys will be imported every time the user logs in.
|
||||||
|
# Additionally, users will not be able to manually edit any listed keys
|
||||||
|
# through their Matrix client.
|
||||||
|
#
|
||||||
|
#profile_key_import_mode = "on_registration"
|
||||||
+1
-1
@@ -50,7 +50,7 @@ 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.19.1
|
ENV BINSTALL_VERSION=1.20.1
|
||||||
# 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
|
||||||
|
|||||||
@@ -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.19.1
|
ENV BINSTALL_VERSION=1.20.1
|
||||||
# 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
|
||||||
|
|||||||
@@ -187,6 +187,75 @@ All paths should be forwarded to LiveKit by default, with the exception of the f
|
|||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>Example docker compose file with caddy-docker-proxy labels</summary>
|
||||||
|
```yaml
|
||||||
|
# This setup assumes all containers share the same bridge network
|
||||||
|
services:
|
||||||
|
lk-jwt-service:
|
||||||
|
image: ghcr.io/element-hq/lk-jwt-service:latest
|
||||||
|
container_name: lk-jwt-service
|
||||||
|
# lk-jwt-service environment config here..
|
||||||
|
labels:
|
||||||
|
caddy: livekit.example.com
|
||||||
|
caddy.@lk-jwt-service.path: "/sfu/get* /healthz* /get_token*"
|
||||||
|
caddy.reverse_proxy: "@lk-jwt-service {{upstreams 8081}}"
|
||||||
|
|
||||||
|
|
||||||
|
livekit:
|
||||||
|
image: livekit/livekit-server:latest
|
||||||
|
container_name: livekit
|
||||||
|
command: --config /etc/livekit.yaml
|
||||||
|
restart: unless-stopped
|
||||||
|
labels:
|
||||||
|
caddy: livekit.example.com
|
||||||
|
caddy.reverse_proxy: "{{upstreams 7880}}"
|
||||||
|
volumes:
|
||||||
|
- ./livekit.yaml:/etc/livekit.yaml:ro
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:7880:7880/tcp"
|
||||||
|
- "7881:7881/tcp"
|
||||||
|
- "50100-50200:50100-50200/udp"
|
||||||
|
|
||||||
|
|
||||||
|
caddy:
|
||||||
|
image: lucaslorentz/caddy-docker-proxy:ci-alpine
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
environment:
|
||||||
|
- CADDY_INGRESS_NETWORKS=caddy
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./data:/data
|
||||||
|
restart: unless-stopped
|
||||||
|
labels:
|
||||||
|
# If you already configured `[global.well_known]` with Continuwuity,
|
||||||
|
# comment out the *_respond labels and add this line
|
||||||
|
# caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008
|
||||||
|
caddy.1_respond: /.well-known/matrix/server {"m.server":"matrix.example.com:443"}
|
||||||
|
caddy.2_respond: /.well-known/matrix/client {"m.server":{"base_url":"https://matrix.example.com"},"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc4143.rtc_foci":[{"type":"livekit","livekit_service_url":"https://livekit.example.com"}]}
|
||||||
|
|
||||||
|
# If you are having problems with continuwuity serving headers uncomment
|
||||||
|
# the header section below.
|
||||||
|
|
||||||
|
# caddy: example.com
|
||||||
|
# caddy.0_header: "*"
|
||||||
|
# caddy.0_header.Access-Control-Allow-Origin: "*"
|
||||||
|
# caddy.0_header.Access-Control-Allow-Methods: "GET, POST, OPTIONS"
|
||||||
|
# caddy.0_header.Access-Control-Allow-Headers: "Authorization"
|
||||||
|
# caddy.0_header.Content-Type: "application/json"
|
||||||
|
|
||||||
|
homeserver:
|
||||||
|
image: forgejo.ellis.link/continuwuation/continuwuity:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
# add additional environment, volume, and network config here...
|
||||||
|
labels:
|
||||||
|
caddy: matrix.example.com
|
||||||
|
caddy.reverse_proxy: "{{upstreams 8008}}"
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
### 6. Start Everything
|
### 6. Start Everything
|
||||||
|
|||||||
@@ -47,9 +47,15 @@ and, for amd64, target the haswell CPU architecture.
|
|||||||
|
|
||||||
### Nix
|
### Nix
|
||||||
|
|
||||||
Theres a Nix package defined in our flake, available for Linux and MacOS. Add continuwuity as an input to your flake, and use `inputs.continuwuity.packages.${system}.default` to get a working Continuwuity package.
|
If you wish to generate a static binary, you can do so using Nix: `nix build git+https://forgejo.ellis.link/continuwuation/continuwuity#packageName`, where `packageName` is one of:
|
||||||
|
|
||||||
If you simply wish to generate a binary using Nix, you can run `nix build git+https://forgejo.ellis.link/continuwuation/continuwuity` to generate a binary in `result/bin/conduwuit`.
|
- `default-static-x86_64`
|
||||||
|
- `default-static-aarch64`
|
||||||
|
- `max-perf-static-x86_64`
|
||||||
|
- `max-perf-haswell-static-x86_64`
|
||||||
|
- `max-perf-static-aarch64`
|
||||||
|
|
||||||
|
`max-perf` takes longer to build, but has more runtime optimizations. Haswell builds are optimized for modern CPUs.
|
||||||
|
|
||||||
### Compiling
|
### Compiling
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,16 @@ The NixOS module provides these configuration options:
|
|||||||
- `extraEnvironment`: Extra environment variables to pass to the Continuwuity server
|
- `extraEnvironment`: Extra environment variables to pass to the Continuwuity server
|
||||||
- `package`: The Continuwuity package to use, defaults to `pkgs.matrix-continuwuity`
|
- `package`: The Continuwuity package to use, defaults to `pkgs.matrix-continuwuity`
|
||||||
- You may want to override this to be from our flake, for faster updates and unstable versions:
|
- You may want to override this to be from our flake, for faster updates and unstable versions:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
package = inputs.continuwuity.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
package = inputs.continuwuity.packages.${pkgs.stdenv.hostPlatform.system}.packageName;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Where `packageName` is one of:
|
||||||
|
- `default`
|
||||||
|
- `max-perf`: Takes longer to build, but has more runtime optimizations
|
||||||
|
- `max-perf-haswell`: Optimized for modern CPUs, don't use if your CPU is not Haswell or later.
|
||||||
|
|
||||||
- `admin.enable`: Whether to add the `conduwuit` binary to `PATH` for administration (enabled by default)
|
- `admin.enable`: Whether to add the `conduwuit` binary to `PATH` for administration (enabled by default)
|
||||||
- `settings`: The Continuwuity configuration
|
- `settings`: The Continuwuity configuration
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
|
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 13,
|
"id": 14,
|
||||||
"mention_room": true,
|
"mention_room": true,
|
||||||
"date": "2026-05-08",
|
"date": "2026-06-20",
|
||||||
"message": "[v0.5.9](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v0.5.9) has been released, fixing a few low-severity federation-related vulnerabilities. It is recommended you read the changelog and update as soon as possible. There are no new features or other changes in this release, only related bugfixes. Deployments tracking the main branch should also update to the latest commit."
|
"message": "[v0.5.10](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v0.5.10) has been released. It is a security release, so we suggest you update as soon as possible. Don't forget to also join [our announcements room](https://matrix.to/#/!jIdNjSM5X-V5JVx2h2kAhUZIIQ08GyzPL55NFZAH1vM/%24K1ISNKIqfNiZzsNVCaTt2E7ZtNeP6Dsy6sbz9l3rO0A?via=ellis.link&via=gingershaped.computer&via=matrix.org)."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,13 @@ Echo input of admin command
|
|||||||
|
|
||||||
## `!admin debug get-auth-chain`
|
## `!admin debug get-auth-chain`
|
||||||
|
|
||||||
Get the auth_chain of a PDU
|
Loads the auth_chain of a PDU, reporting how long it took
|
||||||
|
|
||||||
|
## `!admin debug show-auth-chain`
|
||||||
|
|
||||||
|
Walks & displays the auth_chain of a PDU in a mermaid graph format.
|
||||||
|
|
||||||
|
This is useless to basically anyone but developers, and is also probably slow and memory hungry.
|
||||||
|
|
||||||
## `!admin debug parse-pdu`
|
## `!admin debug parse-pdu`
|
||||||
|
|
||||||
@@ -44,6 +50,12 @@ This is functionally equivalent to `GET /_matrix/client/v3/rooms/{roomid}/state`
|
|||||||
|
|
||||||
Of course the check is still done on the actual client API.
|
Of course the check is still done on the actual client API.
|
||||||
|
|
||||||
|
## `!admin debug get-state-at`
|
||||||
|
|
||||||
|
Gets all the room state events at the specified event.
|
||||||
|
|
||||||
|
State at event might not be available for some PDUs, such as rejected ones.
|
||||||
|
|
||||||
## `!admin debug get-signing-keys`
|
## `!admin debug get-signing-keys`
|
||||||
|
|
||||||
Get and display signing keys from local cache or remote server
|
Get and display signing keys from local cache or remote server
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Admin commands allow server administrators to manage the server from within thei
|
|||||||
- [`!admin appservices`](appservices/): Commands for managing appservices
|
- [`!admin appservices`](appservices/): Commands for managing appservices
|
||||||
- [`!admin users`](users/): Commands for managing local users
|
- [`!admin users`](users/): Commands for managing local users
|
||||||
- [`!admin token`](token/): Commands for managing registration tokens
|
- [`!admin token`](token/): Commands for managing registration tokens
|
||||||
|
- [`!admin oidc`](oidc/): Commands for managing OIDC
|
||||||
- [`!admin rooms`](rooms/): Commands for managing rooms
|
- [`!admin rooms`](rooms/): Commands for managing rooms
|
||||||
- [`!admin federation`](federation/): Commands for managing federation
|
- [`!admin federation`](federation/): Commands for managing federation
|
||||||
- [`!admin server`](server/): Commands for managing the server
|
- [`!admin server`](server/): Commands for managing the server
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<!-- This file is generated by `cargo xtask generate-docs`. Do not edit. -->
|
||||||
|
# `!admin oidc`
|
||||||
|
|
||||||
|
Commands for managing OIDC
|
||||||
|
|
||||||
|
|
||||||
|
## `!admin oidc link`
|
||||||
|
|
||||||
|
Link a user ID to the given subject claim
|
||||||
|
|
||||||
|
## `!admin oidc unlink`
|
||||||
|
|
||||||
|
Unlink the given subject claim from its associated user ID
|
||||||
@@ -12,10 +12,6 @@ Create a new user
|
|||||||
|
|
||||||
Reset user password
|
Reset user password
|
||||||
|
|
||||||
## `!admin users issue-password-reset-link`
|
|
||||||
|
|
||||||
Issue a self-service password reset link for a user
|
|
||||||
|
|
||||||
## `!admin users get-email`
|
## `!admin users get-email`
|
||||||
|
|
||||||
Get a user's associated email address
|
Get a user's associated email address
|
||||||
@@ -96,6 +92,14 @@ Disables login for the specified user without deactivating or locking their acco
|
|||||||
|
|
||||||
List local users in the database
|
List local users in the database
|
||||||
|
|
||||||
|
## `!admin users list-invited-rooms`
|
||||||
|
|
||||||
|
Lists all the rooms (local and remote) that the specified user is invited to
|
||||||
|
|
||||||
|
## `!admin users reject-all-invites`
|
||||||
|
|
||||||
|
Manually make a user reject all current invites
|
||||||
|
|
||||||
## `!admin users list-joined-rooms`
|
## `!admin users list-joined-rooms`
|
||||||
|
|
||||||
Lists all the rooms (local and remote) that the specified user is joined in
|
Lists all the rooms (local and remote) that the specified user is joined in
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Please check that your issues are not due to problems with your Docker setup.
|
|||||||
|
|
||||||
### Slow joins to rooms
|
### Slow joins to rooms
|
||||||
|
|
||||||
Some slowness is to be expected if you're the first person on your homserver to join a room (which will
|
Some slowness is to be expected if you're the first person on your homeserver to join a room (which will
|
||||||
always be the case for single-user homeservers). In this situation, your homeserver has to verify the signatures of
|
always be the case for single-user homeservers). In this situation, your homeserver has to verify the signatures of
|
||||||
all of the state events sent by other servers before your join. To make this process as fast as possible, make sure you have
|
all of the state events sent by other servers before your join. To make this process as fast as possible, make sure you have
|
||||||
multiple fast, trusted servers listed in `trusted_servers` in your configuration, and ensure
|
multiple fast, trusted servers listed in `trusted_servers` in your configuration, and ensure
|
||||||
|
|||||||
Generated
+18
-18
@@ -3,11 +3,11 @@
|
|||||||
"advisory-db": {
|
"advisory-db": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778915282,
|
"lastModified": 1781566179,
|
||||||
"narHash": "sha256-iqXYpuCoWoGypnpM5ceXN748QlYeBXDtZx0uI98qFLo=",
|
"narHash": "sha256-Tqv8I586fYzWpEW/Smq/JqESFa3DVVzVWsnAMtvhy/I=",
|
||||||
"owner": "rustsec",
|
"owner": "rustsec",
|
||||||
"repo": "advisory-db",
|
"repo": "advisory-db",
|
||||||
"rev": "f2ae5fc8e5d208373b6c838f9676434525327a72",
|
"rev": "74e084413d979d52d2f93b1d93b1ab7b9ee648f5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
},
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778106249,
|
"lastModified": 1780532242,
|
||||||
"narHash": "sha256-cM/AuKy5tMhwOOQIbha8ZRRMHVfNf7cv2aljIw+qoCg=",
|
"narHash": "sha256-D+BsdpxmtUwtqGoY0IXPhHgTlmqgcZKCEo1oMyn7ep0=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "6d015ea29630b7ad2402841386da2cb617a470a7",
|
"rev": "59a82a1222dd3b2080b5cc52a1a2e8d5f1b77f37",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -39,11 +39,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778919578,
|
"lastModified": 1781527054,
|
||||||
"narHash": "sha256-+z+jgTly48gsAiX8rOe/vs8C/2G4vdCpcEtqMJUpFqw=",
|
"narHash": "sha256-1fX9ev2Fh5QoKQ41G9dYutjo5j/jywu6tZse5Eb1Ck4=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "ecd6d4ff22cfdb1339b2915455a2ff4dc85bf52e",
|
"rev": "8c2e51dffefc040a21975da7abf6f252c8c9b783",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -89,11 +89,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778869304,
|
"lastModified": 1781074563,
|
||||||
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
|
"narHash": "sha256-md8WlXOlfnIeHeOScMTTHFyf2d6iaTwPl2apR5EQ3P4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
|
"rev": "9ae611a455b90cf061d8f332b977e387bda8e1ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -132,11 +132,11 @@
|
|||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778854817,
|
"lastModified": 1781453968,
|
||||||
"narHash": "sha256-iG+VuMy8W585geVVCUd7pR025WsY3ZkgSv5Yt5bxDmQ=",
|
"narHash": "sha256-+V3nK4pCngbmgyVGXY6Kkrlevp4ocPkJJLf2aqwkDNA=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "1a68212c5683555ad80f0eab71db9715c6d52145",
|
"rev": "cc272809a173c2c11d0e479d639c811c1eacf049",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -153,11 +153,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775636079,
|
"lastModified": 1780220602,
|
||||||
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
|
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
|
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
perSystem =
|
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
self',
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
_module.args.craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (
|
|
||||||
pkgs: self'.packages.stable-toolchain
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./rust.nix
|
./rust.nix
|
||||||
./crane.nix
|
|
||||||
./packages
|
./packages
|
||||||
./devshell.nix
|
./devshell.nix
|
||||||
./fmt.nix
|
./fmt.nix
|
||||||
|
|||||||
+4
-3
@@ -1,7 +1,6 @@
|
|||||||
{
|
{ inputs, ... }: {
|
||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
craneLib,
|
|
||||||
self',
|
self',
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
@@ -9,7 +8,9 @@
|
|||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
# basic nix shell containing all things necessary to build continuwuity in all flavors manually (on x86_64-linux)
|
# basic nix shell containing all things necessary to build continuwuity in all flavors manually (on x86_64-linux)
|
||||||
devShells.default = craneLib.devShell {
|
devShells.default =
|
||||||
|
((inputs.crane.mkLib pkgs).overrideToolchain (pkgs: self'.packages.stable-toolchain)).devShell
|
||||||
|
{
|
||||||
packages = [
|
packages = [
|
||||||
self'.packages.rocksdb
|
self'.packages.rocksdb
|
||||||
pkgs.nodejs
|
pkgs.nodejs
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
lib,
|
lib,
|
||||||
self,
|
self,
|
||||||
stdenv,
|
stdenv,
|
||||||
liburing,
|
rocksdb,
|
||||||
craneLib,
|
craneLib,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
callPackage,
|
liburing,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
cargoExtraArgs ? "",
|
cargoExtraArgs ? "",
|
||||||
rustflags ? "",
|
rustflags ? "",
|
||||||
target_cpu ? null,
|
target_cpu ? null,
|
||||||
rocksdb ? callPackage ./rocksdb.nix { },
|
|
||||||
profile ? "release",
|
profile ? "release",
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
@@ -29,18 +28,26 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
attrs = {
|
attrs = {
|
||||||
|
__structuredAttrs = true;
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config
|
pkg-config
|
||||||
rustPlatform.bindgenHook
|
rustPlatform.bindgenHook
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ liburing ];
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ liburing ];
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
|
||||||
CARGO_PROFILE = profile;
|
CARGO_PROFILE = profile;
|
||||||
RUSTFLAGS = rustflags;
|
RUSTFLAGS = rustflags;
|
||||||
}
|
}
|
||||||
|
// (lib.optionalAttrs (rocksdb != null) {
|
||||||
|
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
||||||
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
||||||
|
})
|
||||||
// (lib.optionalAttrs (target_cpu != null) {
|
// (lib.optionalAttrs (target_cpu != null) {
|
||||||
TARGET_CPU = target_cpu;
|
TARGET_CPU = target_cpu;
|
||||||
});
|
});
|
||||||
@@ -52,7 +59,7 @@ craneLib.buildPackage (
|
|||||||
cargoArtifacts = craneLib.buildDepsOnly attrs;
|
cargoArtifacts = craneLib.buildDepsOnly attrs;
|
||||||
|
|
||||||
# Needed to make continuwuity link to rocksdb
|
# Needed to make continuwuity link to rocksdb
|
||||||
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
postFixup = lib.optionalString (stdenv.hostPlatform.isLinux && rocksdb != null) ''
|
||||||
old_rpath="$(patchelf --print-rpath $out/bin/conduwuit)"
|
old_rpath="$(patchelf --print-rpath $out/bin/conduwuit)"
|
||||||
extra_rpath="${
|
extra_rpath="${
|
||||||
lib.makeLibraryPath [
|
lib.makeLibraryPath [
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
inputs,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
@@ -6,31 +7,84 @@
|
|||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
self',
|
self',
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs',
|
||||||
|
system,
|
||||||
craneLib,
|
craneLib,
|
||||||
|
mkToolchain,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
packages = {
|
packages =
|
||||||
rocksdb = pkgs.callPackage ./rocksdb.nix { };
|
let
|
||||||
|
mkPackages =
|
||||||
|
pkgs:
|
||||||
|
let
|
||||||
|
fnx = inputs'.fenix.packages;
|
||||||
|
|
||||||
|
isStatic = pkgs.stdenv.hostPlatform.isMusl;
|
||||||
|
|
||||||
|
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (
|
||||||
|
_:
|
||||||
|
if isStatic then
|
||||||
|
fnx.combine [
|
||||||
|
self'.packages.stable-toolchain
|
||||||
|
(mkToolchain fnx.targets.${pkgs.stdenv.hostPlatform.config}).rust-std
|
||||||
|
]
|
||||||
|
else
|
||||||
|
self'.packages.stable-toolchain
|
||||||
|
);
|
||||||
|
|
||||||
default = pkgs.callPackage ./continuwuity.nix {
|
default = pkgs.callPackage ./continuwuity.nix {
|
||||||
inherit self craneLib;
|
inherit self craneLib;
|
||||||
|
|
||||||
|
liburing = (if isStatic then pkgs.pkgsStatic else pkgs).liburing;
|
||||||
|
rocksdb = if isStatic then null else self'.packages.rocksdb;
|
||||||
|
|
||||||
# extra features via `cargoExtraArgs`
|
# extra features via `cargoExtraArgs`
|
||||||
cargoExtraArgs = "-F http3";
|
cargoExtraArgs = "-F http3";
|
||||||
# extra RUSTFLAGS via `rustflags`
|
# extra RUSTFLAGS via `rustflags`
|
||||||
# the stuff below is required for http3
|
# the stuff below is required for http3
|
||||||
rustflags = "--cfg reqwest_unstable";
|
rustflags = "--cfg reqwest_unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
# users may also override this with other cargo profiles to build for other feature sets
|
# users may also override this with other cargo profiles to build for other feature sets
|
||||||
# for features configuration see `default` package which enables http3 by default
|
# for features configuration see `default` package which enables http3 by default
|
||||||
|
|
||||||
# example: different compilation profile and different target_cpu
|
max-perf = default.override {
|
||||||
max-perf-haswell = self'.packages.default.override {
|
|
||||||
# compiles explicitly for haswell arch cpus
|
|
||||||
target_cpu = "haswell";
|
|
||||||
# compiles slower but with more thorough optimizations
|
# compiles slower but with more thorough optimizations
|
||||||
profile = "release-max-perf";
|
profile = "release-max-perf";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
max-perf-haswell = max-perf.override {
|
||||||
|
# compiles explicitly for haswell arch cpus
|
||||||
|
target_cpu = "haswell";
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit default max-perf max-perf-haswell;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
rocksdb = pkgs.callPackage ./rocksdb.nix { };
|
||||||
|
}
|
||||||
|
// (mkPackages pkgs)
|
||||||
|
// (lib.mapAttrs' (name: value: lib.nameValuePair "${name}-static-x86_64" value) (
|
||||||
|
mkPackages (
|
||||||
|
import inputs.nixpkgs {
|
||||||
|
localSystem = system;
|
||||||
|
crossSystem = "x86_64-unknown-linux-musl";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
))
|
||||||
|
// (lib.mapAttrs' (name: value: lib.nameValuePair "${name}-static-aarch64" value) (
|
||||||
|
mkPackages (
|
||||||
|
import inputs.nixpkgs {
|
||||||
|
localSystem = system;
|
||||||
|
crossSystem = "aarch64-unknown-linux-musl";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
stdenv,
|
# stdenv,
|
||||||
|
# enableJemalloc ? stdenv.hostPlatform.isLinux,
|
||||||
|
enableJemalloc ? false,
|
||||||
rocksdb,
|
rocksdb,
|
||||||
fetchFromGitea,
|
fetchFromGitea,
|
||||||
rust-jemalloc-sys-unprefixed,
|
rust-jemalloc-sys-unprefixed,
|
||||||
@@ -13,7 +15,7 @@
|
|||||||
#
|
#
|
||||||
# [1]: https://github.com/tikv/jemallocator/blob/ab0676d77e81268cd09b059260c75b38dbef2d51/jemalloc-sys/src/env.rs#L17
|
# [1]: https://github.com/tikv/jemallocator/blob/ab0676d77e81268cd09b059260c75b38dbef2d51/jemalloc-sys/src/env.rs#L17
|
||||||
jemalloc = rust-jemalloc-sys-unprefixed;
|
jemalloc = rust-jemalloc-sys-unprefixed;
|
||||||
enableJemalloc = stdenv.hostPlatform.isLinux;
|
inherit enableJemalloc;
|
||||||
}).overrideAttrs
|
}).overrideAttrs
|
||||||
({
|
({
|
||||||
version = "continuwuity-v0.5.0-unstable-2026-05-19";
|
version = "continuwuity-v0.5.0-unstable-2026-05-19";
|
||||||
|
|||||||
+13
-9
@@ -2,22 +2,26 @@
|
|||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
system,
|
|
||||||
lib,
|
lib,
|
||||||
|
inputs',
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
mkToolchain =
|
||||||
|
target:
|
||||||
|
target.fromToolchainName {
|
||||||
|
name = (lib.importTOML "${inputs.self}/rust-toolchain.toml").toolchain.channel;
|
||||||
|
sha256 = "sha256-h+t2xTBz5yt2YIO+1VMIIGlCU7gyp2LYOFvaV1nwOXU=";
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
_module.args = { inherit mkToolchain; };
|
||||||
|
|
||||||
packages =
|
packages =
|
||||||
let
|
let
|
||||||
fnx = inputs.fenix.packages.${system};
|
fnx = inputs'.fenix.packages;
|
||||||
|
stable-toolchain = (mkToolchain fnx).toolchain;
|
||||||
stable-toolchain = fnx.fromToolchainFile {
|
|
||||||
file = inputs.self + "/rust-toolchain.toml";
|
|
||||||
|
|
||||||
# See also `rust-toolchain.toml`
|
|
||||||
sha256 = "sha256-gh/xTkxKHL4eiRXzWv8KP7vfjSk61Iq48x47BEDFgfk=";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit stable-toolchain;
|
inherit stable-toolchain;
|
||||||
|
|||||||
Generated
+211
-162
@@ -125,14 +125,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rsbuild/core": {
|
"node_modules/@rsbuild/core": {
|
||||||
"version": "2.0.6",
|
"version": "2.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.0.15.tgz",
|
||||||
"integrity": "sha512-0/u7oTgPp9NsL7E7qXzYiOOPAsOJiDbOr0FmG6gizJDIpYK8nospogNrwQ00SG0had9fdhLI7XkhP160IaLnWw==",
|
"integrity": "sha512-O8vmMhZu1YImO6jOqt/K/vlJSvkq7UtSq5YM1DIlcEd9LW8Gf6/dkQ1B2KPI6F+hSMFBnTTTumdcIowSLCw97g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rspack/core": "~2.0.3",
|
"@rspack/core": "~2.0.8",
|
||||||
"@swc/helpers": "^0.5.21"
|
"@swc/helpers": "^0.5.23"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"rsbuild": "bin/rsbuild.js"
|
"rsbuild": "bin/rsbuild.js"
|
||||||
@@ -150,9 +150,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rsbuild/plugin-react": {
|
"node_modules/@rsbuild/plugin-react": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rsbuild/plugin-react/-/plugin-react-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@rsbuild/plugin-react/-/plugin-react-2.0.1.tgz",
|
||||||
"integrity": "sha512-/1gzt39EGUSFEqB83g46QoOwsgv172HI18i6au1b6lgIaX4sv9stuX4ijdHbHCp8PqYEq+MyQ99jIQMO6I+etg==",
|
"integrity": "sha512-n5m3VxEm6m3Dv1VkI0WnxsildySJ6M+QjGIzkZDy5UebRCIJ1Q/hlQVyhofBL6C+AcsF9fGjlHQkeiteXJSr3Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -169,28 +169,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding": {
|
"node_modules/@rspack/binding": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.0.8.tgz",
|
||||||
"integrity": "sha512-4exVNhGhW5RFHjK87XeTKbkA/qAgI5NHJlT1jNqiJv0gcUXLqTOEU3w7f8+f9zUo4JMFvPc0c9veOi4M19YYTg==",
|
"integrity": "sha512-3uZ+y8aQxq33ty2srMxg2Nu0XuBI6vVrG50rkDaXqwWqOohfgGUSfFuQK7EnSUNy4aFUQlCG6NHialQHJov0wg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rspack/binding-darwin-arm64": "2.0.3",
|
"@rspack/binding-darwin-arm64": "2.0.8",
|
||||||
"@rspack/binding-darwin-x64": "2.0.3",
|
"@rspack/binding-darwin-x64": "2.0.8",
|
||||||
"@rspack/binding-linux-arm64-gnu": "2.0.3",
|
"@rspack/binding-linux-arm64-gnu": "2.0.8",
|
||||||
"@rspack/binding-linux-arm64-musl": "2.0.3",
|
"@rspack/binding-linux-arm64-musl": "2.0.8",
|
||||||
"@rspack/binding-linux-x64-gnu": "2.0.3",
|
"@rspack/binding-linux-x64-gnu": "2.0.8",
|
||||||
"@rspack/binding-linux-x64-musl": "2.0.3",
|
"@rspack/binding-linux-x64-musl": "2.0.8",
|
||||||
"@rspack/binding-wasm32-wasi": "2.0.3",
|
"@rspack/binding-wasm32-wasi": "2.0.8",
|
||||||
"@rspack/binding-win32-arm64-msvc": "2.0.3",
|
"@rspack/binding-win32-arm64-msvc": "2.0.8",
|
||||||
"@rspack/binding-win32-ia32-msvc": "2.0.3",
|
"@rspack/binding-win32-ia32-msvc": "2.0.8",
|
||||||
"@rspack/binding-win32-x64-msvc": "2.0.3"
|
"@rspack/binding-win32-x64-msvc": "2.0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-darwin-arm64": {
|
"node_modules/@rspack/binding-darwin-arm64": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.0.8.tgz",
|
||||||
"integrity": "sha512-4UyCjLJwU/WxR6K1/gG4u3+jUsoaRHJ5rNu9fto/UbvrItwdlVNULChAApqZFw6mcSetMddSjSICeuj5pSB6sA==",
|
"integrity": "sha512-vCgbgH7B7qom+uID+RCZsTCOYFb9wC4/4+1U6rMfytrXGVJ72eNQs2tbdjOl0lb18CT3N/n+VkWynUiLk84GwA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -202,9 +202,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-darwin-x64": {
|
"node_modules/@rspack/binding-darwin-x64": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.0.8.tgz",
|
||||||
"integrity": "sha512-K3evrbTgZNa8emEqk+AjDtbuoXZp5tPZz3pcEgETxuu3KanW8Zu+Fb+TUp1DEUcL0xOmHPPox8H2cZ3pF4Zmug==",
|
"integrity": "sha512-satPm2PD4B7jDTVlVAdvMVdUszwLvWUEnUDzLb77mvVkezKNDZmuhb+e8s+FfKs8hJpNbZ9VAejuA2rr8o985w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -216,9 +216,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-arm64-gnu": {
|
"node_modules/@rspack/binding-linux-arm64-gnu": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.0.8.tgz",
|
||||||
"integrity": "sha512-aPLDaaTtX1wqjLYAIHc2MGDQZtv1Hbjx47oaaefbWz5GbAnSA4P8jdYIeeGRyrqvQ0WqJXIWXgT0d/iXtes00A==",
|
"integrity": "sha512-pSI+npPQE/uDtiboqvcOIRJbEV2+B+H1xffmko/gw50la92oTUW60kVULFwsb6L0+GVCzIcwX3yq60GtYIn+Ug==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -233,9 +233,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-arm64-musl": {
|
"node_modules/@rspack/binding-linux-arm64-musl": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.0.8.tgz",
|
||||||
"integrity": "sha512-0WulUQPop6vmSDfrTxghmVlm+6crU8/XqD2f0dOWbEniZVuDZJ5/Y/cBqTRyk3rjl0vrmUv3lc87/t7UgQJQSw==",
|
"integrity": "sha512-igjJ43yxWQ72GZqjDDZSSHax9/Vg+6rLMmOvFglTJUkQpB4Tyvu/YjW+WRjYj2xRw6blOjLxUSJWASvuSqqlvg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -250,9 +250,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-x64-gnu": {
|
"node_modules/@rspack/binding-linux-x64-gnu": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.0.8.tgz",
|
||||||
"integrity": "sha512-fAhiMuV5omT53YMft+f3Y9euAFgspuyBAk9ZpeW2buL2TkuUMwP07adhhvQfKdQ5gpELfzmjQaRDGqaIT8UWiA==",
|
"integrity": "sha512-zrkoEOnqj1hOEBO5T2I/2Ts2HSJsYFh1qXwMpK4dMJFGGNWDfNeUa6/LF5uq3VINF3JUl7RL47AgrucoSZJXPA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -267,9 +267,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-x64-musl": {
|
"node_modules/@rspack/binding-linux-x64-musl": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.0.8.tgz",
|
||||||
"integrity": "sha512-0kcuFoZ8vy2iNWoISFOZt+/Ujo7LRLrzE7h07AV5r+oN/mv+/v14Sd/8NUtDIScCkrYOszYq/QS31e6t0UrVfw==",
|
"integrity": "sha512-6CtDaGZjNDvJd9TBp7a9zABbrPORO21W96+3ZcGBn0YNUPUk4ARxIxrTTpeJ/1F41QDM8AYIkGDdqEYMqTYBsA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -284,9 +284,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-wasm32-wasi": {
|
"node_modules/@rspack/binding-wasm32-wasi": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.0.8.tgz",
|
||||||
"integrity": "sha512-x2fsw7GzNZEnw444ikj4/b8kVjM0Y0TllxmizHpYZ9gmaQrOk5OXo9RQdz+l4zzoGors0l2IZP5Cc4GJNCaSoQ==",
|
"integrity": "sha512-Yf4SiqTUroT5Ju+te0YAY2xxKOb35tECsO21v7hYyGa705wrgoAK/MmF7enOvs9GR1iZIqgiLD/wxsIxl8GjJw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"wasm32"
|
"wasm32"
|
||||||
],
|
],
|
||||||
@@ -300,9 +300,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-arm64-msvc": {
|
"node_modules/@rspack/binding-win32-arm64-msvc": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.0.8.tgz",
|
||||||
"integrity": "sha512-jqlxuVPdrgMuwj/HEjSkC/jmhl4fAuKyob36zJXq2uAusn2FRJ4kClGe1fLFpfxRXFVQAWwlAOwLJg8T0suuaA==",
|
"integrity": "sha512-8NCuiQsAhXrwRBy57QZoypqrws/zLBkaQVGiB8hksr6v++8hNigNjqpQARLbd0iyMuHsQQ++8+auGk6xlDXmzw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -314,9 +314,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-ia32-msvc": {
|
"node_modules/@rspack/binding-win32-ia32-msvc": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.0.8.tgz",
|
||||||
"integrity": "sha512-QM4JEuyk5QaZ5gnvnAIaCwVQzCkrD2E4Sud77kx/MVGDsRkcOlMx3blMC5QNHPDamRmWGk+7314YOQvRhKuWyg==",
|
"integrity": "sha512-bxiekytbX7V9KFAra+HkwtNWC6pYfHEBBZFpiT0xUs3mCFOmAAFVBsBSQsoCP9AdCEXoMAvNdnrHNw3iov4OZw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -328,9 +328,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-x64-msvc": {
|
"node_modules/@rspack/binding-win32-x64-msvc": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.0.8.tgz",
|
||||||
"integrity": "sha512-vSQNnAy0wswG6AfNRuArTHQBiXOXl+A9ddQxBFup4PMHUzXxKtsBLQzw7BgFC0EgrPeHbt+30j7sXVZKYukj4A==",
|
"integrity": "sha512-7zPs8YCe/ZVJTwd+5lpB0CP0tkn2pONf/T1ycmVY76u21Nrwt8mXQGc/2yH2eWP4B7fikYBr3hGr7mpR2fajqQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -342,20 +342,20 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/core": {
|
"node_modules/@rspack/core": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.0.8.tgz",
|
||||||
"integrity": "sha512-2ufO/8FHIA/lX6UOgSsKPhpDvHr0sh9lYq/n/LsIZsTwu3973BGbu2fg1Akvuu3rEnskPqXjsqH2EPBzEA42uA==",
|
"integrity": "sha512-+NLGJf8gZxihDmMFzjlly3toc2SMjeDmuvz0/Cai9AMdV4F+Pqcnt2BA9V4e3SY2jmhJQtPwgyyLtR1RiJO77g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rspack/binding": "2.0.3"
|
"@rspack/binding": "2.0.8"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",
|
"@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",
|
||||||
"@swc/helpers": ">=0.5.1"
|
"@swc/helpers": "^0.5.23"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"@module-federation/runtime-tools": {
|
"@module-federation/runtime-tools": {
|
||||||
@@ -383,18 +383,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/core": {
|
"node_modules/@rspress/core": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.15.tgz",
|
||||||
"integrity": "sha512-4YBOFmSMFv5GWrCa80qSIW8VxqZQQS/PknVq2r7Hb7kgfB38Fzciopn3hjb3hNwI4TTRbsi/Jev2HyRWD4bYAQ==",
|
"integrity": "sha512-epLmUXYscNRw/GtQZx2oknoBE9wKbCrUGEOrQEDI4Qq8X32GdM4d7itzuHsliY7q3IbffKx8rMVbvlmygEocTQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mdx-js/mdx": "^3.1.1",
|
"@mdx-js/mdx": "^3.1.1",
|
||||||
"@mdx-js/react": "^3.1.1",
|
"@mdx-js/react": "^3.1.1",
|
||||||
"@rsbuild/core": "^2.0.5",
|
"@rsbuild/core": "^2.0.15",
|
||||||
"@rsbuild/plugin-react": "~2.0.0",
|
"@rsbuild/plugin-react": "~2.0.1",
|
||||||
"@rspress/shared": "2.0.11",
|
"@rspress/shared": "2.0.15",
|
||||||
"@shikijs/rehype": "^4.0.2",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"@types/unist": "^3.0.3",
|
"@types/unist": "^3.0.3",
|
||||||
"@unhead/react": "^2.1.15",
|
"@unhead/react": "^2.1.15",
|
||||||
"body-scroll-lock": "4.0.0-beta.0",
|
"body-scroll-lock": "4.0.0-beta.0",
|
||||||
@@ -407,22 +407,22 @@
|
|||||||
"mdast-util-mdxjs-esm": "^2.0.1",
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
||||||
"medium-zoom": "1.1.0",
|
"medium-zoom": "1.1.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"react": "^19.2.6",
|
"react": "^19.2.7",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.7",
|
||||||
"react-lazy-with-preload": "^2.2.1",
|
"react-lazy-with-preload": "^2.2.1",
|
||||||
"react-reconciler": "0.33.0",
|
"react-reconciler": "0.33.0",
|
||||||
"react-render-to-markdown": "19.0.1",
|
"react-render-to-markdown": "19.1.0",
|
||||||
"react-router-dom": "^7.15.0",
|
"react-router-dom": "^7.15.1",
|
||||||
"rehype-external-links": "^3.0.0",
|
"rehype-external-links": "^3.0.0",
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"remark-cjk-friendly": "^2.0.1",
|
"remark-cjk-friendly": "^2.3.1",
|
||||||
"remark-cjk-friendly-gfm-strikethrough": "^2.0.1",
|
"remark-cjk-friendly-gfm-strikethrough": "^2.1.0",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"remark-mdx": "^3.1.1",
|
"remark-mdx": "^3.1.1",
|
||||||
"remark-parse": "^11.0.0",
|
"remark-parse": "^11.0.0",
|
||||||
"remark-stringify": "^11.0.0",
|
"remark-stringify": "^11.0.0",
|
||||||
"scroll-into-view-if-needed": "^3.1.0",
|
"scroll-into-view-if-needed": "^3.1.0",
|
||||||
"shiki": "^4.0.2",
|
"shiki": "^4.2.0",
|
||||||
"unified": "^11.0.5",
|
"unified": "^11.0.5",
|
||||||
"unist-util-remove": "^4.0.0",
|
"unist-util-remove": "^4.0.0",
|
||||||
"unist-util-visit": "^5.1.0",
|
"unist-util-visit": "^5.1.0",
|
||||||
@@ -436,9 +436,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/plugin-client-redirects": {
|
"node_modules/@rspress/plugin-client-redirects": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.15.tgz",
|
||||||
"integrity": "sha512-DI9vod5mGccg57c19CuFpN3mGP1FEEueOUnEUz1UHXSyXg9YTj+ox7Xla4jUUzAzoPVGiWSSsfbtCTwdoxAsbg==",
|
"integrity": "sha512-bPf/KIHH7Y6huLTtK6JXwRfxM7zKjksoxm46+IBsF1wisw0doKkEKR9HwJydxWnykyKBbA2cuZOaoT4h174Z1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -449,9 +449,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/plugin-sitemap": {
|
"node_modules/@rspress/plugin-sitemap": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.15.tgz",
|
||||||
"integrity": "sha512-046LCHgbJXdaPipWB2SWMjZcAtIrOjXGZOD92xlTjhZ74D7Mk1Nod1MQdtOEoISWedcHdgpUVXMDbB1doKBpPQ==",
|
"integrity": "sha512-z1hbyGP79ZXdSGJxiWw7ZjmX8qW0q9nXMDxr14cVEg/wdj7ToVzGtZHw0wvTPE0YiKG3BMiGkVNfE1rdOaPXiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -462,26 +462,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/shared": {
|
"node_modules/@rspress/shared": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.15.tgz",
|
||||||
"integrity": "sha512-7l5Pso4s597utJyisVEnd7n/40h053nfE8DwGQMeS8RLGtSwVgxFwNHsSrvQEGtFlLrg2aWWSITqnAVO1wfTew==",
|
"integrity": "sha512-o8aYwEzNuTmWnmKe91ntPv+34u3RbtAe+rcK9XC5MANOlgncwOaCs3bUa8/B1/llwyLoNgrpi+VB9bEiU11ZRQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rsbuild/core": "^2.0.5",
|
"@rsbuild/core": "^2.0.15",
|
||||||
"@shikijs/rehype": "^4.0.2",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"unified": "^11.0.5"
|
"unified": "^11.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/core": {
|
"node_modules/@shikijs/core": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz",
|
||||||
"integrity": "sha512-hxT0YF4ExEqB8G/qFdtJvpmHXBYJ2lWW7qTHDarVkIudPFE6iCIrqdgWxGn5s+ppkGXI0aEGlibI0PAyzP3zlw==",
|
"integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/primitive": "4.0.2",
|
"@shikijs/primitive": "4.2.0",
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@shikijs/vscode-textmate": "^10.0.2",
|
"@shikijs/vscode-textmate": "^10.0.2",
|
||||||
"@types/hast": "^3.0.4",
|
"@types/hast": "^3.0.4",
|
||||||
"hast-util-to-html": "^9.0.5"
|
"hast-util-to-html": "^9.0.5"
|
||||||
@@ -491,28 +491,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/engine-javascript": {
|
"node_modules/@shikijs/engine-javascript": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz",
|
||||||
"integrity": "sha512-7PW0Nm49DcoUIQEXlJhNNBHyoGMjalRETTCcjMqEaMoJRLljy1Bi/EGV3/qLBgLKQejdspiiYuHGQW6dX94Nag==",
|
"integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@shikijs/vscode-textmate": "^10.0.2",
|
"@shikijs/vscode-textmate": "^10.0.2",
|
||||||
"oniguruma-to-es": "^4.3.4"
|
"oniguruma-to-es": "^4.3.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/engine-oniguruma": {
|
"node_modules/@shikijs/engine-oniguruma": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz",
|
||||||
"integrity": "sha512-UpCB9Y2sUKlS9z8juFSKz7ZtysmeXCgnRF0dlhXBkmQnek7lAToPte8DkxmEYGNTMii72zU/lyXiCB6StuZeJg==",
|
"integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@shikijs/vscode-textmate": "^10.0.2"
|
"@shikijs/vscode-textmate": "^10.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -520,26 +520,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/langs": {
|
"node_modules/@shikijs/langs": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz",
|
||||||
"integrity": "sha512-KaXby5dvoeuZzN0rYQiPMjFoUrz4hgwIE+D6Du9owcHcl6/g16/yT5BQxSW5cGt2MZBz6Hl0YuRqf12omRfUUg==",
|
"integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2"
|
"@shikijs/types": "4.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/primitive": {
|
"node_modules/@shikijs/primitive": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz",
|
||||||
"integrity": "sha512-M6UMPrSa3fN5ayeJwFVl9qWofl273wtK1VG8ySDZ1mQBfhCpdd8nEx7nPZ/tk7k+TYcpqBZzj/AnwxT9lO+HJw==",
|
"integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@shikijs/vscode-textmate": "^10.0.2",
|
"@shikijs/vscode-textmate": "^10.0.2",
|
||||||
"@types/hast": "^3.0.4"
|
"@types/hast": "^3.0.4"
|
||||||
},
|
},
|
||||||
@@ -548,16 +548,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/rehype": {
|
"node_modules/@shikijs/rehype": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/rehype/-/rehype-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/rehype/-/rehype-4.2.0.tgz",
|
||||||
"integrity": "sha512-cmPlKLD8JeojasNFoY64162ScpEdEdQUMuVodPCrv1nx1z3bjmGwoKWDruQWa/ejSznImlaeB0Ty6Q3zPaVQAA==",
|
"integrity": "sha512-ST3EWye/dwF1gWskczJNBnwFtDzEQ9ceytXZtyc/GfwR5V0qJrkoSGZO55O3SAKDDsXkTDcsfwd9pVe7ROlAHg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@types/hast": "^3.0.4",
|
"@types/hast": "^3.0.4",
|
||||||
"hast-util-to-string": "^3.0.1",
|
"hast-util-to-string": "^3.0.1",
|
||||||
"shiki": "4.0.2",
|
"shiki": "4.2.0",
|
||||||
"unified": "^11.0.5",
|
"unified": "^11.0.5",
|
||||||
"unist-util-visit": "^5.1.0"
|
"unist-util-visit": "^5.1.0"
|
||||||
},
|
},
|
||||||
@@ -566,22 +566,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/themes": {
|
"node_modules/@shikijs/themes": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz",
|
||||||
"integrity": "sha512-mjCafwt8lJJaVSsQvNVrJumbnnj1RI8jbUKrPKgE6E3OvQKxnuRoBaYC51H4IGHePsGN/QtALglWBU7DoKDFnA==",
|
"integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/types": "4.0.2"
|
"@shikijs/types": "4.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/types": {
|
"node_modules/@shikijs/types": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz",
|
||||||
"integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==",
|
"integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -600,9 +600,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@swc/helpers": {
|
"node_modules/@swc/helpers": {
|
||||||
"version": "0.5.21",
|
"version": "0.5.23",
|
||||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.21.tgz",
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",
|
||||||
"integrity": "sha512-jI/VAmtdjB/RnI8GTnokyX7Ug8c+g+ffD6QRLa6XQewtnGyukKkKSk3wLTM3b5cjt1jNh9x0jfVlagdN2gDKQg==",
|
"integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -668,9 +668,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/mdx": {
|
"node_modules/@types/mdx": {
|
||||||
"version": "2.0.13",
|
"version": "2.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.14.tgz",
|
||||||
"integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==",
|
"integrity": "sha512-T48PeuJtvLosNTPVhfnIp3i/n3a4g4Bad7YCq5k64D4u7NwDrAotikQ+5+sjtUvBmxCMlbo3dVL+C2dP0rWHzg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
@@ -682,9 +682,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "19.2.14",
|
"version": "19.2.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz",
|
||||||
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
"integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
@@ -723,9 +723,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.16.0",
|
"version": "8.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz",
|
||||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
"integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1821,6 +1821,53 @@
|
|||||||
"url": "https://opencollective.com/unified"
|
"url": "https://opencollective.com/unified"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mdast-util-to-markdown-cjk-friendly": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mdast-util-to-markdown-cjk-friendly/-/mdast-util-to-markdown-cjk-friendly-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-BoaAm8mlJ+LAYz0Qs532Y3ciTuQYgBUPZcSFbvC/ZKmEMAKgulw84YvQK1gI34t/vL2euSfuaWlqczkTBgamkw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mdast-util-to-markdown": "^2.1.2",
|
||||||
|
"micromark-extension-cjk-friendly-util": "3.0.1",
|
||||||
|
"micromark-util-symbol": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/mdast": "*"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/mdast": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough/-/mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-1ePVfB4P/vz3xSsm6H3D32r6VYGErxclnuLLFK02/2ReF+UdEKm7caulK6Vm0LBIp5gPRtB2Z1OYDznCkX3k2w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mdast-util-gfm-strikethrough": "^2.0.0",
|
||||||
|
"mdast-util-to-markdown": "^2.1.2",
|
||||||
|
"micromark-extension-cjk-friendly-util": "3.0.1",
|
||||||
|
"micromark-util-symbol": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/mdast": "*"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/mdast": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mdast-util-to-string": {
|
"node_modules/mdast-util-to-string": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz",
|
||||||
@@ -2742,9 +2789,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/property-information": {
|
"node_modules/property-information": {
|
||||||
"version": "7.1.0",
|
"version": "7.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz",
|
||||||
"integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==",
|
"integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
@@ -2753,9 +2800,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "19.2.6",
|
"version": "19.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz",
|
||||||
"integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==",
|
"integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2763,16 +2810,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-dom": {
|
"node_modules/react-dom": {
|
||||||
"version": "19.2.6",
|
"version": "19.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz",
|
||||||
"integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==",
|
"integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^19.2.6"
|
"react": "^19.2.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-lazy-with-preload": {
|
"node_modules/react-lazy-with-preload": {
|
||||||
@@ -2809,9 +2856,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-render-to-markdown": {
|
"node_modules/react-render-to-markdown": {
|
||||||
"version": "19.0.1",
|
"version": "19.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.1.0.tgz",
|
||||||
"integrity": "sha512-BPv48o+ubcu2JyUDIktvJXFqLIZqR7hA4mvGu1eFIofz9fogT2me9UvXwRvqvGs9jEtNaJkxZIUKUX0oiK4hDA==",
|
"integrity": "sha512-dF9b3tO41ezqdmHP8X92kbHbMexJ6iC7iHw4ykC8fwiO7DgpFc9PhMoKlI+BcPzRxGcWgQSdrixVB9RykhjJpQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2822,9 +2869,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router": {
|
"node_modules/react-router": {
|
||||||
"version": "7.15.1",
|
"version": "7.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.17.0.tgz",
|
||||||
"integrity": "sha512-R8rl9HhgikFYoPJymnUtPXWbnDb3oget6lQnfIoupbt61aT9aOhRkDsY2XRhZRyX1Z/8a5sL74fXmFNm3NRK5A==",
|
"integrity": "sha512-FDELK7rTMlCHO5+reyXsPlmfr7N1F91lPHsWYfMEGQm/KQ+F4JFM8jGoeQDmDvdTs93Fw9aSilH+uKRb4/jXvQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2845,13 +2892,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router-dom": {
|
"node_modules/react-router-dom": {
|
||||||
"version": "7.15.1",
|
"version": "7.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.17.0.tgz",
|
||||||
"integrity": "sha512-AzF62gjY6U9rkMq4RfP/r2EVtQ7DMfNMjyOp/flLTCrtRylLiK4wT4pSq6O8rOXZ2eXdZYJPEYe+ifomiv+Igg==",
|
"integrity": "sha512-fyU2yjGups/hE6Xz0I5ZYbVL8Gx29eCjgpHaRaTaVU+OOAdfRX05KsvyRm0GO8YQwOkhpU3MurW1jyMUJn+zSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-router": "7.15.1"
|
"react-router": "7.17.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
@@ -3011,12 +3058,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/remark-cjk-friendly": {
|
"node_modules/remark-cjk-friendly": {
|
||||||
"version": "2.0.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/remark-cjk-friendly/-/remark-cjk-friendly-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/remark-cjk-friendly/-/remark-cjk-friendly-2.3.1.tgz",
|
||||||
"integrity": "sha512-6WwkoQyZf/4j5k53zdFYrR8Ca+UVn992jXdLUSBDZR4eBpFhKyVxmA4gUHra/5fesjGIxrDhHesNr/sVoiiysA==",
|
"integrity": "sha512-f+pKZRxCRwNEGFBKNRAZAqU91GIK1SAo3ZyFHWRUgC9zcxRR0BXKd6YwqgSsxtW0rNpUDtONj7H5nje2WL3fcA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"mdast-util-to-markdown-cjk-friendly": "1.0.0",
|
||||||
"micromark-extension-cjk-friendly": "2.0.1"
|
"micromark-extension-cjk-friendly": "2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -3033,12 +3081,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/remark-cjk-friendly-gfm-strikethrough": {
|
"node_modules/remark-cjk-friendly-gfm-strikethrough": {
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/remark-cjk-friendly-gfm-strikethrough/-/remark-cjk-friendly-gfm-strikethrough-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/remark-cjk-friendly-gfm-strikethrough/-/remark-cjk-friendly-gfm-strikethrough-2.1.0.tgz",
|
||||||
"integrity": "sha512-pWKj25O2eLXIL1aBupayl1fKhco+Brw8qWUWJPVB9EBzbQNd7nGLj0nLmJpggWsGLR5j5y40PIdjxby9IEYTuA==",
|
"integrity": "sha512-3Kyq2hjY7V7eU8MbVbWW6QQLN81pjJcIvKHvPxr8hZZmcq/9wqm3MJ3iUG34Ch9QTM4WHN+a1JVAVC1fSi5mig==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"mdast-util-to-markdown-cjk-friendly-gfm-strikethrough": "1.0.0",
|
||||||
"micromark-extension-cjk-friendly-gfm-strikethrough": "2.0.1"
|
"micromark-extension-cjk-friendly-gfm-strikethrough": "2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -3164,18 +3213,18 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/shiki": {
|
"node_modules/shiki": {
|
||||||
"version": "4.0.2",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/shiki/-/shiki-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz",
|
||||||
"integrity": "sha512-eAVKTMedR5ckPo4xne/PjYQYrU3qx78gtJZ+sHlXEg5IHhhoQhMfZVzetTYuaJS0L2Ef3AcCRzCHV8T0WI6nIQ==",
|
"integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/core": "4.0.2",
|
"@shikijs/core": "4.2.0",
|
||||||
"@shikijs/engine-javascript": "4.0.2",
|
"@shikijs/engine-javascript": "4.2.0",
|
||||||
"@shikijs/engine-oniguruma": "4.0.2",
|
"@shikijs/engine-oniguruma": "4.2.0",
|
||||||
"@shikijs/langs": "4.0.2",
|
"@shikijs/langs": "4.2.0",
|
||||||
"@shikijs/themes": "4.0.2",
|
"@shikijs/themes": "4.2.0",
|
||||||
"@shikijs/types": "4.0.2",
|
"@shikijs/types": "4.2.0",
|
||||||
"@shikijs/vscode-textmate": "^10.0.2",
|
"@shikijs/vscode-textmate": "^10.0.2",
|
||||||
"@types/hast": "^3.0.4"
|
"@types/hast": "^3.0.4"
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
[toolchain]
|
[toolchain]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
channel = "1.95.0"
|
channel = "1.96.1"
|
||||||
components = [
|
components = [
|
||||||
# For rust-analyzer
|
# For rust-analyzer
|
||||||
"rust-src",
|
"rust-src",
|
||||||
|
|||||||
+26
-11
@@ -1,5 +1,5 @@
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use conduwuit::Result;
|
use conduwuit::{Err, Result};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
appservice::{self, AppserviceCommand},
|
appservice::{self, AppserviceCommand},
|
||||||
@@ -8,6 +8,7 @@ use crate::{
|
|||||||
debug::{self, DebugCommand},
|
debug::{self, DebugCommand},
|
||||||
federation::{self, FederationCommand},
|
federation::{self, FederationCommand},
|
||||||
media::{self, MediaCommand},
|
media::{self, MediaCommand},
|
||||||
|
oidc::{self, OidcCommand},
|
||||||
query::{self, QueryCommand},
|
query::{self, QueryCommand},
|
||||||
room::{self, RoomCommand},
|
room::{self, RoomCommand},
|
||||||
server::{self, ServerCommand},
|
server::{self, ServerCommand},
|
||||||
@@ -16,46 +17,50 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
#[command(name = conduwuit_core::name(), version = conduwuit_core::version())]
|
#[command(name = conduwuit_core::BRANDING, version = conduwuit_core::version())]
|
||||||
pub enum AdminCommand {
|
pub enum AdminCommand {
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing appservices
|
/// Commands for managing appservices
|
||||||
|
#[command(subcommand)]
|
||||||
Appservices(AppserviceCommand),
|
Appservices(AppserviceCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing local users
|
/// Commands for managing local users
|
||||||
|
#[command(subcommand)]
|
||||||
Users(UserCommand),
|
Users(UserCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing registration tokens
|
/// Commands for managing registration tokens
|
||||||
|
#[command(subcommand)]
|
||||||
Token(TokenCommand),
|
Token(TokenCommand),
|
||||||
|
|
||||||
|
/// Commands for managing OIDC
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
|
Oidc(OidcCommand),
|
||||||
|
|
||||||
/// Commands for managing rooms
|
/// Commands for managing rooms
|
||||||
|
#[command(subcommand)]
|
||||||
Rooms(RoomCommand),
|
Rooms(RoomCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing federation
|
/// Commands for managing federation
|
||||||
|
#[command(subcommand)]
|
||||||
Federation(FederationCommand),
|
Federation(FederationCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing the server
|
/// Commands for managing the server
|
||||||
|
#[command(subcommand)]
|
||||||
Server(ServerCommand),
|
Server(ServerCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for managing media
|
/// Commands for managing media
|
||||||
|
#[command(subcommand)]
|
||||||
Media(MediaCommand),
|
Media(MediaCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for checking integrity
|
/// Commands for checking integrity
|
||||||
|
#[command(subcommand)]
|
||||||
Check(CheckCommand),
|
Check(CheckCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Commands for debugging things
|
/// Commands for debugging things
|
||||||
|
#[command(subcommand)]
|
||||||
Debug(DebugCommand),
|
Debug(DebugCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// Low-level queries for database getters and iterators
|
/// Low-level queries for database getters and iterators
|
||||||
|
#[command(subcommand)]
|
||||||
Query(QueryCommand),
|
Query(QueryCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +85,16 @@ pub(super) async fn process(command: AdminCommand, context: &Context<'_>) -> Res
|
|||||||
context.bail_restricted()?;
|
context.bail_restricted()?;
|
||||||
token::process(command, context).await
|
token::process(command, context).await
|
||||||
},
|
},
|
||||||
|
| Oidc(command) => {
|
||||||
|
// OIDC commands are all restricted
|
||||||
|
context.bail_restricted()?;
|
||||||
|
|
||||||
|
if !context.services.oidc.enabled() {
|
||||||
|
return Err!("OIDC is not configured");
|
||||||
|
}
|
||||||
|
|
||||||
|
oidc::process(command, context).await
|
||||||
|
},
|
||||||
| Rooms(command) => room::process(command, context).await,
|
| Rooms(command) => room::process(command, context).await,
|
||||||
| Federation(command) => federation::process(command, context).await,
|
| Federation(command) => federation::process(command, context).await,
|
||||||
| Server(command) => server::process(command, context).await,
|
| Server(command) => server::process(command, context).await,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use conduwuit::{Err, Result, checked};
|
use conduwuit::{Err, Result, checked};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt};
|
use futures::{FutureExt, StreamExt, TryFutureExt};
|
||||||
|
|
||||||
use crate::admin_command;
|
impl crate::Context<'_> {
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn register(&self) -> Result {
|
pub(super) async fn register(&self) -> Result {
|
||||||
let body = &self.body;
|
let body = &self.body;
|
||||||
let body_len = self.body.len();
|
let body_len = self.body.len();
|
||||||
@@ -33,7 +31,6 @@ pub(super) async fn register(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn unregister(&self, appservice_identifier: String) -> Result {
|
pub(super) async fn unregister(&self, appservice_identifier: String) -> Result {
|
||||||
match self
|
match self
|
||||||
.services
|
.services
|
||||||
@@ -47,7 +44,6 @@ pub(super) async fn unregister(&self, appservice_identifier: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn show_appservice_config(&self, appservice_identifier: String) -> Result {
|
pub(super) async fn show_appservice_config(&self, appservice_identifier: String) -> Result {
|
||||||
match self
|
match self
|
||||||
.services
|
.services
|
||||||
@@ -64,7 +60,6 @@ pub(super) async fn show_appservice_config(&self, appservice_identifier: String)
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_registered(&self) -> Result {
|
pub(super) async fn list_registered(&self) -> Result {
|
||||||
self.services
|
self.services
|
||||||
.appservice
|
.appservice
|
||||||
@@ -78,3 +73,4 @@ pub(super) async fn list_registered(&self) -> Result {
|
|||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
use conduwuit::Result;
|
use conduwuit::Result;
|
||||||
use conduwuit_macros::implement;
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
|
|
||||||
#[implement(Context, params = "<'_>")]
|
impl Context<'_> {
|
||||||
pub(super) async fn check_all_users(&self) -> Result {
|
pub(super) async fn check_all_users(&self) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let users = self.services.users.stream().collect::<Vec<_>>().await;
|
let users = self
|
||||||
|
.services
|
||||||
|
.users
|
||||||
|
.stream_local_users()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.await;
|
||||||
let query_time = timer.elapsed();
|
let query_time = timer.elapsed();
|
||||||
|
|
||||||
let total = users.len();
|
let total = users.len();
|
||||||
@@ -21,3 +25,4 @@ pub(super) async fn check_all_users(&self) -> Result {
|
|||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+361
-58
@@ -1,12 +1,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::{HashMap, HashSet},
|
||||||
fmt::Write,
|
fmt::Write,
|
||||||
iter::once,
|
iter::once,
|
||||||
time::{Instant, SystemTime},
|
time::{Instant, SystemTime},
|
||||||
};
|
};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result, debug_error, err, info,
|
Err, Result, at, debug_error, err, info,
|
||||||
matrix::{
|
matrix::{
|
||||||
Event,
|
Event,
|
||||||
pdu::{PduEvent, PduId, RawPduId},
|
pdu::{PduEvent, PduId, RawPduId},
|
||||||
@@ -22,7 +22,7 @@ use futures::{FutureExt, StreamExt, TryStreamExt};
|
|||||||
use lettre::message::Mailbox;
|
use lettre::message::Mailbox;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
|
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
|
||||||
OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId,
|
OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId, UInt,
|
||||||
api::federation::event::get_room_state, events::AnyStateEvent, serde::Raw,
|
api::federation::event::get_room_state, events::AnyStateEvent, serde::Raw,
|
||||||
};
|
};
|
||||||
use service::rooms::{
|
use service::rooms::{
|
||||||
@@ -31,15 +31,60 @@ use service::rooms::{
|
|||||||
};
|
};
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
use crate::admin_command;
|
use crate::PAGE_SIZE;
|
||||||
|
|
||||||
#[admin_command]
|
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||||
|
enum NodeStatus {
|
||||||
|
Normal(bool),
|
||||||
|
SoftFailed(bool),
|
||||||
|
Rejected(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AuthChild {
|
||||||
|
node_id: String,
|
||||||
|
event_id: OwnedEventId,
|
||||||
|
depth: UInt,
|
||||||
|
ts: UInt,
|
||||||
|
first_seen: bool,
|
||||||
|
pdu: Option<PduEvent>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_node(
|
||||||
|
graph: &mut String,
|
||||||
|
node_id: &str,
|
||||||
|
event_id: &EventId,
|
||||||
|
name: &str,
|
||||||
|
status: NodeStatus,
|
||||||
|
) -> Result {
|
||||||
|
let evt_str = event_id.to_string();
|
||||||
|
|
||||||
|
let status_label = match status {
|
||||||
|
| NodeStatus::Normal(false) => format!("{evt_str}: {name}"),
|
||||||
|
| NodeStatus::Normal(true) => format!("{evt_str}: {name} (missing locally)"),
|
||||||
|
| NodeStatus::SoftFailed(false) => format!("{evt_str}: {name} (soft-failed)"),
|
||||||
|
| NodeStatus::SoftFailed(true) =>
|
||||||
|
format!("{evt_str}: {name} (soft-failed & missing locally)"),
|
||||||
|
| NodeStatus::Rejected(false) => format!("{evt_str}: {name} (rejected)"),
|
||||||
|
| NodeStatus::Rejected(true) => format!("{evt_str}: {name} (rejected & missing locally)"),
|
||||||
|
};
|
||||||
|
|
||||||
|
writeln!(graph, "{node_id}[\"{}\"]", status_label.as_str())?;
|
||||||
|
|
||||||
|
match status {
|
||||||
|
| NodeStatus::Rejected(_) => writeln!(graph, "class {node_id} rejected;")?,
|
||||||
|
| NodeStatus::SoftFailed(_) => writeln!(graph, "class {node_id} soft_failed;")?,
|
||||||
|
| NodeStatus::Normal(_) => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn echo(&self, message: Vec<String>) -> Result {
|
pub(super) async fn echo(&self, message: Vec<String>) -> Result {
|
||||||
let message = message.join(" ");
|
let message = message.join(" ");
|
||||||
self.write_str(&message).await
|
self.write_str(&message).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_auth_chain(&self, event_id: OwnedEventId) -> Result {
|
pub(super) async fn get_auth_chain(&self, event_id: OwnedEventId) -> Result {
|
||||||
let Ok(event) = self.services.rooms.timeline.get_pdu_json(&event_id).await else {
|
let Ok(event) = self.services.rooms.timeline.get_pdu_json(&event_id).await else {
|
||||||
return Err!("Event not found.");
|
return Err!("Event not found.");
|
||||||
@@ -69,7 +114,159 @@ pub(super) async fn get_auth_chain(&self, event_id: OwnedEventId) -> Result {
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn show_auth_chain(&self, event_id: OwnedEventId) -> Result {
|
||||||
|
let node_status = async |event_id: &EventId, missing: bool| -> NodeStatus {
|
||||||
|
if self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.is_event_rejected(event_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
NodeStatus::Rejected(missing)
|
||||||
|
} else if self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.is_event_soft_failed(event_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
NodeStatus::SoftFailed(missing)
|
||||||
|
} else {
|
||||||
|
NodeStatus::Normal(missing)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let Ok(root) = self.services.rooms.timeline.get_pdu(&event_id).await else {
|
||||||
|
return Err!("Event not found.");
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut graph = String::from(
|
||||||
|
"```mermaid\n%% This is a mermaid graph. You can plug this output into\n\
|
||||||
|
%% https://mermaid.live/edit to visualise it on-the-fly.\nflowchart TD\n\
|
||||||
|
classDef rejected fill:#ffe5e5,stroke:#cc0000,stroke-width:2px,color:#000;\n\
|
||||||
|
classDef soft_failed fill:#fff6cc,stroke:#c9a400,stroke-width:2px,color:#000;\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut node_ids: HashMap<OwnedEventId, String> = HashMap::new();
|
||||||
|
let mut cached_events: HashMap<OwnedEventId, PduEvent> =
|
||||||
|
HashMap::from([(event_id.clone(), root.clone())]);
|
||||||
|
let mut scheduled: HashSet<OwnedEventId> = HashSet::from([event_id.clone()]);
|
||||||
|
let mut visited: HashSet<OwnedEventId> = HashSet::new();
|
||||||
|
let mut stack = vec![root];
|
||||||
|
let mut next_node_id = 0_usize;
|
||||||
|
|
||||||
|
let node_id_for = |event_id: &OwnedEventId,
|
||||||
|
node_ids: &mut HashMap<OwnedEventId, String>,
|
||||||
|
next_node_id: &mut usize| {
|
||||||
|
node_ids
|
||||||
|
.entry(event_id.clone())
|
||||||
|
.or_insert_with(|| {
|
||||||
|
let id = format!("n{}", *next_node_id);
|
||||||
|
*next_node_id = next_node_id.saturating_add(1);
|
||||||
|
id
|
||||||
|
})
|
||||||
|
.clone()
|
||||||
|
};
|
||||||
|
let node_name = |e: &PduEvent| {
|
||||||
|
if let Some(state_key) = e.state_key() {
|
||||||
|
format!("{},'{}'", e.event_type(), state_key)
|
||||||
|
} else {
|
||||||
|
format!("{}", e.event_type())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
while let Some(event) = stack.pop() {
|
||||||
|
let current_event_id = event.event_id().to_owned();
|
||||||
|
if !visited.insert(current_event_id.clone()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let current_node_id =
|
||||||
|
node_id_for(¤t_event_id, &mut node_ids, &mut next_node_id);
|
||||||
|
let current_status = node_status(¤t_event_id, false).await;
|
||||||
|
|
||||||
|
render_node(
|
||||||
|
&mut graph,
|
||||||
|
¤t_node_id,
|
||||||
|
¤t_event_id,
|
||||||
|
&node_name(&event),
|
||||||
|
current_status,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let mut children = Vec::with_capacity(event.auth_events.len());
|
||||||
|
for auth_event_id in event.auth_events().rev() {
|
||||||
|
let auth_event_id = auth_event_id.to_owned();
|
||||||
|
let auth_node_id = node_id_for(&auth_event_id, &mut node_ids, &mut next_node_id);
|
||||||
|
writeln!(graph, "{current_node_id} --> {auth_node_id}")?;
|
||||||
|
|
||||||
|
let first_seen = scheduled.insert(auth_event_id.clone());
|
||||||
|
let auth_pdu = if let Some(auth_pdu) = cached_events.get(&auth_event_id) {
|
||||||
|
// NOTE: events might be referenced multiple times (like the create event)
|
||||||
|
// so this saves some cheeky db lookup time
|
||||||
|
Some(auth_pdu.clone())
|
||||||
|
} else if first_seen {
|
||||||
|
match self.services.rooms.timeline.get_pdu(&auth_event_id).await {
|
||||||
|
| Ok(auth_event) => {
|
||||||
|
cached_events.insert(auth_event_id.clone(), auth_event.clone());
|
||||||
|
Some(auth_event)
|
||||||
|
},
|
||||||
|
| Err(_) => None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
// NOTE: Depth is used as the primary sorting key here, even though it has no
|
||||||
|
// bearing on state resolution or anything. Timestamp is used as a
|
||||||
|
// tiebreaker, failing back to lexicographical comparison.
|
||||||
|
let (depth, ts) = auth_pdu
|
||||||
|
.as_ref()
|
||||||
|
.map_or((UInt::MAX, UInt::MAX), |pdu| (pdu.depth, pdu.origin_server_ts));
|
||||||
|
|
||||||
|
children.push(AuthChild {
|
||||||
|
node_id: auth_node_id,
|
||||||
|
event_id: auth_event_id,
|
||||||
|
depth,
|
||||||
|
ts,
|
||||||
|
first_seen,
|
||||||
|
pdu: auth_pdu,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
children.sort_by(|a, b| {
|
||||||
|
a.depth
|
||||||
|
.cmp(&b.depth)
|
||||||
|
.then(a.ts.cmp(&b.ts))
|
||||||
|
.then(a.event_id.as_str().cmp(b.event_id.as_str()))
|
||||||
|
});
|
||||||
|
|
||||||
|
for child in children.into_iter().rev() {
|
||||||
|
if !child.first_seen {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(child_pdu) = child.pdu {
|
||||||
|
// We have this PDU so will want to traverse it.
|
||||||
|
stack.push(child_pdu);
|
||||||
|
} else {
|
||||||
|
// We don't have this PDU locally so we can't traverse its auth events,
|
||||||
|
// but we can still render it as a node.
|
||||||
|
render_node(
|
||||||
|
&mut graph,
|
||||||
|
&child.node_id,
|
||||||
|
&child.event_id,
|
||||||
|
"",
|
||||||
|
node_status(&child.event_id, true).await,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
graph.push_str("```\n");
|
||||||
|
self.write_str(&graph).await
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) async fn parse_pdu(&self) -> Result {
|
pub(super) async fn parse_pdu(&self) -> Result {
|
||||||
if self.body.len() < 2
|
if self.body.len() < 2
|
||||||
|| !self.body[0].trim().starts_with("```")
|
|| !self.body[0].trim().starts_with("```")
|
||||||
@@ -88,7 +285,8 @@ pub(super) async fn parse_pdu(&self) -> Result {
|
|||||||
| Ok(hash) => {
|
| Ok(hash) => {
|
||||||
let event_id = EventId::parse(format!("${hash}"));
|
let event_id = EventId::parse(format!("${hash}"));
|
||||||
match serde_json::from_value::<PduEvent>(serde_json::to_value(value)?) {
|
match serde_json::from_value::<PduEvent>(serde_json::to_value(value)?) {
|
||||||
| Err(e) => return Err!("EventId: {event_id:?}\nCould not parse event: {e}"),
|
| Err(e) =>
|
||||||
|
return Err!("EventId: {event_id:?}\nCould not parse event: {e}"),
|
||||||
| Ok(pdu) => write!(self, "EventId: {event_id:?}\n{pdu:#?}"),
|
| Ok(pdu) => write!(self, "EventId: {event_id:?}\n{pdu:#?}"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -97,7 +295,6 @@ pub(super) async fn parse_pdu(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result {
|
pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result {
|
||||||
let mut outlier = false;
|
let mut outlier = false;
|
||||||
let mut pdu_json = self
|
let mut pdu_json = self
|
||||||
@@ -111,15 +308,31 @@ pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result {
|
|||||||
outlier = true;
|
outlier = true;
|
||||||
pdu_json = self.services.rooms.timeline.get_pdu_json(&event_id).await;
|
pdu_json = self.services.rooms.timeline.get_pdu_json(&event_id).await;
|
||||||
}
|
}
|
||||||
|
let rejected = self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.is_event_rejected(&event_id)
|
||||||
|
.await;
|
||||||
|
let soft_failed = self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.is_event_soft_failed(&event_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
match pdu_json {
|
match pdu_json {
|
||||||
| Err(_) => return Err!("PDU not found locally."),
|
| Err(_) => return Err!("PDU not found locally."),
|
||||||
| Ok(json) => {
|
| Ok(json) => {
|
||||||
let text = serde_json::to_string_pretty(&json)?;
|
let text = serde_json::to_string_pretty(&json)?;
|
||||||
let msg = if outlier {
|
let msg = if rejected {
|
||||||
"Outlier (Rejected / Soft Failed) PDU found in our database"
|
"Rejected PDU:"
|
||||||
|
} else if soft_failed {
|
||||||
|
"Soft-failed PDU:"
|
||||||
|
} else if outlier {
|
||||||
|
"Outlier PDU:"
|
||||||
} else {
|
} else {
|
||||||
"PDU found in our database"
|
"PDU:"
|
||||||
};
|
};
|
||||||
write!(self, "{msg}\n```json\n{text}\n```")
|
write!(self, "{msg}\n```json\n{text}\n```")
|
||||||
},
|
},
|
||||||
@@ -127,7 +340,6 @@ pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_short_pdu(
|
pub(super) async fn get_short_pdu(
|
||||||
&self,
|
&self,
|
||||||
shortroomid: ShortRoomId,
|
shortroomid: ShortRoomId,
|
||||||
@@ -156,8 +368,11 @@ pub(super) async fn get_short_pdu(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn get_remote_pdu_list(
|
||||||
pub(super) async fn get_remote_pdu_list(&self, server: OwnedServerName, force: bool) -> Result {
|
&self,
|
||||||
|
server: OwnedServerName,
|
||||||
|
force: bool,
|
||||||
|
) -> Result {
|
||||||
if !self.services.server.config.allow_federation {
|
if !self.services.server.config.allow_federation {
|
||||||
return Err!("Federation is disabled on this homeserver.",);
|
return Err!("Federation is disabled on this homeserver.",);
|
||||||
}
|
}
|
||||||
@@ -210,13 +425,13 @@ pub(super) async fn get_remote_pdu_list(&self, server: OwnedServerName, force: b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let out =
|
let out = format!(
|
||||||
format!("Fetched {success_count} remote PDUs successfully with {failed_count} failures");
|
"Fetched {success_count} remote PDUs successfully with {failed_count} failures"
|
||||||
|
);
|
||||||
|
|
||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_remote_pdu(
|
pub(super) async fn get_remote_pdu(
|
||||||
&self,
|
&self,
|
||||||
event_id: OwnedEventId,
|
event_id: OwnedEventId,
|
||||||
@@ -244,15 +459,17 @@ pub(super) async fn get_remote_pdu(
|
|||||||
{
|
{
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Remote server did not have PDU or failed sending request to remote server: {e}"
|
"Remote server did not have PDU or failed sending request to remote server: \
|
||||||
|
{e}"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
| Ok(response) => {
|
| Ok(response) => {
|
||||||
let json: CanonicalJsonObject =
|
let json: CanonicalJsonObject = serde_json::from_str(response.pdu.get())
|
||||||
serde_json::from_str(response.pdu.get()).map_err(|e| {
|
.map_err(|e| {
|
||||||
warn!(
|
warn!(
|
||||||
"Requested event ID {event_id} from server but failed to convert from \
|
"Requested event ID {event_id} from server but failed to convert \
|
||||||
RawValue to CanonicalJsonObject (malformed event/response?): {e}"
|
from RawValue to CanonicalJsonObject (malformed event/response?): \
|
||||||
|
{e}"
|
||||||
);
|
);
|
||||||
err!(Request(Unknown(
|
err!(Request(Unknown(
|
||||||
"Received response from server but failed to parse PDU"
|
"Received response from server but failed to parse PDU"
|
||||||
@@ -274,7 +491,9 @@ pub(super) async fn get_remote_pdu(
|
|||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
warn!("Failed to parse PDU: {e}");
|
warn!("Failed to parse PDU: {e}");
|
||||||
info!("Full PDU: {:?}", &response.pdu);
|
info!("Full PDU: {:?}", &response.pdu);
|
||||||
return Err!("Failed to parse PDU remote server {server} sent us: {e}");
|
return Err!(
|
||||||
|
"Failed to parse PDU remote server {server} sent us: {e}"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -289,7 +508,43 @@ pub(super) async fn get_remote_pdu(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn get_state_at(&self, event_id: OwnedEventId) -> Result {
|
||||||
|
self.bail_restricted()?;
|
||||||
|
|
||||||
|
let shortstatehash = self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.pdu_shortstatehash(&event_id)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let state_ids: Vec<OwnedEventId> = self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.state_full_ids(shortstatehash)
|
||||||
|
.map(at!(1))
|
||||||
|
.collect()
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let pdus: Vec<CanonicalJsonObject> = state_ids
|
||||||
|
.iter()
|
||||||
|
.try_stream()
|
||||||
|
.and_then(|id| self.services.rooms.timeline.get_pdu_json(id))
|
||||||
|
.try_collect()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let json = serde_json::to_string_pretty(&pdus).map_err(|e| {
|
||||||
|
err!(Database(
|
||||||
|
"Failed to convert room state events to pretty JSON, possible invalid room \
|
||||||
|
state events in our database {e}",
|
||||||
|
))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let out = format!("```json\n{json}\n```");
|
||||||
|
self.write_str(&out).await
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) async fn get_room_state(&self, room: OwnedRoomOrAliasId) -> Result {
|
pub(super) async fn get_room_state(&self, room: OwnedRoomOrAliasId) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -309,8 +564,8 @@ pub(super) async fn get_room_state(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
|
|
||||||
let json = serde_json::to_string_pretty(&room_state).map_err(|e| {
|
let json = serde_json::to_string_pretty(&room_state).map_err(|e| {
|
||||||
err!(Database(
|
err!(Database(
|
||||||
"Failed to convert room state events to pretty JSON, possible invalid room state \
|
"Failed to convert room state events to pretty JSON, possible invalid room \
|
||||||
events in our database {e}",
|
state events in our database {e}",
|
||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -318,7 +573,6 @@ pub(super) async fn get_room_state(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn ping(&self, server: OwnedServerName) -> Result {
|
pub(super) async fn ping(&self, server: OwnedServerName) -> Result {
|
||||||
if server == self.services.globals.server_name() {
|
if server == self.services.globals.server_name() {
|
||||||
return Err!("Not allowed to send federation requests to ourselves.");
|
return Err!("Not allowed to send federation requests to ourselves.");
|
||||||
@@ -354,19 +608,17 @@ pub(super) async fn ping(&self, server: OwnedServerName) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_device_list_updates(&self) -> Result {
|
pub(super) async fn force_device_list_updates(&self) -> Result {
|
||||||
// Force E2EE device list updates for all users
|
// Force E2EE device list updates for all users
|
||||||
self.services
|
self.services
|
||||||
.users
|
.users
|
||||||
.stream()
|
.stream_local_users()
|
||||||
.for_each(async |user_id| self.services.users.mark_device_key_update(&user_id).await)
|
.for_each(async |user_id| self.services.users.mark_device_key_update(&user_id).await)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
write!(self, "Marked all devices for all users as having new keys to update").await
|
write!(self, "Marked all devices for all users as having new keys to update").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn change_log_level(&self, filter: Option<String>, reset: bool) -> Result {
|
pub(super) async fn change_log_level(&self, filter: Option<String>, reset: bool) -> Result {
|
||||||
let handles = &["console"];
|
let handles = &["console"];
|
||||||
|
|
||||||
@@ -388,7 +640,8 @@ pub(super) async fn change_log_level(&self, filter: Option<String>, reset: bool)
|
|||||||
},
|
},
|
||||||
| Ok(()) => {
|
| Ok(()) => {
|
||||||
let value = &self.services.server.config.log;
|
let value = &self.services.server.config.log;
|
||||||
let out = format!("Successfully changed log level back to config value {value}");
|
let out =
|
||||||
|
format!("Successfully changed log level back to config value {value}");
|
||||||
return self.write_str(&out).await;
|
return self.write_str(&out).await;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -419,7 +672,6 @@ pub(super) async fn change_log_level(&self, filter: Option<String>, reset: bool)
|
|||||||
Err!("No log level was specified.")
|
Err!("No log level was specified.")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn verify_json(&self) -> Result {
|
pub(super) async fn verify_json(&self) -> Result {
|
||||||
if self.body.len() < 2
|
if self.body.len() < 2
|
||||||
|| !self.body[0].trim().starts_with("```")
|
|| !self.body[0].trim().starts_with("```")
|
||||||
@@ -446,7 +698,6 @@ pub(super) async fn verify_json(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result {
|
pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result {
|
||||||
use ruma::signatures::Verified;
|
use ruma::signatures::Verified;
|
||||||
|
|
||||||
@@ -468,7 +719,6 @@ pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result {
|
|||||||
self.write_str(msg).await
|
self.write_str(msg).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
#[tracing::instrument(skip(self), level = "info")]
|
#[tracing::instrument(skip(self), level = "info")]
|
||||||
pub(super) async fn first_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn first_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
@@ -480,7 +730,9 @@ pub(super) async fn first_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
|||||||
.server_in_room(&self.services.server.name, &room_id)
|
.server_in_room(&self.services.server.name, &room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err!("We are not participating in the room / we don't know about the room ID.",);
|
return Err!(
|
||||||
|
"We are not participating in the room / we don't know about the room ID.",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let first_pdu = self
|
let first_pdu = self
|
||||||
@@ -495,7 +747,6 @@ pub(super) async fn first_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
#[tracing::instrument(skip(self), level = "info")]
|
#[tracing::instrument(skip(self), level = "info")]
|
||||||
pub(super) async fn latest_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn latest_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
@@ -507,7 +758,9 @@ pub(super) async fn latest_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
|||||||
.server_in_room(&self.services.server.name, &room_id)
|
.server_in_room(&self.services.server.name, &room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err!("We are not participating in the room / we don't know about the room ID.");
|
return Err!(
|
||||||
|
"We are not participating in the room / we don't know about the room ID."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let latest_pdu = self
|
let latest_pdu = self
|
||||||
@@ -522,7 +775,6 @@ pub(super) async fn latest_pdu_in_room(&self, room_id: OwnedRoomId) -> Result {
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
#[tracing::instrument(skip(self), level = "info")]
|
#[tracing::instrument(skip(self), level = "info")]
|
||||||
pub(super) async fn force_set_room_state_from_server(
|
pub(super) async fn force_set_room_state_from_server(
|
||||||
&self,
|
&self,
|
||||||
@@ -539,7 +791,9 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
.server_in_room(&self.services.server.name, &room_id)
|
.server_in_room(&self.services.server.name, &room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
return Err!("We are not participating in the room / we don't know about the room ID.");
|
return Err!(
|
||||||
|
"We are not participating in the room / we don't know about the room ID."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let at_event_id = match at_event {
|
let at_event_id = match at_event {
|
||||||
@@ -596,7 +850,9 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let pdu = PduEvent::from_id_val(&event_id, value.clone()).map_err(|e| {
|
let pdu = PduEvent::from_id_val(&event_id, value.clone()).map_err(|e| {
|
||||||
debug_error!("Invalid PDU in fetching remote room state PDUs response: {value:#?}");
|
debug_error!(
|
||||||
|
"Invalid PDU in fetching remote room state PDUs response: {value:#?}"
|
||||||
|
);
|
||||||
err!(BadServerResponse(debug_error!("Invalid PDU in send_join response: {e:?}")))
|
err!(BadServerResponse(debug_error!("Invalid PDU in send_join response: {e:?}")))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -614,6 +870,10 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
state.insert(shortstatekey, pdu.event_id.clone());
|
state.insert(shortstatekey, pdu.event_id.clone());
|
||||||
|
self.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.clear_pdu_markers(pdu.event_id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,6 +891,10 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
.rooms
|
.rooms
|
||||||
.outlier
|
.outlier
|
||||||
.add_pdu_outlier(&event_id, &value);
|
.add_pdu_outlier(&event_id, &value);
|
||||||
|
self.services
|
||||||
|
.rooms
|
||||||
|
.pdu_metadata
|
||||||
|
.clear_pdu_markers(&event_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Resolving new room state");
|
info!("Resolving new room state");
|
||||||
@@ -662,10 +926,7 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
.force_state(room_id.clone().as_ref(), short_state_hash, added, removed, &state_lock)
|
.force_state(room_id.clone().as_ref(), short_state_hash, added, removed, &state_lock)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
info!(
|
info!("Updating joined counts for room");
|
||||||
"Updating joined counts for room just in case (e.g. we may have found a difference in \
|
|
||||||
the room's m.room.member state"
|
|
||||||
);
|
|
||||||
self.services
|
self.services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
@@ -676,7 +937,6 @@ pub(super) async fn force_set_room_state_from_server(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_signing_keys(
|
pub(super) async fn get_signing_keys(
|
||||||
&self,
|
&self,
|
||||||
server_name: Option<OwnedServerName>,
|
server_name: Option<OwnedServerName>,
|
||||||
@@ -712,7 +972,6 @@ pub(super) async fn get_signing_keys(
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_verify_keys(&self, server_name: Option<OwnedServerName>) -> Result {
|
pub(super) async fn get_verify_keys(&self, server_name: Option<OwnedServerName>) -> Result {
|
||||||
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
|
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
|
||||||
|
|
||||||
@@ -732,7 +991,6 @@ pub(super) async fn get_verify_keys(&self, server_name: Option<OwnedServerName>)
|
|||||||
self.write_str(&out).await
|
self.write_str(&out).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn resolve_true_destination(
|
pub(super) async fn resolve_true_destination(
|
||||||
&self,
|
&self,
|
||||||
server_name: OwnedServerName,
|
server_name: OwnedServerName,
|
||||||
@@ -759,7 +1017,6 @@ pub(super) async fn resolve_true_destination(
|
|||||||
self.write_str(&msg).await
|
self.write_str(&msg).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result {
|
pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result {
|
||||||
const OPTS: &str = "abcdefghijklmnopqrstuvwxyz";
|
const OPTS: &str = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
@@ -783,7 +1040,7 @@ pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(tokio_unstable)]
|
#[cfg(tokio_unstable)]
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn runtime_metrics(&self) -> Result {
|
pub(super) async fn runtime_metrics(&self) -> Result {
|
||||||
let out = self.services.server.metrics.runtime_metrics().map_or_else(
|
let out = self.services.server.metrics.runtime_metrics().map_or_else(
|
||||||
|| "Runtime metrics are not available.".to_owned(),
|
|| "Runtime metrics are not available.".to_owned(),
|
||||||
@@ -801,14 +1058,13 @@ pub(super) async fn runtime_metrics(&self) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tokio_unstable))]
|
#[cfg(not(tokio_unstable))]
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn runtime_metrics(&self) -> Result {
|
pub(super) async fn runtime_metrics(&self) -> Result {
|
||||||
self.write_str("Runtime metrics require building with `tokio_unstable`.")
|
self.write_str("Runtime metrics require building with `tokio_unstable`.")
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(tokio_unstable)]
|
#[cfg(tokio_unstable)]
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn runtime_interval(&self) -> Result {
|
pub(super) async fn runtime_interval(&self) -> Result {
|
||||||
let out = self.services.server.metrics.runtime_interval().map_or_else(
|
let out = self.services.server.metrics.runtime_interval().map_or_else(
|
||||||
|| "Runtime metrics are not available.".to_owned(),
|
|| "Runtime metrics are not available.".to_owned(),
|
||||||
@@ -819,13 +1075,11 @@ pub(super) async fn runtime_interval(&self) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tokio_unstable))]
|
#[cfg(not(tokio_unstable))]
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn runtime_interval(&self) -> Result {
|
pub(super) async fn runtime_interval(&self) -> Result {
|
||||||
self.write_str("Runtime metrics require building with `tokio_unstable`.")
|
self.write_str("Runtime metrics require building with `tokio_unstable`.")
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn time(&self) -> Result {
|
pub(super) async fn time(&self) -> Result {
|
||||||
let now = SystemTime::now();
|
let now = SystemTime::now();
|
||||||
let now = utils::time::format(now, "%+");
|
let now = utils::time::format(now, "%+");
|
||||||
@@ -833,7 +1087,6 @@ pub(super) async fn time(&self) -> Result {
|
|||||||
self.write_str(&now).await
|
self.write_str(&now).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn database_stats(
|
pub(super) async fn database_stats(
|
||||||
&self,
|
&self,
|
||||||
property: Option<String>,
|
property: Option<String>,
|
||||||
@@ -853,7 +1106,6 @@ pub(super) async fn database_stats(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn database_files(&self, map: Option<String>, level: Option<i32>) -> Result {
|
pub(super) async fn database_files(&self, map: Option<String>, level: Option<i32>) -> Result {
|
||||||
let mut files: Vec<_> = self.services.db.db.file_list().collect::<Result<_>>()?;
|
let mut files: Vec<_> = self.services.db.db.file_list().collect::<Result<_>>()?;
|
||||||
|
|
||||||
@@ -884,14 +1136,12 @@ pub(super) async fn database_files(&self, map: Option<String>, level: Option<i32
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn trim_memory(&self) -> Result {
|
pub(super) async fn trim_memory(&self) -> Result {
|
||||||
conduwuit::alloc::trim(None)?;
|
conduwuit::alloc::trim(None)?;
|
||||||
|
|
||||||
writeln!(self, "done").await
|
writeln!(self, "done").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn send_test_email(&self) -> Result {
|
pub(super) async fn send_test_email(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -918,3 +1168,56 @@ pub(super) async fn send_test_email(&self) -> Result {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) async fn rooms_by_extremity_count(&self, page: Option<usize>) -> Result {
|
||||||
|
let page = page.unwrap_or(1);
|
||||||
|
// My Giant Chain:tm:
|
||||||
|
let mapped: HashMap<OwnedRoomId, u64> = self
|
||||||
|
.services
|
||||||
|
.rooms
|
||||||
|
.state
|
||||||
|
.all_forward_extremities()
|
||||||
|
.ready_fold(HashMap::new(), move |mut map, (room_id, _)| {
|
||||||
|
let count: u64 = map.get(&room_id).copied().unwrap_or(0);
|
||||||
|
map.insert(room_id, count.saturating_add(1));
|
||||||
|
map
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|(room_id, count)| (count >= 2).then_some((room_id, count)))
|
||||||
|
.collect();
|
||||||
|
if mapped.is_empty() {
|
||||||
|
return Err!("No more rooms.");
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut rooms = mapped.keys().collect::<Vec<_>>();
|
||||||
|
rooms.sort_by_key(|room_id| {
|
||||||
|
mapped
|
||||||
|
.get(*room_id)
|
||||||
|
.copied()
|
||||||
|
.expect("keys must have values")
|
||||||
|
});
|
||||||
|
rooms.reverse();
|
||||||
|
|
||||||
|
let body = rooms
|
||||||
|
.into_iter()
|
||||||
|
.stream()
|
||||||
|
.skip(page.saturating_sub(1).saturating_mul(PAGE_SIZE))
|
||||||
|
.take(PAGE_SIZE)
|
||||||
|
.map(|room_id| {
|
||||||
|
format!(
|
||||||
|
"{room_id}: {}",
|
||||||
|
mapped.get(room_id).copied().expect("keys must have values")
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.await;
|
||||||
|
|
||||||
|
self.write_str(&format!(
|
||||||
|
"Rooms by extremity count ({}):\n```\n{}\n```",
|
||||||
|
body.len(),
|
||||||
|
body.join("\n")
|
||||||
|
))
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
-1
@@ -17,12 +17,21 @@ pub enum DebugCommand {
|
|||||||
message: Vec<String>,
|
message: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Get the auth_chain of a PDU
|
/// Loads the auth_chain of a PDU, reporting how long it took.
|
||||||
GetAuthChain {
|
GetAuthChain {
|
||||||
/// An event ID (the $ character followed by the base64 reference hash)
|
/// An event ID (the $ character followed by the base64 reference hash)
|
||||||
event_id: OwnedEventId,
|
event_id: OwnedEventId,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Walks & displays the auth_chain of a PDU in a mermaid graph format.
|
||||||
|
///
|
||||||
|
/// This is useless to basically anyone but developers, and is also probably
|
||||||
|
/// slow and memory hungry.
|
||||||
|
ShowAuthChain {
|
||||||
|
/// The root event ID to start walking back from.
|
||||||
|
event_id: OwnedEventId,
|
||||||
|
},
|
||||||
|
|
||||||
/// Parse and print a PDU from a JSON
|
/// Parse and print a PDU from a JSON
|
||||||
///
|
///
|
||||||
/// The PDU event is only checked for validity and is not added to the
|
/// The PDU event is only checked for validity and is not added to the
|
||||||
@@ -86,6 +95,14 @@ pub enum DebugCommand {
|
|||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Gets all the room state events at the specified event.
|
||||||
|
///
|
||||||
|
/// State at event might not be available for some PDUs, such as rejected
|
||||||
|
/// ones.
|
||||||
|
GetStateAt {
|
||||||
|
event_id: OwnedEventId,
|
||||||
|
},
|
||||||
|
|
||||||
/// Get and display signing keys from local cache or remote server.
|
/// Get and display signing keys from local cache or remote server.
|
||||||
GetSigningKeys {
|
GetSigningKeys {
|
||||||
server_name: Option<OwnedServerName>,
|
server_name: Option<OwnedServerName>,
|
||||||
@@ -228,6 +245,11 @@ pub enum DebugCommand {
|
|||||||
/// Send a test email to the invoking admin's email address
|
/// Send a test email to the invoking admin's email address
|
||||||
SendTestEmail,
|
SendTestEmail,
|
||||||
|
|
||||||
|
/// Lists room IDs by forward extremity count in descending order
|
||||||
|
RoomsByExtremityCount {
|
||||||
|
page: Option<usize>,
|
||||||
|
},
|
||||||
|
|
||||||
/// Developer test stubs
|
/// Developer test stubs
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use conduwuit::{Err, Result};
|
use conduwuit::{Err, Result};
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, clap::Subcommand)]
|
#[derive(Debug, clap::Subcommand)]
|
||||||
@@ -11,31 +11,25 @@ pub enum TesterCommand {
|
|||||||
Timer,
|
Timer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl crate::Context<'_> {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[admin_command]
|
|
||||||
async fn panic(&self) -> Result {
|
async fn panic(&self) -> Result {
|
||||||
|
|
||||||
panic!("panicked")
|
panic!("panicked")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[admin_command]
|
|
||||||
async fn failure(&self) -> Result {
|
async fn failure(&self) -> Result {
|
||||||
|
|
||||||
Err!("failed")
|
Err!("failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[admin_command]
|
|
||||||
async fn tester(&self) -> Result {
|
async fn tester(&self) -> Result {
|
||||||
|
|
||||||
self.write_str("Ok").await
|
self.write_str("Ok").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[admin_command]
|
|
||||||
async fn timer(&self) -> Result {
|
async fn timer(&self) -> Result {
|
||||||
let started = std::time::Instant::now();
|
let started = std::time::Instant::now();
|
||||||
timed(self.body);
|
timed(self.body);
|
||||||
@@ -43,6 +37,7 @@ async fn timer(&self) -> Result {
|
|||||||
let elapsed = started.elapsed();
|
let elapsed = started.elapsed();
|
||||||
self.write_str(&format!("completed in {elapsed:#?}")).await
|
self.write_str(&format!("completed in {elapsed:#?}")).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
|
|||||||
@@ -4,23 +4,21 @@ use conduwuit::{Err, Result, utils::response::LimitReadExt};
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId};
|
use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId};
|
||||||
|
|
||||||
use crate::{admin_command, get_room_info};
|
use crate::get_room_info;
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn disable_room(&self, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn disable_room(&self, room_id: OwnedRoomId) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
self.services.rooms.metadata.disable_room(&room_id, true);
|
self.services.rooms.metadata.disable_room(&room_id, true);
|
||||||
self.write_str("Room disabled.").await
|
self.write_str("Room disabled.").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn enable_room(&self, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn enable_room(&self, room_id: OwnedRoomId) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
self.services.rooms.metadata.disable_room(&room_id, false);
|
self.services.rooms.metadata.disable_room(&room_id, false);
|
||||||
self.write_str("Room enabled.").await
|
self.write_str("Room enabled.").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn incoming_federation(&self) -> Result {
|
pub(super) async fn incoming_federation(&self) -> Result {
|
||||||
let msg = {
|
let msg = {
|
||||||
let map = self
|
let map = self
|
||||||
@@ -37,7 +35,14 @@ pub(super) async fn incoming_federation(&self) -> Result {
|
|||||||
);
|
);
|
||||||
for (r, (e, i)) in map.iter() {
|
for (r, (e, i)) in map.iter() {
|
||||||
let elapsed = i.elapsed();
|
let elapsed = i.elapsed();
|
||||||
writeln!(msg, "{} {}: {}m{}s", r, e, elapsed.as_secs() / 60, elapsed.as_secs() % 60)?;
|
writeln!(
|
||||||
|
msg,
|
||||||
|
"{} {}: {}m{}s",
|
||||||
|
r,
|
||||||
|
e,
|
||||||
|
elapsed.as_secs() / 60,
|
||||||
|
elapsed.as_secs() % 60
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
msg
|
msg
|
||||||
};
|
};
|
||||||
@@ -45,7 +50,6 @@ pub(super) async fn incoming_federation(&self) -> Result {
|
|||||||
self.write_str(&msg).await
|
self.write_str(&msg).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn fetch_support_well_known(&self, server_name: OwnedServerName) -> Result {
|
pub(super) async fn fetch_support_well_known(&self, server_name: OwnedServerName) -> Result {
|
||||||
let response = self
|
let response = self
|
||||||
.services
|
.services
|
||||||
@@ -93,7 +97,6 @@ pub(super) async fn fetch_support_well_known(&self, server_name: OwnedServerName
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn remote_user_in_rooms(&self, user_id: OwnedUserId) -> Result {
|
pub(super) async fn remote_user_in_rooms(&self, user_id: OwnedUserId) -> Result {
|
||||||
if user_id.server_name() == self.services.server.name {
|
if user_id.server_name() == self.services.server.name {
|
||||||
return Err!(
|
return Err!(
|
||||||
@@ -128,3 +131,4 @@ pub(super) async fn remote_user_in_rooms(&self, user_id: OwnedUserId) -> Result
|
|||||||
self.write_str(&format!("Rooms {user_id} shares with us ({num}):\n```\n{body}\n```"))
|
self.write_str(&format!("Rooms {user_id} shares with us ({num}):\n```\n{body}\n```"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+32
-30
@@ -9,9 +9,9 @@ use conduwuit_service::media::Dim;
|
|||||||
use ruma::{OwnedEventId, OwnedMxcUri, OwnedServerName};
|
use ruma::{OwnedEventId, OwnedMxcUri, OwnedServerName};
|
||||||
use service::media::mxc::Mxc;
|
use service::media::mxc::Mxc;
|
||||||
|
|
||||||
use crate::{admin_command, utils::parse_local_user_id};
|
use crate::utils::parse_local_user_id;
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn delete(
|
pub(super) async fn delete(
|
||||||
&self,
|
&self,
|
||||||
mxc: Option<OwnedMxcUri>,
|
mxc: Option<OwnedMxcUri>,
|
||||||
@@ -59,8 +59,8 @@ pub(super) async fn delete(
|
|||||||
mxc_urls.push(final_url);
|
mxc_urls.push(final_url);
|
||||||
} else {
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"Found a URL in the event ID {event_id} but did not start \
|
"Found a URL in the event ID {event_id} but did not \
|
||||||
with mxc://, ignoring"
|
start with mxc://, ignoring"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,26 +73,29 @@ pub(super) async fn delete(
|
|||||||
|
|
||||||
if let Some(info) = info_obj {
|
if let Some(info) = info_obj {
|
||||||
if let Some(thumbnail_url) = info.get("thumbnail_url") {
|
if let Some(thumbnail_url) = info.get("thumbnail_url") {
|
||||||
debug!("Found a thumbnail_url in info key: {thumbnail_url}");
|
debug!(
|
||||||
|
"Found a thumbnail_url in info key: {thumbnail_url}"
|
||||||
|
);
|
||||||
|
|
||||||
if thumbnail_url.to_string().starts_with("\"mxc://") {
|
if thumbnail_url.to_string().starts_with("\"mxc://") {
|
||||||
debug!(
|
debug!(
|
||||||
"Pushing thumbnail URL {thumbnail_url} to list of \
|
"Pushing thumbnail URL {thumbnail_url} to list \
|
||||||
MXCs to delete"
|
of MXCs to delete"
|
||||||
);
|
);
|
||||||
let final_thumbnail_url =
|
let final_thumbnail_url =
|
||||||
thumbnail_url.to_string().replace('"', "");
|
thumbnail_url.to_string().replace('"', "");
|
||||||
mxc_urls.push(final_thumbnail_url);
|
mxc_urls.push(final_thumbnail_url);
|
||||||
} else {
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"Found a thumbnail URL in the event ID {event_id} \
|
"Found a thumbnail URL in the event ID \
|
||||||
but did not start with mxc://, ignoring"
|
{event_id} but did not start with mxc://, \
|
||||||
|
ignoring"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"No \"thumbnail_url\" key in \"info\" key, assuming no \
|
"No \"thumbnail_url\" key in \"info\" key, assuming \
|
||||||
thumbnails."
|
no thumbnails."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,8 +117,8 @@ pub(super) async fn delete(
|
|||||||
mxc_urls.push(final_url);
|
mxc_urls.push(final_url);
|
||||||
} else {
|
} else {
|
||||||
warn!(
|
warn!(
|
||||||
"Found a URL in the event ID {event_id} but did not \
|
"Found a URL in the event ID {event_id} but did \
|
||||||
start with mxc://, ignoring"
|
not start with mxc://, ignoring"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -131,8 +134,8 @@ pub(super) async fn delete(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Event ID does not have a \"content\" key, this is not a message or an \
|
"Event ID does not have a \"content\" key, this is not a message or \
|
||||||
event type that contains media.",
|
an event type that contains media.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -155,11 +158,15 @@ pub(super) async fn delete(
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
| Ok(()) => {
|
| Ok(()) => {
|
||||||
debug_info!("Successfully deleted {mxc_url} from filesystem and database");
|
debug_info!(
|
||||||
|
"Successfully deleted {mxc_url} from filesystem and database"
|
||||||
|
);
|
||||||
mxc_deletion_count = mxc_deletion_count.saturating_add(1);
|
mxc_deletion_count = mxc_deletion_count.saturating_add(1);
|
||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
debug_warn!("Failed to delete {mxc_url}, ignoring error and skipping: {e}");
|
debug_warn!(
|
||||||
|
"Failed to delete {mxc_url}, ignoring error and skipping: {e}"
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -167,8 +174,8 @@ pub(super) async fn delete(
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
.write_str(&format!(
|
.write_str(&format!(
|
||||||
"Deleted {mxc_deletion_count} total MXCs from our database and the filesystem \
|
"Deleted {mxc_deletion_count} total MXCs from our database and the \
|
||||||
from event ID {event_id}."
|
filesystem from event ID {event_id}."
|
||||||
))
|
))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
@@ -179,7 +186,6 @@ pub(super) async fn delete(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_list(&self) -> Result {
|
pub(super) async fn delete_list(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -224,13 +230,13 @@ pub(super) async fn delete_list(&self) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Finished bulk MXC deletion, deleted {mxc_deletion_count} total MXCs from our database \
|
"Finished bulk MXC deletion, deleted {mxc_deletion_count} total MXCs from our \
|
||||||
and the filesystem. {failed_parsed_mxcs} MXCs failed to be parsed from the database.",
|
database and the filesystem. {failed_parsed_mxcs} MXCs failed to be parsed from \
|
||||||
|
the database.",
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_past_remote_media(
|
pub(super) async fn delete_past_remote_media(
|
||||||
&self,
|
&self,
|
||||||
duration: String,
|
duration: String,
|
||||||
@@ -266,7 +272,6 @@ pub(super) async fn delete_past_remote_media(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_all_from_user(&self, username: String) -> Result {
|
pub(super) async fn delete_all_from_user(&self, username: String) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &username)?;
|
let user_id = parse_local_user_id(self.services, &username)?;
|
||||||
|
|
||||||
@@ -276,7 +281,6 @@ pub(super) async fn delete_all_from_user(&self, username: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_all_from_server(
|
pub(super) async fn delete_all_from_server(
|
||||||
&self,
|
&self,
|
||||||
server_name: OwnedServerName,
|
server_name: OwnedServerName,
|
||||||
@@ -284,7 +288,8 @@ pub(super) async fn delete_all_from_server(
|
|||||||
) -> Result {
|
) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
if server_name == self.services.globals.server_name() && !yes_i_want_to_delete_local_media {
|
if server_name == self.services.globals.server_name() && !yes_i_want_to_delete_local_media
|
||||||
|
{
|
||||||
return Err!("This command only works for remote media by default.",);
|
return Err!("This command only works for remote media by default.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +340,6 @@ pub(super) async fn delete_all_from_server(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_file_info(&self, mxc: OwnedMxcUri) -> Result {
|
pub(super) async fn get_file_info(&self, mxc: OwnedMxcUri) -> Result {
|
||||||
let mxc: Mxc<'_> = mxc.as_str().try_into()?;
|
let mxc: Mxc<'_> = mxc.as_str().try_into()?;
|
||||||
let metadata = self.services.media.get_metadata(&mxc).await;
|
let metadata = self.services.media.get_metadata(&mxc).await;
|
||||||
@@ -343,7 +347,6 @@ pub(super) async fn get_file_info(&self, mxc: OwnedMxcUri) -> Result {
|
|||||||
self.write_str(&format!("```\n{metadata:#?}\n```")).await
|
self.write_str(&format!("```\n{metadata:#?}\n```")).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_remote_file(
|
pub(super) async fn get_remote_file(
|
||||||
&self,
|
&self,
|
||||||
mxc: OwnedMxcUri,
|
mxc: OwnedMxcUri,
|
||||||
@@ -366,7 +369,6 @@ pub(super) async fn get_remote_file(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_remote_thumbnail(
|
pub(super) async fn get_remote_thumbnail(
|
||||||
&self,
|
&self,
|
||||||
mxc: OwnedMxcUri,
|
mxc: OwnedMxcUri,
|
||||||
@@ -392,7 +394,6 @@ pub(super) async fn get_remote_thumbnail(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_url_preview(&self, url: Option<String>, all: bool) -> Result {
|
pub(super) async fn delete_url_preview(&self, url: Option<String>, all: bool) -> Result {
|
||||||
if all {
|
if all {
|
||||||
self.services.media.clear_url_previews().await;
|
self.services.media.clear_url_previews().await;
|
||||||
@@ -407,3 +408,4 @@ pub(super) async fn delete_url_preview(&self, url: Option<String>, all: bool) ->
|
|||||||
self.write_str(&format!("Deleted cached URL preview for: {url}"))
|
self.write_str(&format!("Deleted cached URL preview for: {url}"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -16,6 +16,7 @@ pub(crate) mod check;
|
|||||||
pub(crate) mod debug;
|
pub(crate) mod debug;
|
||||||
pub(crate) mod federation;
|
pub(crate) mod federation;
|
||||||
pub(crate) mod media;
|
pub(crate) mod media;
|
||||||
|
pub(crate) mod oidc;
|
||||||
pub(crate) mod query;
|
pub(crate) mod query;
|
||||||
pub(crate) mod room;
|
pub(crate) mod room;
|
||||||
pub(crate) mod server;
|
pub(crate) mod server;
|
||||||
@@ -26,7 +27,7 @@ extern crate conduwuit_api as api;
|
|||||||
extern crate conduwuit_core as conduwuit;
|
extern crate conduwuit_core as conduwuit;
|
||||||
extern crate conduwuit_service as service;
|
extern crate conduwuit_service as service;
|
||||||
|
|
||||||
pub(crate) use conduwuit_macros::{admin_command, admin_command_dispatch};
|
pub(crate) use conduwuit_macros::admin_command_dispatch;
|
||||||
|
|
||||||
pub(crate) use crate::{context::Context, utils::get_room_info};
|
pub(crate) use crate::{context::Context, utils::get_room_info};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
use conduwuit::Result;
|
||||||
|
|
||||||
|
use crate::utils::parse_active_local_user_id;
|
||||||
|
|
||||||
|
impl crate::Context<'_> {
|
||||||
|
pub(super) async fn oidc_link(&self, user_id: String, subject: String) -> Result {
|
||||||
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
|
|
||||||
|
self.services.oidc.link_user(&user_id, &subject);
|
||||||
|
|
||||||
|
self.write_str(&format!("Subject `{subject}` linked to account `{user_id}`."))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn oidc_unlink(&self, subject: String) -> Result {
|
||||||
|
self.services.oidc.unlink_user(&subject);
|
||||||
|
|
||||||
|
self.write_str(&format!("Subject `{subject}` unlinked."))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
mod commands;
|
||||||
|
|
||||||
|
use clap::Subcommand;
|
||||||
|
use conduwuit::Result;
|
||||||
|
use conduwuit_macros::admin_command_dispatch;
|
||||||
|
|
||||||
|
#[admin_command_dispatch]
|
||||||
|
#[derive(Debug, Subcommand)]
|
||||||
|
pub enum OidcCommand {
|
||||||
|
/// Link a user ID to the given subject claim.
|
||||||
|
#[clap(name = "link")]
|
||||||
|
OidcLink {
|
||||||
|
user_id: String,
|
||||||
|
subject: String,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Unlink the given subject claim from its associated user ID.
|
||||||
|
#[clap(name = "unlink")]
|
||||||
|
OidcUnlink {
|
||||||
|
subject: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ use conduwuit_database::Deserialized as _;
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{OwnedRoomId, OwnedUserId, exports::serde::Serialize};
|
use ruma::{OwnedRoomId, OwnedUserId, exports::serde::Serialize};
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -31,7 +31,7 @@ pub enum AccountDataCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
async fn changes_since(
|
async fn changes_since(
|
||||||
&self,
|
&self,
|
||||||
user_id: OwnedUserId,
|
user_id: OwnedUserId,
|
||||||
@@ -51,7 +51,6 @@ async fn changes_since(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn account_data_get(
|
async fn account_data_get(
|
||||||
&self,
|
&self,
|
||||||
user_id: OwnedUserId,
|
user_id: OwnedUserId,
|
||||||
@@ -78,3 +77,4 @@ async fn account_data_get(
|
|||||||
self.write_str(&format!("Query completed in {query_time:?}:\n\n```rs\n{json}\n```"))
|
self.write_str(&format!("Query completed in {query_time:?}:\n\n```rs\n{json}\n```"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+27
-19
@@ -13,7 +13,7 @@ use conduwuit_service::Services;
|
|||||||
use futures::{FutureExt, Stream, StreamExt, TryStreamExt};
|
use futures::{FutureExt, Stream, StreamExt, TryStreamExt};
|
||||||
use tokio::time::Instant;
|
use tokio::time::Instant;
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -159,7 +159,7 @@ pub enum RawCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn compact(
|
pub(super) async fn compact(
|
||||||
&self,
|
&self,
|
||||||
map: Option<Vec<String>>,
|
map: Option<Vec<String>>,
|
||||||
@@ -223,7 +223,6 @@ pub(super) async fn compact(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_count(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
pub(super) async fn raw_count(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
||||||
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
||||||
|
|
||||||
@@ -238,7 +237,6 @@ pub(super) async fn raw_count(&self, map: Option<String>, prefix: Option<String>
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_keys(&self, map: String, prefix: Option<String>) -> Result {
|
pub(super) async fn raw_keys(&self, map: String, prefix: Option<String>) -> Result {
|
||||||
writeln!(self, "```").boxed().await?;
|
writeln!(self, "```").boxed().await?;
|
||||||
|
|
||||||
@@ -257,8 +255,11 @@ pub(super) async fn raw_keys(&self, map: String, prefix: Option<String>) -> Resu
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn raw_keys_sizes(
|
||||||
pub(super) async fn raw_keys_sizes(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
&self,
|
||||||
|
map: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
|
) -> Result {
|
||||||
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
||||||
|
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -279,8 +280,11 @@ pub(super) async fn raw_keys_sizes(&self, map: Option<String>, prefix: Option<St
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn raw_keys_total(
|
||||||
pub(super) async fn raw_keys_total(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
&self,
|
||||||
|
map: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
|
) -> Result {
|
||||||
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
||||||
|
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -297,8 +301,11 @@ pub(super) async fn raw_keys_total(&self, map: Option<String>, prefix: Option<St
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn raw_vals_sizes(
|
||||||
pub(super) async fn raw_vals_sizes(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
&self,
|
||||||
|
map: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
|
) -> Result {
|
||||||
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
||||||
|
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -320,8 +327,11 @@ pub(super) async fn raw_vals_sizes(&self, map: Option<String>, prefix: Option<St
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn raw_vals_total(
|
||||||
pub(super) async fn raw_vals_total(&self, map: Option<String>, prefix: Option<String>) -> Result {
|
&self,
|
||||||
|
map: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
|
) -> Result {
|
||||||
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
let prefix = prefix.as_deref().unwrap_or(EMPTY);
|
||||||
|
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -339,7 +349,6 @@ pub(super) async fn raw_vals_total(&self, map: Option<String>, prefix: Option<St
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_iter(&self, map: String, prefix: Option<String>) -> Result {
|
pub(super) async fn raw_iter(&self, map: String, prefix: Option<String>) -> Result {
|
||||||
writeln!(self, "```").await?;
|
writeln!(self, "```").await?;
|
||||||
|
|
||||||
@@ -347,7 +356,10 @@ pub(super) async fn raw_iter(&self, map: String, prefix: Option<String>) -> Resu
|
|||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
prefix
|
prefix
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.map_or_else(|| map.raw_stream().boxed(), |prefix| map.raw_stream_prefix(prefix).boxed())
|
.map_or_else(
|
||||||
|
|| map.raw_stream().boxed(),
|
||||||
|
|prefix| map.raw_stream_prefix(prefix).boxed(),
|
||||||
|
)
|
||||||
.map_ok(apply!(2, String::from_utf8_lossy))
|
.map_ok(apply!(2, String::from_utf8_lossy))
|
||||||
.map_ok(apply!(2, Cow::into_owned))
|
.map_ok(apply!(2, Cow::into_owned))
|
||||||
.try_for_each(|keyval| writeln!(self, "{keyval:?}"))
|
.try_for_each(|keyval| writeln!(self, "{keyval:?}"))
|
||||||
@@ -359,7 +371,6 @@ pub(super) async fn raw_iter(&self, map: String, prefix: Option<String>) -> Resu
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_keys_from(
|
pub(super) async fn raw_keys_from(
|
||||||
&self,
|
&self,
|
||||||
map: String,
|
map: String,
|
||||||
@@ -382,7 +393,6 @@ pub(super) async fn raw_keys_from(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_iter_from(
|
pub(super) async fn raw_iter_from(
|
||||||
&self,
|
&self,
|
||||||
map: String,
|
map: String,
|
||||||
@@ -404,7 +414,6 @@ pub(super) async fn raw_iter_from(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_del(&self, map: String, key: String) -> Result {
|
pub(super) async fn raw_del(&self, map: String, key: String) -> Result {
|
||||||
let map = self.services.db.get(&map)?;
|
let map = self.services.db.get(&map)?;
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -415,7 +424,6 @@ pub(super) async fn raw_del(&self, map: String, key: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_get(&self, map: String, key: String) -> Result {
|
pub(super) async fn raw_get(&self, map: String, key: String) -> Result {
|
||||||
let map = self.services.db.get(&map)?;
|
let map = self.services.db.get(&map)?;
|
||||||
let timer = Instant::now();
|
let timer = Instant::now();
|
||||||
@@ -427,12 +435,12 @@ pub(super) async fn raw_get(&self, map: String, key: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn raw_maps(&self) -> Result {
|
pub(super) async fn raw_maps(&self) -> Result {
|
||||||
let list: Vec<_> = self.services.db.iter().map(at!(0)).copied().collect();
|
let list: Vec<_> = self.services.db.iter().map(at!(0)).copied().collect();
|
||||||
|
|
||||||
self.write_str(&format!("{list:#?}")).await
|
self.write_str(&format!("{list:#?}")).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn with_maps_or<'a>(
|
fn with_maps_or<'a>(
|
||||||
map: Option<&'a str>,
|
map: Option<&'a str>,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use conduwuit::{Err, Result, utils::time};
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::OwnedServerName;
|
use ruma::OwnedServerName;
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -39,7 +39,7 @@ pub enum ResolverCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
async fn destinations_cache(&self, server_name: Option<OwnedServerName>) -> Result {
|
async fn destinations_cache(&self, server_name: Option<OwnedServerName>) -> Result {
|
||||||
use service::resolver::cache::CachedDest;
|
use service::resolver::cache::CachedDest;
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@ async fn destinations_cache(&self, server_name: Option<OwnedServerName>) -> Resu
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn overrides_cache(&self, server_name: Option<String>) -> Result {
|
async fn overrides_cache(&self, server_name: Option<String>) -> Result {
|
||||||
use service::resolver::cache::CachedOverride;
|
use service::resolver::cache::CachedOverride;
|
||||||
|
|
||||||
@@ -82,14 +81,15 @@ async fn overrides_cache(&self, server_name: Option<String>) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let expire = time::format(expire, "%+");
|
let expire = time::format(expire, "%+");
|
||||||
self.write_str(&format!("| {name} | {ips:?} | {port} | {expire} | {overriding:?} |\n"))
|
self.write_str(&format!(
|
||||||
|
"| {name} | {ips:?} | {port} | {expire} | {overriding:?} |\n"
|
||||||
|
))
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn flush_cache(&self, name: Option<OwnedServerName>, all: bool) -> Result {
|
async fn flush_cache(&self, name: Option<OwnedServerName>, all: bool) -> Result {
|
||||||
if all {
|
if all {
|
||||||
self.services.resolver.cache.clear().await;
|
self.services.resolver.cache.clear().await;
|
||||||
@@ -103,3 +103,4 @@ async fn flush_cache(&self, name: Option<OwnedServerName>, all: bool) -> Result
|
|||||||
Err!("Missing name. Supply a name or use --all to flush the whole cache.")
|
Err!("Missing name. Supply a name or use --all to flush the whole cache.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ use conduwuit::{PduCount, Result, utils::stream::TryTools};
|
|||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
use ruma::OwnedRoomOrAliasId;
|
use ruma::OwnedRoomOrAliasId;
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -23,7 +23,7 @@ pub enum RoomTimelineCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn last(&self, room_id: OwnedRoomOrAliasId) -> Result {
|
pub(super) async fn last(&self, room_id: OwnedRoomOrAliasId) -> Result {
|
||||||
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
||||||
|
|
||||||
@@ -37,7 +37,6 @@ pub(super) async fn last(&self, room_id: OwnedRoomOrAliasId) -> Result {
|
|||||||
self.write_str(&format!("{result:#?}")).await
|
self.write_str(&format!("{result:#?}")).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn pdus(
|
pub(super) async fn pdus(
|
||||||
&self,
|
&self,
|
||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
@@ -59,3 +58,4 @@ pub(super) async fn pdus(
|
|||||||
|
|
||||||
self.write_str(&format!("```\n{result:#?}\n```")).await
|
self.write_str(&format!("```\n{result:#?}\n```")).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ use clap::Subcommand;
|
|||||||
use conduwuit::Result;
|
use conduwuit::Result;
|
||||||
use ruma::{OwnedEventId, OwnedRoomOrAliasId};
|
use ruma::{OwnedEventId, OwnedRoomOrAliasId};
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -17,7 +17,7 @@ pub enum ShortCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn short_event_id(&self, event_id: OwnedEventId) -> Result {
|
pub(super) async fn short_event_id(&self, event_id: OwnedEventId) -> Result {
|
||||||
let shortid = self
|
let shortid = self
|
||||||
.services
|
.services
|
||||||
@@ -29,7 +29,6 @@ pub(super) async fn short_event_id(&self, event_id: OwnedEventId) -> Result {
|
|||||||
self.write_str(&format!("{shortid:#?}")).await
|
self.write_str(&format!("{shortid:#?}")).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn short_room_id(&self, room_id: OwnedRoomOrAliasId) -> Result {
|
pub(super) async fn short_room_id(&self, room_id: OwnedRoomOrAliasId) -> Result {
|
||||||
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
||||||
|
|
||||||
@@ -37,3 +36,4 @@ pub(super) async fn short_room_id(&self, room_id: OwnedRoomOrAliasId) -> Result
|
|||||||
|
|
||||||
self.write_str(&format!("{shortid:#?}")).await
|
self.write_str(&format!("{shortid:#?}")).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+26
-25
@@ -3,7 +3,7 @@ use conduwuit::Result;
|
|||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
use ruma::{OwnedDeviceId, OwnedRoomId, OwnedUserId};
|
use ruma::{OwnedDeviceId, OwnedRoomId, OwnedUserId};
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -92,7 +92,7 @@ pub enum UsersCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
async fn get_shared_rooms(&self, user_a: OwnedUserId, user_b: OwnedUserId) -> Result {
|
async fn get_shared_rooms(&self, user_a: OwnedUserId, user_b: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result: Vec<_> = self
|
let result: Vec<_> = self
|
||||||
@@ -108,7 +108,6 @@ async fn get_shared_rooms(&self, user_a: OwnedUserId, user_b: OwnedUserId) -> Re
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_backup_session(
|
async fn get_backup_session(
|
||||||
&self,
|
&self,
|
||||||
user_id: OwnedUserId,
|
user_id: OwnedUserId,
|
||||||
@@ -128,7 +127,6 @@ async fn get_backup_session(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_room_backups(
|
async fn get_room_backups(
|
||||||
&self,
|
&self,
|
||||||
user_id: OwnedUserId,
|
user_id: OwnedUserId,
|
||||||
@@ -147,7 +145,6 @@ async fn get_room_backups(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_all_backups(&self, user_id: OwnedUserId, version: String) -> Result {
|
async fn get_all_backups(&self, user_id: OwnedUserId, version: String) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self.services.key_backups.get_all(&user_id, &version).await;
|
let result = self.services.key_backups.get_all(&user_id, &version).await;
|
||||||
@@ -157,7 +154,6 @@ async fn get_all_backups(&self, user_id: OwnedUserId, version: String) -> Result
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_backup_algorithm(&self, user_id: OwnedUserId, version: String) -> Result {
|
async fn get_backup_algorithm(&self, user_id: OwnedUserId, version: String) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
@@ -171,7 +167,6 @@ async fn get_backup_algorithm(&self, user_id: OwnedUserId, version: String) -> R
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_latest_backup_version(&self, user_id: OwnedUserId) -> Result {
|
async fn get_latest_backup_version(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
@@ -185,7 +180,6 @@ async fn get_latest_backup_version(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_latest_backup(&self, user_id: OwnedUserId) -> Result {
|
async fn get_latest_backup(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self.services.key_backups.get_latest_backup(&user_id).await;
|
let result = self.services.key_backups.get_latest_backup(&user_id).await;
|
||||||
@@ -195,10 +189,15 @@ async fn get_latest_backup(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn iter_users(&self) -> Result {
|
async fn iter_users(&self) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result: Vec<OwnedUserId> = self.services.users.stream().map(Into::into).collect().await;
|
let result: Vec<OwnedUserId> = self
|
||||||
|
.services
|
||||||
|
.users
|
||||||
|
.stream_local_users()
|
||||||
|
.map(Into::into)
|
||||||
|
.collect()
|
||||||
|
.await;
|
||||||
|
|
||||||
let query_time = timer.elapsed();
|
let query_time = timer.elapsed();
|
||||||
|
|
||||||
@@ -206,10 +205,9 @@ async fn iter_users(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn iter_users2(&self) -> Result {
|
async fn iter_users2(&self) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result: Vec<_> = self.services.users.stream().collect().await;
|
let result: Vec<_> = self.services.users.stream_local_users().collect().await;
|
||||||
let result: Vec<_> = result
|
let result: Vec<_> = result
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|user_id| String::from_utf8_lossy(user_id.as_bytes()).into_owned())
|
.map(|user_id| String::from_utf8_lossy(user_id.as_bytes()).into_owned())
|
||||||
@@ -221,7 +219,6 @@ async fn iter_users2(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn count_users(&self) -> Result {
|
async fn count_users(&self) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self.services.users.count().await;
|
let result = self.services.users.count().await;
|
||||||
@@ -231,7 +228,6 @@ async fn count_users(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn list_devices(&self, user_id: OwnedUserId) -> Result {
|
async fn list_devices(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let devices = self
|
let devices = self
|
||||||
@@ -247,7 +243,6 @@ async fn list_devices(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn list_devices_metadata(&self, user_id: OwnedUserId) -> Result {
|
async fn list_devices_metadata(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let devices = self
|
let devices = self
|
||||||
@@ -262,8 +257,11 @@ async fn list_devices_metadata(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
async fn get_device_metadata(
|
||||||
async fn get_device_metadata(&self, user_id: OwnedUserId, device_id: OwnedDeviceId) -> Result {
|
&self,
|
||||||
|
user_id: OwnedUserId,
|
||||||
|
device_id: OwnedDeviceId,
|
||||||
|
) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let device = self
|
let device = self
|
||||||
.services
|
.services
|
||||||
@@ -276,7 +274,6 @@ async fn get_device_metadata(&self, user_id: OwnedUserId, device_id: OwnedDevice
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_devices_version(&self, user_id: OwnedUserId) -> Result {
|
async fn get_devices_version(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let device = self.services.users.get_devicelist_version(&user_id).await;
|
let device = self.services.users.get_devicelist_version(&user_id).await;
|
||||||
@@ -286,8 +283,11 @@ async fn get_devices_version(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
async fn count_one_time_keys(
|
||||||
async fn count_one_time_keys(&self, user_id: OwnedUserId, device_id: OwnedDeviceId) -> Result {
|
&self,
|
||||||
|
user_id: OwnedUserId,
|
||||||
|
device_id: OwnedDeviceId,
|
||||||
|
) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
.services
|
.services
|
||||||
@@ -300,7 +300,6 @@ async fn count_one_time_keys(&self, user_id: OwnedUserId, device_id: OwnedDevice
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_device_keys(&self, user_id: OwnedUserId, device_id: OwnedDeviceId) -> Result {
|
async fn get_device_keys(&self, user_id: OwnedUserId, device_id: OwnedDeviceId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
@@ -314,7 +313,6 @@ async fn get_device_keys(&self, user_id: OwnedUserId, device_id: OwnedDeviceId)
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_user_signing_key(&self, user_id: OwnedUserId) -> Result {
|
async fn get_user_signing_key(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self.services.users.get_user_signing_key(&user_id).await;
|
let result = self.services.users.get_user_signing_key(&user_id).await;
|
||||||
@@ -324,7 +322,6 @@ async fn get_user_signing_key(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn get_master_key(&self, user_id: OwnedUserId) -> Result {
|
async fn get_master_key(&self, user_id: OwnedUserId) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
@@ -338,8 +335,11 @@ async fn get_master_key(&self, user_id: OwnedUserId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
async fn get_to_device_events(
|
||||||
async fn get_to_device_events(&self, user_id: OwnedUserId, device_id: OwnedDeviceId) -> Result {
|
&self,
|
||||||
|
user_id: OwnedUserId,
|
||||||
|
device_id: OwnedDeviceId,
|
||||||
|
) -> Result {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
let result = self
|
let result = self
|
||||||
.services
|
.services
|
||||||
@@ -352,3 +352,4 @@ async fn get_to_device_events(&self, user_id: OwnedUserId, device_id: OwnedDevic
|
|||||||
self.write_str(&format!("Query completed in {query_time:?}:\n\n```rs\n{result:#?}\n```"))
|
self.write_str(&format!("Query completed in {query_time:?}:\n\n```rs\n{result:#?}\n```"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ use conduwuit::{Err, Result};
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::OwnedRoomId;
|
use ruma::OwnedRoomId;
|
||||||
|
|
||||||
use crate::{PAGE_SIZE, admin_command, get_room_info};
|
use crate::{PAGE_SIZE, get_room_info};
|
||||||
|
|
||||||
|
impl crate::Context<'_> {
|
||||||
#[allow(clippy::fn_params_excessive_bools)]
|
#[allow(clippy::fn_params_excessive_bools)]
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_rooms(
|
pub(super) async fn list_rooms(
|
||||||
&self,
|
&self,
|
||||||
page: Option<usize>,
|
page: Option<usize>,
|
||||||
@@ -76,9 +76,9 @@ pub(super) async fn list_rooms(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn exists(&self, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn exists(&self, room_id: OwnedRoomId) -> Result {
|
||||||
let result = self.services.rooms.metadata.exists(&room_id).await;
|
let result = self.services.rooms.metadata.exists(&room_id).await;
|
||||||
|
|
||||||
self.write_str(&format!("{result}")).await
|
self.write_str(&format!("{result}")).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ use conduwuit::{Err, Result, utils::ReadyExt};
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::OwnedRoomId;
|
use ruma::OwnedRoomId;
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch};
|
use crate::admin_command_dispatch;
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -26,7 +26,7 @@ pub enum RoomInfoCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
async fn list_joined_members(&self, room_id: OwnedRoomId, local_only: bool) -> Result {
|
async fn list_joined_members(&self, room_id: OwnedRoomId, local_only: bool) -> Result {
|
||||||
let room_name = self
|
let room_name = self
|
||||||
.services
|
.services
|
||||||
@@ -70,7 +70,6 @@ async fn list_joined_members(&self, room_id: OwnedRoomId, local_only: bool) -> R
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn view_room_topic(&self, room_id: OwnedRoomId) -> Result {
|
async fn view_room_topic(&self, room_id: OwnedRoomId) -> Result {
|
||||||
let Ok(room_topic) = self
|
let Ok(room_topic) = self
|
||||||
.services
|
.services
|
||||||
@@ -85,3 +84,4 @@ async fn view_room_topic(&self, room_id: OwnedRoomId) -> Result {
|
|||||||
self.write_str(&format!("Room topic:\n```\n{room_topic}\n```"))
|
self.write_str(&format!("Room topic:\n```\n{room_topic}\n```"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ use conduwuit::{
|
|||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use ruma::{OwnedRoomId, OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId};
|
use ruma::{OwnedRoomId, OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId};
|
||||||
|
|
||||||
use crate::{admin_command, admin_command_dispatch, get_room_info};
|
use crate::{admin_command_dispatch, get_room_info};
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
@@ -45,7 +45,7 @@ pub enum RoomModerationCommand {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
||||||
debug!("Got room alias or ID: {}", room);
|
debug!("Got room alias or ID: {}", room);
|
||||||
|
|
||||||
@@ -62,8 +62,8 @@ async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
| Ok(room_id) => room_id,
|
| Ok(room_id) => room_id,
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
"Failed to parse room ID {room}. Please note that this requires a full \
|
||||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`): {e}"
|
(`#roomalias:example.com`): {e}"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -77,8 +77,8 @@ async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
| Ok(room_alias) => room_alias,
|
| Ok(room_alias) => room_alias,
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
"Failed to parse room ID {room}. Please note that this requires a full \
|
||||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`): {e}"
|
(`#roomalias:example.com`): {e}"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -104,8 +104,8 @@ async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Room specified is not a room ID or room alias. Please note that this requires a \
|
"Room specified is not a room ID or room alias. Please note that this requires \
|
||||||
full room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
a full room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`)",
|
(`#roomalias:example.com`)",
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -154,12 +154,12 @@ async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
self.services.rooms.metadata.disable_room(&room_id, true); // disable federation
|
self.services.rooms.metadata.disable_room(&room_id, true); // disable federation
|
||||||
|
|
||||||
self.write_str(
|
self.write_str(
|
||||||
"Room banned, removed all our local users, and disabled incoming federation with room.",
|
"Room banned, removed all our local users, and disabled incoming federation with \
|
||||||
|
room.",
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn ban_list_of_rooms(&self) -> Result {
|
async fn ban_list_of_rooms(&self) -> Result {
|
||||||
if self.body.len() < 2
|
if self.body.len() < 2
|
||||||
|| !self.body[0].trim().starts_with("```")
|
|| !self.body[0].trim().starts_with("```")
|
||||||
@@ -183,7 +183,8 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
match <&RoomOrAliasId>::try_from(room) {
|
match <&RoomOrAliasId>::try_from(room) {
|
||||||
| Ok(room_alias_or_id) => {
|
| Ok(room_alias_or_id) => {
|
||||||
if let Ok(admin_room_id) = self.services.admin.get_admin_room().await {
|
if let Ok(admin_room_id) = self.services.admin.get_admin_room().await {
|
||||||
if room.to_owned().eq(&admin_room_id) || room.to_owned().eq(admin_room_alias)
|
if room.to_owned().eq(&admin_room_id)
|
||||||
|
|| room.to_owned().eq(admin_room_alias)
|
||||||
{
|
{
|
||||||
warn!("User specified admin room in bulk ban list, ignoring");
|
warn!("User specified admin room in bulk ban list, ignoring");
|
||||||
continue;
|
continue;
|
||||||
@@ -219,8 +220,9 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
| Ok(room_id) => room_id,
|
| Ok(room_id) => room_id,
|
||||||
| _ => {
|
| _ => {
|
||||||
debug!(
|
debug!(
|
||||||
"We don't have this room alias to a room ID locally, \
|
"We don't have this room alias to a room ID \
|
||||||
attempting to fetch room ID over federation"
|
locally, attempting to fetch room ID over \
|
||||||
|
federation"
|
||||||
);
|
);
|
||||||
|
|
||||||
match self
|
match self
|
||||||
@@ -241,8 +243,8 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
warn!(
|
warn!(
|
||||||
"Failed to resolve room alias {room} to a room \
|
"Failed to resolve room alias {room} to a \
|
||||||
ID: {e}"
|
room ID: {e}"
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
@@ -264,8 +266,8 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
warn!(
|
warn!(
|
||||||
"Error parsing room \"{room}\" during bulk room banning, ignoring error and \
|
"Error parsing room \"{room}\" during bulk room banning, ignoring error \
|
||||||
logging here: {e}"
|
and logging here: {e}"
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
@@ -287,8 +289,8 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
|
|
||||||
while let Some(ref user_id) = users.next().await {
|
while let Some(ref user_id) = users.next().await {
|
||||||
debug!(
|
debug!(
|
||||||
"Attempting leave for user {user_id} in room {room_id} (ignoring all errors, \
|
"Attempting leave for user {user_id} in room {room_id} (ignoring all \
|
||||||
evicting admins too)",
|
errors, evicting admins too)",
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Err(e) = leave_room(self.services, user_id, &room_id, None)
|
if let Err(e) = leave_room(self.services, user_id, &room_id, None)
|
||||||
@@ -323,21 +325,20 @@ async fn ban_list_of_rooms(&self) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Finished bulk room ban, banned {room_ban_count} total rooms, evicted all users, and \
|
"Finished bulk room ban, banned {room_ban_count} total rooms, evicted all users, \
|
||||||
disabled incoming federation with the room."
|
and disabled incoming federation with the room."
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
||||||
let room_id = if room.is_room_id() {
|
let room_id = if room.is_room_id() {
|
||||||
let room_id = match RoomId::parse(&room) {
|
let room_id = match RoomId::parse(&room) {
|
||||||
| Ok(room_id) => room_id,
|
| Ok(room_id) => room_id,
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
"Failed to parse room ID {room}. Please note that this requires a full \
|
||||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`): {e}"
|
(`#roomalias:example.com`): {e}"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -352,8 +353,8 @@ async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
| Ok(room_alias) => room_alias,
|
| Ok(room_alias) => room_alias,
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
"Failed to parse room ID {room}. Please note that this requires a full \
|
||||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`): {e}"
|
(`#roomalias:example.com`): {e}"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -374,8 +375,8 @@ async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
| Ok(room_id) => room_id,
|
| Ok(room_id) => room_id,
|
||||||
| _ => {
|
| _ => {
|
||||||
debug!(
|
debug!(
|
||||||
"We don't have this room alias to a room ID locally, attempting to fetch \
|
"We don't have this room alias to a room ID locally, attempting to \
|
||||||
room ID over federation"
|
fetch room ID over federation"
|
||||||
);
|
);
|
||||||
|
|
||||||
match self.services.rooms.alias.resolve_alias(&room_alias).await {
|
match self.services.rooms.alias.resolve_alias(&room_alias).await {
|
||||||
@@ -399,8 +400,8 @@ async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
room_id
|
room_id
|
||||||
} else {
|
} else {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Room specified is not a room ID or room alias. Please note that this requires a \
|
"Room specified is not a room ID or room alias. Please note that this requires \
|
||||||
full room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
a full room ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||||
(`#roomalias:example.com`)",
|
(`#roomalias:example.com`)",
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -410,7 +411,6 @@ async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
async fn list_banned_rooms(&self, no_details: bool) -> Result {
|
async fn list_banned_rooms(&self, no_details: bool) -> Result {
|
||||||
let room_ids: Vec<OwnedRoomId> = self
|
let room_ids: Vec<OwnedRoomId> = self
|
||||||
.services
|
.services
|
||||||
@@ -452,3 +452,4 @@ async fn list_banned_rooms(&self, no_details: bool) -> Result {
|
|||||||
self.write_str(&format!("Rooms Banned ({num}):\n```\n{body}\n```"))
|
self.write_str(&format!("Rooms Banned ({num}):\n```\n{body}\n```"))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,7 @@ use conduwuit::{
|
|||||||
};
|
};
|
||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
|
|
||||||
use crate::admin_command;
|
impl crate::Context<'_> {
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn uptime(&self) -> Result {
|
pub(super) async fn uptime(&self) -> Result {
|
||||||
let elapsed = self
|
let elapsed = self
|
||||||
.services
|
.services
|
||||||
@@ -22,7 +20,6 @@ pub(super) async fn uptime(&self) -> Result {
|
|||||||
self.write_str(&format!("{result}.")).await
|
self.write_str(&format!("{result}.")).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn show_config(&self) -> Result {
|
pub(super) async fn show_config(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -30,7 +27,6 @@ pub(super) async fn show_config(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn reload_config(&self, path: Option<PathBuf>) -> Result {
|
pub(super) async fn reload_config(&self, path: Option<PathBuf>) -> Result {
|
||||||
// The path argument is only what's optionally passed via the admin command,
|
// The path argument is only what's optionally passed via the admin command,
|
||||||
// so we need to merge it with the existing paths if any were given at startup.
|
// so we need to merge it with the existing paths if any were given at startup.
|
||||||
@@ -59,12 +55,11 @@ pub(super) async fn reload_config(&self, path: Option<PathBuf>) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn memory_usage(&self) -> Result {
|
pub(super) async fn memory_usage(&self) -> Result {
|
||||||
let services_usage = self.services.memory_usage().await?;
|
let services_usage = self.services.memory_usage().await?;
|
||||||
let database_usage = self.services.db.db.memory_usage()?;
|
let database_usage = self.services.db.db.memory_usage()?;
|
||||||
let allocator_usage =
|
let allocator_usage = conduwuit::alloc::memory_usage()
|
||||||
conduwuit::alloc::memory_usage().map_or(String::new(), |s| format!("\nAllocator:\n{s}"));
|
.map_or(String::new(), |s| format!("\nAllocator:\n{s}"));
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Services:\n{services_usage}\nDatabase:\n{database_usage}{allocator_usage}",
|
"Services:\n{services_usage}\nDatabase:\n{database_usage}{allocator_usage}",
|
||||||
@@ -72,14 +67,12 @@ pub(super) async fn memory_usage(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn clear_caches(&self) -> Result {
|
pub(super) async fn clear_caches(&self) -> Result {
|
||||||
self.services.clear_cache().await;
|
self.services.clear_cache().await;
|
||||||
|
|
||||||
self.write_str("Done.").await
|
self.write_str("Done.").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_backups(&self) -> Result {
|
pub(super) async fn list_backups(&self) -> Result {
|
||||||
self.services
|
self.services
|
||||||
.db
|
.db
|
||||||
@@ -90,7 +83,6 @@ pub(super) async fn list_backups(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn backup_database(&self) -> Result {
|
pub(super) async fn backup_database(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -110,7 +102,6 @@ pub(super) async fn backup_database(&self) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn admin_notice(&self, message: Vec<String>) -> Result {
|
pub(super) async fn admin_notice(&self, message: Vec<String>) -> Result {
|
||||||
let message = message.join(" ");
|
let message = message.join(" ");
|
||||||
self.services.admin.send_text(&message).await;
|
self.services.admin.send_text(&message).await;
|
||||||
@@ -118,7 +109,6 @@ pub(super) async fn admin_notice(&self, message: Vec<String>) -> Result {
|
|||||||
self.write_str("Notice was sent to #admins").await
|
self.write_str("Notice was sent to #admins").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn reload_mods(&self) -> Result {
|
pub(super) async fn reload_mods(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -127,15 +117,14 @@ pub(super) async fn reload_mods(&self) -> Result {
|
|||||||
self.write_str("Reloading server...").await
|
self.write_str("Reloading server...").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub(super) async fn restart(&self, force: bool) -> Result {
|
pub(super) async fn restart(&self, force: bool) -> Result {
|
||||||
use conduwuit::utils::sys::current_exe_deleted;
|
use conduwuit::utils::sys::current_exe_deleted;
|
||||||
|
|
||||||
if !force && current_exe_deleted() {
|
if !force && current_exe_deleted() {
|
||||||
return Err!(
|
return Err!(
|
||||||
"The server cannot be restarted because the executable changed. If this is expected \
|
"The server cannot be restarted because the executable changed. If this is \
|
||||||
use --force to override."
|
expected use --force to override."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +133,6 @@ pub(super) async fn restart(&self, force: bool) -> Result {
|
|||||||
self.write_str("Restarting server...").await
|
self.write_str("Restarting server...").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn shutdown(&self) -> Result {
|
pub(super) async fn shutdown(&self) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -154,7 +142,6 @@ pub(super) async fn shutdown(&self) -> Result {
|
|||||||
self.write_str("Shutting down server...").await
|
self.write_str("Shutting down server...").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_features(&self) -> Result {
|
pub(super) async fn list_features(&self) -> Result {
|
||||||
let mut enabled_features = conduwuit::info::introspection::ENABLED_FEATURES
|
let mut enabled_features = conduwuit::info::introspection::ENABLED_FEATURES
|
||||||
.lock()
|
.lock()
|
||||||
@@ -186,7 +173,6 @@ pub(super) async fn list_features(&self) -> Result {
|
|||||||
self.write_str(&features).await
|
self.write_str(&features).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn build_info(&self) -> Result {
|
pub(super) async fn build_info(&self) -> Result {
|
||||||
use conduwuit::build_metadata::built;
|
use conduwuit::build_metadata::built;
|
||||||
|
|
||||||
@@ -247,3 +233,4 @@ pub(super) async fn build_info(&self) -> Result {
|
|||||||
|
|
||||||
self.write_str(&info).await
|
self.write_str(&info).await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
use conduwuit::{Err, Result, utils};
|
use conduwuit::{Err, Result, utils};
|
||||||
use conduwuit_macros::admin_command;
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use service::registration_tokens::TokenExpires;
|
use service::registration_tokens::TokenExpires;
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result {
|
pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result {
|
||||||
let expires = {
|
let expires = {
|
||||||
if expires.immortal {
|
if expires.immortal {
|
||||||
@@ -15,7 +14,9 @@ pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result {
|
|||||||
} else if let Some(max_age) = expires
|
} else if let Some(max_age) = expires
|
||||||
.max_age
|
.max_age
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.map(|max_age| utils::time::timepoint_from_now(utils::time::parse_duration(max_age)?))
|
.map(|max_age| {
|
||||||
|
utils::time::timepoint_from_now(utils::time::parse_duration(max_age)?)
|
||||||
|
})
|
||||||
.transpose()?
|
.transpose()?
|
||||||
{
|
{
|
||||||
Some(TokenExpires::AfterTime(max_age))
|
Some(TokenExpires::AfterTime(max_age))
|
||||||
@@ -37,10 +38,32 @@ pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result {
|
|||||||
"Never expires".to_owned()
|
"Never expires".to_owned()
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
.await
|
.await?;
|
||||||
|
|
||||||
|
if self
|
||||||
|
.services
|
||||||
|
.config
|
||||||
|
.oauth
|
||||||
|
.compatibility_mode()
|
||||||
|
.oauth_available()
|
||||||
|
{
|
||||||
|
self.write_str(&format!(
|
||||||
|
"\nInvite link using this token: {}",
|
||||||
|
self.services
|
||||||
|
.config
|
||||||
|
.get_client_domain()
|
||||||
|
.join(&format!(
|
||||||
|
"{}/account/register/?flow=trusted&token={token}",
|
||||||
|
conduwuit::ROUTE_PREFIX
|
||||||
|
))
|
||||||
|
.unwrap()
|
||||||
|
))
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn revoke_token(&self, token: String) -> Result {
|
pub(super) async fn revoke_token(&self, token: String) -> Result {
|
||||||
let Some(token) = self
|
let Some(token) = self
|
||||||
.services
|
.services
|
||||||
@@ -56,7 +79,6 @@ pub(super) async fn revoke_token(&self, token: String) -> Result {
|
|||||||
self.write_str("Token revoked successfully.").await
|
self.write_str("Token revoked successfully.").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_tokens(&self) -> Result {
|
pub(super) async fn list_tokens(&self) -> Result {
|
||||||
let tokens: Vec<_> = self
|
let tokens: Vec<_> = self
|
||||||
.services
|
.services
|
||||||
@@ -74,3 +96,4 @@ pub(super) async fn list_tokens(&self) -> Result {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
+103
-251
@@ -1,13 +1,10 @@
|
|||||||
use std::{
|
use std::collections::{BTreeMap, HashSet};
|
||||||
collections::{BTreeMap, HashSet},
|
|
||||||
fmt::Write as _,
|
|
||||||
};
|
|
||||||
|
|
||||||
use api::client::{
|
use api::client::{
|
||||||
full_user_deactivate, leave_room, recreate_push_rules_and_return, remote_leave_room,
|
full_user_deactivate, leave_room, recreate_push_rules_and_return, remote_leave_room,
|
||||||
};
|
};
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result, debug_warn, error, info,
|
Err, Result, debug_warn, info,
|
||||||
matrix::{Event, pdu::PartialPdu},
|
matrix::{Event, pdu::PartialPdu},
|
||||||
utils::{self, ReadyExt},
|
utils::{self, ReadyExt},
|
||||||
warn,
|
warn,
|
||||||
@@ -23,17 +20,17 @@ use ruma::{
|
|||||||
tag::{TagEvent, TagEventContent, TagInfo},
|
tag::{TagEvent, TagEventContent, TagInfo},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::users::HashedPassword;
|
use service::users::{AccountStatus, HashedPassword};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
admin_command, get_room_info,
|
get_room_info,
|
||||||
utils::{parse_active_local_user_id, parse_local_user_id},
|
utils::{parse_active_local_user_id, parse_local_user_id},
|
||||||
};
|
};
|
||||||
|
|
||||||
const AUTO_GEN_PASSWORD_LENGTH: usize = 25;
|
const AUTO_GEN_PASSWORD_LENGTH: usize = 25;
|
||||||
const BULK_JOIN_REASON: &str = "Bulk force joining this room as initiated by the server admin.";
|
const BULK_JOIN_REASON: &str = "Bulk force joining this room as initiated by the server admin.";
|
||||||
|
|
||||||
#[admin_command]
|
impl crate::Context<'_> {
|
||||||
pub(super) async fn list_users(&self) -> Result {
|
pub(super) async fn list_users(&self) -> Result {
|
||||||
let users: Vec<_> = self
|
let users: Vec<_> = self
|
||||||
.services
|
.services
|
||||||
@@ -50,136 +47,25 @@ pub(super) async fn list_users(&self) -> Result {
|
|||||||
self.write_str(&plain_msg).await
|
self.write_str(&plain_msg).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn create_user(&self, username: String, password: Option<String>) -> Result {
|
pub(super) async fn create_user(&self, username: String, password: Option<String>) -> Result {
|
||||||
// Validate user id
|
let user_id = self
|
||||||
let user_id = parse_local_user_id(self.services, &username)?;
|
.services
|
||||||
|
|
||||||
if let Err(e) = user_id.validate_strict() {
|
|
||||||
if self.services.config.emergency_password.is_none() {
|
|
||||||
return Err!("Username {user_id} contains disallowed characters or spaces: {e}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} already exists");
|
|
||||||
}
|
|
||||||
|
|
||||||
let password = password.unwrap_or_else(|| utils::random_string(AUTO_GEN_PASSWORD_LENGTH));
|
|
||||||
|
|
||||||
// Create user
|
|
||||||
self.services
|
|
||||||
.users
|
.users
|
||||||
.create(&user_id, Some(HashedPassword::new(&password)?))
|
.determine_registration_user_id(Some(username), None, None)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Default to pretty displayname
|
let password =
|
||||||
let mut displayname = user_id.localpart().to_owned();
|
&password.unwrap_or_else(|| utils::random_string(AUTO_GEN_PASSWORD_LENGTH));
|
||||||
|
|
||||||
// If `new_user_displayname_suffix` is set, registration will push whatever
|
|
||||||
// content is set to the user's display name with a space before it
|
|
||||||
if !self
|
|
||||||
.services
|
|
||||||
.server
|
|
||||||
.config
|
|
||||||
.new_user_displayname_suffix
|
|
||||||
.is_empty()
|
|
||||||
{
|
|
||||||
write!(displayname, " {}", self.services.server.config.new_user_displayname_suffix)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.services
|
self.services
|
||||||
.users
|
.users
|
||||||
.set_displayname(&user_id, Some(displayname));
|
.create_local_account(&user_id, Some(HashedPassword::new(password)?), None)
|
||||||
|
|
||||||
// Initial account data
|
|
||||||
self.services
|
|
||||||
.account_data
|
|
||||||
.update(
|
|
||||||
None,
|
|
||||||
&user_id,
|
|
||||||
ruma::events::GlobalAccountDataEventType::PushRules
|
|
||||||
.to_string()
|
|
||||||
.into(),
|
|
||||||
&serde_json::to_value(ruma::events::push_rules::PushRulesEvent::new(
|
|
||||||
ruma::events::push_rules::PushRulesEventContent::new(
|
|
||||||
ruma::push::Ruleset::server_default(&user_id),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if !self.services.server.config.auto_join_rooms.is_empty() {
|
self.write_str(&format!("Created user {user_id} with password `{password}`"))
|
||||||
for room in &self.services.server.config.auto_join_rooms {
|
|
||||||
let Ok(room_id) = self.services.rooms.alias.resolve(room).await else {
|
|
||||||
error!(
|
|
||||||
%user_id,
|
|
||||||
"Failed to resolve room alias to room ID when attempting to auto join {room}, skipping"
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
|
|
||||||
if !self
|
|
||||||
.services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.server_in_room(self.services.globals.server_name(), &room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
warn!(
|
|
||||||
"Skipping room {room} to automatically join as we have never joined before."
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(room_server_name) = room.server_name() {
|
|
||||||
match self
|
|
||||||
.services
|
|
||||||
.rooms
|
|
||||||
.membership
|
|
||||||
.join_room(
|
|
||||||
&user_id,
|
|
||||||
&room_id,
|
|
||||||
Some("Automatically joining this room upon registration".to_owned()),
|
|
||||||
&[
|
|
||||||
self.services.globals.server_name().to_owned(),
|
|
||||||
room_server_name.to_owned(),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
| Ok(_response) => {
|
|
||||||
info!("Automatically joined room {room} for user {user_id}");
|
|
||||||
},
|
|
||||||
| Err(e) => {
|
|
||||||
// don't return this error so we don't fail registrations
|
|
||||||
error!(
|
|
||||||
"Failed to automatically join room {room} for user {user_id}: {e}"
|
|
||||||
);
|
|
||||||
self.services
|
|
||||||
.admin
|
|
||||||
.send_text(&format!(
|
|
||||||
"Failed to automatically join room {room} for user {user_id}: \
|
|
||||||
{e}"
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// we dont add a device since we're not the user, just the creator
|
|
||||||
|
|
||||||
// Make the first user to register an administrator and disable first-run mode.
|
|
||||||
self.services.firstrun.empower_first_user(&user_id).await?;
|
|
||||||
|
|
||||||
self.write_str(&format!("Created user with user_id: {user_id} and password: `{password}`"))
|
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn deactivate(&self, no_leave_rooms: bool, user_id: String) -> Result {
|
pub(super) async fn deactivate(&self, no_leave_rooms: bool, user_id: String) -> Result {
|
||||||
// Validate user id
|
// Validate user id
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
@@ -215,18 +101,14 @@ pub(super) async fn deactivate(&self, no_leave_rooms: bool, user_id: String) ->
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn suspend(&self, user_id: String) -> Result {
|
pub(super) async fn suspend(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!("Not allowed to suspend the server service account.",);
|
return Err!("Not allowed to suspend the server service account.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
if self.services.users.is_admin(&user_id).await {
|
if self.services.users.is_admin(&user_id).await {
|
||||||
return Err!("Admin users cannot be suspended.");
|
return Err!("Admin users cannot be suspended.");
|
||||||
}
|
}
|
||||||
@@ -240,50 +122,69 @@ pub(super) async fn suspend(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn unsuspend(&self, user_id: String) -> Result {
|
pub(super) async fn unsuspend(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!("Not allowed to unsuspend the server service account.",);
|
return Err!("Not allowed to unsuspend the server service account.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
self.services.users.unsuspend_account(&user_id).await;
|
self.services.users.unsuspend_account(&user_id).await;
|
||||||
|
|
||||||
self.write_str(&format!("User {user_id} has been unsuspended."))
|
self.write_str(&format!("User {user_id} has been unsuspended."))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn reset_password(
|
pub(super) async fn reset_password(
|
||||||
&self,
|
&self,
|
||||||
logout: bool,
|
logout: bool,
|
||||||
username: String,
|
username: String,
|
||||||
password: Option<String>,
|
password: Option<String>,
|
||||||
|
convert_to_local_account: bool,
|
||||||
) -> Result {
|
) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &username)?;
|
let user_id = parse_local_user_id(self.services, &username)?;
|
||||||
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!(
|
return Err!(
|
||||||
"Not allowed to set the password for the server account. Please use the emergency \
|
"Not allowed to set the password for the server account. Please use the \
|
||||||
password config option.",
|
emergency password config option.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_password = password.unwrap_or_else(|| utils::random_string(AUTO_GEN_PASSWORD_LENGTH));
|
let new_password =
|
||||||
|
password.unwrap_or_else(|| utils::random_string(AUTO_GEN_PASSWORD_LENGTH));
|
||||||
|
let new_password_hash = HashedPassword::new(&new_password)?;
|
||||||
|
|
||||||
|
if convert_to_local_account {
|
||||||
self.services
|
self.services
|
||||||
.users
|
.users
|
||||||
.set_password(&user_id, Some(HashedPassword::new(&new_password)?));
|
.convert_to_local_account(&user_id, new_password_hash)
|
||||||
|
.await?;
|
||||||
|
} else {
|
||||||
|
match self.services.users.status(&user_id).await {
|
||||||
|
| AccountStatus::Active if !self.services.users.is_shadow(&user_id).await => {
|
||||||
|
self.services
|
||||||
|
.users
|
||||||
|
.set_password(&user_id, new_password_hash)
|
||||||
|
.await?;
|
||||||
|
},
|
||||||
|
| AccountStatus::NotFound => {
|
||||||
|
return Err!("The provided user does not exist.");
|
||||||
|
},
|
||||||
|
| _ => {
|
||||||
|
return Err!(
|
||||||
|
"The provided user is a shadow or deactivated account. To convert it to \
|
||||||
|
a local account, pass the --convert-to-local-account flag."
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Successfully reset the password for user {user_id}: `{new_password}`"
|
"Successfully reset the password for user {user_id}: `{new_password}`"
|
||||||
))
|
))
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
if logout {
|
if logout {
|
||||||
self.services
|
self.services
|
||||||
@@ -302,32 +203,6 @@ pub(super) async fn reset_password(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn issue_password_reset_link(&self, username: String) -> Result {
|
|
||||||
use conduwuit_service::password_reset::{PASSWORD_RESET_PATH, RESET_TOKEN_QUERY_PARAM};
|
|
||||||
|
|
||||||
self.bail_restricted()?;
|
|
||||||
|
|
||||||
let mut reset_url = self
|
|
||||||
.services
|
|
||||||
.config
|
|
||||||
.get_client_domain()
|
|
||||||
.join(PASSWORD_RESET_PATH)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let user_id = parse_local_user_id(self.services, &username)?;
|
|
||||||
let token = self.services.password_reset.issue_token(user_id).await?;
|
|
||||||
reset_url
|
|
||||||
.query_pairs_mut()
|
|
||||||
.append_pair(RESET_TOKEN_QUERY_PARAM, &token.token);
|
|
||||||
|
|
||||||
self.write_str(&format!("Password reset link issued for {username}: {reset_url}"))
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn deactivate_all(&self, no_leave_rooms: bool, force: bool) -> Result {
|
pub(super) async fn deactivate_all(&self, no_leave_rooms: bool, force: bool) -> Result {
|
||||||
if self.body.len() < 2
|
if self.body.len() < 2
|
||||||
|| !self.body[0].trim().starts_with("```")
|
|| !self.body[0].trim().starts_with("```")
|
||||||
@@ -350,7 +225,9 @@ pub(super) async fn deactivate_all(&self, no_leave_rooms: bool, force: bool) ->
|
|||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
self.services
|
self.services
|
||||||
.admin
|
.admin
|
||||||
.send_text(&format!("{username} is not a valid username, skipping over: {e}"))
|
.send_text(&format!(
|
||||||
|
"{username} is not a valid username, skipping over: {e}"
|
||||||
|
))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -398,7 +275,9 @@ pub(super) async fn deactivate_all(&self, no_leave_rooms: bool, force: bool) ->
|
|||||||
| Ok(()) => {
|
| Ok(()) => {
|
||||||
deactivation_count = deactivation_count.saturating_add(1);
|
deactivation_count = deactivation_count.saturating_add(1);
|
||||||
if !no_leave_rooms {
|
if !no_leave_rooms {
|
||||||
info!("Forcing user {user_id} to leave all rooms apart of deactivate-all");
|
info!(
|
||||||
|
"Forcing user {user_id} to leave all rooms apart of deactivate-all"
|
||||||
|
);
|
||||||
let all_joined_rooms: Vec<OwnedRoomId> = self
|
let all_joined_rooms: Vec<OwnedRoomId> = self
|
||||||
.services
|
.services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -429,7 +308,6 @@ pub(super) async fn deactivate_all(&self, no_leave_rooms: bool, force: bool) ->
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_invited_rooms(&self, user_id: String) -> Result {
|
pub(super) async fn list_invited_rooms(&self, user_id: String) -> Result {
|
||||||
// Validate user id
|
// Validate user id
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
@@ -468,11 +346,13 @@ pub(super) async fn list_invited_rooms(&self, user_id: String) -> Result {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
self.write_str(&format!("Rooms {user_id} is Invited to ({}):\n```\n{body}\n```", rooms.len()))
|
self.write_str(&format!(
|
||||||
|
"Rooms {user_id} is Invited to ({}):\n```\n{body}\n```",
|
||||||
|
rooms.len()
|
||||||
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn reject_all_invites(&self, user_id: String) -> Result {
|
pub(super) async fn reject_all_invites(&self, user_id: String) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
|
|
||||||
@@ -505,7 +385,6 @@ pub(super) async fn reject_all_invites(&self, user_id: String) -> Result {
|
|||||||
self.write_str("Successfully rejected all invites.").await
|
self.write_str("Successfully rejected all invites.").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn list_joined_rooms(&self, user_id: String) -> Result {
|
pub(super) async fn list_joined_rooms(&self, user_id: String) -> Result {
|
||||||
// Validate user id
|
// Validate user id
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
@@ -536,7 +415,6 @@ pub(super) async fn list_joined_rooms(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_join_list_of_local_users(
|
pub(super) async fn force_join_list_of_local_users(
|
||||||
&self,
|
&self,
|
||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
@@ -551,8 +429,8 @@ pub(super) async fn force_join_list_of_local_users(
|
|||||||
|
|
||||||
if !yes_i_want_to_do_this {
|
if !yes_i_want_to_do_this {
|
||||||
return Err!(
|
return Err!(
|
||||||
"You must pass the --yes-i-want-to-do-this-flag to ensure you really want to force \
|
"You must pass the --yes-i-want-to-do-this-flag to ensure you really want to \
|
||||||
bulk join all specified local users.",
|
force bulk join all specified local users.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +496,9 @@ pub(super) async fn force_join_list_of_local_users(
|
|||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
self.services
|
self.services
|
||||||
.admin
|
.admin
|
||||||
.send_text(&format!("{username} is not a valid username, skipping over: {e}"))
|
.send_text(&format!(
|
||||||
|
"{username} is not a valid username, skipping over: {e}"
|
||||||
|
))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -641,7 +521,9 @@ pub(super) async fn force_join_list_of_local_users(
|
|||||||
successful_joins = successful_joins.saturating_add(1);
|
successful_joins = successful_joins.saturating_add(1);
|
||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
debug_warn!("Failed force joining {user_id} to {room_id} during bulk join: {e}");
|
debug_warn!(
|
||||||
|
"Failed force joining {user_id} to {room_id} during bulk join: {e}"
|
||||||
|
);
|
||||||
failed_joins = failed_joins.saturating_add(1);
|
failed_joins = failed_joins.saturating_add(1);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -654,7 +536,6 @@ pub(super) async fn force_join_list_of_local_users(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_join_all_local_users(
|
pub(super) async fn force_join_all_local_users(
|
||||||
&self,
|
&self,
|
||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
@@ -662,8 +543,8 @@ pub(super) async fn force_join_all_local_users(
|
|||||||
) -> Result {
|
) -> Result {
|
||||||
if !yes_i_want_to_do_this {
|
if !yes_i_want_to_do_this {
|
||||||
return Err!(
|
return Err!(
|
||||||
"You must pass the --yes-i-want-to-do-this-flag to ensure you really want to force \
|
"You must pass the --yes-i-want-to-do-this-flag to ensure you really want to \
|
||||||
bulk join all local users.",
|
force bulk join all local users.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,7 +603,9 @@ pub(super) async fn force_join_all_local_users(
|
|||||||
successful_joins = successful_joins.saturating_add(1);
|
successful_joins = successful_joins.saturating_add(1);
|
||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
debug_warn!("Failed force joining {user_id} to {room_id} during bulk join: {e}");
|
debug_warn!(
|
||||||
|
"Failed force joining {user_id} to {room_id} during bulk join: {e}"
|
||||||
|
);
|
||||||
failed_joins = failed_joins.saturating_add(1);
|
failed_joins = failed_joins.saturating_add(1);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -735,19 +618,23 @@ pub(super) async fn force_join_all_local_users(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_join_room(
|
pub(super) async fn force_join_room(
|
||||||
&self,
|
&self,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
|
via: Option<String>,
|
||||||
) -> Result {
|
) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
let (room_id, servers) = self
|
let (room_id, mut servers) = self
|
||||||
.services
|
.services
|
||||||
.rooms
|
.rooms
|
||||||
.alias
|
.alias
|
||||||
.resolve_with_servers(&room_id, None)
|
.resolve_with_servers(&room_id, None)
|
||||||
.await?;
|
.await?;
|
||||||
|
if let Some(via) = via.map(ServerName::parse).transpose()? {
|
||||||
|
servers.retain(|n| *n != via);
|
||||||
|
servers.insert(0, via);
|
||||||
|
}
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
self.services.globals.user_is_local(&user_id),
|
self.services.globals.user_is_local(&user_id),
|
||||||
@@ -763,7 +650,6 @@ pub(super) async fn force_join_room(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_leave_room(
|
pub(super) async fn force_leave_room(
|
||||||
&self,
|
&self,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
@@ -795,8 +681,11 @@ pub(super) async fn force_leave_room(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
pub(super) async fn force_demote(
|
||||||
pub(super) async fn force_demote(&self, user_id: String, room_id: OwnedRoomOrAliasId) -> Result {
|
&self,
|
||||||
|
user_id: String,
|
||||||
|
room_id: OwnedRoomOrAliasId,
|
||||||
|
) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
let room_id = self.services.rooms.alias.resolve(&room_id).await?;
|
||||||
|
|
||||||
@@ -846,7 +735,6 @@ pub(super) async fn force_demote(&self, user_id: String, room_id: OwnedRoomOrAli
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn make_user_admin(&self, user_id: String) -> Result {
|
pub(super) async fn make_user_admin(&self, user_id: String) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
assert!(
|
assert!(
|
||||||
@@ -864,7 +752,6 @@ pub(super) async fn make_user_admin(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn put_room_tag(
|
pub(super) async fn put_room_tag(
|
||||||
&self,
|
&self,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
@@ -896,12 +783,12 @@ pub(super) async fn put_room_tag(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Successfully updated room account data for {user_id} and room {room_id} with tag {tag}"
|
"Successfully updated room account data for {user_id} and room {room_id} with tag \
|
||||||
|
{tag}"
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn delete_room_tag(
|
pub(super) async fn delete_room_tag(
|
||||||
&self,
|
&self,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
@@ -930,13 +817,12 @@ pub(super) async fn delete_room_tag(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"Successfully updated room account data for {user_id} and room {room_id}, deleting room \
|
"Successfully updated room account data for {user_id} and room {room_id}, deleting \
|
||||||
tag {tag}"
|
room tag {tag}"
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_room_tags(&self, user_id: String, room_id: OwnedRoomId) -> Result {
|
pub(super) async fn get_room_tags(&self, user_id: String, room_id: OwnedRoomId) -> Result {
|
||||||
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
|
|
||||||
@@ -951,7 +837,6 @@ pub(super) async fn get_room_tags(&self, user_id: String, room_id: OwnedRoomId)
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn redact_event(&self, event_id: OwnedEventId) -> Result {
|
pub(super) async fn redact_event(&self, event_id: OwnedEventId) -> Result {
|
||||||
let Ok(event) = self
|
let Ok(event) = self
|
||||||
.services
|
.services
|
||||||
@@ -1009,7 +894,6 @@ pub(super) async fn redact_event(&self, event_id: OwnedEventId) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn force_leave_remote_room(
|
pub(super) async fn force_leave_remote_room(
|
||||||
&self,
|
&self,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
@@ -1050,24 +934,18 @@ pub(super) async fn force_leave_remote_room(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn lock(&self, user_id: String) -> Result {
|
pub(super) async fn lock(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
assert!(
|
|
||||||
self.services.globals.user_is_local(&user_id),
|
|
||||||
"Parsed user_id must be a local user"
|
|
||||||
);
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!("Not allowed to lock the server service account.",);
|
return Err!("Not allowed to lock the server service account.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
if self.services.users.is_admin(&user_id).await {
|
if self.services.users.is_admin(&user_id).await {
|
||||||
return Err!("Admin users cannot be locked.");
|
return Err!("Admin users cannot be locked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.services
|
self.services
|
||||||
.users
|
.users
|
||||||
.lock_account(&user_id, self.sender_or_service_user())
|
.lock_account(&user_id, self.sender_or_service_user())
|
||||||
@@ -1077,38 +955,28 @@ pub(super) async fn lock(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn unlock(&self, user_id: String) -> Result {
|
pub(super) async fn unlock(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
assert!(
|
|
||||||
self.services.globals.user_is_local(&user_id),
|
|
||||||
"Parsed user_id must be a local user"
|
|
||||||
);
|
|
||||||
self.services.users.unlock_account(&user_id).await;
|
self.services.users.unlock_account(&user_id).await;
|
||||||
|
|
||||||
self.write_str(&format!("User {user_id} has been unlocked."))
|
self.write_str(&format!("User {user_id} has been unlocked."))
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn logout(&self, user_id: String) -> Result {
|
pub(super) async fn logout(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
assert!(
|
|
||||||
self.services.globals.user_is_local(&user_id),
|
|
||||||
"Parsed user_id must be a local user"
|
|
||||||
);
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!("Not allowed to log out the server service account.",);
|
return Err!("Not allowed to log out the server service account.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
if self.services.users.is_admin(&user_id).await {
|
if self.services.users.is_admin(&user_id).await {
|
||||||
return Err!("You cannot forcefully log out admin users.");
|
return Err!("You cannot forcefully log out admin users.");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.services
|
self.services
|
||||||
.users
|
.users
|
||||||
.all_device_ids(&user_id)
|
.all_device_ids(&user_id)
|
||||||
@@ -1123,21 +991,14 @@ pub(super) async fn logout(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn disable_login(&self, user_id: String) -> Result {
|
pub(super) async fn disable_login(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
assert!(
|
|
||||||
self.services.globals.user_is_local(&user_id),
|
|
||||||
"Parsed user_id must be a local user"
|
|
||||||
);
|
|
||||||
if user_id == self.services.globals.server_user {
|
if user_id == self.services.globals.server_user {
|
||||||
return Err!("Not allowed to disable login for the server service account.",);
|
return Err!("Not allowed to disable login for the server service account.",);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
if self.services.users.is_admin(&user_id).await {
|
if self.services.users.is_admin(&user_id).await {
|
||||||
return Err!("Admin users cannot have their login disallowed.");
|
return Err!("Admin users cannot have their login disallowed.");
|
||||||
}
|
}
|
||||||
@@ -1149,23 +1010,15 @@ pub(super) async fn disable_login(&self, user_id: String) -> Result {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn enable_login(&self, user_id: String) -> Result {
|
pub(super) async fn enable_login(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
assert!(
|
|
||||||
self.services.globals.user_is_local(&user_id),
|
|
||||||
"Parsed user_id must be a local user"
|
|
||||||
);
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id} does not exist.");
|
|
||||||
}
|
|
||||||
self.services.users.enable_login(&user_id);
|
self.services.users.enable_login(&user_id);
|
||||||
|
|
||||||
self.write_str(&format!("{user_id} can now log in.")).await
|
self.write_str(&format!("{user_id} can now log in.")).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_email(&self, user_id: String) -> Result {
|
pub(super) async fn get_email(&self, user_id: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||||
@@ -1185,7 +1038,6 @@ pub(super) async fn get_email(&self, user_id: String) -> Result {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn get_user_by_email(&self, email: String) -> Result {
|
pub(super) async fn get_user_by_email(&self, email: String) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -1195,8 +1047,10 @@ pub(super) async fn get_user_by_email(&self, email: String) -> Result {
|
|||||||
|
|
||||||
match self.services.threepid.get_localpart_for_email(&email).await {
|
match self.services.threepid.get_localpart_for_email(&email).await {
|
||||||
| Some(localpart) => {
|
| Some(localpart) => {
|
||||||
let user_id =
|
let user_id = UserId::parse(format!(
|
||||||
UserId::parse(format!("@{localpart}:{}", self.services.globals.server_name()))
|
"@{localpart}:{}",
|
||||||
|
self.services.globals.server_name()
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
self.write_str(&format!("{email} belongs to {user_id}."))
|
self.write_str(&format!("{email} belongs to {user_id}."))
|
||||||
@@ -1208,7 +1062,6 @@ pub(super) async fn get_user_by_email(&self, email: String) -> Result {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn change_email(&self, user_id: String, email: Option<String>) -> Result {
|
pub(super) async fn change_email(&self, user_id: String, email: Option<String>) -> Result {
|
||||||
self.bail_restricted()?;
|
self.bail_restricted()?;
|
||||||
|
|
||||||
@@ -1241,8 +1094,8 @@ pub(super) async fn change_email(&self, user_id: String, email: Option<String>)
|
|||||||
|
|
||||||
if let Some(current_email) = current_email {
|
if let Some(current_email) = current_email {
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"The associated email of {user_id} has been changed from {current_email} to \
|
"The associated email of {user_id} has been changed from \
|
||||||
{new_email}."
|
{current_email} to {new_email}."
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
} else {
|
} else {
|
||||||
@@ -1259,20 +1112,19 @@ pub(super) async fn change_email(&self, user_id: String, email: Option<String>)
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"The associated email of {user_id} has been removed (it was {current_email})."
|
"The associated email of {user_id} has been removed (it was \
|
||||||
|
{current_email})."
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
|
||||||
pub(super) async fn reset_push_rules(&self, user_id: String) -> Result {
|
pub(super) async fn reset_push_rules(&self, user_id: String) -> Result {
|
||||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
let user_id = parse_active_local_user_id(self.services, &user_id).await?;
|
||||||
if !self.services.users.is_active(&user_id).await {
|
|
||||||
return Err!("User is not active.");
|
|
||||||
}
|
|
||||||
recreate_push_rules_and_return(self.services, &user_id).await?;
|
recreate_push_rules_and_return(self.services, &user_id).await?;
|
||||||
self.write_str("Reset user's push rules to the server default.")
|
self.write_str("Reset user's push rules to the server default.")
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -27,12 +27,9 @@ pub enum UserCommand {
|
|||||||
username: String,
|
username: String,
|
||||||
/// New password for the user, if unspecified one is generated
|
/// New password for the user, if unspecified one is generated
|
||||||
password: Option<String>,
|
password: Option<String>,
|
||||||
},
|
|
||||||
|
|
||||||
/// Issue a self-service password reset link for a user.
|
#[arg(long)]
|
||||||
IssuePasswordResetLink {
|
convert_to_local_account: bool,
|
||||||
/// Username of the user who may use the link
|
|
||||||
username: String,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Get a user's associated email address.
|
/// Get a user's associated email address.
|
||||||
@@ -179,8 +176,15 @@ pub enum UserCommand {
|
|||||||
|
|
||||||
/// Manually join a local user to a room.
|
/// Manually join a local user to a room.
|
||||||
ForceJoinRoom {
|
ForceJoinRoom {
|
||||||
|
/// The user to join
|
||||||
user_id: String,
|
user_id: String,
|
||||||
|
/// The room to join
|
||||||
room_id: OwnedRoomOrAliasId,
|
room_id: OwnedRoomOrAliasId,
|
||||||
|
/// The server name to join via.
|
||||||
|
///
|
||||||
|
/// This server will always be tried first, however if more are
|
||||||
|
/// available, they may be tried after.
|
||||||
|
via: Option<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Manually leave a local user from a room.
|
/// Manually leave a local user from a room.
|
||||||
|
|||||||
+1
-8
@@ -54,14 +54,7 @@ pub(crate) async fn parse_active_local_user_id(
|
|||||||
user_id: &str,
|
user_id: &str,
|
||||||
) -> Result<OwnedUserId> {
|
) -> Result<OwnedUserId> {
|
||||||
let user_id = parse_local_user_id(services, user_id)?;
|
let user_id = parse_local_user_id(services, user_id)?;
|
||||||
|
services.users.status(&user_id).await.ensure_active()?;
|
||||||
if !services.users.exists(&user_id).await {
|
|
||||||
return Err!("User {user_id:?} does not exist on this server.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if services.users.is_deactivated(&user_id).await? {
|
|
||||||
return Err!("User {user_id:?} is deactivated.");
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(user_id)
|
Ok(user_id)
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ pub(crate) async fn ban_room(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<rooms::ban::v1::Request>,
|
body: Ruma<rooms::ban::v1::Request>,
|
||||||
) -> Result<rooms::ban::v1::Response> {
|
) -> Result<rooms::ban::v1::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
if !services.users.is_admin(sender_user).await {
|
if !services.users.is_admin(sender_user).await {
|
||||||
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub(crate) async fn list_rooms(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<rooms::list::v1::Request>,
|
body: Ruma<rooms::list::v1::Request>,
|
||||||
) -> Result<rooms::list::v1::Response> {
|
) -> Result<rooms::list::v1::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
if !services.users.is_admin(sender_user).await {
|
if !services.users.is_admin(sender_user).await {
|
||||||
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ use ruma::{
|
|||||||
power_levels::RoomPowerLevelsEventContent,
|
power_levels::RoomPowerLevelsEventContent,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::{mailer::messages, uiaa::Identity, users::HashedPassword};
|
use service::{mailer::messages, uiaa::UiaaInitiator, users::HashedPassword};
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::Ruma;
|
use crate::{Ruma, router::ClientIdentity};
|
||||||
|
|
||||||
pub(crate) mod register;
|
pub(crate) mod register;
|
||||||
pub(crate) mod threepid;
|
pub(crate) mod threepid;
|
||||||
@@ -49,41 +49,16 @@ pub(crate) async fn get_register_available_route(
|
|||||||
ClientIp(client): ClientIp,
|
ClientIp(client): ClientIp,
|
||||||
body: Ruma<get_username_availability::v3::Request>,
|
body: Ruma<get_username_availability::v3::Request>,
|
||||||
) -> Result<get_username_availability::v3::Response> {
|
) -> Result<get_username_availability::v3::Response> {
|
||||||
// Validate user id
|
let _ = services
|
||||||
let user_id =
|
.users
|
||||||
match UserId::parse_with_server_name(&body.username, services.globals.server_name()) {
|
.determine_registration_user_id(
|
||||||
| Ok(user_id) => {
|
Some(body.username.clone()),
|
||||||
if let Err(e) = user_id.validate_strict() {
|
None,
|
||||||
return Err!(Request(InvalidUsername(debug_warn!(
|
body.identity
|
||||||
"Username {} contains disallowed characters or spaces: {e}",
|
.as_ref()
|
||||||
body.username
|
.and_then(ClientIdentity::appservice_info),
|
||||||
))));
|
)
|
||||||
}
|
.await?;
|
||||||
|
|
||||||
user_id
|
|
||||||
},
|
|
||||||
| Err(e) => {
|
|
||||||
return Err!(Request(InvalidUsername(debug_warn!(
|
|
||||||
"Username {} is not valid: {e}",
|
|
||||||
body.username
|
|
||||||
))));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check if username is creative enough
|
|
||||||
if services.users.exists(&user_id).await {
|
|
||||||
return Err!(Request(UserInUse("User ID is not available.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref info) = body.appservice_info {
|
|
||||||
if !info.is_user_match(&user_id) {
|
|
||||||
return Err!(Request(Exclusive("Username is not in an appservice namespace.")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if services.appservice.is_exclusive_user_id(&user_id).await {
|
|
||||||
return Err!(Request(Exclusive("Username is reserved by an appservice.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(get_username_availability::v3::Response::new(true))
|
Ok(get_username_availability::v3::Response::new(true))
|
||||||
}
|
}
|
||||||
@@ -111,7 +86,7 @@ pub(crate) async fn change_password_route(
|
|||||||
ClientIp(client): ClientIp,
|
ClientIp(client): ClientIp,
|
||||||
body: Ruma<change_password::v3::Request>,
|
body: Ruma<change_password::v3::Request>,
|
||||||
) -> Result<change_password::v3::Response> {
|
) -> Result<change_password::v3::Response> {
|
||||||
let identity = if let Some(ref user_id) = body.sender_user {
|
let identity = if let Some(identity) = body.identity.as_ref() {
|
||||||
// A signed-in user is trying to change their password, prompt them for their
|
// A signed-in user is trying to change their password, prompt them for their
|
||||||
// existing one
|
// existing one
|
||||||
|
|
||||||
@@ -121,7 +96,10 @@ pub(crate) async fn change_password_route(
|
|||||||
&body.auth,
|
&body.auth,
|
||||||
vec![AuthFlow::new(vec![AuthType::Password])],
|
vec![AuthFlow::new(vec![AuthType::Password])],
|
||||||
Box::default(),
|
Box::default(),
|
||||||
Some(Identity::from_user_id(user_id)),
|
Some(UiaaInitiator::new(
|
||||||
|
identity.expect_sender_user()?,
|
||||||
|
identity.sender_device(),
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
@@ -150,14 +128,20 @@ pub(crate) async fn change_password_route(
|
|||||||
|
|
||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
.set_password(&sender_user, Some(HashedPassword::new(&body.new_password)?));
|
.set_password(&sender_user, HashedPassword::new(&body.new_password)?)
|
||||||
|
.await?;
|
||||||
|
|
||||||
if body.logout_devices {
|
if body.logout_devices {
|
||||||
// Logout all devices except the current one
|
// Logout all devices except the current one
|
||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
.all_device_ids(&sender_user)
|
.all_device_ids(&sender_user)
|
||||||
.ready_filter(|id| *id != body.sender_device())
|
.ready_filter(|id| {
|
||||||
|
body.identity
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|identity| identity.sender_device())
|
||||||
|
.is_none_or(|sender_device| sender_device != *id)
|
||||||
|
})
|
||||||
.for_each(async |id| services.users.remove_device(&sender_user, &id).await)
|
.for_each(async |id| services.users.remove_device(&sender_user, &id).await)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@@ -173,7 +157,12 @@ pub(crate) async fn change_password_route(
|
|||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|pusher_device| pusher_device != body.sender_device())
|
.is_some_and(|pusher_device| {
|
||||||
|
body.identity
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|identity| identity.sender_device())
|
||||||
|
.is_none_or(|sender_device| sender_device != *pusher_device)
|
||||||
|
})
|
||||||
.then_some(pushkey)
|
.then_some(pushkey)
|
||||||
})
|
})
|
||||||
.for_each(async |pushkey| {
|
.for_each(async |pushkey| {
|
||||||
@@ -187,7 +176,7 @@ pub(crate) async fn change_password_route(
|
|||||||
if services.server.config.admin_room_notices {
|
if services.server.config.admin_room_notices {
|
||||||
services
|
services
|
||||||
.admin
|
.admin
|
||||||
.notice(&format!("User {} changed their password.", &sender_user))
|
.notice(&format!("User {sender_user} changed their password."))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,9 +230,11 @@ pub(crate) async fn whoami_route(
|
|||||||
State(_): State<crate::State>,
|
State(_): State<crate::State>,
|
||||||
body: Ruma<whoami::v3::Request>,
|
body: Ruma<whoami::v3::Request>,
|
||||||
) -> Result<whoami::v3::Response> {
|
) -> Result<whoami::v3::Response> {
|
||||||
Ok(assign!(whoami::v3::Response::new(body.sender_user().to_owned(), false), {
|
Ok(
|
||||||
device_id: body.sender_device,
|
assign!(whoami::v3::Response::new(body.identity.expect_sender_user()?.to_owned(), false), {
|
||||||
}))
|
device_id: body.identity.sender_device().map(ToOwned::to_owned),
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/account/deactivate`
|
/// # `POST /_matrix/client/r0/account/deactivate`
|
||||||
@@ -265,15 +256,24 @@ pub(crate) async fn deactivate_route(
|
|||||||
) -> Result<deactivate::v3::Response> {
|
) -> Result<deactivate::v3::Response> {
|
||||||
// Authentication for this endpoint is technically optional,
|
// Authentication for this endpoint is technically optional,
|
||||||
// but we require the user to be logged in
|
// but we require the user to be logged in
|
||||||
let sender_user = body
|
let identity = body
|
||||||
.sender_user
|
.identity
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?;
|
.ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?;
|
||||||
|
|
||||||
|
let sender_user = identity.expect_sender_user()?;
|
||||||
|
|
||||||
|
if !services.config.allow_deactivation {
|
||||||
|
return Err!(Request(Forbidden(
|
||||||
|
"You may not deactivate your own account. Contact your server's administrator for \
|
||||||
|
assistance."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
// Prompt the user to confirm with their password using UIAA
|
// Prompt the user to confirm with their password using UIAA
|
||||||
let _ = services
|
let _ = services
|
||||||
.uiaa
|
.uiaa
|
||||||
.authenticate_password(&body.auth, Some(Identity::from_user_id(sender_user)))
|
.authenticate_password(&body.auth, sender_user, identity.sender_device(), None)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Remove profile pictures and display name
|
// Remove profile pictures and display name
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
use std::{collections::HashMap, fmt::Write};
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::ClientIp;
|
use axum_client_ip::ClientIp;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result, debug_info, error, info,
|
Err, Result, debug_info, info,
|
||||||
utils::{self},
|
utils::{self},
|
||||||
warn,
|
|
||||||
};
|
};
|
||||||
use conduwuit_service::Services;
|
use conduwuit_service::Services;
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::StreamExt;
|
||||||
use lettre::{Address, message::Mailbox};
|
use lettre::{Address, message::Mailbox};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedUserId, UserId,
|
|
||||||
api::client::{
|
api::client::{
|
||||||
account::{
|
account::{
|
||||||
register::{self, LoginType, RegistrationKind},
|
register::{self, LoginType, RegistrationKind},
|
||||||
@@ -20,11 +18,6 @@ use ruma::{
|
|||||||
uiaa::{AuthFlow, AuthType},
|
uiaa::{AuthFlow, AuthType},
|
||||||
},
|
},
|
||||||
assign,
|
assign,
|
||||||
events::{
|
|
||||||
GlobalAccountDataEventType, push_rules::PushRulesEvent,
|
|
||||||
room::message::RoomMessageEventContent,
|
|
||||||
},
|
|
||||||
push,
|
|
||||||
};
|
};
|
||||||
use serde_json::value::RawValue;
|
use serde_json::value::RawValue;
|
||||||
use service::{mailer::messages, users::HashedPassword};
|
use service::{mailer::messages, users::HashedPassword};
|
||||||
@@ -32,8 +25,6 @@ use service::{mailer::messages, users::HashedPassword};
|
|||||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/register`
|
/// # `POST /_matrix/client/v3/register`
|
||||||
///
|
///
|
||||||
/// Register an account on this homeserver.
|
/// Register an account on this homeserver.
|
||||||
@@ -52,14 +43,12 @@ pub(crate) async fn register_route(
|
|||||||
return Err!(Request(GuestAccessForbidden("Guests may not register on this server.")));
|
return Err!(Request(GuestAccessForbidden("Guests may not register on this server.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
let emergency_mode_enabled = services.config.emergency_password.is_some();
|
|
||||||
|
|
||||||
// Allow registration if it's enabled in the config file or if this is the first
|
// Allow registration if it's enabled in the config file or if this is the first
|
||||||
// run (so the first user account can be created)
|
// run (so the first user account can be created)
|
||||||
let allow_registration =
|
let allow_registration =
|
||||||
services.config.allow_registration || services.firstrun.is_first_run();
|
services.config.allow_registration || services.firstrun.is_first_run();
|
||||||
|
|
||||||
if !allow_registration && body.appservice_info.is_none() {
|
if !allow_registration && body.identity.is_none() {
|
||||||
info!(
|
info!(
|
||||||
?body.username,
|
?body.username,
|
||||||
?body.initial_device_display_name,
|
?body.initial_device_display_name,
|
||||||
@@ -71,101 +60,59 @@ pub(crate) async fn register_route(
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let identity = if body.appservice_info.is_some() {
|
let user_id = if body.body.login_type == Some(LoginType::ApplicationService) {
|
||||||
// Appservices can skip auth
|
let Some(appservice_info) = &body.identity else {
|
||||||
None
|
return Err!(Request(Forbidden(
|
||||||
|
"Only appservices can use the appservice login type."
|
||||||
|
)));
|
||||||
|
};
|
||||||
|
|
||||||
|
let user_id = services
|
||||||
|
.users
|
||||||
|
.determine_registration_user_id(body.username.clone(), None, Some(appservice_info))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
services.users.create_shadow_account(&user_id).await?;
|
||||||
|
|
||||||
|
user_id
|
||||||
} else {
|
} else {
|
||||||
// Perform UIAA to determine the user's identity
|
// Perform UIAA to determine the user's identity
|
||||||
let (flows, params) = create_registration_uiaa_session(&services).await?;
|
let (flows, params) = create_registration_uiaa_session(&services).await?;
|
||||||
|
|
||||||
Some(
|
let identity = services
|
||||||
services
|
|
||||||
.uiaa
|
.uiaa
|
||||||
.authenticate(&body.auth, flows, params, None)
|
.authenticate(&body.auth, flows, params, None)
|
||||||
.await?,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the user didn't supply a username but did supply an email, use
|
|
||||||
// the email's user as their initial localpart to avoid falling back to
|
|
||||||
// a randomly generated localpart
|
|
||||||
let supplied_username = body.username.clone().or_else(|| {
|
|
||||||
if let Some(identity) = &identity
|
|
||||||
&& let Some(email) = &identity.email
|
|
||||||
{
|
|
||||||
Some(email.user().to_owned())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let user_id =
|
|
||||||
determine_registration_user_id(&services, supplied_username, emergency_mode_enabled)
|
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if body.body.login_type == Some(LoginType::ApplicationService) {
|
let password = if let Some(password) = &body.password {
|
||||||
// For appservice logins, make sure that the user ID is in the appservice's
|
HashedPassword::new(password)?
|
||||||
// namespace
|
|
||||||
|
|
||||||
match body.appservice_info {
|
|
||||||
| Some(ref info) =>
|
|
||||||
if !info.is_user_match(&user_id) && !emergency_mode_enabled {
|
|
||||||
return Err!(Request(Exclusive(
|
|
||||||
"Username is not in an appservice namespace."
|
|
||||||
)));
|
|
||||||
},
|
|
||||||
| _ => {
|
|
||||||
return Err!(Request(MissingToken("Missing appservice token.")));
|
|
||||||
},
|
|
||||||
}
|
|
||||||
} else if services.appservice.is_exclusive_user_id(&user_id).await && !emergency_mode_enabled
|
|
||||||
{
|
|
||||||
// For non-appservice logins, ban user IDs which are in an appservice's
|
|
||||||
// namespace (unless emergency mode is enabled)
|
|
||||||
return Err!(Request(Exclusive("Username is reserved by an appservice.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
let password = if body.appservice_info.is_some() {
|
|
||||||
None
|
|
||||||
} else if let Some(password) = body.password.as_deref() {
|
|
||||||
Some(HashedPassword::new(password)?)
|
|
||||||
} else {
|
} else {
|
||||||
return Err!(Request(InvalidParam("A password must be provided")));
|
return Err!(Request(InvalidParam("A password must be provided.")));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create user
|
let user_id = services
|
||||||
services.users.create(&user_id, password).await?;
|
.users
|
||||||
|
.determine_registration_user_id(body.username.clone(), identity.email.as_ref(), None)
|
||||||
// Set an initial display name
|
.await?;
|
||||||
let mut displayname = user_id.localpart().to_owned();
|
|
||||||
|
|
||||||
// Apply the new user displayname suffix, if it's set
|
|
||||||
if !services.globals.new_user_displayname_suffix().is_empty()
|
|
||||||
&& body.appservice_info.is_none()
|
|
||||||
{
|
|
||||||
write!(displayname, " {}", services.server.config.new_user_displayname_suffix)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
.set_displayname(&user_id, Some(displayname.clone()));
|
.create_local_account(&user_id, Some(password), identity.email)
|
||||||
|
|
||||||
// Initial account data
|
|
||||||
services
|
|
||||||
.account_data
|
|
||||||
.update(
|
|
||||||
None,
|
|
||||||
&user_id,
|
|
||||||
GlobalAccountDataEventType::PushRules.to_string().into(),
|
|
||||||
&serde_json::to_value(PushRulesEvent::new(
|
|
||||||
push::Ruleset::server_default(&user_id).into(),
|
|
||||||
))
|
|
||||||
.expect("should be able to serialize push rules"),
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Generate new device id if the user didn't specify one
|
user_id
|
||||||
|
};
|
||||||
|
|
||||||
let (token, device) = if !body.inhibit_login {
|
let (token, device) = if !body.inhibit_login {
|
||||||
|
// If UIAA is disabled, we can't create a device. In that case only appservices
|
||||||
|
// can reach this point in the first place, so we return an error for them.
|
||||||
|
if !services.config.oauth.compatibility_mode().uiaa_available() {
|
||||||
|
return Err!(Request(AppserviceLoginUnsupported(
|
||||||
|
"User-interactive appservice registration is not available on this server."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate new device id if the user didn't specify one
|
||||||
let device_id = body
|
let device_id = body
|
||||||
.device_id
|
.device_id
|
||||||
.clone()
|
.clone()
|
||||||
@@ -181,6 +128,7 @@ pub(crate) async fn register_route(
|
|||||||
&user_id,
|
&user_id,
|
||||||
&device_id,
|
&device_id,
|
||||||
&new_token,
|
&new_token,
|
||||||
|
None,
|
||||||
body.initial_device_display_name.clone(),
|
body.initial_device_display_name.clone(),
|
||||||
Some(client.to_string()),
|
Some(client.to_string()),
|
||||||
)
|
)
|
||||||
@@ -191,118 +139,7 @@ pub(crate) async fn register_route(
|
|||||||
(None, None)
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
debug_info!(%user_id, ?device, "User account was created");
|
debug_info!(%user_id, ?device, "New account created via legacy registration");
|
||||||
|
|
||||||
// If the user registered with an email, associate it with their account.
|
|
||||||
if let Some(identity) = identity
|
|
||||||
&& let Some(email) = identity.email
|
|
||||||
{
|
|
||||||
// This may fail if the email is already in use, but we already check for that
|
|
||||||
// in `/requestToken`, so ignoring the error is acceptable here in the rare case
|
|
||||||
// that an email is sniped by another user between the `/requestToken` request
|
|
||||||
// and the `/register` request.
|
|
||||||
let _ = services
|
|
||||||
.threepid
|
|
||||||
.associate_localpart_email(user_id.localpart(), &email)
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
|
|
||||||
let device_display_name = body.initial_device_display_name.as_deref().unwrap_or("");
|
|
||||||
|
|
||||||
if body.appservice_info.is_none() {
|
|
||||||
if !device_display_name.is_empty() {
|
|
||||||
let notice = format!(
|
|
||||||
"New user \"{user_id}\" registered on this server from IP {client} and device \
|
|
||||||
display name \"{device_display_name}\""
|
|
||||||
);
|
|
||||||
|
|
||||||
info!("{notice}");
|
|
||||||
if services.server.config.admin_room_notices {
|
|
||||||
services.admin.notice(¬ice).await;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let notice = format!("New user \"{user_id}\" registered on this server.");
|
|
||||||
|
|
||||||
info!("{notice}");
|
|
||||||
if services.server.config.admin_room_notices {
|
|
||||||
services.admin.notice(¬ice).await;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make the first user to register an administrator and disable first-run mode.
|
|
||||||
let was_first_user = services.firstrun.empower_first_user(&user_id).await?;
|
|
||||||
|
|
||||||
// If the registering user was not the first and we're suspending users on
|
|
||||||
// register, suspend them.
|
|
||||||
if !was_first_user && services.config.suspend_on_register {
|
|
||||||
// Note that we can still do auto joins for suspended users
|
|
||||||
services
|
|
||||||
.users
|
|
||||||
.suspend_account(&user_id, &services.globals.server_user)
|
|
||||||
.await;
|
|
||||||
// And send an @room notice to the admin room, to prompt admins to review the
|
|
||||||
// new user and ideally unsuspend them if deemed appropriate.
|
|
||||||
if services.server.config.admin_room_notices {
|
|
||||||
services
|
|
||||||
.admin
|
|
||||||
.send_loud_message(RoomMessageEventContent::text_plain(format!(
|
|
||||||
"User {user_id} has been suspended as they are not the first user on this \
|
|
||||||
server. Please review and unsuspend them if appropriate."
|
|
||||||
)))
|
|
||||||
.await
|
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if body.appservice_info.is_none() && !services.server.config.auto_join_rooms.is_empty() {
|
|
||||||
for room in &services.server.config.auto_join_rooms {
|
|
||||||
let Ok(room_id) = services.rooms.alias.resolve(room).await else {
|
|
||||||
error!(
|
|
||||||
"Failed to resolve room alias to room ID when attempting to auto join \
|
|
||||||
{room}, skipping"
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
|
|
||||||
if !services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.server_in_room(services.globals.server_name(), &room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
warn!(
|
|
||||||
"Skipping room {room} to automatically join as we have never joined before."
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(room_server_name) = room.server_name() {
|
|
||||||
match services
|
|
||||||
.rooms
|
|
||||||
.membership
|
|
||||||
.join_room(
|
|
||||||
&user_id,
|
|
||||||
&room_id,
|
|
||||||
Some("Automatically joining this room upon registration".to_owned()),
|
|
||||||
&[services.globals.server_name().to_owned(), room_server_name.to_owned()],
|
|
||||||
)
|
|
||||||
.boxed()
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
| Err(e) => {
|
|
||||||
// don't return this error so we don't fail registrations
|
|
||||||
error!(
|
|
||||||
"Failed to automatically join room {room} for user {user_id}: {e}"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
| _ => {
|
|
||||||
info!("Automatically joined room {room} for user {user_id}");
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(assign!(register::v3::Response::new(user_id), {
|
Ok(assign!(register::v3::Response::new(user_id), {
|
||||||
access_token: token,
|
access_token: token,
|
||||||
@@ -374,21 +211,21 @@ async fn create_registration_uiaa_session(
|
|||||||
|
|
||||||
// Require all users to agree to the terms and conditions, if configured
|
// Require all users to agree to the terms and conditions, if configured
|
||||||
let terms = &services.config.registration_terms;
|
let terms = &services.config.registration_terms;
|
||||||
if !terms.is_empty() {
|
if !terms.documents.is_empty() {
|
||||||
let mut terms =
|
let mut terms_map = HashMap::new();
|
||||||
serde_json::to_value(terms.clone()).expect("failed to serialize terms");
|
|
||||||
|
|
||||||
// Insert a dummy `version` field
|
for (id, document) in &terms.documents {
|
||||||
for (_, documents) in terms.as_object_mut().unwrap() {
|
terms_map.insert(id.to_owned(), serde_json::json!({
|
||||||
let documents = documents.as_object_mut().unwrap();
|
terms.language.clone(): serde_json::to_value(document).expect("should be able to serialize document")
|
||||||
|
}));
|
||||||
documents.insert("version".to_owned(), "latest".into());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
terms_map.insert("version".to_owned(), "latest".into());
|
||||||
|
|
||||||
params.insert(
|
params.insert(
|
||||||
AuthType::Terms.as_str().to_owned(),
|
AuthType::Terms.as_str().to_owned(),
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"policies": terms,
|
"policies": terms_map,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -421,81 +258,6 @@ async fn create_registration_uiaa_session(
|
|||||||
Ok((flows, params))
|
Ok((flows, params))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn determine_registration_user_id(
|
|
||||||
services: &Services,
|
|
||||||
supplied_username: Option<String>,
|
|
||||||
emergency_mode_enabled: bool,
|
|
||||||
) -> Result<OwnedUserId> {
|
|
||||||
if let Some(supplied_username) = supplied_username {
|
|
||||||
// The user gets to pick their username. Do some validation to make sure it's
|
|
||||||
// acceptable.
|
|
||||||
|
|
||||||
// Don't allow registration with forbidden usernames.
|
|
||||||
if services
|
|
||||||
.globals
|
|
||||||
.forbidden_usernames()
|
|
||||||
.is_match(&supplied_username)
|
|
||||||
&& !emergency_mode_enabled
|
|
||||||
{
|
|
||||||
return Err!(Request(Forbidden("Username is forbidden")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and validate the user ID
|
|
||||||
let user_id = match UserId::parse_with_server_name(
|
|
||||||
&supplied_username,
|
|
||||||
services.globals.server_name(),
|
|
||||||
) {
|
|
||||||
| Ok(user_id) => {
|
|
||||||
if let Err(e) = user_id.validate_strict() {
|
|
||||||
// Unless we are in emergency mode, we should follow synapse's behaviour on
|
|
||||||
// not allowing things like spaces and UTF-8 characters in usernames
|
|
||||||
if !emergency_mode_enabled {
|
|
||||||
return Err!(Request(InvalidUsername(debug_warn!(
|
|
||||||
"Username {supplied_username} contains disallowed characters or \
|
|
||||||
spaces: {e}"
|
|
||||||
))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't allow registration with user IDs that aren't local
|
|
||||||
if !services.globals.user_is_local(&user_id) {
|
|
||||||
return Err!(Request(InvalidUsername(
|
|
||||||
"Username {supplied_username} is not local to this server"
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
user_id
|
|
||||||
},
|
|
||||||
| Err(e) => {
|
|
||||||
return Err!(Request(InvalidUsername(debug_warn!(
|
|
||||||
"Username {supplied_username} is not valid: {e}"
|
|
||||||
))));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if services.users.exists(&user_id).await {
|
|
||||||
return Err!(Request(UserInUse("User ID is not available.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(user_id)
|
|
||||||
} else {
|
|
||||||
// The user didn't specify a username. Generate a username for
|
|
||||||
// them.
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let user_id = UserId::parse_with_server_name(
|
|
||||||
utils::random_string(RANDOM_USER_ID_LENGTH).to_lowercase(),
|
|
||||||
services.globals.server_name(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if !services.users.exists(&user_id).await {
|
|
||||||
break Ok(user_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/register/email/requestToken`
|
/// # `POST /_matrix/client/v3/register/email/requestToken`
|
||||||
///
|
///
|
||||||
/// Requests a validation email for the purpose of registering a new account.
|
/// Requests a validation email for the purpose of registering a new account.
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ use ruma::{
|
|||||||
},
|
},
|
||||||
thirdparty::{Medium, ThirdPartyIdentifierInit},
|
thirdparty::{Medium, ThirdPartyIdentifierInit},
|
||||||
};
|
};
|
||||||
use service::{mailer::messages, uiaa::Identity};
|
use service::mailer::messages;
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::{Ruma, router::ClientIdentity};
|
||||||
|
|
||||||
/// # `GET _matrix/client/v3/account/3pid`
|
/// # `GET _matrix/client/v3/account/3pid`
|
||||||
///
|
///
|
||||||
@@ -22,9 +22,13 @@ pub(crate) async fn third_party_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_3pids::v3::Request>,
|
body: Ruma<get_3pids::v3::Request>,
|
||||||
) -> Result<get_3pids::v3::Response> {
|
) -> Result<get_3pids::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
let mut threepids = vec![];
|
let mut threepids = vec![];
|
||||||
|
|
||||||
|
if !services.threepid.email_requirement().may_view() {
|
||||||
|
return Ok(get_3pids::v3::Response::new(vec![]));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(email) = services
|
if let Some(email) = services
|
||||||
.threepid
|
.threepid
|
||||||
.get_email_for_localpart(sender_user.localpart())
|
.get_email_for_localpart(sender_user.localpart())
|
||||||
@@ -53,6 +57,14 @@ pub(crate) async fn request_3pid_management_token_via_email_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<request_3pid_management_token_via_email::v3::Request>,
|
body: Ruma<request_3pid_management_token_via_email::v3::Request>,
|
||||||
) -> Result<request_3pid_management_token_via_email::v3::Response> {
|
) -> Result<request_3pid_management_token_via_email::v3::Response> {
|
||||||
|
// Authentication for this endpoint is technically optional,
|
||||||
|
// but we require the user to be logged in
|
||||||
|
let sender_user = body
|
||||||
|
.identity
|
||||||
|
.as_ref()
|
||||||
|
.map(ClientIdentity::expect_sender_user)
|
||||||
|
.ok_or_else(|| err!(Request(MissingToken("Missing access token."))))??;
|
||||||
|
|
||||||
if !services.threepid.email_requirement().may_change() {
|
if !services.threepid.email_requirement().may_change() {
|
||||||
return Err!(Request(Forbidden("You may not change your email address.")));
|
return Err!(Request(Forbidden("You may not change your email address.")));
|
||||||
}
|
}
|
||||||
@@ -76,7 +88,7 @@ pub(crate) async fn request_3pid_management_token_via_email_route(
|
|||||||
Mailbox::new(None, email),
|
Mailbox::new(None, email),
|
||||||
|verification_link| messages::ChangeEmail {
|
|verification_link| messages::ChangeEmail {
|
||||||
server_name: services.config.server_name.as_str(),
|
server_name: services.config.server_name.as_str(),
|
||||||
user_id: body.sender_user.as_deref(),
|
user_id: Some(sender_user),
|
||||||
verification_link,
|
verification_link,
|
||||||
},
|
},
|
||||||
&body.client_secret,
|
&body.client_secret,
|
||||||
@@ -107,8 +119,6 @@ pub(crate) async fn add_3pid_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<add_3pid::v3::Request>,
|
body: Ruma<add_3pid::v3::Request>,
|
||||||
) -> Result<add_3pid::v3::Response> {
|
) -> Result<add_3pid::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
|
||||||
|
|
||||||
if !services.threepid.email_requirement().may_change() {
|
if !services.threepid.email_requirement().may_change() {
|
||||||
return Err!(Request(Forbidden("You may not change your email address.")));
|
return Err!(Request(Forbidden("You may not change your email address.")));
|
||||||
}
|
}
|
||||||
@@ -116,18 +126,24 @@ pub(crate) async fn add_3pid_route(
|
|||||||
// Require password auth to add an email
|
// Require password auth to add an email
|
||||||
let _ = services
|
let _ = services
|
||||||
.uiaa
|
.uiaa
|
||||||
.authenticate_password(&body.auth, Some(Identity::from_user_id(sender_user)))
|
.authenticate_password(
|
||||||
|
&body.auth,
|
||||||
|
body.identity.expect_sender_user()?,
|
||||||
|
body.identity.sender_device(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let email = services
|
let email = services
|
||||||
.threepid
|
.threepid
|
||||||
.consume_valid_session(&body.sid, &body.client_secret)
|
.get_valid_session(&body.sid, &body.client_secret)
|
||||||
.await
|
.await
|
||||||
.map_err(|message| err!(Request(ThreepidAuthFailed("{message}"))))?;
|
.map_err(|message| err!(Request(ThreepidAuthFailed("{message}"))))?
|
||||||
|
.consume();
|
||||||
|
|
||||||
services
|
services
|
||||||
.threepid
|
.threepid
|
||||||
.associate_localpart_email(sender_user.localpart(), &email)
|
.associate_localpart_email(body.identity.expect_sender_user()?.localpart(), &email)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(add_3pid::v3::Response::new())
|
Ok(add_3pid::v3::Response::new())
|
||||||
@@ -138,8 +154,6 @@ pub(crate) async fn delete_3pid_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<delete_3pid::v3::Request>,
|
body: Ruma<delete_3pid::v3::Request>,
|
||||||
) -> Result<delete_3pid::v3::Response> {
|
) -> Result<delete_3pid::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
|
||||||
|
|
||||||
if body.medium != Medium::Email {
|
if body.medium != Medium::Email {
|
||||||
return Ok(delete_3pid::v3::Response::new(ThirdPartyIdRemovalStatus::NoSupport));
|
return Ok(delete_3pid::v3::Response::new(ThirdPartyIdRemovalStatus::NoSupport));
|
||||||
}
|
}
|
||||||
@@ -150,7 +164,7 @@ pub(crate) async fn delete_3pid_route(
|
|||||||
|
|
||||||
if services
|
if services
|
||||||
.threepid
|
.threepid
|
||||||
.disassociate_localpart_email(sender_user.localpart())
|
.disassociate_localpart_email(body.identity.expect_sender_user()?.localpart())
|
||||||
.await
|
.await
|
||||||
.is_none()
|
.is_none()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ pub(crate) async fn set_global_account_data_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<set_global_account_data::v3::Request>,
|
body: Ruma<set_global_account_data::v3::Request>,
|
||||||
) -> Result<set_global_account_data::v3::Response> {
|
) -> Result<set_global_account_data::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if sender_user != body.user_id && body.appservice_info.is_none() {
|
if sender_user != body.user_id && !body.identity.is_appservice() {
|
||||||
return Err!(Request(Forbidden("You cannot set account data for other users.")));
|
return Err!(Request(Forbidden("You cannot set account data for other users.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ pub(crate) async fn set_room_account_data_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<set_room_account_data::v3::Request>,
|
body: Ruma<set_room_account_data::v3::Request>,
|
||||||
) -> Result<set_room_account_data::v3::Response> {
|
) -> Result<set_room_account_data::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if sender_user != body.user_id && body.appservice_info.is_none() {
|
if sender_user != body.user_id && !body.identity.is_appservice() {
|
||||||
return Err!(Request(Forbidden("You cannot set account data for other users.")));
|
return Err!(Request(Forbidden("You cannot set account data for other users.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +72,9 @@ pub(crate) async fn get_global_account_data_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_global_account_data::v3::Request>,
|
body: Ruma<get_global_account_data::v3::Request>,
|
||||||
) -> Result<get_global_account_data::v3::Response> {
|
) -> Result<get_global_account_data::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if sender_user != body.user_id && body.appservice_info.is_none() {
|
if sender_user != body.user_id && !body.identity.is_appservice() {
|
||||||
return Err!(Request(Forbidden("You cannot get account data of other users.")));
|
return Err!(Request(Forbidden("You cannot get account data of other users.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +94,9 @@ pub(crate) async fn get_room_account_data_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_room_account_data::v3::Request>,
|
body: Ruma<get_room_account_data::v3::Request>,
|
||||||
) -> Result<get_room_account_data::v3::Response> {
|
) -> Result<get_room_account_data::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if sender_user != body.user_id && body.appservice_info.is_none() {
|
if sender_user != body.user_id && !body.identity.is_appservice() {
|
||||||
return Err!(Request(Forbidden("You cannot get account data of other users.")));
|
return Err!(Request(Forbidden("You cannot get account data of other users.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
use axum::extract::State;
|
||||||
|
use conduwuit::{Err, Result};
|
||||||
|
use futures::future::{join, join3};
|
||||||
|
use ruma::api::client::admin::{is_user_locked, lock_user};
|
||||||
|
|
||||||
|
use crate::Ruma;
|
||||||
|
|
||||||
|
/// # `GET /_matrix/client/v1/admin/lock/{userId}`
|
||||||
|
///
|
||||||
|
/// Check the account lock status of a target user
|
||||||
|
pub(crate) async fn get_lock_status(
|
||||||
|
State(services): State<crate::State>,
|
||||||
|
body: Ruma<is_user_locked::v1::Request>,
|
||||||
|
) -> Result<is_user_locked::v1::Response> {
|
||||||
|
let (admin, status) = join(
|
||||||
|
services.users.is_admin(body.identity.expect_sender_user()?),
|
||||||
|
services.users.status(&body.user_id),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
if !admin {
|
||||||
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
|
}
|
||||||
|
|
||||||
|
status.ensure_active()?;
|
||||||
|
|
||||||
|
Ok(is_user_locked::v1::Response::new(
|
||||||
|
services.users.is_locked(&body.user_id).await?,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # `PUT /_matrix/client/v1/admin/lock/{userId}`
|
||||||
|
///
|
||||||
|
/// Set the account lock status of a target user
|
||||||
|
pub(crate) async fn put_lock_status(
|
||||||
|
State(services): State<crate::State>,
|
||||||
|
body: Ruma<lock_user::v1::Request>,
|
||||||
|
) -> Result<lock_user::v1::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
|
let (sender_admin, status, target_admin) = join3(
|
||||||
|
services.users.is_admin(sender_user),
|
||||||
|
services.users.status(&body.user_id),
|
||||||
|
services.users.is_admin(&body.user_id),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
if !sender_admin {
|
||||||
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
|
}
|
||||||
|
|
||||||
|
status.ensure_active()?;
|
||||||
|
|
||||||
|
if body.user_id == *sender_user {
|
||||||
|
return Err!(Request(Forbidden("You cannot lock yourself")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if target_admin {
|
||||||
|
return Err!(Request(Forbidden("You cannot lock another server administrator")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if services.users.is_locked(&body.user_id).await? == body.locked {
|
||||||
|
// No change
|
||||||
|
return Ok(lock_user::v1::Response::new(body.locked));
|
||||||
|
}
|
||||||
|
|
||||||
|
let action = if body.locked {
|
||||||
|
services
|
||||||
|
.users
|
||||||
|
.suspend_account(&body.user_id, sender_user)
|
||||||
|
.await;
|
||||||
|
"locked"
|
||||||
|
} else {
|
||||||
|
services.users.unsuspend_account(&body.user_id).await;
|
||||||
|
"unlocked"
|
||||||
|
};
|
||||||
|
|
||||||
|
if services.config.admin_room_notices {
|
||||||
|
// Notify the admin room that an account has been un/suspended
|
||||||
|
services
|
||||||
|
.admin
|
||||||
|
.send_text(&format!("{} has been {} by {}.", body.user_id, action, sender_user))
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(lock_user::v1::Response::new(body.locked))
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
mod lock;
|
||||||
mod suspend;
|
mod suspend;
|
||||||
|
|
||||||
pub(crate) use self::suspend::*;
|
pub(crate) use self::{lock::*, suspend::*};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result};
|
use conduwuit::{Err, Result};
|
||||||
use futures::future::{join, join3};
|
use futures::future::{join, join3};
|
||||||
use ruminuwuity::admin::{get_suspended, set_suspended};
|
use ruma::api::client::admin::{is_user_suspended, suspend_user};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -10,22 +10,21 @@ use crate::Ruma;
|
|||||||
/// Check the suspension status of a target user
|
/// Check the suspension status of a target user
|
||||||
pub(crate) async fn get_suspended_status(
|
pub(crate) async fn get_suspended_status(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_suspended::v1::Request>,
|
body: Ruma<is_user_suspended::v1::Request>,
|
||||||
) -> Result<get_suspended::v1::Response> {
|
) -> Result<is_user_suspended::v1::Response> {
|
||||||
let sender_user = body.sender_user();
|
let (admin, status) = join(
|
||||||
|
services.users.is_admin(body.identity.expect_sender_user()?),
|
||||||
|
services.users.status(&body.user_id),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
let (admin, active) =
|
|
||||||
join(services.users.is_admin(sender_user), services.users.is_active(&body.user_id)).await;
|
|
||||||
if !admin {
|
if !admin {
|
||||||
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
}
|
}
|
||||||
if !services.globals.user_is_local(&body.user_id) {
|
|
||||||
return Err!(Request(InvalidParam("Can only check the suspended status of local users")));
|
status.ensure_active()?;
|
||||||
}
|
|
||||||
if !active {
|
Ok(is_user_suspended::v1::Response::new(
|
||||||
return Err!(Request(NotFound("Unknown user")));
|
|
||||||
}
|
|
||||||
Ok(get_suspended::v1::Response::new(
|
|
||||||
services.users.is_suspended(&body.user_id).await?,
|
services.users.is_suspended(&body.user_id).await?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -35,13 +34,13 @@ pub(crate) async fn get_suspended_status(
|
|||||||
/// Set the suspension status of a target user
|
/// Set the suspension status of a target user
|
||||||
pub(crate) async fn put_suspended_status(
|
pub(crate) async fn put_suspended_status(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<set_suspended::v1::Request>,
|
body: Ruma<suspend_user::v1::Request>,
|
||||||
) -> Result<set_suspended::v1::Response> {
|
) -> Result<suspend_user::v1::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
let (sender_admin, active, target_admin) = join3(
|
let (sender_admin, status, target_admin) = join3(
|
||||||
services.users.is_admin(sender_user),
|
services.users.is_admin(sender_user),
|
||||||
services.users.is_active(&body.user_id),
|
services.users.status(&body.user_id),
|
||||||
services.users.is_admin(&body.user_id),
|
services.users.is_admin(&body.user_id),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
@@ -49,21 +48,20 @@ pub(crate) async fn put_suspended_status(
|
|||||||
if !sender_admin {
|
if !sender_admin {
|
||||||
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
}
|
}
|
||||||
if !services.globals.user_is_local(&body.user_id) {
|
|
||||||
return Err!(Request(InvalidParam("Can only set the suspended status of local users")));
|
status.ensure_active()?;
|
||||||
}
|
|
||||||
if !active {
|
|
||||||
return Err!(Request(NotFound("Unknown user")));
|
|
||||||
}
|
|
||||||
if body.user_id == *sender_user {
|
if body.user_id == *sender_user {
|
||||||
return Err!(Request(Forbidden("You cannot suspend yourself")));
|
return Err!(Request(Forbidden("You cannot suspend yourself")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if target_admin {
|
if target_admin {
|
||||||
return Err!(Request(Forbidden("You cannot suspend another server administrator")));
|
return Err!(Request(Forbidden("You cannot suspend another server administrator")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if services.users.is_suspended(&body.user_id).await? == body.suspended {
|
if services.users.is_suspended(&body.user_id).await? == body.suspended {
|
||||||
// No change
|
// No change
|
||||||
return Ok(set_suspended::v1::Response::new(body.suspended));
|
return Ok(suspend_user::v1::Response::new(body.suspended));
|
||||||
}
|
}
|
||||||
|
|
||||||
let action = if body.suspended {
|
let action = if body.suspended {
|
||||||
@@ -85,5 +83,5 @@ pub(crate) async fn put_suspended_status(
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(set_suspended::v1::Response::new(body.suspended))
|
Ok(suspend_user::v1::Response::new(body.suspended))
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,8 @@ pub(crate) async fn create_alias_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<create_alias::v3::Request>,
|
body: Ruma<create_alias::v3::Request>,
|
||||||
) -> Result<create_alias::v3::Response> {
|
) -> Result<create_alias::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if services.users.is_suspended(sender_user).await? {
|
if services.users.is_suspended(sender_user).await? {
|
||||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||||
}
|
}
|
||||||
@@ -19,7 +20,7 @@ pub(crate) async fn create_alias_route(
|
|||||||
services
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.alias
|
.alias
|
||||||
.appservice_checks(&body.room_alias, &body.appservice_info)
|
.appservice_checks(&body.room_alias, body.identity.appservice_info())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// this isn't apart of alias_checks or delete alias route because we should
|
// this isn't apart of alias_checks or delete alias route because we should
|
||||||
@@ -59,7 +60,8 @@ pub(crate) async fn delete_alias_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<delete_alias::v3::Request>,
|
body: Ruma<delete_alias::v3::Request>,
|
||||||
) -> Result<delete_alias::v3::Response> {
|
) -> Result<delete_alias::v3::Response> {
|
||||||
let sender_user = body.sender_user();
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if services.users.is_suspended(sender_user).await? {
|
if services.users.is_suspended(sender_user).await? {
|
||||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||||
}
|
}
|
||||||
@@ -67,7 +69,7 @@ pub(crate) async fn delete_alias_route(
|
|||||||
services
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.alias
|
.alias
|
||||||
.appservice_checks(&body.room_alias, &body.appservice_info)
|
.appservice_checks(&body.room_alias, body.identity.appservice_info())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
services
|
services
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, err};
|
use conduwuit::{Err, Result};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{appservice::ping, client::appservice::request_ping},
|
api::{appservice::ping, client::appservice::request_ping},
|
||||||
assign,
|
assign,
|
||||||
@@ -15,9 +15,7 @@ pub(crate) async fn appservice_ping(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<request_ping::v1::Request>,
|
body: Ruma<request_ping::v1::Request>,
|
||||||
) -> Result<request_ping::v1::Response> {
|
) -> Result<request_ping::v1::Response> {
|
||||||
let appservice_info = body.appservice_info.as_ref().ok_or_else(|| {
|
let appservice_info = &body.identity;
|
||||||
err!(Request(Forbidden("This endpoint can only be called by appservices.")))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
if body.appservice_id != appservice_info.registration.id {
|
if body.appservice_id != appservice_info.registration.id {
|
||||||
return Err!(Request(Forbidden(
|
return Err!(Request(Forbidden(
|
||||||
|
|||||||
+47
-26
@@ -25,7 +25,7 @@ pub(crate) async fn create_backup_version_route(
|
|||||||
) -> Result<create_backup_version::v3::Response> {
|
) -> Result<create_backup_version::v3::Response> {
|
||||||
let version = services
|
let version = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.create_backup(body.sender_user(), &body.algorithm)?;
|
.create_backup(body.identity.expect_sender_user()?, &body.algorithm)?;
|
||||||
|
|
||||||
Ok(create_backup_version::v3::Response::new(version))
|
Ok(create_backup_version::v3::Response::new(version))
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ pub(crate) async fn update_backup_version_route(
|
|||||||
) -> Result<update_backup_version::v3::Response> {
|
) -> Result<update_backup_version::v3::Response> {
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.update_backup(body.sender_user(), &body.version, &body.algorithm)
|
.update_backup(body.identity.expect_sender_user()?, &body.version, &body.algorithm)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(update_backup_version::v3::Response::new())
|
Ok(update_backup_version::v3::Response::new())
|
||||||
@@ -53,13 +53,15 @@ pub(crate) async fn get_latest_backup_info_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_latest_backup_info::v3::Request>,
|
body: Ruma<get_latest_backup_info::v3::Request>,
|
||||||
) -> Result<get_latest_backup_info::v3::Response> {
|
) -> Result<get_latest_backup_info::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
let (version, algorithm) = services
|
let (version, algorithm) = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_latest_backup(body.sender_user())
|
.get_latest_backup(sender_user)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| err!(Request(NotFound("Key backup does not exist."))))?;
|
.map_err(|_| err!(Request(NotFound("Key backup does not exist."))))?;
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &version).await;
|
||||||
|
|
||||||
Ok(get_latest_backup_info::v3::Response::new(algorithm, count, etag, version))
|
Ok(get_latest_backup_info::v3::Response::new(algorithm, count, etag, version))
|
||||||
}
|
}
|
||||||
@@ -71,15 +73,17 @@ pub(crate) async fn get_backup_info_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_backup_info::v3::Request>,
|
body: Ruma<get_backup_info::v3::Request>,
|
||||||
) -> Result<get_backup_info::v3::Response> {
|
) -> Result<get_backup_info::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
let algorithm = services
|
let algorithm = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_backup(body.sender_user(), &body.version)
|
.get_backup(sender_user, &body.version)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
err!(Request(NotFound("Key backup does not exist at version {:?}", body.version)))
|
err!(Request(NotFound("Key backup does not exist at version {:?}", body.version)))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(get_backup_info::v3::Response::new(algorithm, count, etag, body.version.clone()))
|
Ok(get_backup_info::v3::Response::new(algorithm, count, etag, body.version.clone()))
|
||||||
}
|
}
|
||||||
@@ -96,7 +100,7 @@ pub(crate) async fn delete_backup_version_route(
|
|||||||
) -> Result<delete_backup_version::v3::Response> {
|
) -> Result<delete_backup_version::v3::Response> {
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.delete_backup(body.sender_user(), &body.version)
|
.delete_backup(body.identity.expect_sender_user()?, &body.version)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Ok(delete_backup_version::v3::Response::new())
|
Ok(delete_backup_version::v3::Response::new())
|
||||||
@@ -114,9 +118,11 @@ pub(crate) async fn add_backup_keys_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<add_backup_keys::v3::Request>,
|
body: Ruma<add_backup_keys::v3::Request>,
|
||||||
) -> Result<add_backup_keys::v3::Response> {
|
) -> Result<add_backup_keys::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if services
|
if services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_latest_backup_version(body.sender_user())
|
.get_latest_backup_version(sender_user)
|
||||||
.await
|
.await
|
||||||
.is_ok_and(|version| version != body.version)
|
.is_ok_and(|version| version != body.version)
|
||||||
{
|
{
|
||||||
@@ -129,12 +135,12 @@ pub(crate) async fn add_backup_keys_route(
|
|||||||
for (session_id, key_data) in &room.sessions {
|
for (session_id, key_data) in &room.sessions {
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.add_key(body.sender_user(), &body.version, room_id, session_id, key_data)
|
.add_key(sender_user, &body.version, room_id, session_id, key_data)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(add_backup_keys::v3::Response::new(etag, count))
|
Ok(add_backup_keys::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
@@ -151,9 +157,11 @@ pub(crate) async fn add_backup_keys_for_room_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<add_backup_keys_for_room::v3::Request>,
|
body: Ruma<add_backup_keys_for_room::v3::Request>,
|
||||||
) -> Result<add_backup_keys_for_room::v3::Response> {
|
) -> Result<add_backup_keys_for_room::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if services
|
if services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_latest_backup_version(body.sender_user())
|
.get_latest_backup_version(sender_user)
|
||||||
.await
|
.await
|
||||||
.is_ok_and(|version| version != body.version)
|
.is_ok_and(|version| version != body.version)
|
||||||
{
|
{
|
||||||
@@ -165,11 +173,11 @@ pub(crate) async fn add_backup_keys_for_room_route(
|
|||||||
for (session_id, key_data) in &body.sessions {
|
for (session_id, key_data) in &body.sessions {
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.add_key(body.sender_user(), &body.version, &body.room_id, session_id, key_data)
|
.add_key(sender_user, &body.version, &body.room_id, session_id, key_data)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(add_backup_keys_for_room::v3::Response::new(etag, count))
|
Ok(add_backup_keys_for_room::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
@@ -186,9 +194,11 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<add_backup_keys_for_session::v3::Request>,
|
body: Ruma<add_backup_keys_for_session::v3::Request>,
|
||||||
) -> Result<add_backup_keys_for_session::v3::Response> {
|
) -> Result<add_backup_keys_for_session::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
if services
|
if services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_latest_backup_version(body.sender_user())
|
.get_latest_backup_version(sender_user)
|
||||||
.await
|
.await
|
||||||
.is_ok_and(|version| version != body.version)
|
.is_ok_and(|version| version != body.version)
|
||||||
{
|
{
|
||||||
@@ -201,7 +211,7 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
|||||||
let mut ok_to_replace = true;
|
let mut ok_to_replace = true;
|
||||||
if let Some(old_key) = &services
|
if let Some(old_key) = &services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_session(body.sender_user(), &body.version, &body.room_id, &body.session_id)
|
.get_session(sender_user, &body.version, &body.room_id, &body.session_id)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
{
|
{
|
||||||
@@ -260,7 +270,7 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
|||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.add_key(
|
.add_key(
|
||||||
body.sender_user(),
|
sender_user,
|
||||||
&body.version,
|
&body.version,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
&body.session_id,
|
&body.session_id,
|
||||||
@@ -269,7 +279,7 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(add_backup_keys_for_session::v3::Response::new(etag, count))
|
Ok(add_backup_keys_for_session::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
@@ -283,7 +293,7 @@ pub(crate) async fn get_backup_keys_route(
|
|||||||
) -> Result<get_backup_keys::v3::Response> {
|
) -> Result<get_backup_keys::v3::Response> {
|
||||||
let rooms = services
|
let rooms = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_all(body.sender_user(), &body.version)
|
.get_all(body.identity.expect_sender_user()?, &body.version)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Ok(get_backup_keys::v3::Response::new(rooms))
|
Ok(get_backup_keys::v3::Response::new(rooms))
|
||||||
@@ -298,7 +308,7 @@ pub(crate) async fn get_backup_keys_for_room_route(
|
|||||||
) -> Result<get_backup_keys_for_room::v3::Response> {
|
) -> Result<get_backup_keys_for_room::v3::Response> {
|
||||||
let sessions = services
|
let sessions = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_room(body.sender_user(), &body.version, &body.room_id)
|
.get_room(body.identity.expect_sender_user()?, &body.version, &body.room_id)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Ok(get_backup_keys_for_room::v3::Response::new(sessions))
|
Ok(get_backup_keys_for_room::v3::Response::new(sessions))
|
||||||
@@ -313,7 +323,12 @@ pub(crate) async fn get_backup_keys_for_session_route(
|
|||||||
) -> Result<get_backup_keys_for_session::v3::Response> {
|
) -> Result<get_backup_keys_for_session::v3::Response> {
|
||||||
let key_data = services
|
let key_data = services
|
||||||
.key_backups
|
.key_backups
|
||||||
.get_session(body.sender_user(), &body.version, &body.room_id, &body.session_id)
|
.get_session(
|
||||||
|
body.identity.expect_sender_user()?,
|
||||||
|
&body.version,
|
||||||
|
&body.room_id,
|
||||||
|
&body.session_id,
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
err!(Request(NotFound(debug_error!("Backup key not found for this user's session."))))
|
err!(Request(NotFound(debug_error!("Backup key not found for this user's session."))))
|
||||||
@@ -329,12 +344,14 @@ pub(crate) async fn delete_backup_keys_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<delete_backup_keys::v3::Request>,
|
body: Ruma<delete_backup_keys::v3::Request>,
|
||||||
) -> Result<delete_backup_keys::v3::Response> {
|
) -> Result<delete_backup_keys::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.delete_all_keys(body.sender_user(), &body.version)
|
.delete_all_keys(sender_user, &body.version)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(delete_backup_keys::v3::Response::new(etag, count))
|
Ok(delete_backup_keys::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
@@ -346,12 +363,14 @@ pub(crate) async fn delete_backup_keys_for_room_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<delete_backup_keys_for_room::v3::Request>,
|
body: Ruma<delete_backup_keys_for_room::v3::Request>,
|
||||||
) -> Result<delete_backup_keys_for_room::v3::Response> {
|
) -> Result<delete_backup_keys_for_room::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.delete_room_keys(body.sender_user(), &body.version, &body.room_id)
|
.delete_room_keys(sender_user, &body.version, &body.room_id)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(delete_backup_keys_for_room::v3::Response::new(etag, count))
|
Ok(delete_backup_keys_for_room::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
@@ -363,12 +382,14 @@ pub(crate) async fn delete_backup_keys_for_session_route(
|
|||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<delete_backup_keys_for_session::v3::Request>,
|
body: Ruma<delete_backup_keys_for_session::v3::Request>,
|
||||||
) -> Result<delete_backup_keys_for_session::v3::Response> {
|
) -> Result<delete_backup_keys_for_session::v3::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
services
|
services
|
||||||
.key_backups
|
.key_backups
|
||||||
.delete_room_key(body.sender_user(), &body.version, &body.room_id, &body.session_id)
|
.delete_room_key(sender_user, &body.version, &body.room_id, &body.session_id)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (count, etag) = get_count_etag(&services, body.sender_user(), &body.version).await;
|
let (count, etag) = get_count_etag(&services, sender_user, &body.version).await;
|
||||||
|
|
||||||
Ok(delete_backup_keys_for_session::v3::Response::new(etag, count))
|
Ok(delete_backup_keys_for_session::v3::Response::new(etag, count))
|
||||||
}
|
}
|
||||||
|
|||||||
Loaded 100 of 404 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user