Skip to content
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

Merged

Conversation

johannescpk
Copy link
Contributor

@johannescpk johannescpk commented Jun 10, 2021

Follow-up to #265 (comment)

Part of #228

Closes #265


- 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
Copy link
Contributor Author

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

Comment on lines -482 to 496
/// 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 {
Copy link
Contributor Author

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)

Comment on lines +1378 to +1382
let config = if self.appservice_mode {
Some(self.http_client.request_config.force_auth())
} else {
None
};
Copy link
Contributor Author

@johannescpk johannescpk Jun 10, 2021

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

Comment on lines -128 to 127
#[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 {
Copy link
Contributor Author

@johannescpk johannescpk Jun 10, 2021

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

@poljar
Copy link
Contributor

poljar commented Jun 10, 2021

Thanks, merged.

@poljar poljar merged commit 1a5cd54 into matrix-org:master Jun 10, 2021
@johannescpk johannescpk deleted the appservice/feature/client-appservice-mode branch June 10, 2021 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants