Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
e5307d44
Commit
e5307d44
authored
11 months ago
by
🥺
Committed by
🥺
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
log error for /publicRooms requests, simplify it a bit
Signed-off-by:
strawberry
<
strawberry@puppygock.gay
>
parent
9b5c8c12
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/client_server/directory.rs
+12
-18
12 additions, 18 deletions
src/api/client_server/directory.rs
src/api/ruma_wrapper/axum.rs
+1
-0
1 addition, 0 deletions
src/api/ruma_wrapper/axum.rs
src/api/server_server.rs
+12
-4
12 additions, 4 deletions
src/api/server_server.rs
with
25 additions
and
22 deletions
src/api/client_server/directory.rs
+
12
−
18
View file @
e5307d44
...
...
@@ -34,15 +34,7 @@
pub
async
fn
get_public_rooms_filtered_route
(
body
:
Ruma
<
get_public_rooms_filtered
::
v3
::
Request
>
,
)
->
Result
<
get_public_rooms_filtered
::
v3
::
Response
>
{
if
!
services
()
.globals
.config
.allow_public_room_directory_without_auth
{
let
_sender_user
=
body
.sender_user
.as_ref
()
.expect
(
"user is authenticated"
);
}
get_public_rooms_filtered_helper
(
let
response
=
get_public_rooms_filtered_helper
(
body
.server
.as_deref
(),
body
.limit
,
body
.since
.as_deref
(),
...
...
@@ -50,6 +42,12 @@ pub async fn get_public_rooms_filtered_route(
&
body
.room_network
,
)
.await
.map_err
(|
e
|
{
warn!
(
"Failed to return our /publicRooms: {e}"
);
Error
::
BadRequest
(
ErrorKind
::
Unknown
,
"Failed to return this server's public room list."
)
})
?
;
Ok
(
response
)
}
/// # `GET /_matrix/client/v3/publicRooms`
...
...
@@ -60,14 +58,6 @@ pub async fn get_public_rooms_filtered_route(
pub
async
fn
get_public_rooms_route
(
body
:
Ruma
<
get_public_rooms
::
v3
::
Request
>
,
)
->
Result
<
get_public_rooms
::
v3
::
Response
>
{
if
!
services
()
.globals
.config
.allow_public_room_directory_without_auth
{
let
_sender_user
=
body
.sender_user
.as_ref
()
.expect
(
"user is authenticated"
);
}
let
response
=
get_public_rooms_filtered_helper
(
body
.server
.as_deref
(),
body
.limit
,
...
...
@@ -75,7 +65,11 @@ pub async fn get_public_rooms_route(
&
Filter
::
default
(),
&
RoomNetwork
::
Matrix
,
)
.await
?
;
.await
.map_err
(|
e
|
{
warn!
(
"Failed to return our /publicRooms: {e}"
);
Error
::
BadRequest
(
ErrorKind
::
Unknown
,
"Failed to return this server's public room list."
)
})
?
;
Ok
(
get_public_rooms
::
v3
::
Response
{
chunk
:
response
.chunk
,
...
...
This diff is collapsed.
Click to expand it.
src/api/ruma_wrapper/axum.rs
+
1
−
0
View file @
e5307d44
...
...
@@ -265,6 +265,7 @@ async fn from_request(req: Request<B>, _state: &S) -> Result<Self, Self::Rejecti
}
},
AuthScheme
::
None
=>
match
parts
.uri
.path
()
{
// TOOD: can we do a better check here?
// allow_public_room_directory_without_auth
"/_matrix/client/v3/publicRooms"
|
"/_matrix/client/r0/publicRooms"
=>
{
if
!
services
()
...
...
This diff is collapsed.
Click to expand it.
src/api/server_server.rs
+
12
−
4
View file @
e5307d44
...
...
@@ -33,7 +33,7 @@
},
OutgoingResponse
,
},
directory
::
{
Filter
,
RoomNetwork
},
directory
::
Filter
,
events
::{
receipt
::{
ReceiptEvent
,
ReceiptEventContent
,
ReceiptType
},
room
::{
...
...
@@ -162,7 +162,11 @@ pub async fn get_public_rooms_filtered_route(
&
body
.filter
,
&
body
.room_network
,
)
.await
?
;
.await
.map_err
(|
e
|
{
warn!
(
"Failed to return our /publicRooms: {e}"
);
Error
::
BadRequest
(
ErrorKind
::
Unknown
,
"Failed to return this server's public room list."
)
})
?
;
Ok
(
get_public_rooms_filtered
::
v1
::
Response
{
chunk
:
response
.chunk
,
...
...
@@ -190,9 +194,13 @@ pub async fn get_public_rooms_route(
body
.limit
,
body
.since
.as_deref
(),
&
Filter
::
default
(),
&
R
oom
N
etwork
::
Matrix
,
&
body
.r
oom
_n
etwork
,
)
.await
?
;
.await
.map_err
(|
e
|
{
warn!
(
"Failed to return our /publicRooms: {e}"
);
Error
::
BadRequest
(
ErrorKind
::
Unknown
,
"Failed to return this server's public room list."
)
})
?
;
Ok
(
get_public_rooms
::
v1
::
Response
{
chunk
:
response
.chunk
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment