Skip to content

Commit

Permalink
🧑‍💻 move mastodon env to services
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Jan 18, 2025
1 parent 3b6d547 commit 61d7486
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/DatabaseCleaner/MastodonServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function checkInvalidServers(): void {
'client_id' => $server->client_id,
'client_secret' => $server->client_secret,
'grant_type' => 'client_credentials',
'redirect_uri' => config('trwl.mastodon_redirect'),
'redirect_uri' => config('services.mastodon.redirect'),
],
'http_errors' => false,
]);
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Backend/Social/MastodonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public static function getMastodonServer(string $domain): ?MastodonServer {
private static function createMastodonServer(string $domain): MastodonServer {
try {
$info = Mastodon::domain($domain)->createApp(
client_name: config('trwl.mastodon_appname'),
redirect_uris: config('trwl.mastodon_redirect'),
client_name: config('services.mastodon.client_name'), //TODO: why is client name required here?
redirect_uris: config('services.mastodon.redirect'),
scopes: 'write read',
website: config('app.url')
);
Expand Down Expand Up @@ -220,6 +220,6 @@ public static function getLastSavedPostIdFromUserStatuses(User $user) {
}

public static function getRequestOptions(): array {
return [RequestOptions::TIMEOUT => config("trwl.mastodon_timeout_seconds")];
return [RequestOptions::TIMEOUT => config('services.mastodon.timeout')];
}
}
4 changes: 3 additions & 1 deletion config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

'mastodon' => [
'domain' => env('MASTODON_DOMAIN'),
'client_name' => env('MASTODON_APPNAME'), // TODO: check if this is a required value...? I don't think, we need this. ~@kris
'client_id' => env('MASTODON_ID'),
'client_secret' => env('MASTODON_SECRET'),
'redirect' => env('MASTODON_REDIRECT'),
'redirect' => env('MASTODON_REDIRECT', 'http://localhost:8000/callback/mastodon'),
'timeout' => env('MASTODON_TIMEOUT_SECONDS', 2),
],

'telegram' => [
Expand Down
8 changes: 0 additions & 8 deletions config/trwl.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
return [
'post_social' => env('POST_SOCIAL', false),

# Mastodon
'mastodon_domain' => env('MASTODON_DOMAIN'),
'mastodon_id' => env('MASTODON_ID'),
'mastodon_secret' => env('MASTODON_SECRET'),
'mastodon_redirect' => env('MASTODON_REDIRECT'),
'mastodon_appname' => env('MASTODON_APPNAME'),
'mastodon_timeout_seconds' => env("MASTODON_TIMEOUT_SECONDS", 5),

# Brouter
'brouter' => env('BROUTER', true),
'brouter_url' => env('BROUTER_URL', 'https://brouter.de/'),
Expand Down

0 comments on commit 61d7486

Please sign in to comment.