-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
appservice: Introduce appservice mode on Client #266
appservice: Introduce appservice mode on Client #266
Conversation
|
||
- name: Clippy without default features | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
# TODO: add `--all-targets` once all warnings in examples are resolved | ||
args: --workspace --exclude matrix-sdk-appservice --no-default-features --features native-tls -- -D warnings | ||
args: --no-default-features --features native-tls,warp -- -D warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warp
here is required as otherwise the appservice crate errors on the compile-time webserver feature check
/// Default is only sending authorization if it is required | ||
#[cfg(any(feature = "require_auth_for_profile_requests", feature = "appservice"))] | ||
#[cfg_attr(feature = "docs", doc(cfg(any(require_auth_for_profile_requests, appservice))))] | ||
/// Default is only sending authorization if it is required. | ||
pub(crate) fn force_auth(mut self) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be OK to do this given it's pub(crate)
let config = if self.appservice_mode { | ||
Some(self.http_client.request_config.force_auth()) | ||
} else { | ||
None | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the appservice_mode
can only be switched with appservice
feature active this should be OK as runtime check
#[cfg(not(feature = "appservice"))] | ||
let request = self.try_into_http_request(request, session, config).await?; | ||
|
||
#[cfg(feature = "appservice")] | ||
let request = if !self.request_config.assert_identity { | ||
self.try_into_http_request(request, session, config).await? | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that assert_identity
can only be switched with appservice
feature active this should be OK as runtime check
Thanks, merged. |
Follow-up to #265 (comment)
Part of #228
Closes #265