Sfoglia il codice sorgente

Merge pull request #628 from pixelfed/frontend-ui-refactor

[WIP] Timeline Refactor
daniel 6 anni fa
parent
commit
7209e64bc4

+ 32 - 7
app/Http/Controllers/Api/BaseApiController.php

@@ -8,6 +8,7 @@ use App\Http\Controllers\{
     AvatarController
 };
 use Auth, Cache, URL;
+use Carbon\Carbon;
 use App\{
     Avatar,
     Notification,
@@ -47,7 +48,22 @@ class BaseApiController extends Controller
         $resource = new Fractal\Resource\Item($notification, new NotificationTransformer());
         $res = $this->fractal->createData($resource)->toArray();
 
-        return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+        return response()->json($res);
+    }
+
+    public function notifications(Request $request)
+    {
+        $pid = Auth::user()->profile->id;
+        $timeago = Carbon::now()->subMonths(6);
+        $notifications = Notification::with('actor')
+            ->whereProfileId($pid)
+            ->whereDate('created_at', '>', $timeago)
+            ->orderBy('created_at','desc')
+            ->paginate(10);
+        $resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
+        $res = $this->fractal->createData($resource)->toArray();
+
+        return response()->json($res);
     }
 
     public function accounts(Request $request, $id)
@@ -56,7 +72,7 @@ class BaseApiController extends Controller
         $resource = new Fractal\Resource\Item($profile, new AccountTransformer());
         $res = $this->fractal->createData($resource)->toArray();
 
-        return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+        return response()->json($res);
     }
 
     public function accountFollowers(Request $request, $id)
@@ -66,7 +82,7 @@ class BaseApiController extends Controller
         $resource = new Fractal\Resource\Collection($followers, new AccountTransformer());
         $res = $this->fractal->createData($resource)->toArray();
 
-        return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+        return response()->json($res);
     }
 
     public function accountFollowing(Request $request, $id)
@@ -76,7 +92,7 @@ class BaseApiController extends Controller
         $resource = new Fractal\Resource\Collection($following, new AccountTransformer());
         $res = $this->fractal->createData($resource)->toArray();
 
-        return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+        return response()->json($res);
     }
 
     public function accountStatuses(Request $request, $id)
@@ -92,7 +108,7 @@ class BaseApiController extends Controller
         $resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
         $res = $this->fractal->createData($resource)->toArray();
 
-        return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+        return response()->json($res);
     }
 
     public function followSuggestions(Request $request)
@@ -140,13 +156,13 @@ class BaseApiController extends Controller
         ]);
     }
 
-    public function showTempMedia(Request $request, $profileId, $mediaId)
+    public function showTempMedia(Request $request, int $profileId, $mediaId)
     {
         if (!$request->hasValidSignature()) {
             abort(401);
         }
         $profile = Auth::user()->profile;
-        if($profile->id !== (int) $profileId) {
+        if($profile->id !== $profileId) {
             abort(403);
         }
         $media = Media::whereProfileId($profile->id)->findOrFail($mediaId);
@@ -240,4 +256,13 @@ class BaseApiController extends Controller
 
         return response()->json($res);
     }
+
+    public function verifyCredentials(Request $request)
+    {
+        $profile = Auth::user()->profile;
+        $resource = new Fractal\Resource\Item($profile, new AccountTransformer());
+        $res = $this->fractal->createData($resource)->toArray();
+
+        return response()->json($res);
+    }
 }

+ 15 - 31
app/Http/Controllers/InternalApiController.php

@@ -94,37 +94,6 @@ class InternalApiController extends Controller
         return $status->url();
     }
 
-    public function notifications(Request $request)
-    {
-        $this->validate($request, [
-          'page' => 'nullable|min:1|max:3',
-        ]);
-        
-        $profile = Auth::user()->profile;
-        $timeago = Carbon::now()->subMonths(6);
-        $notifications = Notification::with('actor')
-        ->whereProfileId($profile->id)
-        ->whereDate('created_at', '>', $timeago)
-        ->orderBy('id', 'desc')
-        ->simplePaginate(30);
-        $notifications = $notifications->map(function($k, $v) {
-            return [
-                'id' => $k->id,
-                'action' => $k->action,
-                'message' => $k->message,
-                'rendered' => $k->rendered,
-                'actor' => [
-                    'avatar' => $k->actor->avatarUrl(),
-                    'username' => $k->actor->username,
-                    'url' => $k->actor->url(),
-                ],
-                'url' => $k->item->url(),
-                'read_at' => $k->read_at,
-            ];
-        });
-        return response()->json($notifications, 200, [], JSON_PRETTY_PRINT);
-    }
-
     // deprecated
     public function discover(Request $request)
     {
@@ -288,4 +257,19 @@ class InternalApiController extends Controller
 
         return;
     }
+
+    public function statusReplies(Request $request, int $id)
+    {
+        $parent = Status::findOrFail($id);
+
+        $children = Status::whereInReplyToId($parent->id)
+            ->orderBy('created_at', 'desc')
+            ->take(3)
+            ->get();
+
+        $resource = new Fractal\Resource\Collection($children, new StatusTransformer());
+        $res = $this->fractal->createData($resource)->toArray();
+
+        return response()->json($res);
+    }
 }

+ 124 - 0
app/Http/Controllers/PublicApiController.php

@@ -12,6 +12,7 @@ use App\{
     Profile,
     StatusHashtag,
     Status,
+    UserFilter
 };
 use Auth,Cache;
 use Carbon\Carbon;
@@ -194,4 +195,127 @@ class PublicApiController extends Controller
                 break;
         }
     }
