From 372a28c56a3895b4d2c71c60964900d270c02779 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 1 Apr 2019 21:15:34 -0600 Subject: [PATCH 01/26] Update FederationController --- app/Http/Controllers/FederationController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 3de6a0ac..95dbb461 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -35,8 +35,8 @@ class FederationController extends Controller { $this->authCheck(); $this->validate($request, [ - 'acct' => 'required|string|min:3|max:255', - ]); + 'acct' => 'required|string|min:3|max:255', + ]); $acct = $request->input('acct'); $nickname = Nickname::normalizeProfileUrl($acct); @@ -63,6 +63,11 @@ class FederationController extends Controller $follower = Auth::user()->profile; $url = $request->input('url'); + $url = Helpers::validateUrl($url); + + if(!$url) { + return; + } RemoteFollowPipeline::dispatch($follower, $url); From f30ab46de560e99c09eb2d09356d057547c419ae Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 1 Apr 2019 21:18:39 -0600 Subject: [PATCH 02/26] Update CommentController --- app/Http/Controllers/CommentController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index e42c2d0e..3dabaab4 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -9,6 +9,7 @@ use Cache; use App\Comment; use App\Jobs\CommentPipeline\CommentPipeline; use App\Jobs\StatusPipeline\NewStatusPipeline; +use App\Util\Lexer\Autolink; use App\Profile; use App\Status; use League\Fractal; @@ -53,10 +54,11 @@ class CommentController extends Controller Cache::forget('transform:status:'.$status->url()); + $autolink = Autolink::create()->autolink($comment); $reply = new Status(); $reply->profile_id = $profile->id; $reply->caption = e($comment); - $reply->rendered = $comment; + $reply->rendered = $autolink; $reply->in_reply_to_id = $status->id; $reply->in_reply_to_profile_id = $status->profile_id; $reply->save(); From 8ed62286d264fa669646dcc123c4dcd760546df6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 1 Apr 2019 21:21:44 -0600 Subject: [PATCH 03/26] Update search results view --- resources/views/search/results.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/views/search/results.blade.php b/resources/views/search/results.blade.php index 25be4394..6684be80 100644 --- a/resources/views/search/results.blade.php +++ b/resources/views/search/results.blade.php @@ -1,10 +1,11 @@ @extends('layouts.app') @section('content') - + @endsection @push('scripts') + + - - diff --git a/resources/assets/sass/landing.scss b/resources/assets/sass/landing.scss new file mode 100644 index 00000000..cfac351b --- /dev/null +++ b/resources/assets/sass/landing.scss @@ -0,0 +1,13 @@ +// Landing Page bundle + +@import 'variables'; +@import '~bootstrap/scss/bootstrap'; +@import 'custom'; +@import 'landing/carousel'; +@import 'landing/devices'; + +.container.slim { + width: auto; + max-width: 680px; + padding: 0 15px; +} \ No newline at end of file diff --git a/resources/assets/sass/landing/carousel.scss b/resources/assets/sass/landing/carousel.scss new file mode 100644 index 00000000..13e3bb4d --- /dev/null +++ b/resources/assets/sass/landing/carousel.scss @@ -0,0 +1,126 @@ +@-webkit-keyframes iosDeviceCarousel { + 0% { + opacity:1; + } + 17% { + opacity:1; + } + 25% { + opacity:0; + } + 92% { + opacity:0; + } + 100% { + opacity:1; + } +} + +@-moz-keyframes iosDeviceCarousel { + 0% { + opacity:1; + } + 17% { + opacity:1; + } + 25% { + opacity:0; + } + 92% { + opacity:0; + } + 100% { + opacity:1; + } +} + +@-o-keyframes iosDeviceCarousel { + 0% { + opacity:1; + } + 17% { + opacity:1; + } + 25% { + opacity:0; + } + 92% { + opacity:0; + } + 100% { + opacity:1; + } +} + +@keyframes iosDeviceCarousel { + 0% { + opacity:1; + } + 17% { + opacity:1; + } + 25% { + opacity:0; + } + 92% { + opacity:0; + } + 100% { + opacity:1; + } +} + +#iosDevice { + position:relative; + margin:0 auto; +} +#iosDevice img { + position:absolute; + left:0; +} + +#iosDevice img { + -webkit-animation-name: iosDeviceCarousel; + -webkit-animation-timing-function: ease-in-out; + -webkit-animation-iteration-count: infinite; + -webkit-animation-duration: 16s; + + -moz-animation-name: iosDeviceCarousel; + -moz-animation-timing-function: ease-in-out; + -moz-animation-iteration-count: infinite; + -moz-animation-duration: 16s; + + -o-animation-name: iosDeviceCarousel; + -o-animation-timing-function: ease-in-out; + -o-animation-iteration-count: infinite; + -o-animation-duration: 16s; + + animation-name: iosDeviceCarousel; + animation-timing-function: ease-in-out; + animation-iteration-count: infinite; + animation-duration: 16s; +} +#iosDevice img:nth-of-type(1) { + -webkit-animation-delay: 12s; + -moz-animation-delay: 12s; + -o-animation-delay: 12s; + animation-delay: 12s; +} +#iosDevice img:nth-of-type(2) { + -webkit-animation-delay: 8s; + -moz-animation-delay: 8s; + -o-animation-delay: 8s; + animation-delay: 8s; +} +#iosDevice img:nth-of-type(3) { + -webkit-animation-delay: 4s; + -moz-animation-delay: 4s; + -o-animation-delay: 4s; + animation-delay: 4s; +} +#iosDevice img:nth-of-type(4) { + -webkit-animation-delay: 0; + -moz-animation-delay: 0; + -o-animation-delay: 0; + animation-delay: 0; +} \ No newline at end of file diff --git a/resources/assets/sass/landing/devices.scss b/resources/assets/sass/landing/devices.scss new file mode 100644 index 00000000..9b25ec4e --- /dev/null +++ b/resources/assets/sass/landing/devices.scss @@ -0,0 +1,593 @@ +.marvel-device { + display: inline-block; + position: relative; + -webkit-box-sizing: content-box !important; + box-sizing: content-box !important +} + +.marvel-device .screen { + width: 100%; + position: relative; + height: 100%; + z-index: 3; + background: white; + overflow: hidden; + display: block; + border-radius: 1px; + -webkit-box-shadow: 0 0 0 3px #111; + box-shadow: 0 0 0 3px #111 +} + +.marvel-device .top-bar, +.marvel-device .bottom-bar { + height: 3px; + background: black; + width: 100%; + display: block +} + +.marvel-device .middle-bar { + width: 3px; + height: 4px; + top: 0px; + left: 90px; + background: black; + position: absolute +} + +.marvel-device.iphone-x { + width: 375px; + height: 812px; + padding: 26px; + background: #fdfdfd; + -webkit-box-shadow: inset 0 0 11px 0 black; + box-shadow: inset 0 0 11px 0 black; + border-radius: 66px +} + +.marvel-device.iphone-x .overflow { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + border-radius: 66px; + overflow: hidden +} + +.marvel-device.iphone-x .shadow { + border-radius: 100%; + width: 90px; + height: 90px; + position: absolute; + background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, rgba(255, 255, 255, 0) 60%) +} + +.marvel-device.iphone-x .shadow--tl { + top: -20px; + left: -20px +} + +.marvel-device.iphone-x .shadow--tr { + top: -20px; + right: -20px +} + +.marvel-device.iphone-x .shadow--bl { + bottom: -20px; + left: -20px +} + +.marvel-device.iphone-x .shadow--br { + bottom: -20px; + right: -20px +} + +.marvel-device.iphone-x:before { + width: calc(100% - 10px); + height: calc(100% - 10px); + position: absolute; + top: 5px; + content: ''; + left: 5px; + border-radius: 61px; + background: black; + z-index: 1 +} + +.marvel-device.iphone-x .inner-shadow { + width: calc(100% - 20px); + height: calc(100% - 20px); + position: absolute; + top: 10px; + overflow: hidden; + left: 10px; + border-radius: 56px; + -webkit-box-shadow: inset 0 0 15px 0 rgba(255, 255, 255, 0.66); + box-shadow: inset 0 0 15px 0 rgba(255, 255, 255, 0.66); + z-index: 1 +} + +.marvel-device.iphone-x .inner-shadow:before { + -webkit-box-shadow: inset 0 0 20px 0 #FFFFFF; + box-shadow: inset 0 0 20px 0 #FFFFFF; + width: 100%; + height: 116%; + position: absolute; + top: -8%; + content: ''; + left: 0; + border-radius: 200px / 112px; + z-index: 2 +} + +.marvel-device.iphone-x .screen { + border-radius: 40px; + -webkit-box-shadow: none; + box-shadow: none +} + +.marvel-device.iphone-x .top-bar, +.marvel-device.iphone-x .bottom-bar { + width: 100%; + position: absolute; + height: 8px; + background: rgba(0, 0, 0, 0.1); + left: 0 +} + +.marvel-device.iphone-x .top-bar { + top: 80px +} + +.marvel-device.iphone-x .bottom-bar { + bottom: 80px +} + +.marvel-device.iphone-x .volume, +.marvel-device.iphone-x .volume:before, +.marvel-device.iphone-x .volume:after, +.marvel-device.iphone-x .sleep { + width: 3px; + background: #b5b5b5; + position: absolute +} + +.marvel-device.iphone-x .volume { + left: -3px; + top: 116px; + height: 32px +} + +.marvel-device.iphone-x .volume:before { + height: 62px; + top: 62px; + content: ''; + left: 0 +} + +.marvel-device.iphone-x .volume:after { + height: 62px; + top: 140px; + content: ''; + left: 0 +} + +.marvel-device.iphone-x .sleep { + height: 96px; + top: 200px; + right: -3px +} + +.marvel-device.iphone-x .camera { + width: 6px; + height: 6px; + top: 9px; + border-radius: 100%; + position: absolute; + left: 154px; + background: #0d4d71 +} + +.marvel-device.iphone-x .speaker { + height: 6px; + width: 60px; + left: 50%; + position: absolute; + top: 9px; + margin-left: -30px; + background: #171818; + border-radius: 6px +} + +.marvel-device.iphone-x .notch { + position: absolute; + width: 210px; + height: 30px; + top: 26px; + left: 108px; + z-index: 4; + background: black; + border-bottom-left-radius: 24px; + border-bottom-right-radius: 24px +} + +.marvel-device.iphone-x .notch:before, +.marvel-device.iphone-x .notch:after { + content: ''; + height: 8px; + position: absolute; + top: 0; + width: 8px +} + +.marvel-device.iphone-x .notch:after { + background: radial-gradient(circle at bottom left, transparent 0, transparent 70%, black 70%, black 100%); + left: -8px +} + +.marvel-device.iphone-x .notch:before { + background: radial-gradient(circle at bottom right, transparent 0, transparent 70%, black 70%, black 100%); + right: -8px +} + +.marvel-device.iphone-x.landscape { + height: 375px; + width: 812px +} + +.marvel-device.iphone-x.landscape .top-bar, +.marvel-device.iphone-x.landscape .bottom-bar { + width: 8px; + height: 100%; + top: 0 +} + +.marvel-device.iphone-x.landscape .top-bar { + left: 80px +} + +.marvel-device.iphone-x.landscape .bottom-bar { + right: 80px; + bottom: auto; + left: auto +} + +.marvel-device.iphone-x.landscape .volume, +.marvel-device.iphone-x.landscape .volume:before, +.marvel-device.iphone-x.landscape .volume:after, +.marvel-device.iphone-x.landscape .sleep { + height: 3px +} + +.marvel-device.iphone-x.landscape .inner-shadow:before { + height: 100%; + width: 116%; + left: -8%; + top: 0; + border-radius: 112px / 200px +} + +.marvel-device.iphone-x.landscape .volume { + bottom: -3px; + top: auto; + left: 116px; + width: 32px +} + +.marvel-device.iphone-x.landscape .volume:before { + width: 62px; + left: 62px; + top: 0 +} + +.marvel-device.iphone-x.landscape .volume:after { + width: 62px; + left: 140px; + top: 0 +} + +.marvel-device.iphone-x.landscape .sleep { + width: 96px; + left: 200px; + top: -3px; + right: auto +} + +.marvel-device.iphone-x.landscape .camera { + left: 9px; + bottom: 154px; + top: auto +} + +.marvel-device.iphone-x.landscape .speaker { + width: 6px; + height: 60px; + left: 9px; + top: 50%; + margin-top: -30px; + margin-left: 0 +} + +.marvel-device.iphone-x.landscape .notch { + height: 210px; + width: 30px; + left: 26px; + bottom: 108px; + top: auto; + border-top-right-radius: 24px; + border-bottom-right-radius: 24px; + border-bottom-left-radius: 0 +} + +.marvel-device.iphone-x.landscape .notch:before, +.marvel-device.iphone-x.landscape .notch:after { + left: 0 +} + +.marvel-device.iphone-x.landscape .notch:after { + background: radial-gradient(circle at bottom right, transparent 0, transparent 70%, black 70%, black 100%); + bottom: -8px; + top: auto +} + +.marvel-device.iphone-x.landscape .notch:before { + background: radial-gradient(circle at top right, transparent 0, transparent 70%, black 70%, black 100%); + top: -8px +} + +.marvel-device.note8 { + width: 400px; + height: 822px; + background: black; + border-radius: 34px; + padding: 45px 10px +} + +.marvel-device.note8 .overflow { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + border-radius: 34px; + overflow: hidden +} + +.marvel-device.note8 .speaker { + height: 8px; + width: 56px; + left: 50%; + position: absolute; + top: 25px; + margin-left: -28px; + background: #171818; + z-index: 1; + border-radius: 8px +} + +.marvel-device.note8 .camera { + height: 18px; + width: 18px; + left: 86px; + position: absolute; + top: 18px; + background: #212b36; + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .camera:before { + content: ''; + height: 8px; + width: 8px; + left: -22px; + position: absolute; + top: 5px; + background: #212b36; + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .sensors { + height: 10px; + width: 10px; + left: 120px; + position: absolute; + top: 22px; + background: #1d233b; + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .sensors:before { + content: ''; + height: 10px; + width: 10px; + left: 18px; + position: absolute; + top: 0; + background: #1d233b; + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .more-sensors { + height: 16px; + width: 16px; + left: 285px; + position: absolute; + top: 18px; + background: #33244a; + -webkit-box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1); + box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1); + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .more-sensors:before { + content: ''; + height: 11px; + width: 11px; + left: 40px; + position: absolute; + top: 4px; + background: #214a61; + z-index: 1; + border-radius: 100% +} + +.marvel-device.note8 .sleep { + width: 2px; + height: 56px; + background: black; + position: absolute; + top: 288px; + right: -2px +} + +.marvel-device.note8 .volume { + width: 2px; + height: 120px; + background: black; + position: absolute; + top: 168px; + left: -2px +} + +.marvel-device.note8 .volume:before { + content: ''; + top: 168px; + width: 2px; + position: absolute; + left: 0; + background: black; + height: 56px +} + +.marvel-device.note8 .inner { + width: 100%; + height: calc(100% - 8px); + position: absolute; + top: 2px; + content: ''; + left: 0px; + border-radius: 34px; + border-top: 2px solid #9fa0a2; + border-bottom: 2px solid #9fa0a2; + background: black; + z-index: 1; + -webkit-box-shadow: inset 0 0 6px 0 rgba(255, 255, 255, 0.5); + box-shadow: inset 0 0 6px 0 rgba(255, 255, 255, 0.5) +} + +.marvel-device.note8 .shadow { + -webkit-box-shadow: inset 0 0 60px 0 white, inset 0 0 30px 0 rgba(255, 255, 255, 0.5), 0 0 20px 0 white, 0 0 20px 0 rgba(255, 255, 255, 0.5); + box-shadow: inset 0 0 60px 0 white, inset 0 0 30px 0 rgba(255, 255, 255, 0.5), 0 0 20px 0 white, 0 0 20px 0 rgba(255, 255, 255, 0.5); + height: 101%; + position: absolute; + top: -0.5%; + content: ''; + width: calc(100% - 20px); + left: 10px; + border-radius: 38px; + z-index: 5; + pointer-events: none +} + +.marvel-device.note8 .screen { + border-radius: 14px; + -webkit-box-shadow: none; + box-shadow: none +} + +.marvel-device.note8.landscape { + height: 400px; + width: 822px; + padding: 10px 45px +} + +.marvel-device.note8.landscape .speaker { + height: 56px; + width: 8px; + top: 50%; + margin-top: -28px; + margin-left: 0; + right: 25px; + left: auto +} + +.marvel-device.note8.landscape .camera { + top: 86px; + right: 18px; + left: auto +} + +.marvel-device.note8.landscape .camera:before { + top: -22px; + left: 5px +} + +.marvel-device.note8.landscape .sensors { + top: 120px; + right: 22px; + left: auto +} + +.marvel-device.note8.landscape .sensors:before { + top: 18px; + left: 0 +} + +.marvel-device.note8.landscape .more-sensors { + top: 285px; + right: 18px; + left: auto +} + +.marvel-device.note8.landscape .more-sensors:before { + top: 40px; + left: 4px +} + +.marvel-device.note8.landscape .sleep { + bottom: -2px; + top: auto; + right: 288px; + width: 56px; + height: 2px +} + +.marvel-device.note8.landscape .volume { + width: 120px; + height: 2px; + top: -2px; + right: 168px; + left: auto +} + +.marvel-device.note8.landscape .volume:before { + right: 168px; + left: auto; + top: 0; + width: 56px; + height: 2px +} + +.marvel-device.note8.landscape .inner { + height: 100%; + width: calc(100% - 8px); + left: 2px; + top: 0; + border-top: 0; + border-bottom: 0; + border-left: 2px solid #9fa0a2; + border-right: 2px solid #9fa0a2 +} + +.marvel-device.note8.landscape .shadow { + width: 101%; + height: calc(100% - 20px); + left: -0.5%; + top: 10px +} \ No newline at end of file diff --git a/resources/views/site/index.blade.php b/resources/views/site/index.blade.php index 0da3bb69..3751dd38 100644 --- a/resources/views/site/index.blade.php +++ b/resources/views/site/index.blade.php @@ -22,11 +22,157 @@ - +
- +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ +
+
+

