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

properly censor the token when connecting #726

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ abstract class Nyxx {

/// Create an instance of [NyxxRest] using the provided options.
static Future<NyxxRest> connectRestWithOptions(RestApiOptions apiOptions, [RestClientOptions clientOptions = const RestClientOptions()]) async {
clientOptions.logger
..info('Connecting to the REST API')
..fine('Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent}')
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

return _doConnect(apiOptions, clientOptions, () async {
clientOptions.logger
..info('Connecting to the REST API')
..fine('Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent}')
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

final client = NyxxRest._(apiOptions, clientOptions);

return client
Expand All @@ -111,12 +111,12 @@ abstract class Nyxx {
///
/// Note that `client.user.id` will contain [Snowflake.zero] if there no `identify` scope.
static Future<NyxxOAuth2> connectOAuth2WithOptions(OAuth2ApiOptions apiOptions, [RestClientOptions clientOptions = const RestClientOptions()]) async {
clientOptions.logger
..info('Connecting to the REST API via OAuth2')
..fine('Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent}')
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

return _doConnect(apiOptions, clientOptions, () async {
clientOptions.logger
..info('Connecting to the REST API via OAuth2')
..fine('Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent}')
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

final client = NyxxOAuth2._(apiOptions, clientOptions);
final information = await client.users.fetchCurrentOAuth2Information();

Expand All @@ -136,16 +136,16 @@ abstract class Nyxx {
GatewayApiOptions apiOptions, [
GatewayClientOptions clientOptions = const GatewayClientOptions(),
]) async {
clientOptions.logger
..info('Connecting to the Gateway API')
..fine(
'Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent},'
' Intents: ${apiOptions.intents.value}, Payloads: ${apiOptions.payloadFormat.value}, Compression: ${apiOptions.compression.name},'
' Shards: ${apiOptions.shards?.join(', ')}, Total shards: ${apiOptions.totalShards}, Large threshold: ${apiOptions.largeThreshold}',
)
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

return _doConnect(apiOptions, clientOptions, () async {
clientOptions.logger
..info('Connecting to the Gateway API')
..fine(
'Token: ${apiOptions.token}, Authorization: ${apiOptions.authorizationHeader}, User-Agent: ${apiOptions.userAgent},'
' Intents: ${apiOptions.intents.value}, Payloads: ${apiOptions.payloadFormat.value}, Compression: ${apiOptions.compression.name},'
' Shards: ${apiOptions.shards?.join(', ')}, Total shards: ${apiOptions.totalShards}, Large threshold: ${apiOptions.largeThreshold}',
)
..fine('Plugins: ${clientOptions.plugins.map((plugin) => plugin.name).join(', ')}');

final client = NyxxGateway._(apiOptions, clientOptions);

client
Expand Down