mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-29 20:07:32 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c9edb84df | ||
|
|
8144c948cb | ||
|
|
a1c0045367 | ||
|
|
1c05735db6 | ||
|
|
cded6d4c36 | ||
|
|
8ad4374274 | ||
|
|
f0198d6254 | ||
|
|
b85a4ce194 | ||
|
|
67332244b7 | ||
|
|
51a9ddb27b | ||
|
|
0d7fb27d0b |
No files matched your search
@@ -81,3 +81,13 @@ jobs:
|
|||||||
--expires 14 \
|
--expires 14 \
|
||||||
--comment "${{ forgejo.sha }}" \
|
--comment "${{ forgejo.sha }}" \
|
||||||
--verbose
|
--verbose
|
||||||
|
|
||||||
|
- name: Post comment to PR
|
||||||
|
if: github.ref != 'refs/heads/main' && forgejo.event.name == 'pull_request'
|
||||||
|
run: |
|
||||||
|
if curl -s ${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/issues/${{ forgejo.event.number }}/comments | grep -qv 'PR-PREVIEW-MARKER'; then
|
||||||
|
echo -n 'Posting comment: '
|
||||||
|
curl -s -X POST ${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/issues/${{ forgejo.event.number }}/comments \
|
||||||
|
-H 'Authorization: token ${{ forgejo.token }}' \
|
||||||
|
--json '{"body":"<!--PR-PREVIEW-MARKER-->Preview ready: https://preview.continuwuity.org/@${{ forgejo.event.number }}/"}'
|
||||||
|
fi
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Rejected events are no longer used as auth events during state resolution.
|
||||||
@@ -44,6 +44,29 @@ appservice can send requests to the homeserver. You don't need to restart
|
|||||||
Continuwuity, but if it doesn't work, restarting while the appservice is running
|
Continuwuity, but if it doesn't work, restarting while the appservice is running
|
||||||
could help.
|
could help.
|
||||||
|
|
||||||
|
### Changing parts of the appservice configuration
|
||||||
|
|
||||||
|
If you want to change an option in the yaml configuration without
|
||||||
|
re-registering, you can send the `!admin appservices register` command again,
|
||||||
|
making sure that the `id` is the same.
|
||||||
|
|
||||||
|
For example, take this registration yaml:
|
||||||
|
~~~txt
|
||||||
|
!admin appservices register
|
||||||
|
```
|
||||||
|
id: meowlnir
|
||||||
|
url: https://url-i-just-changed.com
|
||||||
|
...other options below
|
||||||
|
```
|
||||||
|
~~~
|
||||||
|
|
||||||
|
This new configuration will be applied immediately. Note that this *replaces*
|
||||||
|
the prior configuration. You must send the complete configuration, changing the
|
||||||
|
fields you want to change.
|
||||||
|
|
||||||
|
You can see the current configuration using `!admin appservices
|
||||||
|
show-appservice-config <id>`.
|
||||||
|
|
||||||
## Appservice-specific instructions
|
## Appservice-specific instructions
|
||||||
|
|
||||||
### Remove an appservice
|
### Remove an appservice
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import { normalizeImagePath } from '@rspress/core/runtime';
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
<img src="/assets/logo.svg" width="150"/>
|
<img src={normalizeImagePath("/assets/logo.svg")} width="150"/>
|
||||||
|
|
||||||
# Continuwuity
|
# Continuwuity
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
target:
|
target:
|
||||||
target.fromToolchainName {
|
target.fromToolchainName {
|
||||||
name = (lib.importTOML "${inputs.self}/rust-toolchain.toml").toolchain.channel;
|
name = (lib.importTOML "${inputs.self}/rust-toolchain.toml").toolchain.channel;
|
||||||
sha256 = "sha256-MFHoWVcPZKjFrLnQnodCXbUsfZcofGfo9tV9fTTvklg=";
|
sha256 = "sha256-W3A3rtdDaQW5yOvFr5JVTfngRUCKKUqPCPIW/3aH0nM=";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
Generated
+23
-21
@@ -11,7 +11,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rspress/core": "^2.0.0",
|
"@rspress/core": "^2.0.0",
|
||||||
"@rspress/plugin-client-redirects": "^2.0.0",
|
"@rspress/plugin-client-redirects": "^2.0.0",
|
||||||
"@types/node": "^26.6.6",
|
"@types/node": "^26.6.7",
|
||||||
"typescript": "^7.0.0"
|
"typescript": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -458,9 +458,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/core": {
|
"node_modules/@rspress/core": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.1.5.tgz",
|
||||||
"integrity": "sha512-7OmP7ABDgQLSpVfpBHfpjqu4H3PGBGMyhLxF1crPQ48Q6MIWAVu77nw7cONn8AZa9GoVq0N/DoE3GEtgZzlu6w==",
|
"integrity": "sha512-kzTqrfJ4UiW+RLLHLunoW/rET5Vjb6Qz4YjhEhiWEp4HYM+KxLVhfyYB5aL8af9+mdnwiTaqlu1s+BZGrMD2zw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -468,27 +468,29 @@
|
|||||||
"@mdx-js/react": "^3.1.1",
|
"@mdx-js/react": "^3.1.1",
|
||||||
"@rsbuild/core": "^2.3.3",
|
"@rsbuild/core": "^2.3.3",
|
||||||
"@rsbuild/plugin-react": "~2.1.1",
|
"@rsbuild/plugin-react": "~2.1.1",
|
||||||
"@rspress/shared": "2.1.4",
|
"@rspress/shared": "2.1.5",
|
||||||
"@shikijs/rehype": "^4.2.0",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"@shikijs/transformers": "^4.2.0",
|
"@shikijs/transformers": "^4.2.0",
|
||||||
"@types/mdast": "^4.0.4",
|
"@types/mdast": "^4.0.4",
|
||||||
"@types/react": "^19.3.0",
|
"@types/react": "^19.3.0",
|
||||||
"@unhead/react": "^2.1.17",
|
"@unhead/react": "^2.1.18",
|
||||||
"body-scroll-lock": "4.0.0-beta.0",
|
"body-scroll-lock": "4.0.0-beta.0",
|
||||||
"clsx": "2.1.1",
|
"clsx": "2.1.1",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"flexsearch": "0.8.212",
|
"flexsearch": "0.8.212",
|
||||||
"hast-util-heading-rank": "^3.0.0",
|
"hast-util-heading-rank": "^3.0.0",
|
||||||
"hast-util-to-jsx-runtime": "^2.3.7",
|
"hast-util-to-jsx-runtime": "^2.3.7",
|
||||||
|
"mdast-util-gfm": "^3.1.0",
|
||||||
"mdast-util-mdx": "^3.0.0",
|
"mdast-util-mdx": "^3.0.0",
|
||||||
"mdast-util-mdxjs-esm": "^2.0.1",
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
||||||
|
"mdast-util-to-markdown": "^2.1.2",
|
||||||
"medium-zoom": "1.1.2",
|
"medium-zoom": "1.1.2",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"react": "^19.3.1",
|
"react": "^19.3.1",
|
||||||
"react-dom": "^19.3.1",
|
"react-dom": "^19.3.1",
|
||||||
"react-lazy-with-preload": "^2.2.1",
|
"react-lazy-with-preload": "^2.2.1",
|
||||||
"react-render-to-markdown": "19.1.0",
|
"react-render-to-markdown": "19.2.0",
|
||||||
"react-router-dom": "^7.18.5",
|
"react-router-dom": "^7.18.6",
|
||||||
"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.3.4",
|
"remark-cjk-friendly": "^2.3.4",
|
||||||
@@ -512,9 +514,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/plugin-client-redirects": {
|
"node_modules/@rspress/plugin-client-redirects": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.1.5.tgz",
|
||||||
"integrity": "sha512-6/g+Mr8lslqiFzlMBouex8TLm6PlQK6cmZ71Yfv82+Uxcrb+LaFAFiPbq2G7gToXBQUoECM4D/7nSLAfeOhnEQ==",
|
"integrity": "sha512-vqAi7ynOgVsuwJi7cXwWEF5UgoNhXqGOyBfQubeZHZKWRtdNHRU42P9rG9DZLTss2dZUiDKlVrM2/vNY40t5hw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -525,16 +527,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/shared": {
|
"node_modules/@rspress/shared": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.1.5.tgz",
|
||||||
"integrity": "sha512-SuQyVKn9xcQwkzfl+4bPBzX10gxbhCs9UupqSoPtxvyr9pMgSbXnlo3gxTPZXLzk5HUqZZ6tlIju25PVCEtYWA==",
|
"integrity": "sha512-XXxegxRZ7VPADS2veN9FTNmmLlA65ieydKH0tOhOZbMJC4OJpKbr/d/JS2jxxAO4u+ZmZxbDyEEir83NQHLKIw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rsbuild/core": "^2.3.3",
|
"@rsbuild/core": "^2.3.3",
|
||||||
"@shikijs/rehype": "^4.2.0",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"@types/react": "^19.3.0",
|
"@types/react": "^19.3.0",
|
||||||
"mdast-util-mdx-jsx": "^3.2.1",
|
"mdast-util-mdx-jsx": "^3.2.2",
|
||||||
"unified": "^11.0.5"
|
"unified": "^11.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -758,9 +760,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "26.6.10",
|
"version": "26.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.11.tgz",
|
||||||
"integrity": "sha512-WJuPHoGB8WNQuTksNF7SOQpnH02PXeDYz4iueWbBT6/hTWnShY5F3T/hoJA3fY9+uYReDZ7pyTKKx83jQa7aGg==",
|
"integrity": "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3318,9 +3320,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-render-to-markdown": {
|
"node_modules/react-render-to-markdown": {
|
||||||
"version": "19.1.0",
|
"version": "19.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.2.0.tgz",
|
||||||
"integrity": "sha512-dF9b3tO41ezqdmHP8X92kbHbMexJ6iC7iHw4ykC8fwiO7DgpFc9PhMoKlI+BcPzRxGcWgQSdrixVB9RykhjJpQ==",
|
"integrity": "sha512-hVF80DyFXazwW8vuUaptMwnW9ZZHMRrLE3WE36U3Iz1M6pPrFbtE8yYcTq8CYRBVn7YdagJUR/2ik3qJD2Rlvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
[toolchain]
|
[toolchain]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
channel = "1.100.0"
|
channel = "1.100.1"
|
||||||
components = [
|
components = [
|
||||||
# For rust-analyzer
|
# For rust-analyzer
|
||||||
"rust-src",
|
"rust-src",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ use serde_json::{
|
|||||||
value::{RawValue as RawJsonValue, to_raw_value as to_raw_json_value},
|
value::{RawValue as RawJsonValue, to_raw_value as to_raw_json_value},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::test_utils::not_rejected;
|
||||||
use crate::{
|
use crate::{
|
||||||
matrix::{Event, Pdu, pdu::EventHash},
|
matrix::{Event, Pdu, pdu::EventHash},
|
||||||
state_res::{self as state_res, Error, Result, StateMap},
|
state_res::{self as state_res, Error, Result, StateMap},
|
||||||
@@ -78,6 +79,7 @@ fn resolution_shallow_auth_chain(c: &mut test::Bencher) {
|
|||||||
&auth_chain_sets,
|
&auth_chain_sets,
|
||||||
&fetch,
|
&fetch,
|
||||||
&exists,
|
&exists,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
@@ -151,6 +153,7 @@ fn resolve_deeper_event_set(c: &mut test::Bencher) {
|
|||||||
&auth_chain_sets,
|
&auth_chain_sets,
|
||||||
&fetch,
|
&fetch,
|
||||||
&exists,
|
&exists,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,18 +75,33 @@ type Result<T, E = Error> = crate::Result<T, E>;
|
|||||||
//#[tracing::instrument(level = "debug", skip(state_sets, auth_chain_sets,
|
//#[tracing::instrument(level = "debug", skip(state_sets, auth_chain_sets,
|
||||||
//#[tracing::instrument(level event_fetch))]
|
//#[tracing::instrument(level event_fetch))]
|
||||||
#[allow(clippy::cognitive_complexity)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
pub async fn resolve<'a, Pdu, Sets, SetIter, Hasher, Fetch, FetchFut, Exists, ExistsFut>(
|
pub async fn resolve<
|
||||||
|
'a,
|
||||||
|
Pdu,
|
||||||
|
Sets,
|
||||||
|
SetIter,
|
||||||
|
Hasher,
|
||||||
|
Fetch,
|
||||||
|
FetchFut,
|
||||||
|
Exists,
|
||||||
|
ExistsFut,
|
||||||
|
Rejected,
|
||||||
|
RejectedFut,
|
||||||
|
>(
|
||||||
room_version: &RoomVersionRules,
|
room_version: &RoomVersionRules,
|
||||||
state_sets: Sets,
|
state_sets: Sets,
|
||||||
auth_chain_sets: &'a [HashSet<OwnedEventId, Hasher>],
|
auth_chain_sets: &'a [HashSet<OwnedEventId, Hasher>],
|
||||||
event_fetch: &Fetch,
|
event_fetch: &Fetch,
|
||||||
event_exists: &Exists,
|
event_exists: &Exists,
|
||||||
|
is_rejected: &Rejected,
|
||||||
) -> Result<StateMap<OwnedEventId>>
|
) -> Result<StateMap<OwnedEventId>>
|
||||||
where
|
where
|
||||||
Fetch: Fn(OwnedEventId) -> FetchFut + Sync,
|
Fetch: Fn(OwnedEventId) -> FetchFut + Sync,
|
||||||
FetchFut: Future<Output = Option<Pdu>> + Send,
|
FetchFut: Future<Output = Option<Pdu>> + Send,
|
||||||
Exists: Fn(OwnedEventId) -> ExistsFut + Sync,
|
Exists: Fn(OwnedEventId) -> ExistsFut + Sync,
|
||||||
ExistsFut: Future<Output = bool> + Send,
|
ExistsFut: Future<Output = bool> + Send,
|
||||||
|
Rejected: Fn(OwnedEventId) -> RejectedFut + Sync,
|
||||||
|
RejectedFut: Future<Output = bool> + Send,
|
||||||
Sets: IntoIterator<IntoIter = SetIter> + Send,
|
Sets: IntoIterator<IntoIter = SetIter> + Send,
|
||||||
SetIter: Iterator<Item = &'a StateMap<OwnedEventId>> + Clone + Send,
|
SetIter: Iterator<Item = &'a StateMap<OwnedEventId>> + Clone + Send,
|
||||||
Hasher: BuildHasher + Send + Sync,
|
Hasher: BuildHasher + Send + Sync,
|
||||||
@@ -174,6 +189,7 @@ where
|
|||||||
sorted_control_levels.iter().stream().map(AsRef::as_ref),
|
sorted_control_levels.iter().stream().map(AsRef::as_ref),
|
||||||
initial_state,
|
initial_state,
|
||||||
&event_fetch,
|
&event_fetch,
|
||||||
|
is_rejected,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -214,6 +230,7 @@ where
|
|||||||
sorted_left_events.iter().stream().map(AsRef::as_ref),
|
sorted_left_events.iter().stream().map(AsRef::as_ref),
|
||||||
resolved_control, // The control events are added to the final resolved state
|
resolved_control, // The control events are added to the final resolved state
|
||||||
&event_fetch,
|
&event_fetch,
|
||||||
|
is_rejected,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -689,15 +706,18 @@ where
|
|||||||
/// the the `fetch_event` closure and verify each event using the
|
/// the the `fetch_event` closure and verify each event using the
|
||||||
/// `event_auth::auth_check` function.
|
/// `event_auth::auth_check` function.
|
||||||
#[tracing::instrument(level = "trace", skip_all)]
|
#[tracing::instrument(level = "trace", skip_all)]
|
||||||
async fn iterative_auth_check<'a, E, F, Fut, S>(
|
async fn iterative_auth_check<'a, E, F, Fut, R, RFut, S>(
|
||||||
room_version: &RoomVersionRules,
|
room_version: &RoomVersionRules,
|
||||||
events_to_check: S,
|
events_to_check: S,
|
||||||
unconflicted_state: StateMap<OwnedEventId>,
|
unconflicted_state: StateMap<OwnedEventId>,
|
||||||
fetch_event: &F,
|
fetch_event: &F,
|
||||||
|
is_rejected: &R,
|
||||||
) -> Result<StateMap<OwnedEventId>>
|
) -> Result<StateMap<OwnedEventId>>
|
||||||
where
|
where
|
||||||
F: Fn(OwnedEventId) -> Fut + Sync,
|
F: Fn(OwnedEventId) -> Fut + Sync,
|
||||||
Fut: Future<Output = Option<E>> + Send,
|
Fut: Future<Output = Option<E>> + Send,
|
||||||
|
R: Fn(OwnedEventId) -> RFut + Sync,
|
||||||
|
RFut: Future<Output = bool> + Send,
|
||||||
S: Stream<Item = &'a EventId> + Send + 'a,
|
S: Stream<Item = &'a EventId> + Send + 'a,
|
||||||
E: Event + Clone + Send + Sync,
|
E: Event + Clone + Send + Sync,
|
||||||
for<'b> &'b E: Event + Send,
|
for<'b> &'b E: Event + Send,
|
||||||
@@ -727,18 +747,34 @@ where
|
|||||||
|
|
||||||
trace!(set = ?auth_event_ids, "auth event IDs to fetch");
|
trace!(set = ?auth_event_ids, "auth event IDs to fetch");
|
||||||
|
|
||||||
let auth_events: HashMap<OwnedEventId, E> = auth_event_ids
|
let rejected_check_ids: HashSet<OwnedEventId> = auth_event_ids
|
||||||
|
.iter()
|
||||||
|
.chain(unconflicted_state.values())
|
||||||
|
.cloned()
|
||||||
|
.chain(events_to_check.iter().map(|e| e.event_id().to_owned()))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let auth_events_fut = auth_event_ids
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.stream()
|
.stream()
|
||||||
.broad_filter_map(fetch_event)
|
.broad_filter_map(fetch_event)
|
||||||
.map(|auth_event| (auth_event.event_id().to_owned(), auth_event))
|
.map(|auth_event| (auth_event.event_id().to_owned(), auth_event))
|
||||||
.collect()
|
.collect::<HashMap<OwnedEventId, E>>()
|
||||||
.boxed()
|
.boxed();
|
||||||
.await;
|
|
||||||
|
let rejected_events_fut = rejected_check_ids
|
||||||
|
.into_iter()
|
||||||
|
.stream()
|
||||||
|
.broad_filter_map(|id| async move { is_rejected(id.clone()).await.then_some(id) })
|
||||||
|
.collect::<HashSet<OwnedEventId>>()
|
||||||
|
.boxed();
|
||||||
|
|
||||||
|
let (auth_events, rejected_events) = future::join(auth_events_fut, rejected_events_fut).await;
|
||||||
|
|
||||||
trace!(map = ?auth_events.keys().collect::<Vec<_>>(), "fetched auth events");
|
trace!(map = ?auth_events.keys().collect::<Vec<_>>(), "fetched auth events");
|
||||||
|
|
||||||
let auth_events = &auth_events;
|
let auth_events = &auth_events;
|
||||||
|
let rejected_events = &rejected_events;
|
||||||
// NOTE: in state resolution v2.1, auth checks should start with an empty
|
// NOTE: in state resolution v2.1, auth checks should start with an empty
|
||||||
// state map. It is the caller's job to do this. Previously, this function
|
// state map. It is the caller's job to do this. Previously, this function
|
||||||
// would force an empty state map in this case, and this resulted in power
|
// would force an empty state map in this case, and this resulted in power
|
||||||
@@ -747,6 +783,7 @@ where
|
|||||||
let mut resolved_state = unconflicted_state;
|
let mut resolved_state = unconflicted_state;
|
||||||
for event in events_to_check {
|
for event in events_to_check {
|
||||||
trace!(event_id = event.event_id().as_str(), "checking event");
|
trace!(event_id = event.event_id().as_str(), "checking event");
|
||||||
|
|
||||||
let state_key = event
|
let state_key = event
|
||||||
.state_key()
|
.state_key()
|
||||||
.ok_or_else(|| Error::InvalidPdu("State event had no state key".to_owned()))?;
|
.ok_or_else(|| Error::InvalidPdu("State event had no state key".to_owned()))?;
|
||||||
@@ -777,8 +814,9 @@ where
|
|||||||
}
|
}
|
||||||
for aid in event.auth_events() {
|
for aid in event.auth_events() {
|
||||||
if let Some(ev) = auth_events.get(aid) {
|
if let Some(ev) = auth_events.get(aid) {
|
||||||
//TODO: synapse checks "rejected_reason" which is most likely
|
if rejected_events.contains(aid) {
|
||||||
// related to soft-failing
|
continue;
|
||||||
|
}
|
||||||
trace!(event_id = aid.as_str(), "found auth event");
|
trace!(event_id = aid.as_str(), "found auth event");
|
||||||
auth_state.insert(
|
auth_state.insert(
|
||||||
ev.event_type()
|
ev.event_type()
|
||||||
@@ -797,6 +835,9 @@ where
|
|||||||
.stream()
|
.stream()
|
||||||
.ready_filter_map(|key| Some((key, resolved_state.get(key)?)))
|
.ready_filter_map(|key| Some((key, resolved_state.get(key)?)))
|
||||||
.filter_map(|(key, ev_id)| async move {
|
.filter_map(|(key, ev_id)| async move {
|
||||||
|
if rejected_events.contains(ev_id) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
if let Some(event) = auth_events.get(ev_id) {
|
if let Some(event) = auth_events.get(ev_id) {
|
||||||
Some((key, event.clone()))
|
Some((key, event.clone()))
|
||||||
} else {
|
} else {
|
||||||
@@ -804,7 +845,6 @@ where
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.ready_for_each(|(key, event)| {
|
.ready_for_each(|(key, event)| {
|
||||||
//TODO: synapse checks "rejected_reason" is None here
|
|
||||||
auth_state.insert(key.to_owned(), event);
|
auth_state.insert(key.to_owned(), event);
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
@@ -1107,8 +1147,8 @@ mod tests {
|
|||||||
StateMap, is_power_event,
|
StateMap, is_power_event,
|
||||||
test_utils::{
|
test_utils::{
|
||||||
INITIAL_EVENTS, TestStore, alice, bob, charlie, do_check, ella, event_id,
|
INITIAL_EVENTS, TestStore, alice, bob, charlie, do_check, ella, event_id,
|
||||||
member_content_ban, member_content_join, room_id, to_init_pdu_event, to_pdu_event,
|
member_content_ban, member_content_join, not_rejected, room_id, to_init_pdu_event,
|
||||||
zara,
|
to_pdu_event, zara,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -1169,6 +1209,7 @@ mod tests {
|
|||||||
ordered_events.iter().map(AsRef::as_ref).stream(),
|
ordered_events.iter().map(AsRef::as_ref).stream(),
|
||||||
initial_state,
|
initial_state,
|
||||||
&fetcher,
|
&fetcher,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1179,6 +1220,172 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn iterative_auth_check_reauths_rejected_events() {
|
||||||
|
let mut events = INITIAL_EVENTS();
|
||||||
|
let initial_state = ["CREATE", "IPOWER", "IJR", "IMB"]
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| {
|
||||||
|
let event = &events[&event_id(id)];
|
||||||
|
(
|
||||||
|
event
|
||||||
|
.event_type()
|
||||||
|
.with_state_key(event.state_key().unwrap()),
|
||||||
|
event.event_id.clone(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let leave = to_pdu_event(
|
||||||
|
"LEAVE",
|
||||||
|
bob(),
|
||||||
|
TimelineEventType::RoomMember,
|
||||||
|
Some(bob().as_str()),
|
||||||
|
to_raw_json_value(&json!({ "membership": "leave" })).unwrap(),
|
||||||
|
&["CREATE", "IPOWER", "IMB"],
|
||||||
|
&["IMB"],
|
||||||
|
);
|
||||||
|
let rejoin = to_pdu_event(
|
||||||
|
"REJOIN",
|
||||||
|
bob(),
|
||||||
|
TimelineEventType::RoomMember,
|
||||||
|
Some(bob().as_str()),
|
||||||
|
member_content_join(),
|
||||||
|
&["CREATE", "IPOWER", "IJR", "LEAVE"],
|
||||||
|
&["LEAVE"],
|
||||||
|
);
|
||||||
|
let ordered_events = [leave.event_id.clone(), rejoin.event_id.clone()];
|
||||||
|
for event in [leave, rejoin] {
|
||||||
|
events.insert(event.event_id.clone(), event);
|
||||||
|
}
|
||||||
|
let fetcher = |id: OwnedEventId| {
|
||||||
|
let events = &events;
|
||||||
|
async move { events.get(&id).cloned() }
|
||||||
|
};
|
||||||
|
let resolved = super::iterative_auth_check(
|
||||||
|
&RoomVersionRules::V6,
|
||||||
|
ordered_events.iter().map(AsRef::as_ref).stream(),
|
||||||
|
initial_state,
|
||||||
|
&fetcher,
|
||||||
|
&|id| async move { id == event_id("REJOIN") },
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
resolved[&StateEventType::RoomMember.with_state_key(bob().as_str())],
|
||||||
|
event_id("REJOIN"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn iterative_auth_check_ignores_rejected_auth_events() {
|
||||||
|
let mut events = INITIAL_EVENTS();
|
||||||
|
let initial_state = ["CREATE", "IPOWER"]
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| {
|
||||||
|
let event = &events[&event_id(id)];
|
||||||
|
(
|
||||||
|
event
|
||||||
|
.event_type()
|
||||||
|
.with_state_key(event.state_key().unwrap()),
|
||||||
|
event.event_id.clone(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
// Bob tries to join relying on IJR in auth_events, which is not in
|
||||||
|
// initial_state and is marked rejected.
|
||||||
|
let join = to_pdu_event(
|
||||||
|
"BOB_JOIN",
|
||||||
|
bob(),
|
||||||
|
TimelineEventType::RoomMember,
|
||||||
|
Some(bob().as_str()),
|
||||||
|
member_content_join(),
|
||||||
|
&["CREATE", "IPOWER", "IJR"],
|
||||||
|
&["IJR"],
|
||||||
|
);
|
||||||
|
let ordered_events = [join.event_id.clone()];
|
||||||
|
events.insert(join.event_id.clone(), join);
|
||||||
|
|
||||||
|
let fetcher = |id: OwnedEventId| {
|
||||||
|
let events = &events;
|
||||||
|
async move { events.get(&id).cloned() }
|
||||||
|
};
|
||||||
|
let resolved = super::iterative_auth_check(
|
||||||
|
&RoomVersionRules::V6,
|
||||||
|
ordered_events.iter().map(AsRef::as_ref).stream(),
|
||||||
|
initial_state,
|
||||||
|
&fetcher,
|
||||||
|
&|id| async move { id == event_id("IJR") },
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
!resolved.contains_key(&StateEventType::RoomMember.with_state_key(bob().as_str()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn iterative_auth_check_ignores_rejected_resolved_state() {
|
||||||
|
let mut events = INITIAL_EVENTS();
|
||||||
|
let ban_bob = to_pdu_event(
|
||||||
|
"BAN_BOB",
|
||||||
|
alice(),
|
||||||
|
TimelineEventType::RoomMember,
|
||||||
|
Some(bob().as_str()),
|
||||||
|
member_content_ban(),
|
||||||
|
&["CREATE", "IPOWER", "IMA", "IMB"],
|
||||||
|
&["IMB"],
|
||||||
|
);
|
||||||
|
let bob_leave = to_pdu_event(
|
||||||
|
"BOB_LEAVE",
|
||||||
|
bob(),
|
||||||
|
TimelineEventType::RoomMember,
|
||||||
|
Some(bob().as_str()),
|
||||||
|
to_raw_json_value(&json!({ "membership": "leave" })).unwrap(),
|
||||||
|
&["CREATE", "IPOWER", "IMB"],
|
||||||
|
&["IMB"],
|
||||||
|
);
|
||||||
|
let ordered_events = [bob_leave.event_id.clone()];
|
||||||
|
for event in [ban_bob, bob_leave] {
|
||||||
|
events.insert(event.event_id.clone(), event);
|
||||||
|
}
|
||||||
|
// initial_state has BAN_BOB for Bob's membership, but BAN_BOB is
|
||||||
|
// rejected, so Bob's auth check should fall back to IMB from
|
||||||
|
// BOB_LEAVE's auth_events and succeed.
|
||||||
|
let initial_state = ["CREATE", "IPOWER", "BAN_BOB"]
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| {
|
||||||
|
let event = &events[&event_id(id)];
|
||||||
|
(
|
||||||
|
event
|
||||||
|
.event_type()
|
||||||
|
.with_state_key(event.state_key().unwrap()),
|
||||||
|
event.event_id.clone(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let fetcher = |id: OwnedEventId| {
|
||||||
|
let events = &events;
|
||||||
|
async move { events.get(&id).cloned() }
|
||||||
|
};
|
||||||
|
let resolved = super::iterative_auth_check(
|
||||||
|
&RoomVersionRules::V6,
|
||||||
|
ordered_events.iter().map(AsRef::as_ref).stream(),
|
||||||
|
initial_state,
|
||||||
|
&fetcher,
|
||||||
|
&|id| async move { id == event_id("BAN_BOB") },
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
resolved.get(&StateEventType::RoomMember.with_state_key(bob().as_str())),
|
||||||
|
Some(&event_id("BOB_LEAVE")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Events at the start of a room have no `m.room.power_levels` in their
|
/// Events at the start of a room have no `m.room.power_levels` in their
|
||||||
/// auth events, so the sender's power for sort ordering comes from the
|
/// auth events, so the sender's power for sort ordering comes from the
|
||||||
/// create event instead.
|
/// create event instead.
|
||||||
@@ -1315,6 +1522,7 @@ mod tests {
|
|||||||
sorted_power_events.iter().map(AsRef::as_ref).stream(),
|
sorted_power_events.iter().map(AsRef::as_ref).stream(),
|
||||||
HashMap::new(), // unconflicted events
|
HashMap::new(), // unconflicted events
|
||||||
&fetcher,
|
&fetcher,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.expect("iterative auth check failed on resolved events");
|
.expect("iterative auth check failed on resolved events");
|
||||||
@@ -1717,6 +1925,7 @@ mod tests {
|
|||||||
&auth_chain,
|
&auth_chain,
|
||||||
&fetcher,
|
&fetcher,
|
||||||
&exists,
|
&exists,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
@@ -1835,6 +2044,7 @@ mod tests {
|
|||||||
&auth_chain,
|
&auth_chain,
|
||||||
&fetcher,
|
&fetcher,
|
||||||
&exists,
|
&exists,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ pub(crate) async fn do_check(
|
|||||||
&auth_chain_sets,
|
&auth_chain_sets,
|
||||||
&fetch,
|
&fetch,
|
||||||
&exists,
|
&exists,
|
||||||
|
¬_rejected,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@@ -363,6 +364,8 @@ impl TestStore<Pdu> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn not_rejected(_: OwnedEventId) -> bool { false }
|
||||||
|
|
||||||
pub(crate) fn event_id(id: &str) -> OwnedEventId {
|
pub(crate) fn event_id(id: &str) -> OwnedEventId {
|
||||||
if id.contains('$') {
|
if id.contains('$') {
|
||||||
return id.try_into().unwrap();
|
return id.try_into().unwrap();
|
||||||
|
|||||||
@@ -109,12 +109,19 @@ impl super::Service {
|
|||||||
{
|
{
|
||||||
let event_fetch = |event_id| self.event_fetch(event_id);
|
let event_fetch = |event_id| self.event_fetch(event_id);
|
||||||
let event_exists = |event_id| self.event_exists(event_id);
|
let event_exists = |event_id| self.event_exists(event_id);
|
||||||
|
let is_rejected = |event_id: OwnedEventId| async move {
|
||||||
|
self.services
|
||||||
|
.pdu_metadata
|
||||||
|
.is_event_rejected(&event_id)
|
||||||
|
.await
|
||||||
|
};
|
||||||
state_res::resolve(
|
state_res::resolve(
|
||||||
room_version_rules,
|
room_version_rules,
|
||||||
state_sets,
|
state_sets,
|
||||||
auth_chain_sets,
|
auth_chain_sets,
|
||||||
&event_fetch,
|
&event_fetch,
|
||||||
&event_exists,
|
&event_exists,
|
||||||
|
&is_rejected,
|
||||||
)
|
)
|
||||||
.map_err(|e| err!(error!("State resolution failed: {e:?}")))
|
.map_err(|e| err!(error!("State resolution failed: {e:?}")))
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ use ruma::{
|
|||||||
serde::Raw,
|
serde::Raw,
|
||||||
signatures::{Ed25519KeyPair, PublicKeyMap, PublicKeySet},
|
signatures::{Ed25519KeyPair, PublicKeyMap, PublicKeySet},
|
||||||
};
|
};
|
||||||
use verify::IncomingServerKeys;
|
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
|
use verify::IncomingServerKeys;
|
||||||
pub use verify::strip_extraneous_signatures;
|
pub use verify::strip_extraneous_signatures;
|
||||||
|
|
||||||
use crate::{Dep, globals, sending, server_keys::util::required_keys};
|
use crate::{Dep, globals, sending, server_keys::util::required_keys};
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
--card-bg: oklch(from var(--panel-bg) var(--background-lightness) c h);
|
--card-bg: oklch(from var(--panel-bg) var(--background-lightness) c h);
|
||||||
|
|
||||||
--rp-home-background-bg: radial-gradient(42.12% 56.13% at 100% 0%, oklch(from var(--c2) var(--background-lightness) c h) 0%, #fff0 100%), radial-gradient(42.01% 79.63% at 52.86% 0%, #d9ff5333 0%, #fff0 100%), radial-gradient(79.67% 58.09% at 0% 0%, oklch(from var(--c1) var(--background-lightness) c h) 0%, #fff0 100%), var(--rp-c-bg);
|
--rp-home-background-bg: radial-gradient(42.12% 56.13% at 100% 0%, oklch(from var(--c2) var(--background-lightness) c h) 0%, #fff0 100%), radial-gradient(42.01% 79.63% at 52.86% 0%, #d9ff5333 0%, #fff0 100%), radial-gradient(79.67% 58.09% at 0% 0%, oklch(from var(--c1) var(--background-lightness) c h) 0%, #fff0 100%), var(--rp-c-bg);
|
||||||
|
--rp-banner-background: linear-gradient(279deg, var(--rp-c-brand-dark) 35.21%, var(--rp-c-brand-light) 63.34%);
|
||||||
|
|
||||||
--rp-c-divider: rgba(0, 0, 0, 0.2);
|
--rp-c-divider: rgba(0, 0, 0, 0.2);
|
||||||
--rp-c-divider-light: rgba(0, 0, 0, 0.1);
|
--rp-c-divider-light: rgba(0, 0, 0, 0.1);
|
||||||
|
|||||||
+22
-4
@@ -1,10 +1,28 @@
|
|||||||
import { HomeLayout as BasicHomeLayout, DocContent } from "@rspress/core/theme-original";
|
import { Banner, HomeLayout as BasicHomeLayout, Layout as BasicLayout, DocContent } from "@rspress/core/theme-original";
|
||||||
|
import { useFrontmatter, useSite } from '@rspress/core/runtime';
|
||||||
import { useFrontmatter } from '@rspress/core/runtime';
|
|
||||||
interface HomeLayoutProps {
|
interface HomeLayoutProps {
|
||||||
components?: Record<string, React.FC>;
|
components?: Record<string, React.FC>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Layout = () => {
|
||||||
|
const { site } = useSite();
|
||||||
|
const sitePath: string = site.base;
|
||||||
|
const prNumber: string = sitePath.substring(sitePath.indexOf("@") + 1, sitePath.lastIndexOf("/"));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BasicLayout
|
||||||
|
beforeNav={
|
||||||
|
sitePath != "/" ? (
|
||||||
|
<Banner
|
||||||
|
href={`https://forgejo.ellis.link/continuwuation/continuwuity/pulls/${prNumber}`}
|
||||||
|
message={`Documentation preview for PR #${prNumber}`}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
function HomeLayout(props: HomeLayoutProps) {
|
function HomeLayout(props: HomeLayoutProps) {
|
||||||
console.log(props)
|
console.log(props)
|
||||||
|
|
||||||
@@ -41,6 +59,6 @@ function HomeLayout(props: HomeLayoutProps) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export { HomeLayout };
|
export { HomeLayout, Layout };
|
||||||
export * from "@rspress/core/theme-original";
|
export * from "@rspress/core/theme-original";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
Reference in new issue
Block a user