Pixelfed

+

Photo sharing for everyone

+
+
+ @if(true === config('pixelfed.open_registration')) +
+ @csrf +
+
+ + + @if ($errors->has('name')) + + {{ $errors->first('name') }} + + @endif +
+
+ +
+
+ + + @if ($errors->has('username')) + + {{ $errors->first('username') }} + + @endif +
+
+ +
+
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+
+ +
+
+ @if(config('pixelfed.recaptcha')) +
+ {!! Recaptcha::render() !!} +
+ @endif +
+
+ +
+
+

By signing up, you agree to our Terms of Use and Privacy Policy.

+
+ @else +
+
+

Registrations are closed.

+

You can find a list of other instances on the-federation.info/pixelfed or fediverse.network/pixelfed

+
+
+ @endif +
+
+
+
+

Have an account? Log in

+
+
+
+
+ +
- - - - - + \ No newline at end of file diff --git a/webpack.mix.js b/webpack.mix.js index 2193d8ec..cd7bea77 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -28,9 +28,6 @@ mix.js('resources/assets/js/app.js', 'public/js') // Timeline component .js('resources/assets/js/timeline.js', 'public/js') -// LandingPage component -.js('resources/assets/js/landing.js', 'public/js') - // ComposeModal component .js('resources/assets/js/compose.js', 'public/js') @@ -43,4 +40,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .sass('resources/assets/sass/appdark.scss', 'public/css', { implementation: require('node-sass') }) +.sass('resources/assets/sass/landing.scss', 'public/css', { + implementation: require('node-sass') +}) .version(); From 2e2a1ac265f6ed565b42f62ec79d515927b23973 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 22:28:09 -0600 Subject: [PATCH 17/26] Remove landing.js --- resources/assets/js/landing.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 resources/assets/js/landing.js diff --git a/resources/assets/js/landing.js b/resources/assets/js/landing.js deleted file mode 100644 index 8c8772a4..00000000 --- a/resources/assets/js/landing.js +++ /dev/null @@ -1,10 +0,0 @@ -window.Vue = require('vue'); - -Vue.component( - 'landing-page', - require('./components/LandingPage.vue').default -); - -new Vue({ - el: '#content' -}); \ No newline at end of file From 6d0a908329ac3764ee077656d0bfeb3d4db073d8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 22:29:15 -0600 Subject: [PATCH 18/26] Fix tests --- tests/Feature/InstalledTest.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/Feature/InstalledTest.php b/tests/Feature/InstalledTest.php index f07a8a50..2627a7f2 100644 --- a/tests/Feature/InstalledTest.php +++ b/tests/Feature/InstalledTest.php @@ -8,13 +8,6 @@ use Illuminate\Foundation\Testing\WithoutMiddleware; class InstalledTest extends TestCase { - /** @test */ - public function landing_page() - { - $response = $this->get('/'); - $response->assertStatus(200); - } - /** @test */ public function nodeinfo_api() { From 1284812f6f46afd2deb82cd334b3e25fab5819cd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 22:55:56 -0600 Subject: [PATCH 19/26] Update SearchController --- app/Http/Controllers/SearchController.php | 93 ++++++++++++++--------- 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 7f371d3b..481f6c1b 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -9,6 +9,11 @@ use App\Status; use Illuminate\Http\Request; use App\Util\ActivityPub\Helpers; use Illuminate\Support\Facades\Cache; +use App\Transformer\Api\{ + AccountTransformer, + HashtagTransformer, + StatusTransformer, +}; class SearchController extends Controller { @@ -22,26 +27,33 @@ class SearchController extends Controller if(mb_strlen($tag) < 3) { return; } + $tag = e(urldecode($tag)); + $hash = hash('sha256', $tag); $tokens = Cache::remember('api:search:tag:'.$hash, now()->addMinutes(5), function () use ($tag) { - $tokens = collect([]); - if(Helpers::validateUrl($tag)) { + $tokens = []; + if(Helpers::validateUrl($tag) != false) { $remote = Helpers::fetchFromUrl($tag); if(isset($remote['type']) && in_array($remote['type'], ['Create', 'Person']) == true) { $type = $remote['type']; if($type == 'Person') { $item = Helpers::profileFirstOrNew($tag); - $tokens->push([[ + $tokens['profiles'] = [[ 'count' => 1, 'url' => $item->url(), 'type' => 'profile', 'value' => $item->username, 'tokens' => [$item->username], 'name' => $item->name, - ]]); + 'entity' => [ + 'id' => $item->id, + 'following' => $item->followedBy(Auth::user()->profile), + 'thumb' => $item->avatarUrl() + ] + ]]; } else if ($type == 'Create') { $item = Helpers::statusFirstOrFetch($tag, false); - $tokens->push([[ + $tokens['posts'] = [[ 'count' => 0, 'url' => $item->url(), 'type' => 'status', @@ -49,10 +61,9 @@ class SearchController extends Controller 'tokens' => [$item->caption], 'name' => $item->caption, 'thumb' => $item->thumb(), - ]]); + ]]; } } - } $hashtags = Hashtag::select('id', 'name', 'slug')->where('slug', 'like', '%'.$tag.'%')->whereHas('posts')->limit(20)->get(); if($hashtags->count() > 0) { @@ -62,37 +73,46 @@ class SearchController extends Controller 'url' => $item->url(), 'type' => 'hashtag', 'value' => $item->name, - 'tokens' => explode('-', $item->name), + 'tokens' => '', 'name' => null, ]; }); - $tokens->push($tags); + $tokens['hashtags'] = $tags; } - $users = Profile::select('username', 'name', 'id') - ->whereNull('status') - ->whereNull('domain') - ->where('username', 'like', '%'.$tag.'%') - //->orWhere('remote_url', $tag) - ->limit(20) - ->get(); - - if($users->count() > 0) { - $profiles = $users->map(function ($item, $key) { - return [ - 'count' => 0, - 'url' => $item->url(), - 'type' => 'profile', - 'value' => $item->username, - 'tokens' => [$item->username], - 'name' => $item->name, - 'id' => $item->id - ]; - }); - $tokens->push($profiles); - } - return $tokens; }); + $users = Profile::select('username', 'name', 'id') + ->whereNull('status') + ->where('id', '!=', Auth::user()->profile->id) + ->where('username', 'like', '%'.$tag.'%') + ->orWhere('remote_url', $tag) + ->limit(20) + ->get(); + + if($users->count() > 0) { + $profiles = $users->map(function ($item, $key) { + return [ + 'count' => 0, + 'url' => $item->url(), + 'type' => 'profile', + 'value' => $item->username, + 'tokens' => [$item->username], + 'name' => $item->name, + 'avatar' => $item->avatarUrl(), + 'id' => $item->id, + 'entity' => [ + 'id' => $item->id, + 'following' => $item->followedBy(Auth::user()->profile), + 'thumb' => $item->avatarUrl() + ] + ]; + }); + if(isset($tokens['profiles'])) { + array_push($tokens['profiles'], $profiles); + } else { + $tokens['profiles'] = $profiles; + } + } $posts = Status::select('id', 'profile_id', 'caption', 'created_at') ->whereHas('media') ->whereNull('in_reply_to_id') @@ -100,7 +120,8 @@ class SearchController extends Controller ->whereProfileId(Auth::user()->profile->id) ->where('caption', 'like', '%'.$tag.'%') ->orWhere('uri', $tag) - ->orderBy('created_at', 'desc') + ->latest() + ->limit(10) ->get(); if($posts->count() > 0) { @@ -115,11 +136,9 @@ class SearchController extends Controller 'thumb' => $item->thumb(), ]; }); - $tokens = $tokens->push($posts); - } - if($tokens->count() > 0) { - $tokens = $tokens[0]; + $tokens['posts'] = $posts; } + return response()->json($tokens); } From 382c00de21906b68497d87b76fab7d97187c0ad2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 22:56:18 -0600 Subject: [PATCH 20/26] Update routes --- routes/web.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/web.php b/routes/web.php index 6c80cbf8..c8888498 100644 --- a/routes/web.php +++ b/routes/web.php @@ -130,6 +130,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('media/preview/{profileId}/{mediaId}', 'ApiController@showTempMedia')->name('temp-media'); + Route::get('results', 'SearchController@results'); + Route::post('visibility', 'StatusController@toggleVisibility'); Route::group(['prefix' => 'report'], function () { Route::get('/', 'ReportController@showForm')->name('report.form'); From eef9e4e5e1e90d24976d3c0e4a2939262d1efc9e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 23:03:16 -0600 Subject: [PATCH 21/26] Update Profile.vue component --- resources/assets/js/components/Profile.vue | 85 +++++++++++++++++----- 1 file changed, 68 insertions(+), 17 deletions(-) diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index aa5f9ebd..0ef3b26d 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -8,33 +8,56 @@
-
- +
+
+
+
+ +
+
+

{{profile.username}}

+

+ Edit Profile +

+
+

+ +

+

+ +

+
+
+
+
+
+ +
-
- {{profile.username}} +
+ {{profile.username}} ADMIN - + - + - + - +
-
+ -

+

{{profile.display_name}}

@@ -64,22 +87,50 @@
-
+
+ +
+
-
+
-
-
+
+ @@ -138,11 +138,13 @@ export default { }, followProfile(id) { - axios.post('/i/follow', { - item: id - }).then(res => { - window.location.href = window.location.href; - }); + // todo: finish AP Accept handling to enable remote follows + return; + // axios.post('/i/follow', { + // item: id + // }).then(res => { + // window.location.href = window.location.href; + // }); }, } From 08b4a934ecb0a983d132bca71fbf28fa34d629b2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 2 Apr 2019 23:13:45 -0600 Subject: [PATCH 23/26] Update PostComponent --- .../assets/js/components/PostComponent.vue | 371 ++++++++++++++++-- 1 file changed, 335 insertions(+), 36 deletions(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 61d14676..be71656f 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -1,18 +1,3 @@ - + +