diff --git a/app/Collection.php b/app/Collection.php
new file mode 100644
index 000000000..2f6034f4e
--- /dev/null
+++ b/app/Collection.php
@@ -0,0 +1,10 @@
+hasOne(Status::class, 'id', 'status_id');
+ }
+
+ public function url()
+ {
+ return url('/i/message/' . $this->to_id . '/' . $this->id);
+ }
+
+ public function author()
+ {
+ return $this->hasOne(Profile::class, 'id', 'from_id');
+ }
+
+ public function me()
+ {
+ return Auth::user()->profile->id === $this->from_id;
+ }
+}
diff --git a/app/Http/Controllers/Api/BaseApiController.php b/app/Http/Controllers/Api/BaseApiController.php
index f55c15ce3..bf72d0d0a 100644
--- a/app/Http/Controllers/Api/BaseApiController.php
+++ b/app/Http/Controllers/Api/BaseApiController.php
@@ -6,8 +6,11 @@ use App\Avatar;
use App\Http\Controllers\AvatarController;
use App\Http\Controllers\Controller;
use App\Jobs\AvatarPipeline\AvatarOptimize;
+use App\Jobs\ImageOptimizePipeline\ImageOptimize;
+use App\Media;
use App\Profile;
use App\Transformer\Api\AccountTransformer;
+use App\Transformer\Api\MediaTransformer;
use App\Transformer\Api\StatusTransformer;
use Auth;
use Cache;
@@ -115,4 +118,44 @@ class BaseApiController extends Controller
'msg' => 'Avatar successfully updated',
]);
}
+
+ public function uploadMedia(Request $request)
+ {
+ $this->validate($request, [
+ 'file.*' => function() {
+ return [
+ 'required',
+ 'mimes:' . config('pixelfed.media_types'),
+ 'max:' . config('pixelfed.max_photo_size'),
+ ];
+ },
+ ]);
+ $user = Auth::user();
+ $profile = $user->profile;
+ $monthHash = hash('sha1', date('Y').date('m'));
+ $userHash = hash('sha1', $user->id.(string) $user->created_at);
+ $photo = $request->file('file');
+
+ $storagePath = "public/m/{$monthHash}/{$userHash}";
+ $path = $photo->store($storagePath);
+ $hash = \hash_file('sha256', $photo);
+
+ $media = new Media();
+ $media->status_id = null;
+ $media->profile_id = $profile->id;
+ $media->user_id = $user->id;
+ $media->media_path = $path;
+ $media->original_sha256 = $hash;
+ $media->size = $photo->getClientSize();
+ $media->mime = $photo->getClientMimeType();
+ $media->filter_class = null;
+ $media->filter_name = null;
+ $media->save();
+
+ ImageOptimize::dispatch($media);
+ $resource = new Fractal\Resource\Item($media, new MediaTransformer());
+ $res = $this->fractal->createData($resource)->toArray();
+
+ return response()->json($res);
+ }
}
diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php
index 77962b1be..fb5682cb9 100644
--- a/app/Http/Controllers/StatusController.php
+++ b/app/Http/Controllers/StatusController.php
@@ -110,7 +110,10 @@ class StatusController extends Controller
$status->profile_id = $profile->id;
$status->caption = strip_tags($request->caption);
$status->is_nsfw = $cw;
+
+ // TODO: remove deprecated visibility in favor of scope
$status->visibility = $visibility;
+ $status->scope = $visibility;
$status->save();
diff --git a/app/Transformer/ActivityPub/ProfileTransformer.php b/app/Transformer/ActivityPub/ProfileTransformer.php
index c576b38b3..d270e8c18 100644
--- a/app/Transformer/ActivityPub/ProfileTransformer.php
+++ b/app/Transformer/ActivityPub/ProfileTransformer.php
@@ -39,9 +39,10 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'owner' => $profile->permalink(),
'publicKeyPem' => $profile->public_key,
],
- 'endpoints' => [
- 'sharedInbox' => config('routes.api.sharedInbox'),
- ],
+ // remove shared inbox support until proper support
+ // 'endpoints' => [
+ // 'sharedInbox' => config('routes.api.sharedInbox'),
+ // ],
'icon' => [
'type' => 'Image',
'mediaType' => 'image/jpeg',
diff --git a/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php b/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php
new file mode 100644
index 000000000..7838179de
--- /dev/null
+++ b/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php
@@ -0,0 +1,34 @@
+boolean('local_profile')->default(true)->index()->after('following_id');
+ $table->boolean('local_following')->default(true)->index()->after('local_profile');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('followers', function (Blueprint $table) {
+ $table->dropColumn('local_profile');
+ $table->dropColumn('local_following');
+ });
+ }
+}
diff --git a/resources/assets/js/components/PostComments.vue b/resources/assets/js/components/PostComments.vue
new file mode 100644
index 000000000..a75bda6cf
--- /dev/null
+++ b/resources/assets/js/components/PostComments.vue
@@ -0,0 +1,147 @@
+
+
+
+
+
' + username + ''+ reply + '1s
'; + var comment = '' + username + ''+ reply + '
'; - comments.append(comment); + comments.prepend(comment); commentform.val(''); commentform.blur(); diff --git a/resources/views/layouts/partial/footer.blade.php b/resources/views/layouts/partial/footer.blade.php index d5dd33bcf..be0e22778 100644 --- a/resources/views/layouts/partial/footer.blade.php +++ b/resources/views/layouts/partial/footer.blade.php @@ -7,11 +7,8 @@ Terms Privacy API - Directory - Profiles - Hashtags Language - Powered by PixelFed + Powered by PixelFed diff --git a/storage/purify/.gitignore b/storage/purify/.gitignore new file mode 100644 index 000000000..c96a04f00 --- /dev/null +++ b/storage/purify/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file
+ + {{comment.account.username}} + + +
+
+ Options
+
+ Reply
+ Permalink
+ Embed
+ Profile
+
+ Report
+
+
+