Skip to content

🧑‍💻 move mastodon env to services #3170

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

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
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
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
Loading