+
+    public function publicTimelineApi(Request $request)
+    {
+        if(!Auth::check()) {
+            return abort(403);
+        }
+
+        $this->validate($request,[
+          'page'        => 'nullable|integer|max:40',
+          'min_id'      => 'nullable|integer',
+          'max_id'      => 'nullable|integer',
+          'limit'       => 'nullable|integer|max:20'
+        ]);
+
+        $page = $request->input('page');
+        $min = $request->input('min_id');
+        $max = $request->input('max_id');
+        $limit = $request->input('limit') ?? 10;
+
+        // TODO: Use redis for timelines
+        // $timeline = Timeline::build()->local();
+        $pid = Auth::user()->profile->id;
+
+        $private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
+        $filters = UserFilter::whereUserId($pid)
+                  ->whereFilterableType('App\Profile')
+                  ->whereIn('filter_type', ['mute', 'block'])
+                  ->pluck('filterable_id')->toArray();
+        $filtered = array_merge($private->toArray(), $filters);
+
+        if($min || $max) {
+            $dir = $min ? '>' : '<';
+            $id = $min ?? $max;
+            $timeline = Status::whereHas('media')
+                      ->where('id', $dir, $id)
+                      ->whereNotIn('profile_id', $filtered)
+                      ->whereNull('in_reply_to_id')
+                      ->whereNull('reblog_of_id')
+                      ->whereVisibility('public')
+                      ->withCount(['comments', 'likes'])
+                      ->orderBy('created_at', 'desc')
+                      ->limit($limit)
+                      ->get();
+        } else {
+            $timeline = Status::whereHas('media')
+                      ->whereNotIn('profile_id', $filtered)
+                      ->whereNull('in_reply_to_id')
+                      ->whereNull('reblog_of_id')
+                      ->whereVisibility('public')
+                      ->withCount(['comments', 'likes'])
+                      ->orderBy('created_at', 'desc')
+                      ->simplePaginate($limit);
+        }
+
+        $fractal = new Fractal\Resource\Collection($timeline, new StatusTransformer());
+        $res = $this->fractal->createData($fractal)->toArray();
+        return response()->json($res);
+
+    }
+
+    public function homeTimelineApi(Request $request)
+    {
+        if(!Auth::check()) {
+            return abort(403);
+        }
+
+        $this->validate($request,[
+          'page'        => 'nullable|integer|max:40',
+          'min_id'      => 'nullable|integer',
+          'max_id'      => 'nullable|integer',
+          'limit'       => 'nullable|integer|max:20'
+        ]);
+
+        $page = $request->input('page');
+        $min = $request->input('min_id');
+        $max = $request->input('max_id');
+        $limit = $request->input('limit') ?? 10;
+
+        // TODO: Use redis for timelines
+        // $timeline = Timeline::build()->local();
+        $pid = Auth::user()->profile->id;
+
+        $following = Follower::whereProfileId($pid)->pluck('following_id');
+        $following->push($pid)->toArray();
+
+        $private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
+        $filters = UserFilter::whereUserId($pid)
+                  ->whereFilterableType('App\Profile')
+                  ->whereIn('filter_type', ['mute', 'block'])
+                  ->pluck('filterable_id')->toArray();
+        $filtered = array_merge($private->toArray(), $filters);
+
+        if($min || $max) {
+            $dir = $min ? '>' : '<';
+            $id = $min ?? $max;
+            $timeline = Status::whereHas('media')
+                      ->where('id', $dir, $id)
+                      ->whereIn('profile_id', $following)
+                      ->whereNotIn('profile_id', $filtered)
+                      ->whereNull('in_reply_to_id')
+                      ->whereNull('reblog_of_id')
+                      ->whereVisibility('public')
+                      ->withCount(['comments', 'likes'])
+                      ->orderBy('created_at', 'desc')
+                      ->limit($limit)
+                      ->get();
+        } else {
+            $timeline = Status::whereHas('media')
+                      ->whereIn('profile_id', $following)
+                      ->whereNotIn('profile_id', $filtered)
+                      ->whereNull('in_reply_to_id')
+                      ->whereNull('reblog_of_id')
+                      ->whereVisibility('public')
+                      ->withCount(['comments', 'likes'])
+                      ->orderBy('created_at', 'desc')
+                      ->simplePaginate($limit);
+        }
+
+        $fractal = new Fractal\Resource\Collection($timeline, new StatusTransformer());
+        $res = $this->fractal->createData($fractal)->toArray();
+        return response()->json($res);
+
+    }
 }

+ 1 - 22
app/Http/Controllers/SiteController.php

@@ -31,28 +31,7 @@ class SiteController extends Controller
 
     public function homeTimeline()
     {
-        $pid = Auth::user()->profile->id;
-        // TODO: Use redis for timelines
-
-        $following = Follower::whereProfileId($pid)->pluck('following_id');
-        $following->push($pid)->toArray();
-
-        $filtered = UserFilter::whereUserId($pid)
-                    ->whereFilterableType('App\Profile')
-                    ->whereIn('filter_type', ['mute', 'block'])
-                    ->pluck('filterable_id')->toArray();
-
-        $timeline = Status::whereIn('profile_id', $following)
-                  ->whereNotIn('profile_id', $filtered)
-                  ->whereHas('media')
-                  ->whereVisibility('public')
-                  ->orderBy('created_at', 'desc')
-                  ->withCount(['comments', 'likes', 'shares'])
-                  ->simplePaginate(20);
-                  
-        $type = 'personal';
-
-        return view('timeline.template', compact('timeline', 'type'));
+        return view('timeline.home');
     }
 
     public function changeLocale(Request $request, $locale)

+ 1 - 25
app/Http/Controllers/TimelineController.php

@@ -20,30 +20,6 @@ class TimelineController extends Controller
 
     public function local(Request $request)
     {
-        $this->validate($request,[
-          'page' => 'nullable|integer|max:20'
-        ]);
-        // TODO: Use redis for timelines
-        // $timeline = Timeline::build()->local();
-        $pid = Auth::user()->profile->id;
-
-        $private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
-        $filters = UserFilter::whereUserId($pid)
-                  ->whereFilterableType('App\Profile')
-                  ->whereIn('filter_type', ['mute', 'block'])
-                  ->pluck('filterable_id')->toArray();
-        $filtered = array_merge($private->toArray(), $filters);
-
-        $timeline = Status::whereHas('media')
-                  ->whereNotIn('profile_id', $filtered)
-                  ->whereNull('in_reply_to_id')
-                  ->whereNull('reblog_of_id')
-                  ->whereVisibility('public')
-                  ->withCount(['comments', 'likes'])
-                  ->orderBy('created_at', 'desc')
-                  ->simplePaginate(10);
-        $type = 'local';
-
-        return view('timeline.template', compact('timeline', 'type'));
+        return view('timeline.local');
     }
 }

+ 1 - 0
app/Profile.php

