From 8e033b3228fbab9324cf3b5e3e98b8e7596ac13e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:34:39 -0600 Subject: [PATCH 01/35] Update CollectionController --- app/Http/Controllers/CollectionController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CollectionController.php b/app/Http/Controllers/CollectionController.php index 884064759..c2c62350d 100644 --- a/app/Http/Controllers/CollectionController.php +++ b/app/Http/Controllers/CollectionController.php @@ -34,7 +34,7 @@ class CollectionController extends Controller public function show(Request $request, int $collection) { - $collection = Collection::whereNotNull('published_at')->findOrFail($collection); + $collection = Collection::with('profile')->whereNotNull('published_at')->findOrFail($collection); if($collection->profile->status != null) { abort(404); } @@ -100,7 +100,11 @@ class CollectionController extends Controller $collection->items()->delete(); $collection->delete(); - return 200; + if($request->wantsJson()) { + return 200; + } + + return redirect('/'); } public function storeId(Request $request) From 396848b20bc5e6d16fe5fb6853ead6e1c4054925 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:35:39 -0600 Subject: [PATCH 02/35] Update Media, Profile models, fix S3 urls --- app/Media.php | 4 ++-- app/Profile.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Media.php b/app/Media.php index 499d95b61..8c3de944b 100644 --- a/app/Media.php +++ b/app/Media.php @@ -34,10 +34,10 @@ class Media extends Model $url = $this->remote_url; } else { $path = $this->media_path; - $url = $this->cdn_url ?? Storage::url($path); + $url = $this->cdn_url ?? config('app.url') . Storage::url($path); } - return url($url); + return $url; } public function thumbnailUrl() diff --git a/app/Profile.php b/app/Profile.php index e46bedeed..e01ad368b 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -140,7 +140,7 @@ class Profile extends Model $version = hash('sha256', $avatar->change_count); $path = "{$path}?v={$version}"; - return url(Storage::url($path)); + return config('app.url') . Storage::url($path); }); return $url; From ce1d6630d7cfabc96a618b1f610ab42e0421cdde Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:36:54 -0600 Subject: [PATCH 03/35] Update AP ProfileTransformer --- app/Transformer/ActivityPub/ProfileTransformer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Transformer/ActivityPub/ProfileTransformer.php b/app/Transformer/ActivityPub/ProfileTransformer.php index 97617bdf0..8172e3773 100644 --- a/app/Transformer/ActivityPub/ProfileTransformer.php +++ b/app/Transformer/ActivityPub/ProfileTransformer.php @@ -15,6 +15,9 @@ class ProfileTransformer extends Fractal\TransformerAbstract 'https://w3id.org/security/v1', [ 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', + 'PropertyValue' => 'schema:PropertyValue', + 'schema' => 'http://schema.org#', + 'value' => 'schema:value' ], ], 'id' => $profile->permalink(), From f47cd884384a050748c829454c9f8fe3fa161869 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:37:14 -0600 Subject: [PATCH 04/35] Update AnnounceTransformer --- app/Transformer/ActivityPub/Verb/Announce.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/Transformer/ActivityPub/Verb/Announce.php b/app/Transformer/ActivityPub/Verb/Announce.php index 682885b77..30330c91f 100644 --- a/app/Transformer/ActivityPub/Verb/Announce.php +++ b/app/Transformer/ActivityPub/Verb/Announce.php @@ -7,20 +7,20 @@ use League\Fractal; class Announce extends Fractal\TransformerAbstract { - public function transform(Status $status) - { - return [ - '@context' => 'https://www.w3.org/ns/activitystreams', - 'id' => $status->permalink(), - 'type' => 'Announce', - 'actor' => $status->profile->permalink(), - 'to' => ['https://www.w3.org/ns/activitystreams#Public'], - 'cc' => [ - $status->profile->permalink(), - $status->profile->follower_url ?? $status->profile->permalink('/followers') - ], - 'published' => $status->created_at->format(DATE_ISO8601), - 'object' => $status->parent()->url(), - ]; - } + public function transform(Status $status) + { + return [ + '@context' => 'https://www.w3.org/ns/activitystreams', + 'id' => $status->permalink(), + 'type' => 'Announce', + 'actor' => $status->profile->permalink(), + 'to' => ['https://www.w3.org/ns/activitystreams#Public'], + 'cc' => [ + $status->profile->permalink(), + $status->profile->follower_url ?? $status->profile->permalink('/followers') + ], + 'published' => $status->created_at->format(DATE_ISO8601), + 'object' => $status->parent()->url(), + ]; + } } \ No newline at end of file From 3e5af1b98a0e8a65b9bca5c29f86540715ee2d37 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:37:42 -0600 Subject: [PATCH 05/35] Add DirectMessageTransformer --- .../Api/DirectMessageTransformer.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/Transformer/Api/DirectMessageTransformer.php diff --git a/app/Transformer/Api/DirectMessageTransformer.php b/app/Transformer/Api/DirectMessageTransformer.php new file mode 100644 index 000000000..d17f08527 --- /dev/null +++ b/app/Transformer/Api/DirectMessageTransformer.php @@ -0,0 +1,23 @@ + $dm->id, + 'to_id' => $dm->to_id, + 'from_id' => $dm->from_id, + 'from_profile_ids' => $dm->from_profile_ids, + 'group_message' => $dm->group_message, + 'status_id' => $dm->status_id, + 'read_at' => $dm->read_at, + 'created_at' => $dm->created_at + ]; + } +} From bd7cad99848fa68b4072d4991dfb69b610cbece2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:38:26 -0600 Subject: [PATCH 06/35] Update Image util --- app/Util/Media/Image.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Util/Media/Image.php b/app/Util/Media/Image.php index e519b4714..feabbd260 100644 --- a/app/Util/Media/Image.php +++ b/app/Util/Media/Image.php @@ -110,14 +110,15 @@ class Image $orientation = $ratio['orientation']; try { - $img = Intervention::make($file)->orientate(); + $img = Intervention::make($file); + $metadata = $img->exif(); + $img->orientate(); if($thumbnail) { $img->resize($aspect['width'], $aspect['height'], function ($constraint) { $constraint->aspectRatio(); }); } else { if(config('media.exif.database', false) == true) { - $metadata = $img->exif(); $media->metadata = json_encode($metadata); } From 5a1aba18bcda165a3ef6d92b3ddaa14fcfdb52f1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:39:50 -0600 Subject: [PATCH 07/35] Update app.js --- resources/assets/js/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index ad0c293af..2f5022e35 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -11,5 +11,11 @@ let token = document.head.querySelector('meta[name="csrf-token"]'); if (token) { window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; } else { - console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); + console.error('CSRF token not found.'); } + +window.App = {}; + +window.App.boot = function() { + new Vue({ el: '#content'}); +} \ No newline at end of file From 9082dd7f8084d10e8ebb080837f284e2ddab413b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:40:08 -0600 Subject: [PATCH 08/35] Update components.js --- resources/assets/js/components.js | 119 ------------------------------ 1 file changed, 119 deletions(-) diff --git a/resources/assets/js/components.js b/resources/assets/js/components.js index a4dbf0613..026b496fe 100644 --- a/resources/assets/js/components.js +++ b/resources/assets/js/components.js @@ -3,7 +3,6 @@ import BootstrapVue from 'bootstrap-vue' import InfiniteLoading from 'vue-infinite-loading'; import Loading from 'vue-loading-overlay'; import VueTimeago from 'vue-timeago'; -//import {Howl, Howler} from 'howler'; Vue.use(BootstrapVue); Vue.use(InfiniteLoading); @@ -36,126 +35,8 @@ try { } window.filesize = require('filesize'); -// window.Plyr = require('plyr'); import swal from 'sweetalert'; -// require('./components/localstorage'); -// require('./components/commentform'); -//require('./components/searchform'); -// require('./components/bookmarkform'); -// require('./components/statusform'); -//require('./components/embed'); -//require('./components/notifications'); - -// import Echo from "laravel-echo" - -// window.io = require('socket.io-client'); - -// window.pixelfed.bootEcho = function() { -// window.Echo = new Echo({ -// broadcaster: 'socket.io', -// host: window.location.hostname + ':2096', -// auth: { -// headers: { -// Authorization: 'Bearer ' + token.content, -// }, -// }, -// }); -// } - -// Initialize Notification Helper -window.pixelfed.n = {}; - -// Vue.component( -// 'search-results', -// require('./components/SearchResults.vue').default -// ); - -// Vue.component( -// 'photo-presenter', -// require('./components/presenter/PhotoPresenter.vue').default -// ); - -// Vue.component( -// 'video-presenter', -// require('./components/presenter/VideoPresenter.vue').default -// ); - -// Vue.component( -// 'photo-album-presenter', -// require('./components/presenter/PhotoAlbumPresenter.vue').default -// ); - -// Vue.component( -// 'video-album-presenter', -// require('./components/presenter/VideoAlbumPresenter.vue').default -// ); - -// Vue.component( -// 'mixed-album-presenter', -// require('./components/presenter/MixedAlbumPresenter.vue').default -// ); - -// Vue.component( -// 'post-menu', -// require('./components/PostMenu.vue').default -// ); - - -// Vue.component( -// 'passport-clients', -// require('./components/passport/Clients.vue').default -// ); - -// Vue.component( -// 'passport-authorized-clients', -// require('./components/passport/AuthorizedClients.vue').default -// ); - -// Vue.component( -// 'passport-personal-access-tokens', -// require('./components/passport/PersonalAccessTokens.vue').default -// ); - - - -// Vue.component( -// 'follow-suggestions', -// require('./components/FollowSuggestions.vue').default -// ); - -// Vue.component( -// 'circle-panel', -// require('./components/CirclePanel.vue') -// ); - -// Vue.component( -// 'story-compose', -// require('./components/StoryCompose.vue').default -// ); - -//import 'promise-polyfill/src/polyfill'; - -// window.pixelfed.copyToClipboard = (str) => { -// const el = document.createElement('textarea'); -// el.value = str; -// el.setAttribute('readonly', ''); -// el.style.position = 'absolute'; -// el.style.left = '-9999px'; -// document.body.appendChild(el); -// const selected = -// document.getSelection().rangeCount > 0 -// ? document.getSelection().getRangeAt(0) -// : false; -// el.select(); -// document.execCommand('copy'); -// document.body.removeChild(el); -// if (selected) { -// document.getSelection().removeAllRanges(); -// document.getSelection().addRange(selected); -// } -// }; - $(document).ready(function() { $(function () { $('[data-toggle="tooltip"]').tooltip() From d26da6af9597b4136e700acc318b115e842bf979 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:41:25 -0600 Subject: [PATCH 09/35] Update CollectionComponent --- .../js/components/CollectionComponent.vue | 197 +++++++++++++++--- 1 file changed, 172 insertions(+), 25 deletions(-) diff --git a/resources/assets/js/components/CollectionComponent.vue b/resources/assets/js/components/CollectionComponent.vue index 53d9739b8..733601ba0 100644 --- a/resources/assets/js/components/CollectionComponent.vue +++ b/resources/assets/js/components/CollectionComponent.vue @@ -1,47 +1,121 @@ - + \ No newline at end of file From 4c30ad49409d2a56fdeffc0b7f5226651ad480aa Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 2 Aug 2019 02:14:30 -0600 Subject: [PATCH 10/35] Update base layouts --- app/Util/Site/Config.php | 47 +++++++++++++++++++++++++ resources/assets/js/app.js | 2 +- resources/views/layouts/anon.blade.php | 2 ++ resources/views/layouts/app.blade.php | 8 +++-- resources/views/layouts/blank.blade.php | 3 ++ resources/views/site/index.blade.php | 1 + resources/views/timeline/home.blade.php | 6 +--- 7 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 app/Util/Site/Config.php diff --git a/app/Util/Site/Config.php b/app/Util/Site/Config.php new file mode 100644 index 000000000..3e6c5351f --- /dev/null +++ b/app/Util/Site/Config.php @@ -0,0 +1,47 @@ +addMinutes(30), function() { + return [ + 'uploader' => [ + 'max_photo_size' => config('pixelfed.max_photo_size'), + 'max_caption_length' => config('pixelfed.max_caption_length'), + 'album_limit' => config('pixelfed.max_album_length'), + 'image_quality' => config('pixelfed.image_quality'), + + 'optimize_image' => config('pixelfed.optimize_image'), + 'optimize_video' => config('pixelfed.optimize_video'), + + 'media_types' => config('pixelfed.media_types'), + 'enforce_account_limit' => config('pixelfed.enforce_account_limit') + ], + + 'activitypub' => [ + 'enabled' => config('federation.activitypub.enabled'), + 'remote_follow' => config('federation.activitypub.remoteFollow') + ], + + 'ab' => [ + 'lc' => config('exp.lc'), + 'rec' => config('exp.rec'), + 'loops' => config('exp.loops') + ], + + 'site' => [ + 'domain' => config('pixelfed.domain.app'), + 'url' => config('app.url') + ] + ]; + }); + } + + public static function json() { + return json_encode(self::get(), JSON_FORCE_OBJECT); + } +} diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 2f5022e35..b16d71c3b 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -14,7 +14,7 @@ if (token) { console.error('CSRF token not found.'); } -window.App = {}; +window.App = window.App || {}; window.App.boot = function() { new Vue({ el: '#content'}); diff --git a/resources/views/layouts/anon.blade.php b/resources/views/layouts/anon.blade.php index f2e0a7f22..03affd7a9 100644 --- a/resources/views/layouts/anon.blade.php +++ b/resources/views/layouts/anon.blade.php @@ -27,6 +27,8 @@ @stack('styles') + + @include('layouts.partial.noauthnav') diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d786a970f..947a70011 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,7 +1,6 @@ - @@ -25,12 +24,17 @@ @if(request()->cookie('dark-mode')) + @else + @endif + @stack('styles') - + + + @include('layouts.partial.nav') diff --git a/resources/views/layouts/blank.blade.php b/resources/views/layouts/blank.blade.php index a7d5a4f62..24f4bd6f3 100644 --- a/resources/views/layouts/blank.blade.php +++ b/resources/views/layouts/blank.blade.php @@ -25,6 +25,9 @@ @stack('styles') + + +
diff --git a/resources/views/site/index.blade.php b/resources/views/site/index.blade.php index 7588468fa..c64f57e12 100644 --- a/resources/views/site/index.blade.php +++ b/resources/views/site/index.blade.php @@ -23,6 +23,7 @@ +
diff --git a/resources/views/timeline/home.blade.php b/resources/views/timeline/home.blade.php index 6c7f129aa..19be8df98 100644 --- a/resources/views/timeline/home.blade.php +++ b/resources/views/timeline/home.blade.php @@ -9,9 +9,5 @@ @push('scripts') - + @endpush \ No newline at end of file From 69ab8e94310bd532c61da6d32f844d63aab66900 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 2 Aug 2019 23:16:16 -0600 Subject: [PATCH 11/35] Update Profile.vue --- resources/assets/js/components/Profile.vue | 432 +++++++++------------ 1 file changed, 191 insertions(+), 241 deletions(-) diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index deccf4e76..ce7a86541 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -1,5 +1,19 @@