Skip to content

Commit d86f239

Browse files
authored
🧑‍💻 move mastodon env to services (#3170)
1 parent 8db3fe8 commit d86f239

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

app/Console/Commands/DatabaseCleaner/MastodonServers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private function checkInvalidServers(): void {
6868
'client_id' => $server->client_id,
6969
'client_secret' => $server->client_secret,
7070
'grant_type' => 'client_credentials',
71-
'redirect_uri' => config('trwl.mastodon_redirect'),
71+
'redirect_uri' => config('services.mastodon.redirect'),
7272
],
7373
'http_errors' => false,
7474
]);

app/Http/Controllers/Backend/Social/MastodonController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public static function getMastodonServer(string $domain): ?MastodonServer {
7777
private static function createMastodonServer(string $domain): MastodonServer {
7878
try {
7979
$info = Mastodon::domain($domain)->createApp(
80-
client_name: config('trwl.mastodon_appname'),
81-
redirect_uris: config('trwl.mastodon_redirect'),
80+
client_name: config('services.mastodon.client_name'), //TODO: why is client name required here?
81+
redirect_uris: config('services.mastodon.redirect'),
8282
scopes: 'write read',
8383
website: config('app.url')
8484
);
@@ -220,6 +220,6 @@ public static function getLastSavedPostIdFromUserStatuses(User $user) {
220220
}
221221

222222
public static function getRequestOptions(): array {
223-
return [RequestOptions::TIMEOUT => config("trwl.mastodon_timeout_seconds")];
223+
return [RequestOptions::TIMEOUT => config('services.mastodon.timeout')];
224224
}
225225
}

config/services.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

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

2426
'telegram' => [

config/trwl.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
return [
44
'post_social' => env('POST_SOCIAL', false),
55

6-
# Mastodon
7-
'mastodon_domain' => env('MASTODON_DOMAIN'),
8-
'mastodon_id' => env('MASTODON_ID'),
9-
'mastodon_secret' => env('MASTODON_SECRET'),
10-
'mastodon_redirect' => env('MASTODON_REDIRECT'),
11-
'mastodon_appname' => env('MASTODON_APPNAME'),
12-
'mastodon_timeout_seconds' => env("MASTODON_TIMEOUT_SECONDS", 5),
13-
146
# Brouter
157
'brouter' => env('BROUTER', true),
168
'brouter_url' => env('BROUTER_URL', 'https://brouter.de/'),

0 commit comments

Comments
 (0)