diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index a90327f4d..ea4a4258a 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -267,7 +267,7 @@ class ApiV1Controller extends Controller 'max_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX, 'since_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX, 'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX, - 'limit' => 'nullable|integer|min:1|max:40' + 'limit' => 'nullable|integer|min:1|max:80' ]); $profile = Profile::whereNull('status')->findOrFail($id); @@ -748,6 +748,8 @@ class ApiV1Controller extends Controller ]); if($like->wasRecentlyCreated == true) { + $status->likes_count = $status->likes()->count(); + $status->save(); LikePipeline::dispatch($like); } @@ -777,6 +779,8 @@ class ApiV1Controller extends Controller if($like) { $like->delete(); + $status->likes_count = $status->likes()->count(); + $status->save(); } $resource = new Fractal\Resource\Item($status, new StatusTransformer()); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 346f245e1..7a8c91efe 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -40,6 +40,7 @@ class Kernel extends HttpKernel 'api' => [ 'throttle:60,1', 'bindings', + \Barryvdh\Cors\HandleCors::class, ], ]; diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 6f077f832..7de25b357 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -27,7 +27,7 @@ class AuthServiceProvider extends ServiceProvider $this->registerPolicies(); if(config('pixelfed.oauth_enabled')) { - Passport::routes(); + Passport::routes(null, ['middleware' => [ \Barryvdh\Cors\HandleCors::class ]]); Passport::tokensExpireIn(now()->addDays(15)); Passport::refreshTokensExpireIn(now()->addDays(30)); Passport::enableImplicitGrant(); diff --git a/app/Transformer/Api/Mastodon/v1/AccountTransformer.php b/app/Transformer/Api/Mastodon/v1/AccountTransformer.php index 0d062851e..00a895a17 100644 --- a/app/Transformer/Api/Mastodon/v1/AccountTransformer.php +++ b/app/Transformer/Api/Mastodon/v1/AccountTransformer.php @@ -4,6 +4,7 @@ namespace App\Transformer\Api\Mastodon\v1; use App\Profile; use League\Fractal; +use Illuminate\Support\Str; class AccountTransformer extends Fractal\TransformerAbstract { @@ -11,12 +12,11 @@ class AccountTransformer extends Fractal\TransformerAbstract { $local = $profile->domain == null; $is_admin = !$local ? false : $profile->user->is_admin; - $acct = $local ? $profile->username . '@' . config('pixelfed.domain.app') : substr($profile->username, 1); - $username = $local ? $profile->username : explode('@', $acct)[0]; + $username = $local ? $profile->username : explode('@', substr($profile->username, 1))[0]; return [ 'id' => (string) $profile->id, 'username' => $username, - 'acct' => $acct, + 'acct' => $username, 'display_name' => $profile->name, 'locked' => (bool) $profile->is_private, 'created_at' => $profile->created_at->toJSON(), @@ -32,7 +32,7 @@ class AccountTransformer extends Fractal\TransformerAbstract 'emojis' => [], 'moved' => null, 'fields' => null, - 'bot' => null, + 'bot' => false, 'software' => 'pixelfed', 'is_admin' => (bool) $is_admin, ]; diff --git a/app/Transformer/Api/Mastodon/v1/StatusTransformer.php b/app/Transformer/Api/Mastodon/v1/StatusTransformer.php index 97f0cb4b8..7a5d1cbff 100644 --- a/app/Transformer/Api/Mastodon/v1/StatusTransformer.php +++ b/app/Transformer/Api/Mastodon/v1/StatusTransformer.php @@ -28,8 +28,8 @@ class StatusTransformer extends Fractal\TransformerAbstract 'created_at' => $status->created_at->toJSON(), 'emojis' => [], 'replies_count' => 0, - 'reblogs_count' => $status->reblogs_count, - 'favourites_count' => $status->likes_count, + 'reblogs_count' => $status->reblogs_count ?? 0, + 'favourites_count' => $status->likes_count ?? 0, 'reblogged' => null, 'favourited' => null, 'muted' => null, diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php index c03a501f6..99d7c4a47 100644 --- a/app/Transformer/Api/StatusTransformer.php +++ b/app/Transformer/Api/StatusTransformer.php @@ -25,8 +25,8 @@ class StatusTransformer extends Fractal\TransformerAbstract 'content' => $status->rendered ?? $status->caption, 'created_at' => $status->created_at->format('c'), 'emojis' => [], - 'reblogs_count' => $status->reblogs_count, - 'favourites_count' => $status->likes_count, + 'reblogs_count' => $status->reblogs_count ?? 0, + 'favourites_count' => $status->likes_count ?? 0, 'reblogged' => $status->shared(), 'favourited' => $status->liked(), 'muted' => null, diff --git a/resources/lang/de/helpcenter.php b/resources/lang/de/helpcenter.php new file mode 100644 index 000000000..953193239 --- /dev/null +++ b/resources/lang/de/helpcenter.php @@ -0,0 +1,26 @@ + 'Hilfezentrum', + 'whatsnew' => 'Was gibt\'s Neues', + + 'gettingStarted' => 'Loslegen', + 'sharingMedia' => 'Medien teilen', + 'profile' => 'Profil', + 'stories' => 'Stories', + 'hashtags' => 'Hashtags', + 'discover' => 'Entdecken', + 'directMessages' => 'Privatnachrichten', + 'timelines' => 'Timelines', + 'embed' => 'Einbetten', + + 'communityGuidelines' => 'Community-Richtlinien', + 'whatIsTheFediverse' => 'Was ist das Fediversum?', + 'controllingVisibility' => 'Sichtbarkeit steuern', + 'blockingAccounts' => 'Kontosperrung', + 'safetyTips' => 'Sicherheitstipps', + 'reportSomething' => 'Etwas melden', + 'dataPolicy' => 'Datenpolitik' + +]; diff --git a/resources/lang/de/navmenu.php b/resources/lang/de/navmenu.php index 61a223c85..7408e455d 100644 --- a/resources/lang/de/navmenu.php +++ b/resources/lang/de/navmenu.php @@ -2,7 +2,13 @@ return [ + 'search' => 'Suche', + 'home' => 'Heim', + 'local' => 'Lokal', + 'network' => 'Netzwerk', + 'discover' => 'Entdecken', 'viewMyProfile' => 'Mein Profil anschauen', + 'myProfile' => 'Mein Profil', 'myTimeline' => 'Meine Timeline', 'publicTimeline' => 'Öffentliche Timeline', 'remoteFollow' => 'Aus der Ferne folgen', diff --git a/resources/lang/de/notification.php b/resources/lang/de/notification.php index f57f22e83..e08d6aea5 100644 --- a/resources/lang/de/notification.php +++ b/resources/lang/de/notification.php @@ -3,8 +3,10 @@ return [ 'likedPhoto' => 'gefällt dein Foto.', + 'likedComment' => 'gefällt dein Kommentar.', 'startedFollowingYou' => 'folgt dir nun.', 'commented' => 'hat deinen Post kommentiert.', 'mentionedYou' => 'hat dich erwähnt.', + 'shared' => 'hat deinen Post teilen.', ]; diff --git a/resources/lang/de/profile.php b/resources/lang/de/profile.php index 89d22473c..44aa5fa50 100644 --- a/resources/lang/de/profile.php +++ b/resources/lang/de/profile.php @@ -9,4 +9,7 @@ return [ 'privateProfileWarning' => 'Dieser Account ist privat', 'alreadyFollow' => ':username bereits folgen?', 'loginToSeeProfile' => 'um deren Bilder und Videos zu sehen.', + + 'status.disabled.header' => 'Profil nicht verfügbar', + 'status.disabled.body' => 'Entschuldigung, dieses Profil ist im Moment nicht verfügbar. Bitte versuchen Sie es später noch einmal.', ]; diff --git a/resources/lang/de/site.php b/resources/lang/de/site.php index 9c3cabf56..c91a1bb39 100644 --- a/resources/lang/de/site.php +++ b/resources/lang/de/site.php @@ -12,5 +12,8 @@ return [ 'l10nWip' => 'Wir arbeiten noch an der Unterstützung weiterer Sprachen', 'currentLocale' => 'Aktuelle Sprache', 'selectLocale' => 'Wähle eine der unterstützten Sprachen aus', - + 'contact' => 'Kontakt', + 'contact-us' => 'Kontaktiere uns', + 'places' => 'Plätze', + ]; diff --git a/resources/lang/en/site.php b/resources/lang/en/site.php index f28f57459..2aa54ef82 100644 --- a/resources/lang/en/site.php +++ b/resources/lang/en/site.php @@ -2,17 +2,18 @@ return [ - 'about' => 'About', - 'help' => 'Help', - 'language' => 'Language', - 'fediverse' => 'Fediverse', - 'opensource' => 'Open Source', - 'terms' => 'Terms', - 'privacy' => 'Privacy', - 'l10nWip' => 'We’re still working on localization support', - 'currentLocale' => 'Current locale', - 'selectLocale' => 'Select one of the supported languages', - 'contact' => 'Contact', - 'contact-us' => 'Contact Us', + 'about' => 'About', + 'help' => 'Help', + 'language' => 'Language', + 'fediverse' => 'Fediverse', + 'opensource' => 'Open Source', + 'terms' => 'Terms', + 'privacy' => 'Privacy', + 'l10nWip' => 'We’re still working on localization support', + 'currentLocale' => 'Current locale', + 'selectLocale' => 'Select one of the supported languages', + 'contact' => 'Contact', + 'contact-us' => 'Contact Us', + 'places' => 'Places', ]; diff --git a/resources/lang/sv/helpcenter.php b/resources/lang/sv/helpcenter.php new file mode 100644 index 000000000..a09500654 --- /dev/null +++ b/resources/lang/sv/helpcenter.php @@ -0,0 +1,26 @@ + 'Hjälpcenter', + 'whatsnew' => 'Vad är nytt', + + 'gettingStarted' => 'Komma igång', + 'sharingMedia' => 'Sharing Media', + 'profile' => 'Profil', + 'stories' => 'Stories', + 'hashtags' => 'Hashtags', + 'discover' => 'Upptäck', + 'directMessages' => 'Direktmeddelanden', + 'timelines' => 'Tidslinjer', + 'embed' => 'Bädda in', + + 'communityGuidelines' => 'Riktlinjer för communityt', + 'whatIsTheFediverse' => 'Vad är fediversumet?', + 'controllingVisibility' => 'Kontrollera synlighet', + 'blockingAccounts' => 'Blocka konton', + 'safetyTips' => 'Säkerhetstips', + 'reportSomething' => 'Rapportera någonting', + 'dataPolicy' => 'Datapolicy' + +]; diff --git a/resources/lang/sv/navmenu.php b/resources/lang/sv/navmenu.php new file mode 100644 index 000000000..1a0a4a3e8 --- /dev/null +++ b/resources/lang/sv/navmenu.php @@ -0,0 +1,20 @@ + 'Sök', + 'home' => 'Hem', + 'local' => 'Lokal', + 'network' => 'Nätverk', + 'discover' => 'Upptäck', + 'viewMyProfile' => 'Se min profil', + 'myProfile' => 'Min Profil', + 'myTimeline' => 'Min Tidslinje', + 'publicTimeline' => 'Publik Tidslinje', + 'remoteFollow' => 'Remote-följ', + 'settings' => 'Inställningar', + 'admin' => 'Admin', + 'logout' => 'Logga ut', + 'directMessages' => 'Meddelanden', + +]; diff --git a/resources/lang/sv/notification.php b/resources/lang/sv/notification.php index 36da5c263..206d79c97 100644 --- a/resources/lang/sv/notification.php +++ b/resources/lang/sv/notification.php @@ -2,7 +2,11 @@ return [ - 'likedPhoto' => 'gillade ditt foto.', + 'likedPhoto' => 'gillade ditt inlägg.', + 'likedComment' => 'gillade din kommentar.', 'startedFollowingYou' => 'började följa dig.', + 'commented' => 'kommenterade ditt inlägg.', + 'mentionedYou' => 'nämnde dig.', + 'shared' => 'delade ditt inlägg.', ]; diff --git a/resources/lang/sv/profile.php b/resources/lang/sv/profile.php index 26891208c..a4cce9e34 100644 --- a/resources/lang/sv/profile.php +++ b/resources/lang/sv/profile.php @@ -1,8 +1,16 @@ 'Den här användaren har inga inlägg än!', - 'emptyFollowers' => 'Den här användaren har inga följare än!', - 'emptyFollowing' => 'Den här användaren följer inte någon än!', - 'savedWarning' => 'Du är den enda som kan se vad du har sparat', + 'emptyTimeline' => 'Den här användaren har inga inlägg än!', + 'emptyFollowers' => 'Den här användaren har inga följare än!', + 'emptyFollowing' => 'Den här användaren följer inte någon än!', + 'emptySaved' => 'Du har inte sparat några inlägg än!', + 'savedWarning' => 'Du är den enda som kan se vad du har sparat', + 'privateProfileWarning' => 'Det här kontot är privat', + 'alreadyFollow' => 'Följer du redan :username?', + 'loginToSeeProfile' => 'för att se hens foton och videos.', + + 'status.disabled.header' => 'Profilen är otillgänglig', + 'status.disabled.body' => 'Förlåt, men den här profilen är otillgänglig just nu. Försök igen om en stund.', + ]; diff --git a/resources/lang/sv/site.php b/resources/lang/sv/site.php new file mode 100644 index 000000000..1411903d5 --- /dev/null +++ b/resources/lang/sv/site.php @@ -0,0 +1,19 @@ + 'Om', + 'help' => 'Hjälp', + 'language' => 'Språk', + 'fediverse' => 'Fediversum', + 'opensource' => 'Öppen källkod', + 'terms' => 'Villkor', + 'privacy' => 'Integritet', + 'l10nWip' => 'Vi jobbar fortfarande med lokalisering', + 'currentLocale' => 'Nuvarande locale', + 'selectLocale' => 'Välj ett av de språk som stöds', + 'contact' => 'Kontakt', + 'contact-us' => 'Kontakta oss', + 'places' => 'Platser', + +]; diff --git a/resources/views/layouts/partial/footer.blade.php b/resources/views/layouts/partial/footer.blade.php index 9206380a1..475641945 100644 --- a/resources/views/layouts/partial/footer.blade.php +++ b/resources/views/layouts/partial/footer.blade.php @@ -8,7 +8,7 @@ {{__('site.help')}} {{__('site.terms')}} {{__('site.privacy')}} - Places + {{__('site.places')}} {{__('site.language')}} Powered by Pixelfed