@@ -156,6 +156,7 @@ class Profile extends Model
     public function statusCount()
     {
         return $this->statuses()
+        ->getQuery()
         ->whereHas('media')
         ->whereNull('in_reply_to_id')
         ->whereNull('reblog_of_id')

+ 1 - 0
app/Transformer/Api/MediaTransformer.php

@@ -23,6 +23,7 @@ class MediaTransformer extends Fractal\TransformerAbstract
             'orientation' => $media->orientation,
             'filter_name' => $media->filter_name,
             'filter_class' => $media->filter_class,
+            'mime'        => $media->mime,
         ];
     }
 }

+ 1 - 0
app/Transformer/Api/NotificationTransformer.php

@@ -45,6 +45,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
 			'mention' => 'mention',
 			'reblog' => 'share',
 			'like' => 'favourite',
+			'comment' => 'comment',
 		];
 		return $verbs[$verb];
 	}

+ 1 - 1
config/pixelfed.php

@@ -23,7 +23,7 @@ return [
     | This value is the version of your PixelFed instance.
     |
     */
-    'version' => '0.4.3',
+    'version' => '0.5.0',
 
     /*
     |--------------------------------------------------------------------------

+ 13 - 0
package-lock.json

@@ -2571,6 +2571,11 @@
                 "assert-plus": "^1.0.0"
             }
         },
+        "date-fns": {
+            "version": "1.29.0",
+            "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.29.0.tgz",
+            "integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw=="
+        },
         "date-now": {
             "version": "0.1.4",
             "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@@ -11372,6 +11377,14 @@
             "integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==",
             "dev": true
         },
+        "vue-timeago": {
+            "version": "5.0.0",
+            "resolved": "https://registry.npmjs.org/vue-timeago/-/vue-timeago-5.0.0.tgz",
+            "integrity": "sha512-C+EqTlfHE9nO6FOQIS6q5trAZ0WIgNz/eydTvsanPRsLVV1xqNiZirTG71d9nl/LjfNETwaktnBlgP8adCc37A==",
+            "requires": {
+                "date-fns": "^1.29.0"
+            }
+        },
         "watchpack": {
             "version": "1.6.0",
             "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",

+ 3 - 2
package.json

@@ -25,6 +25,7 @@
         "filesize": "^3.6.1",
         "infinite-scroll": "^3.0.4",
         "laravel-echo": "^1.4.0",
+        "opencollective": "^1.0.3",
         "opencollective-postinstall": "^2.0.1",
         "plyr": "^3.4.7",
         "pusher-js": "^4.2.2",
@@ -34,10 +35,10 @@
         "twitter-text": "^2.0.5",
         "vue-infinite-loading": "^2.4.3",
         "vue-loading-overlay": "^3.1.0",
-        "opencollective": "^1.0.3"
+        "vue-timeago": "^5.0.0"
     },
     "collective": {
         "type": "opencollective",
         "url": "https://opencollective.com/pixelfed-528"
     }
-}
+}

BIN
public/js/components.js


BIN
public/mix-manifest.json


+ 7 - 0
resources/assets/js/components.js

@@ -2,10 +2,12 @@ window.Vue = require('vue');
 import BootstrapVue from 'bootstrap-vue'
 import InfiniteLoading from 'vue-infinite-loading';
 import Loading from 'vue-loading-overlay';
+import VueTimeago from 'vue-timeago'
 
 Vue.use(BootstrapVue);
 Vue.use(InfiniteLoading);
 Vue.use(Loading);
+Vue.use(VueTimeago);
 
 pixelfed.readmore = () => {
   $('.read-more').each(function(k,v) {
@@ -81,6 +83,11 @@ Vue.component(
     require('./components/PostComments.vue')
 );
 
+Vue.component(
+    'timeline',
+    require('./components/Timeline.vue')
+);
+
 Vue.component(
     'passport-clients',
     require('./components/passport/Clients.vue')

+ 23 - 7
resources/assets/js/components/PostComponent.vue

@@ -4,12 +4,23 @@
   max-height: 70vh;
   overflow-y: scroll;
 }
+
+.status-comments,
+.reactions,
+.col-md-4 {
+  background: #fff;
+}
+
+.postPresenterContainer {
+  background: #000;
+  min-height: 600px;
+}
 </style>
 <template>
 <div class="postComponent d-none">
   <div class="container px-0 mt-md-4">
     <div class="card card-md-rounded-0 status-container orientation-unknown">
-      <div class="row mx-0">
+      <div class="row px-0 mx-0">
       <div class="d-flex d-md-none align-items-center justify-content-between card-header bg-white w-100">
         <a :href="statusProfileUrl" class="d-flex align-items-center status-username text-truncate" data-toggle="tooltip" data-placement="bottom" :title="statusUsername">
           <div class="status-avatar mr-2">
@@ -40,7 +51,7 @@
           </div>
         </div>
        </div>
-        <div class="col-12 col-md-8 status-photo px-0">
+        <div class="col-12 col-md-8 status-photo px-0 mx-0">
             <div class="postPresenterLoader text-center">
               <div class="lds-ring"><div></div><div></div><div></div><div></div></div> 
             </div>
@@ -204,14 +215,17 @@ pixelfed.presenter = {
         .removeClass('orientation-unknown')
         .addClass('orientation-' + media[0]['orientation']);
       let wrapper = $('<div>');
-      wrapper.addClass(media[0]['filter_class']);
+      container.addClass('d-flex align-items-center');
+      if(media[0]['filter_class']) {
+        wrapper.addClass(media[0]['filter_class']);
+      }
       let el = $('<img>');
       el.attr('src', media[0]['url']);
       el.attr('title', media[0]['description']);
       wrapper.append(el);
       if(status.sensitive == true) {
         let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
-        let cw = $('<details>').addClass('details-animated');
+        let cw = $('<details>').addClass('details-animated w-100');
         let summary = $('<summary>');
         let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
         let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
@@ -225,7 +239,7 @@ pixelfed.presenter = {
 
     video: function(container, media, status) {
       let wrapper = $('<div>');
-      wrapper.addClass('');
+      container.addClass('d-flex align-items-center');
       let el = $('<video>');
       el.addClass('embed-responsive-item');
       el.attr('controls', '');
@@ -235,7 +249,7 @@ pixelfed.presenter = {
       wrapper.append(el);
       if(status.sensitive == true) {
         let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
-        let cw = $('<details>').addClass('details-animated');
+        let cw = $('<details>').addClass('details-animated w-100');
         let summary = $('<summary>');
         let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
         let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
@@ -268,6 +282,7 @@ pixelfed.presenter = {
         .addClass('orientation-' + media[0]['orientation']);
       let id = 'photo-carousel-wrapper-' + status.id;
       let wrapper = $('<div>');
+      container.addClass('d-flex align-items-center');
       wrapper.addClass('carousel slide carousel-fade');
       wrapper.attr('data-ride', 'carousel');
       wrapper.attr('id', id);
@@ -325,7 +340,7 @@ pixelfed.presenter = {
       wrapper.append(indicators, inner, prev, next);
       if(status.sensitive == true) {
         let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
-        let cw = $('<details>').addClass('details-animated');
+        let cw = $('<details>').addClass('details-animated w-100');
         let summary = $('<summary>');
         let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
         let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
@@ -387,6 +402,7 @@ export default {
         $('head title').text(title);
       }
     },
+    
     methods: {
       authCheck() {
         let authed = $('body').hasClass('loggedIn');

+ 623 - 0
resources/assets/js/components/Timeline.vue

@@ -0,0 +1,623 @@
+<template>
+<div class="container" style="">
+	<div class="row">
+		<div class="col-md-8 col-lg-8 pt-2 px-0 my-3 timeline">
+			<div class="loader text-center">
+				<div class="lds-ring"><div></div><div></div><div></div><div></div></div> 
+			</div>
+			<div class="card mb-4 status-card card-md-rounded-0" :data-status-id="status.id" v-for="(status, index) in feed" :key="status.id">
+
+				<div class="card-header d-inline-flex align-items-center bg-white">
+					<img v-bind:src="status.account.avatar" width="32px" height="32px" style="border-radius: 32px;">
+					<a class="username font-weight-bold pl-2 text-dark" v-bind:href="status.account.url">
+						{{status.account.username}}
+					</a>
+					<div class="text-right" style="flex-grow:1;">
+						<div class="dropdown">
+							<button class="btn btn-link text-dark no-caret dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Post options">
+								<span class="fas fa-ellipsis-v fa-lg text-muted"></span>
+							</button>
+							<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
+								<a class="dropdown-item font-weight-bold" :href="status.url">Go to post</a>
+								<span v-bind:class="[statusOwner(status) ? 'd-none' : '']">
+									<a class="dropdown-item font-weight-bold" :href="reportUrl(status)">Report</a>
+									<a class="dropdown-item font-weight-bold" v-on:click="muteProfile(status)">Mute Profile</a>
+									<a class="dropdown-item font-weight-bold" v-on:click="blockProfile(status)">Block Profile</a>
+								</span>
+								<span  v-bind:class="[statusOwner(status) ? '' : 'd-none']">
+									<a class="dropdown-item font-weight-bold" :href="editUrl(status)">Edit</a>
+									<a class="dropdown-item font-weight-bold text-danger" v-on:click="deletePost(status)">Delete</a>
+								</span>
+							</div>
+						</div>
+					</div>
+				</div>
+
+				<div class="postPresenterContainer">
+					<div v-if="status.pf_type === 'photo'" class="w-100">
+						<div v-if="status.sensitive == true">
+							<details class="details-animated">
+								<summary>
+									<p class="mb-0 lead font-weight-bold">{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
+									<p class="font-weight-light">(click to show)</p>
+								</summary>
+								<a class="max-hide-overflow" :href="status.url">
+									<img class="card-img-top" :src="status.media_attachments[0].url">
+								</a>
+							</details>
+						</div>
+						<div v-else>
+							<div>
+								<img class="card-img-top" :src="status.media_attachments[0].url">
+							</div>
+						</div>
+					</div>
+
+					<div v-else-if="status.pf_type === 'video'" class="w-100">
+						<div v-if="status.sensitive == true">
+							<details class="details-animated">
+								<summary>
+									<p class="mb-0 lead font-weight-bold">{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
+									<p class="font-weight-light">(click to show)</p>
+								</summary>
+								<div class="embed-responsive embed-responsive-16by9">
+									<video class="video" preload="none" controls loop>
+										<source :src="status.media_attachments[0].url" :type="status.media_attachments[0].mime">
+									</video>
+								</div>
+							</details>
+						</div>
+						<div v-else class="embed-responsive embed-responsive-16by9">
+							<video class="video" preload="none" controls loop>
+								<source :src="status.media_attachments[0].url" :type="status.media_attachments[0].mime">
+							</video>
+						</div>
+					</div>
+
+					<div v-else-if="status.pf_type === 'photo:album'">
+						<div v-if="status.sensitive == true">
+							<details class="details-animated">
+								<summary>
+									<p class="mb-0 lead font-weight-bold">{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
+									<p class="font-weight-light">(click to show)</p>
+								</summary>
+								<b-carousel :id="status.id + '-carousel'"
+									style="text-shadow: 1px 1px 2px #333;"
+									controls
+									indicators
+									background="#ffffff"
+									:interval="0"
+								>
+									<b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id">
+										<img slot="img" class="d-block img-fluid w-100" :src="img.url" :alt="img.description">
+									</b-carousel-slide>
+								</b-carousel>
+							</details>
+						</div>
+						<div v-else>
+							<b-carousel :id="status.id + '-carousel'"
+								style="text-shadow: 1px 1px 2px #333;"
+								controls
+								indicators
+								background="#ffffff"
+								:interval="0"
+							>
+								<b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id">
+									<img slot="img" class="d-block img-fluid w-100" :src="img.url" :alt="img.description">
+								</b-carousel-slide>
+							</b-carousel>
+						</div>
+					</div>
+
+					<div v-else-if="status.pf_type === 'video:album'" class="w-100">
+						<div v-if="status.sensitive == true">
+							<details class="details-animated">
+								<summary>
+									<p class="mb-0 lead font-weight-bold">{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
+									<p class="font-weight-light">(click to show)</p>
+								</summary>
+								<b-carousel :id="status.id + '-carousel'"
+									style="text-shadow: 1px 1px 2px #333; background-color: #000;"
+									controls
+									img-blank
+									background="#ffffff"
+									:interval="0"
+								>
+									<b-carousel-slide v-for="(vid, index) in status.media_attachments" :key="vid.id + '-media'">
+										<video slot="img" class="embed-responsive-item" preload="none" controls loop :alt="vid.description" width="100%" height="100%">
+											<source :src="vid.url" :type="vid.mime">
+										</video>
+									</b-carousel-slide>
+								</b-carousel>
+							</details>
+						</div>
+						<div v-else>
+							<b-carousel :id="status.id + '-carousel'"
+								style="text-shadow: 1px 1px 2px #333; background-color: #000;"
+								controls
+								img-blank
+								background="#ffffff"
+								:interval="0"
+							>
+								<b-carousel-slide v-for="(vid, index) in status.media_attachments" :key="vid.id + '-media'">
+									<video slot="img" class="embed-responsive-item" preload="none" controls loop :alt="vid.description" width="100%" height="100%">
+										<source :src="vid.url" :type="vid.mime">
+									</video>
+								</b-carousel-slide>
+							</b-carousel>
+						</div>
+					</div>
+
+					<div v-else-if="status.pf_type === 'photo:video:album'" class="w-100">
+						<div v-if="status.sensitive == true">
+							<details class="details-animated">
+								<summary>
+									<p class="mb-0 lead font-weight-bold">{{ status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
+									<p class="font-weight-light">(click to show)</p>
+								</summary>
+								<b-carousel :id="status.id + '-carousel'"
+									style="text-shadow: 1px 1px 2px #333; background-color: #000;"
+									controls
+									img-blank
+									background="#ffffff"
+									:interval="0"
+								>
+									<b-carousel-slide v-for="(media, index) in status.media_attachments" :key="media.id + '-media'">
+
+										<video v-if="media.type == 'Video'" slot="img" class="embed-responsive-item" preload="none" controls loop :alt="media.description" width="100%" height="100%">
+											<source :src="media.url" :type="media.mime">
+										</video>
+
+										<img v-else-if="media.type == 'Image'" slot="img" class="d-block img-fluid w-100" :src="media.url" :alt="media.description">
+
+										<p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
+
+									</b-carousel-slide>
+								</b-carousel>
+							</details>
+						</div>
+						<div v-else>
+							<b-carousel :id="status.id + '-carousel'"
+										style="text-shadow: 1px 1px 2px #333; background-color: #000;"
+										controls
+										img-blank
+										background="#ffffff"
+										:interval="0"
+									>
+								<b-carousel-slide v-for="(media, index) in status.media_attachments" :key="media.id + '-media'">
+
+									<video v-if="media.type == 'Video'" slot="img" class="embed-responsive-item" preload="none" controls loop :alt="media.description" width="100%" height="100%">
+										<source :src="media.url" :type="media.mime">
+									</video>
+
+									<img v-else-if="media.type == 'Image'" slot="img" class="d-block img-fluid w-100" :src="media.url" :alt="media.description">
+
+									<p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
+
+								</b-carousel-slide>
+							</b-carousel>
+						</div>
+					</div>
+
+					<div v-else class="w-100">
+						<p class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
+					</div>
+				</div>
+
+				<div class="card-body">
+					<div class="reactions my-1">
+						<h3 v-bind:class="[status.favourited ? 'fas fa-heart text-danger pr-3 m-0 cursor-pointer' : 'far fa-heart pr-3 m-0 like-btn cursor-pointer']" title="Like" v-on:click="likeStatus(status, $event)"></h3>
+						<h3 class="far fa-comment pr-3 m-0 cursor-pointer" title="Comment" v-on:click="commentFocus(status, $event)"></h3>
+						<h3 v-bind:class="[status.reblogged ? 'far fa-share-square pr-3 m-0 text-primary cursor-pointer' : 'far fa-share-square pr-3 m-0 share-btn cursor-pointer']" title="Share" v-on:click="shareStatus(status, $event)"></h3>
+					</div>
+
+					<div class="likes font-weight-bold">
+						<span class="like-count">{{status.favourites_count}}</span> {{status.favourites_count == 1 ? 'like' : 'likes'}}
+					</div>
+					<div class="caption">
+						<p class="mb-2 read-more" style="overflow: hidden;">
+							<span class="username font-weight-bold">
+								<bdi><a class="text-dark" :href="status.account.url">{{status.account.username}}</a></bdi>
+							</span>
+							<span v-html="status.content"></span>
+						</p>
+					</div>
+					<div class="comments">
+					</div>
+					<div class="timestamp pt-1">
+						<p class="small text-uppercase mb-0">
+							<a :href="status.url" class="text-muted">
+								<timeago :datetime="status.created_at" :auto-update="60" :converter-options="{includeSeconds:true}" :title="timestampFormat(status.created_at)" v-b-tooltip.hover.bottom></timeago>
+							</a>
+						</p>
+					</div>
+				</div>
+
+				<div class="card-footer bg-white d-none">
+					<form class="" v-on:submit.prevent="commentSubmit(status, $event)">
+						<input type="hidden" name="item" value="">
+						<input class="form-control status-reply-input" name="comment" placeholder="Add a comment…" autocomplete="off">
+					</form>
+				</div>
+			</div>
+		</div>
+
+		<div class="col-md-4 col-lg-4 pt-2 my-3">
+			<div class="mb-4">
+				<div class="card profile-card">
+					<div class="card-body loader text-center">
+						<div class="lds-ring"><div></div><div></div><div></div><div></div></div> 
+					</div>
+					<div class="card-body contents d-none">
+						<div class="media d-flex align-items-center">
+							<a :href="profile.url">
+								<img class="mr-3 rounded-circle box-shadow" :src="profile.avatar || '/storage/avatars/default.png'" alt="avatar" width="64px">
+							</a>
+							<div class="media-body">
+								<p class="mb-0 px-0 font-weight-bold"><a :href="profile.url" class="text-dark">&commat;{{profile.username}}</a></p>
+								<p class="my-0 text-muted text-truncate pb-0">{{profile.display_name}}</p>
+							</div>
+						</div>
+					</div>
+					<div class="card-footer bg-white py-1 d-none">
+						<div class="d-flex justify-content-between text-center">
+							<span class="pl-3">
+								<p class="mb-0 font-weight-bold">{{profile.statuses_count}}</p>
+								<p class="mb-0 small text-muted">Posts</p>
+							</span>
+							<span>
+								<p class="mb-0 font-weight-bold">{{profile.followers_count}}</p>
+								<p class="mb-0 small text-muted">Followers</p>
+							</span>
+							<span class="pr-3">
+								<p class="mb-0 font-weight-bold">{{profile.following_count}}</p>
+								<p class="mb-0 small text-muted">Following</p>
+							</span>
+						</div>
+					</div>
+				</div>
+			</div>
+
+			<div class="mb-4">
+				<div class="card notification-card">
+					<div class="card-header bg-white">
+						<p class="mb-0 d-flex align-items-center justify-content-between">
+							<span class="text-muted font-weight-bold">Notifications</span>
+							<a class="text-dark small" href="/account/activity">See All</a>
+						</p>
+					</div>
+					<div class="card-body loader text-center" style="height: 300px;">
+						<div class="lds-ring"><div></div><div></div><div></div><div></div></div> 
+					</div>
+					<div class="card-body pt-2 contents" style="max-height: 300px; overflow-y: scroll;">
+						<div class="media mb-3 align-items-center" v-for="(n, index) in notifications">
+							<img class="mr-2 rounded-circle img-thumbnail" :src="n.account.avatar" alt="" width="32px">
+							<div class="media-body font-weight-light small">
+								<div v-if="n.type == 'favourite'">
+									<p class="my-0">
+										<span class="font-weight-bold">{{n.account.username}}</span> liked your post.
+									</p>
+								</div>
+								<div v-else-if="n.type == 'comment'">
+									<p class="my-0">
+										<span class="font-weight-bold">{{n.account.username}}</span> commented on your post.
+									</p>
+								</div>
+								<div v-else-if="n.type == 'mention'">
+									<p class="my-0">
+										<span class="font-weight-bold">{{n.account.username}}</span> mentioned you.
+									</p>
+								</div>
+							</div>
+							
+						</div>
+					</div>
+				</div>
+			</div>
+
+			<footer>
+				<div class="container pb-5">
+					<p class="mb-0 text-uppercase font-weight-bold text-muted small">
+						<a href="/site/about" class="text-dark pr-2">About Us</a>
+						<a href="/site/help" class="text-dark pr-2">Support</a>
+						<a href="/site/open-source" class="text-dark pr-2">Open Source</a>
+						<a href="/site/language" class="text-dark pr-2">Language</a>
+						<a href="/site/terms" class="text-dark pr-2">Terms</a>
+						<a href="/site/privacy" class="text-dark pr-2">Privacy</a>
+						<a href="/site/platform" class="text-dark pr-2">API</a>
+					</p>
+					<p class="mb-0 text-uppercase font-weight-bold text-muted small">
+						<a href="http://pixelfed.org" class="text-muted" rel="noopener" title="" data-toggle="tooltip">Powered by PixelFed</a>
+					</p>
+				</div>
+			</footer>
+		</div>
+	</div>
+</div>
+</template>
+
+<style type="text/css">
+	.postPresenterContainer {
+		display: flex;
+		align-items: center;
+		background: #000;
+		min-height: 600px;
+	}
+	.cursor-pointer {
+		cursor: pointer;
+	}
+</style>
+
+<script type="text/javascript">
+	export default {
+		data() {
+			return {
+				page: 1,
+				feed: [],
+				profile: {},
+				scope: window.location.pathname,
+				min_id: 0,
+				max_id: 0,
+				notifications: {},
+				stories: {},
+				suggestions: {},
+			}
+		},
+
+		beforeMount() {
+			this.fetchTimelineApi();
+			this.fetchProfile();
+		},
+
+		mounted() {
+		},
+
+		updated() {
+			this.scroll();
+		},
+
+		methods: {
+			fetchProfile() {
+				axios.get('/api/v1/accounts/verify_credentials').then(res => {
+					this.profile = res.data;
+					$('.profile-card .loader').addClass('d-none');
+					$('.profile-card .contents').removeClass('d-none');
+					$('.profile-card .card-footer').removeClass('d-none');
+					this.fetchNotifications();
+				}).catch(err => {
+					swal(
+						'Oops, something went wrong',
+						'Please reload the page.',
+						'error'
+					);
+				});
+			},
+
+			fetchTimelineApi() {
+				let homeTimeline = '/api/v1/timelines/home?page=' + this.page;
+				let localTimeline = '/api/v1/timelines/public?page=' + this.page;
+				let apiUrl = this.scope == '/' ? homeTimeline : localTimeline;
+				axios.get(apiUrl).then(res => {
+					$('.timeline .loader').addClass('d-none');
+					let data = res.data;
+					this.feed.push(...data);
+					let ids = data.map(status => status.id);
+					this.min_id = Math.min(...ids);
+					if(this.page == 1) {
+						this.max_id = Math.max(...ids);
+					}
+					this.page++;
+				}).catch(err => {
+				});
+			},
+
+			fetchNotifications() {
+				axios.get('/api/v1/notifications')
+				.then(res => {
+					this.notifications = res.data;
+					$('.notification-card .loader').addClass('d-none');
+					$('.notification-card .contents').removeClass('d-none');
+				});
+			},
+
+			scroll() {
+				window.onscroll = () => {
+				  let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight == document.documentElement.offsetHeight;
+
+				  if (bottomOfWindow) {
+				  	this.fetchTimelineApi();
+				  }
+				};
+			},
+
+			reportUrl(status) {
+				let type = status.in_reply_to ? 'comment' : 'post';
+				let id = status.id;
+				return '/i/report?type=' + type + '&id=' + id;
+			},
+
+			commentFocus(status, $event) {
+				let el = event.target;
+				let card = el.parentElement.parentElement.parentElement;
+				let comments = card.getElementsByClassName('comments')[0];
+				if(comments.children.length == 0) {
+					comments.classList.add('mb-2');
+					this.fetchStatusComments(status, card);
+				}
+				let footer = card.querySelectorAll('.card-footer')[0];
+				let input = card.querySelectorAll('.status-reply-input')[0];
+				if(footer.classList.contains('d-none') == true) {
+					footer.classList.remove('d-none');
+					input.focus();
+				} else {
+					footer.classList.add('d-none');
+					input.blur();
+				}
+			},
+
+			likeStatus(status, $event) {
+				if($('body').hasClass('loggedIn') == false) {
+					return;
+				}
+				
+				axios.post('/i/like', {
+					item: status.id
+				}).then(res => {
+					status.favourites_count = res.data.count;
+					if(status.favourited == true) {
+						status.favourited = false;
+					} else {
+						status.favourited = true;
+					}
+				}).catch(err => {
+					swal('Error', 'Something went wrong, please try again later.', 'error');
+				});
+			},
+
+			shareStatus(status, $event) {
+				if($('body').hasClass('loggedIn') == false) {
+					return;
+				}
+
+				axios.post('/i/share', {
+					item: status.id
+				}).then(res => {
+					status.reblogs_count = res.data.count;
+					if(status.reblogged == true) {
+						status.reblogged = false;
+					} else {
+						status.reblogged = true;
+					}
+				}).catch(err => {
+					swal('Error', 'Something went wrong, please try again later.', 'error');
+				});
+			},
+
+			timestampFormat(timestamp) {
+				let ts = new Date(timestamp);
+				return ts.toDateString() + ' ' + ts.toLocaleTimeString();
+			},
+
+			editUrl(status) {
+				return status.url + '/edit';
+			},
+
+			statusOwner(status) {
+				let sid = status.account.id;
+				let uid = this.profile.id;
+				if(sid == uid) {
+					return true;
+				} else {
+					return false;
+				}
+			},
+
+			fetchStatusComments(status, card) {
+				axios.get('/api/v2/status/'+status.id+'/replies')
+				.then(res => {
+					let comments = card.querySelectorAll('.comments')[0];
+					let data = res.data;
+					data.forEach(function(i, k) {
+						let username = document.createElement('a');
+						username.classList.add('font-weight-bold');
+						username.classList.add('text-dark');
+						username.classList.add('mr-2');
+						username.setAttribute('href', i.account.url);
+						username.textContent = i.account.username;
+
+						let text = document.createElement('span');
+						text.innerHTML = i.content;
+
+						let comment = document.createElement('p');
+						comment.classList.add('read-more');
+						comment.classList.add('mb-0');
+						comment.appendChild(username);
+						comment.appendChild(text);
+						comments.appendChild(comment);
+					});
+				}).catch(err => {
+				})
+			},
+
+			muteProfile(status) {
+				if($('body').hasClass('loggedIn') == false) {
+					return;
+				}
+				axios.post('/i/mute', {
+					type: 'user',
+					item: status.account.id
+				}).then(res => {
+					this.feed = this.feed.filter(s => s.account.id !== status.account.id);
+					swal('Success', 'You have successfully muted ' + status.account.acct, 'success');
+				}).catch(err => {
+					swal('Error', 'Something went wrong. Please try again later.', 'error');
+				});
+			},
+
+			blockProfile(status) {
+				if($('body').hasClass('loggedIn') == false) {
+					return;
+				}
+
+				axios.post('/i/block', {
+					type: 'user',
+					item: status.account.id
+				}).then(res => {
+					this.feed = this.feed.filter(s => s.account.id !== status.account.id);
+					swal('Success', 'You have successfully blocked ' + status.account.acct, 'success');
+				}).catch(err => {
+					swal('Error', 'Something went wrong. Please try again later.', 'error');
+				});
+			},
+
+			deletePost(status, index) {
+				if($('body').hasClass('loggedIn') == false || status.account.id !== this.profile.id) {
+					return;
+				}
+
+				axios.post('/i/delete', {
+					type: 'status',
+					item: status.id
+				}).then(res => {
+					this.feed.splice(index,1);
+					swal('Success', 'You have successfully deleted this post', 'success');
+				}).catch(err => {
+					swal('Error', 'Something went wrong. Please try again later.', 'error');
+				});
+			},
+
+			commentSubmit(status, $event) {
+				let id = status.id;
+				let form = $event.target;
+				let input = $(form).find('input[name="comment"]');
+				let comment = input.val();
+				let comments = form.parentElement.parentElement.getElementsByClassName('comments')[0];
+				axios.post('/i/comment', {
+					item: id,
+					comment: comment
+				}).then(res => {
+					input.val('');
+					input.blur();
+
+					let username = document.createElement('a');
+					username.classList.add('font-weight-bold');
+					username.classList.add('text-dark');
+					username.classList.add('mr-2');
+					username.setAttribute('href', this.profile.url);
+					username.textContent = this.profile.username;
+
+					let text = document.createElement('span');
+					text.innerHTML = comment;
+
+					let wrapper = document.createElement('p');
+					wrapper.classList.add('read-more');
+					wrapper.classList.add('mb-0');
+					wrapper.appendChild(username);
+					wrapper.appendChild(text);
+					comments.insertBefore(wrapper, comments.firstChild);
+				});
+			}
+
+		}
+	}
+</script>

+ 12 - 33
resources/views/layouts/partial/nav.blade.php

@@ -19,32 +19,19 @@
                     <li><a class="nav-link font-weight-bold text-primary" href="{{ route('login') }}" title="Login">{{ __('Login') }}</a></li>
                     <li><a class="nav-link font-weight-bold" href="{{ route('register') }}" title="Register">{{ __('Register') }}</a></li>
                 @else
-                    <li class="nav-item pr-2">
-                        <a class="nav-link" href="{{route('discover')}}" title="Discover" data-toggle="tooltip" data-placement="bottom"><i class="far fa-compass fa-lg"></i></a>
+                    <li class="pr-2">
+                        <a class="nav-link font-weight-bold {{request()->is('/') ?'text-primary':''}}" href="/" title="Home Timeline">
+                        {{ __('Home') }}
+                        </a>
+                    </li>
+                    <li class="pr-2">
+                        <a class="nav-link font-weight-bold {{request()->is('timeline/public') ?'text-primary':''}}" href="/timeline/public" title="Local Timeline">
+                        {{ __('Local') }}
+                        </a>
                     </li>
                     <li class="nav-item pr-2">
-                        <a class="nav-link" href="{{route('notifications')}}" title="Notifications" data-toggle="tooltip" data-placement="bottom"><i class="fas fa-inbox fa-lg text"></i></a>
+                        <a class="nav-link font-weight-bold" href="{{route('discover')}}" title="Discover" data-toggle="tooltip" data-placement="bottom">{{ __('Discover')}}</i></a>
                     </li>
-                    {{-- <li class="nav-item dropdown d-none d-md-block pr-2">
-                        <a class="nav-link dropdown-toggle nav-notification" href="{{route('notifications')}}" id="nav-notification" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                            <i class="fas fa-inbox fa-lg text"></i>
-                      </a>
-                      <div class="dropdown-menu dropdown-menu-right nav-notification-dropdown" aria-labelledby="nav-notification">
-                        <div class="loader text-center">
-                            <div class="lds-ring"><div></div><div></div><div></div><div></div></div> 
-                        </div>
-                        <div class="dropdown-item disabled bg-light py-2">
-                            <a href="{{route('notifications')}}" class="font-weight-bold mr-4" data-toggle="tooltip" title="Notifications"><i class="fas fa-inbox"></i></a>
-                            {{-- <a href="#" class="text-muted font-weight-bold mr-4" data-toggle="tooltip" title="Direct Messages"><i class="far fa-envelope"></i></a>
-                            <a href="#" class="text-muted font-weight-bold mr-4" data-toggle="tooltip" title="Following Activity"><i class="fas fa-users"></i></a> -}}
-                            <a href="{{route('follow-requests')}}" class="text-muted font-weight-bold" data-toggle="tooltip" title="Follow Requests"><i class="fas fa-user-plus"></i></a>
-
-                            <span class="float-right">
-                                <a class="btn btn-sm btn-outline-secondary py-0 notification-action" data-type="mark_read" href="#">Mark as Read</a>
-                            </span>
-                        </div>
-                      </div>
-                    </li> --}}
                     <li class="nav-item pr-2">
                         <div title="Create new post" data-toggle="tooltip" data-placement="bottom">
                             <a href="{{route('compose')}}" class="nav-link" data-toggle="modal" data-target="#composeModal">
@@ -65,22 +52,14 @@
                             </a>
                             <div class="dropdown-divider"></div>
                             <a class="dropdown-item font-weight-bold" href="{{route('timeline.personal')}}">
-                                <span class="fas fa-list-alt pr-1"></span>
+                                <span class="fas fa-home pr-1"></span>
                                 {{__('navmenu.myTimeline')}}
                             </a>
                             <a class="dropdown-item font-weight-bold" href="{{route('timeline.public')}}">
-                                <span class="far fa-list-alt pr-1"></span>
+                                <span class="far fa-map pr-1"></span>
                                 {{__('navmenu.publicTimeline')}}
                             </a>
-                            {{-- <a class="dropdown-item font-weight-bold" href="{{route('messages')}}">
-                                <span class="far fa-envelope pr-1"></span>
-                                {{__('navmenu.directMessages')}}
-                            </a> --}}
                             <div class="dropdown-divider"></div>
-                            {{-- <a class="dropdown-item font-weight-bold" href="{{route('remotefollow')}}">
-                                <span class="fas fa-user-plus pr-1"></span>
-                                {{__('navmenu.remoteFollow')}}
-                            </a> --}}
                             <a class="dropdown-item font-weight-bold" href="{{route('settings')}}">
                                 <span class="fas fa-cog pr-1"></span>
                                 {{__('navmenu.settings')}}

+ 15 - 0
resources/views/timeline/home.blade.php

@@ -0,0 +1,15 @@
+@extends('layouts.app')
+
+@section('content')
+
+<timeline></timeline>
+
+@endsection
+
+@push('scripts')
+<script type="text/javascript">
+	new Vue({
+		el: '#content'
+	});
+</script>
+@endpush

+ 15 - 0
resources/views/timeline/local.blade.php

@@ -0,0 +1,15 @@
+@extends('layouts.app')
+
+@section('content')
+
+<timeline></timeline>
+
+@endsection
+
+@push('scripts')
+<script type="text/javascript">
+	new Vue({
+		el: '#content'
+	});
+</script>
+@endpush

+ 8 - 7
routes/web.php

@@ -38,15 +38,16 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
         Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
 
         Route::group(['prefix' => 'v1'], function () {
+            Route::get('accounts/verify_credentials', 'ApiController@verifyCredentials');
             Route::post('avatar/update', 'ApiController@avatarUpdate');
             Route::get('likes', 'ApiController@hydrateLikes');
-            Route::post('media', 'ApiController@uploadMedia')->middleware('throttle:250,1440');
+            Route::post('media', 'ApiController@uploadMedia')->middleware('throttle:500,1440');
+            Route::get('notifications', 'ApiController@notifications');
+            Route::get('timelines/public', 'PublicApiController@publicTimelineApi');
+            Route::get('timelines/home', 'PublicApiController@homeTimelineApi');
         });
         Route::group(['prefix' => 'v2'], function() {
-            Route::get('notifications', 'InternalApiController@notifications');
-            Route::post('notifications', 'InternalApiController@notificationMarkAllRead');
             Route::get('discover', 'InternalApiController@discover');
-            // Route::get('discover/people', 'InternalApiController@discoverPeople');
             Route::get('discover/posts', 'InternalApiController@discoverPosts');
             Route::get('profile/{username}/status/{postid}', 'PublicApiController@status');
             Route::get('comments/{username}/status/{postId}', 'PublicApiController@statusComments');
@@ -56,7 +57,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
         Route::group(['prefix' => 'local'], function () {
             Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
             Route::post('i/more-comments', 'ApiController@loadMoreComments');
-            Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:250,1440');
+            Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:500,1440');
         });
     });
 
@@ -67,8 +68,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
         Route::get('compose', 'StatusController@compose')->name('compose');
         Route::post('comment', 'CommentController@store')->middleware('throttle:1000,1440');
         Route::post('delete', 'StatusController@delete')->middleware('throttle:1000,1440');
-        Route::post('mute', 'AccountController@mute')->middleware('throttle:100,1440');
-        Route::post('block', 'AccountController@block')->middleware('throttle:100,1440');
+        Route::post('mute', 'AccountController@mute');
+        Route::post('block', 'AccountController@block');
         Route::post('like', 'LikeController@store')->middleware('throttle:1000,1440');
         Route::post('share', 'StatusController@storeShare')->middleware('throttle:1000,1440');
         Route::post('follow', 'FollowerController@store')->middleware('throttle:250,1440');