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

Frontend ui refactor
This commit is contained in:
daniel 2019-04-30 22:59:32 -06:00 committed by GitHub
commit 76e343f9e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 379 additions and 337 deletions

View file

@ -42,7 +42,6 @@ API_BASE="/api/1/"
API_SEARCH="/api/search"
OPEN_REGISTRATION=true
RECAPTCHA_ENABLED=false
ENFORCE_EMAIL_VERIFICATION=true
MAX_PHOTO_SIZE=15000

View file

@ -41,7 +41,6 @@ API_BASE="/api/1/"
API_SEARCH="/api/search"
OPEN_REGISTRATION=false
RECAPTCHA_ENABLED=false
ENFORCE_EMAIL_VERIFICATION=true
MAX_PHOTO_SIZE=15000

View file

@ -32,6 +32,7 @@ use App\Jobs\VideoPipeline\{
VideoPostProcess,
VideoThumbnail
};
use App\Services\NotificationService;
class BaseApiController extends Controller
{
@ -47,13 +48,28 @@ class BaseApiController extends Controller
public function notifications(Request $request)
{
$pid = Auth::user()->profile->id;
$timeago = Carbon::now()->subMonths(6);
$notifications = Notification::whereProfileId($pid)
->whereDate('created_at', '>', $timeago)
->latest()
->simplePaginate(10);
$resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
$res = $this->fractal->createData($resource)->toArray();
if(config('exp.ns') == false) {
$timeago = Carbon::now()->subMonths(6);
$notifications = Notification::whereProfileId($pid)
->whereDate('created_at', '>', $timeago)
->latest()
->simplePaginate(10);
$resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
$res = $this->fractal->createData($resource)->toArray();
} else {
$this->validate($request, [
'page' => 'nullable|integer|min:1',
'limit' => 'nullable|integer|min:1|max:10'
]);
$limit = $request->input('limit') ?? 10;
$page = $request->input('page') ?? 1;
if($page > 3) {
return response()->json([]);
}
$end = (int) $page * $limit;
$start = (int) $end - $limit;
$res = NotificationService::get($pid, $start, $end);
}
return response()->json($res);
}

View file

@ -53,10 +53,6 @@ class LoginController extends Controller
'password' => 'required|string|min:6',
];
if (config('pixelfed.recaptcha')) {
$rules['g-recaptcha-response'] = 'required|recaptcha';
}
$this->validate($request, $rules);
}

View file

@ -76,10 +76,6 @@ class RegisterController extends Controller
'password' => 'required|string|min:6|confirmed',
];
if (config('pixelfed.recaptcha')) {
$rules['g-recaptcha-response'] = 'required|recaptcha';
}
return Validator::make($data, $rules);
}

View file

@ -118,7 +118,6 @@ class FederationController extends Controller
'homepage' => 'https://pixelfed.org',
'repo' => 'https://github.com/pixelfed/pixelfed',
],
'captcha' => (bool) config('pixelfed.recaptcha'),
],
'protocols' => [
'activitypub',

View file

@ -0,0 +1,64 @@
<?php
namespace App\Observers;
use App\Notification;
use App\Services\NotificationService;
class NotificationObserver
{
/**
* Handle the notification "created" event.
*
* @param \App\Notification $notification
* @return void
*/
public function created(Notification $notification)
{
NotificationService::set($notification->profile_id, $notification->id);
}
/**
* Handle the notification "updated" event.
*
* @param \App\Notification $notification
* @return void
*/
public function updated(Notification $notification)
{
NotificationService::set($notification->profile_id, $notification->id);
}
/**
* Handle the notification "deleted" event.
*
* @param \App\Notification $notification
* @return void
*/
public function deleted(Notification $notification)
{
NotificationService::del($notification->profile_id, $notification->id);
}
/**
* Handle the notification "restored" event.
*
* @param \App\Notification $notification
* @return void
*/
public function restored(Notification $notification)
{
NotificationService::set($notification->profile_id, $notification->id);
}
/**
* Handle the notification "force deleted" event.
*
* @param \App\Notification $notification
* @return void
*/
public function forceDeleted(Notification $notification)
{
NotificationService::del($notification->profile_id, $notification->id);
}
}

View file

@ -4,9 +4,14 @@ namespace App\Providers;
use App\Observers\{
AvatarObserver,
NotificationObserver,
UserObserver
};
use App\{Avatar,User};
use App\{
Avatar,
Notification,
User
};
use Auth, Horizon, URL;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
@ -25,6 +30,7 @@ class AppServiceProvider extends ServiceProvider
Schema::defaultStringLength(191);
Avatar::observe(AvatarObserver::class);
Notification::observe(NotificationObserver::class);
User::observe(UserObserver::class);
Horizon::auth(function ($request) {

View file

@ -0,0 +1,98 @@
<?php
namespace App\Services;
use Cache, Redis;
use App\{
Notification,
Profile
};
use App\Transformer\Api\NotificationTransformer;
use League\Fractal;
use League\Fractal\Serializer\ArraySerializer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
class NotificationService {
const CACHE_KEY = 'pf:services:notifications:ids:';
public static function get($id, $start = 0, $stop = 300)
{
$res = collect([]);
$key = self::CACHE_KEY . $id;
$stop = $stop > 300 ? 300 : $stop;
$ids = Redis::zrangebyscore($key, $start, $stop);
if(empty($ids)) {
$ids = self::coldGet($id, $start, $stop);
}
foreach($ids as $id) {
$res->push(self::getNotification($id));
}
return $res;
}
public static function coldGet($id, $start = 0, $stop = 300)
{
$stop = $stop > 300 ? 300 : $stop;
$ids = Notification::whereProfileId($id)
->latest()
->skip($start)
->take($stop)
->pluck('id');
foreach($ids as $key) {
self::set($id, $key);
}
return $ids;
}
public static function set($id, $val)
{
return Redis::zadd(self::CACHE_KEY . $id, $val, $val);
}
public static function del($id, $val)
{
return Redis::zrem(self::CACHE_KEY . $id, $val);
}
public static function add($id, $val)
{
return self::set($id, $val);
}
public static function rem($id, $val)
{
return self::del($id, $val);
}
public static function count($id)
{
return Redis::zcount(self::CACHE_KEY . $id, '-inf', '+inf');
}
public static function getNotification($id)
{
return Cache::remember('service:notification:'.$id, now()->addDays(7), function() use($id) {
$n = Notification::findOrFail($id);
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($n, new NotificationTransformer());
return $fractal->createData($resource)->toArray();
});
}
public static function warmCache($id, $stop = 100, $force = false)
{
if(self::count($id) == 0 || $force == true) {
$ids = Notification::whereProfileId($id)
->latest()
->limit($stop)
->pluck('id');
foreach($ids as $key) {
self::set($id, $key);
}
return 1;
}
return 0;
}
}

View file

@ -17,7 +17,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
return [
'id' => (string) $notification->id,
'type' => $this->replaceTypeVerb($notification->action),
'created_at' => (string) $notification->created_at,
'created_at' => (string) $notification->created_at->format('c'),
'account' => null,
'status' => null
];

View file

@ -16,7 +16,6 @@
"beyondcode/laravel-self-diagnosis": "^1.0.2",
"doctrine/dbal": "^2.7",
"fideloper/proxy": "^4.0",
"greggilbert/recaptcha": "dev-master",
"intervention/image": "^2.4",
"jenssegers/agent": "^2.6",
"laravel/framework": "5.8.*",

334
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "702a3ed0b8499d50323723eb4fb41965",
"content-hash": "f11a1ada5d055b3fb00a5f3aeab6e49a",
"packages": [
{
"name": "alchemy/binary-driver",
@ -71,16 +71,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.91.4",
"version": "3.93.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "41b67dce3c86da61137b47054d9d52c6ef57b5ec"
"reference": "021c540f24391e883e15c801d03cbebee1206df1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/41b67dce3c86da61137b47054d9d52c6ef57b5ec",
"reference": "41b67dce3c86da61137b47054d9d52c6ef57b5ec",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/021c540f24391e883e15c801d03cbebee1206df1",
"reference": "021c540f24391e883e15c801d03cbebee1206df1",
"shasum": ""
},
"require": {
@ -104,7 +104,8 @@
"ext-sockets": "*",
"nette/neon": "^2.3",
"phpunit/phpunit": "^4.8.35|^5.4.3",
"psr/cache": "^1.0"
"psr/cache": "^1.0",
"psr/simple-cache": "^1.0"
},
"suggest": {
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
@ -149,7 +150,7 @@
"s3",
"sdk"
],
"time": "2019-04-05T18:10:20+00:00"
"time": "2019-04-30T18:24:07+00:00"
},
{
"name": "beyondcode/laravel-self-diagnosis",
@ -215,16 +216,16 @@
},
{
"name": "cakephp/chronos",
"version": "1.2.4",
"version": "1.2.5",
"source": {
"type": "git",
"url": "https://github.com/cakephp/chronos.git",
"reference": "ebda7326d4a65e53bc5bb915ebbbeee98f1926b0"
"reference": "8a2b005a2db173e1b5493002afb8e1e13c71a62a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/chronos/zipball/ebda7326d4a65e53bc5bb915ebbbeee98f1926b0",
"reference": "ebda7326d4a65e53bc5bb915ebbbeee98f1926b0",
"url": "https://api.github.com/repos/cakephp/chronos/zipball/8a2b005a2db173e1b5493002afb8e1e13c71a62a",
"reference": "8a2b005a2db173e1b5493002afb8e1e13c71a62a",
"shasum": ""
},
"require": {
@ -268,7 +269,7 @@
"datetime",
"time"
],
"time": "2019-02-11T02:08:31+00:00"
"time": "2019-04-23T19:00:57+00:00"
},
{
"name": "composer/semver",
@ -1165,58 +1166,6 @@
"description": "A PHP class to ping hosts.",
"time": "2017-02-02T15:38:40+00:00"
},
{
"name": "greggilbert/recaptcha",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/greggilbert/recaptcha.git",
"reference": "c2ed383785a4fe20467ce470c97c303e5c5b85de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/greggilbert/recaptcha/zipball/c2ed383785a4fe20467ce470c97c303e5c5b85de",
"reference": "c2ed383785a4fe20467ce470c97c303e5c5b85de",
"shasum": ""
},
"require": {
"illuminate/support": "~5.1",
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"classmap": [
"src/migrations"
],
"psr-4": {
"Greggilbert\\Recaptcha\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Greg Gilbert",
"email": "greg@greg-gilbert.com"
}
],
"description": "reCAPTCHA Validator for Laravel 5",
"homepage": "http://github.com/greggilbert/recaptcha",
"keywords": [
"captcha",
"laravel",
"laravel5",
"recaptcha"
],
"time": "2017-08-31T03:39:47+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.3.3",
@ -1560,16 +1509,16 @@
},
{
"name": "jaybizzle/crawler-detect",
"version": "v1.2.80",
"version": "v1.2.81",
"source": {
"type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847"
"reference": "ffb1880f8e9610569d3bc70dc90bf07db311471d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/ffb1880f8e9610569d3bc70dc90bf07db311471d",
"reference": "ffb1880f8e9610569d3bc70dc90bf07db311471d",
"shasum": ""
},
"require": {
@ -1605,7 +1554,7 @@
"crawlerdetect",
"php crawler detect"
],
"time": "2019-04-05T19:52:02+00:00"
"time": "2019-04-23T20:02:21+00:00"
},
{
"name": "jenssegers/agent",
@ -1678,16 +1627,16 @@
},
{
"name": "laravel/framework",
"version": "v5.8.10",
"version": "v5.8.15",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "505325b4577968750e622d7a5a271cf8785a7a1a"
"reference": "8a34004aed6ff0aa4072360e3e5bd875edebc223"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/505325b4577968750e622d7a5a271cf8785a7a1a",
"reference": "505325b4577968750e622d7a5a271cf8785a7a1a",
"url": "https://api.github.com/repos/laravel/framework/zipball/8a34004aed6ff0aa4072360e3e5bd875edebc223",
"reference": "8a34004aed6ff0aa4072360e3e5bd875edebc223",
"shasum": ""
},
"require": {
@ -1821,20 +1770,20 @@
"framework",
"laravel"
],
"time": "2019-04-04T13:39:49+00:00"
"time": "2019-04-30T14:05:03+00:00"
},
{
"name": "laravel/horizon",
"version": "v3.1.1",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/horizon.git",
"reference": "62ba971c2b180fe54dd3e0cde418c7181a481460"
"reference": "32313d787a7a7575c1866e8ed12ec944c1513b7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/horizon/zipball/62ba971c2b180fe54dd3e0cde418c7181a481460",
"reference": "62ba971c2b180fe54dd3e0cde418c7181a481460",
"url": "https://api.github.com/repos/laravel/horizon/zipball/32313d787a7a7575c1866e8ed12ec944c1513b7f",
"reference": "32313d787a7a7575c1866e8ed12ec944c1513b7f",
"shasum": ""
},
"require": {
@ -1890,7 +1839,7 @@
"laravel",
"queue"
],
"time": "2019-04-02T16:09:07+00:00"
"time": "2019-04-30T15:20:11+00:00"
},
{
"name": "laravel/passport",
@ -2624,16 +2573,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.16.3",
"version": "2.17.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "373d9f0d58651af366435148c39beb702c2b7ef4"
"reference": "96acbc0c03782e8115156dd4dd8b736267155066"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/373d9f0d58651af366435148c39beb702c2b7ef4",
"reference": "373d9f0d58651af366435148c39beb702c2b7ef4",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/96acbc0c03782e8115156dd4dd8b736267155066",
"reference": "96acbc0c03782e8115156dd4dd8b736267155066",
"shasum": ""
},
"require": {
@ -2643,9 +2592,9 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
"kylekatarnls/multi-tester": "^0.1",
"kylekatarnls/multi-tester": "^1.1",
"phpmd/phpmd": "^2.6",
"phpstan/phpstan": "^0.10.8",
"phpstan/phpstan": "^0.11",
"phpunit/phpunit": "^7.5 || ^8.0",
"squizlabs/php_codesniffer": "^3.4"
},
@ -2680,7 +2629,7 @@
"datetime",
"time"
],
"time": "2019-04-06T17:09:23+00:00"
"time": "2019-04-27T18:04:27+00:00"
},
{
"name": "neutron/temporary-filesystem",
@ -3701,16 +3650,16 @@
},
{
"name": "psr/http-factory",
"version": "1.0.0",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c"
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
"reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
@ -3749,7 +3698,7 @@
"request",
"response"
],
"time": "2018-07-30T21:54:04+00:00"
"time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
@ -4094,16 +4043,16 @@
},
{
"name": "spatie/db-dumper",
"version": "2.13.2",
"version": "2.14.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/db-dumper.git",
"reference": "c0eb0e16d73af665e23bf5b92d1ab2079ab8df91"
"reference": "eec21c55012b02fb8453c9929fa1c3150ca184ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/db-dumper/zipball/c0eb0e16d73af665e23bf5b92d1ab2079ab8df91",
"reference": "c0eb0e16d73af665e23bf5b92d1ab2079ab8df91",
"url": "https://api.github.com/repos/spatie/db-dumper/zipball/eec21c55012b02fb8453c9929fa1c3150ca184ac",
"reference": "eec21c55012b02fb8453c9929fa1c3150ca184ac",
"shasum": ""
},
"require": {
@ -4140,7 +4089,7 @@
"mysqldump",
"spatie"
],
"time": "2019-03-03T10:52:00+00:00"
"time": "2019-04-17T07:03:19+00:00"
},
{
"name": "spatie/image-optimizer",
@ -4194,16 +4143,16 @@
},
{
"name": "spatie/laravel-backup",
"version": "6.1.2",
"version": "6.2.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-backup.git",
"reference": "3b223bf8355d97c4bb9c0afbd7b4c4f7952fc529"
"reference": "d706e64c2500fda276d421551c140693156c0195"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-backup/zipball/3b223bf8355d97c4bb9c0afbd7b4c4f7952fc529",
"reference": "3b223bf8355d97c4bb9c0afbd7b4c4f7952fc529",
"url": "https://api.github.com/repos/spatie/laravel-backup/zipball/d706e64c2500fda276d421551c140693156c0195",
"reference": "d706e64c2500fda276d421551c140693156c0195",
"shasum": ""
},
"require": {
@ -4264,7 +4213,7 @@
"laravel-backup",
"spatie"
],
"time": "2019-04-05T13:08:54+00:00"
"time": "2019-04-25T11:01:00+00:00"
},
{
"name": "spatie/laravel-image-optimizer",
@ -4433,16 +4382,16 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.2.0",
"version": "v6.2.1",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707"
"reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
"reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a",
"reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a",
"shasum": ""
},
"require": {
@ -4491,20 +4440,20 @@
"mail",
"mailer"
],
"time": "2019-03-10T07:52:41+00:00"
"time": "2019-04-21T09:21:45+00:00"
},
{
"name": "symfony/console",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "24206aff3efe6962593297e57ef697ebb220e384"
"reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/24206aff3efe6962593297e57ef697ebb220e384",
"reference": "24206aff3efe6962593297e57ef697ebb220e384",
"url": "https://api.github.com/repos/symfony/console/zipball/e2840bb38bddad7a0feaf85931e38fdcffdb2f81",
"reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81",
"shasum": ""
},
"require": {
@ -4563,7 +4512,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-04-01T07:32:59+00:00"
"time": "2019-04-08T14:23:48+00:00"
},
{
"name": "symfony/contracts",
@ -4635,7 +4584,7 @@
},
{
"name": "symfony/css-selector",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -4688,16 +4637,16 @@
},
{
"name": "symfony/debug",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "43ce8ab34c734dcc8a4af576cb86711daab964c5"
"reference": "2d279b6bb1d582dd5740d4d3251ae8c18812ed37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/43ce8ab34c734dcc8a4af576cb86711daab964c5",
"reference": "43ce8ab34c734dcc8a4af576cb86711daab964c5",
"url": "https://api.github.com/repos/symfony/debug/zipball/2d279b6bb1d582dd5740d4d3251ae8c18812ed37",
"reference": "2d279b6bb1d582dd5740d4d3251ae8c18812ed37",
"shasum": ""
},
"require": {
@ -4740,20 +4689,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2019-03-10T17:09:50+00:00"
"time": "2019-04-11T11:27:41+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544"
"reference": "fbce53cd74ac509cbe74b6f227622650ab759b02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544",
"reference": "ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fbce53cd74ac509cbe74b6f227622650ab759b02",
"reference": "fbce53cd74ac509cbe74b6f227622650ab759b02",
"shasum": ""
},
"require": {
@ -4804,11 +4753,11 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2019-03-30T15:58:42+00:00"
"time": "2019-04-06T13:51:08+00:00"
},
{
"name": "symfony/filesystem",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@ -4858,16 +4807,16 @@
},
{
"name": "symfony/finder",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a"
"reference": "e45135658bd6c14b61850bf131c4f09a55133f69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/267b7002c1b70ea80db0833c3afe05f0fbde580a",
"reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a",
"url": "https://api.github.com/repos/symfony/finder/zipball/e45135658bd6c14b61850bf131c4f09a55133f69",
"reference": "e45135658bd6c14b61850bf131c4f09a55133f69",
"shasum": ""
},
"require": {
@ -4903,20 +4852,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-02-23T15:42:05+00:00"
"time": "2019-04-06T13:51:08+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1"
"reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1",
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/6ebbe61f48069033225c9d3fa7eb5ed116d766d6",
"reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6",
"shasum": ""
},
"require": {
@ -4957,20 +4906,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2019-03-30T15:58:42+00:00"
"time": "2019-04-17T14:56:00+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "e8b940bbeebf0f96789b5d17d9d77f8b2613960b"
"reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/e8b940bbeebf0f96789b5d17d9d77f8b2613960b",
"reference": "e8b940bbeebf0f96789b5d17d9d77f8b2613960b",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/3db83303dbc1da9777e5ff63423b8b7fde423a1b",
"reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b",
"shasum": ""
},
"require": {
@ -5046,7 +4995,7 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2019-04-02T19:03:51+00:00"
"time": "2019-04-17T16:17:13+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -5451,16 +5400,16 @@
},
{
"name": "symfony/process",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6"
"reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6",
"reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6",
"url": "https://api.github.com/repos/symfony/process/zipball/8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"shasum": ""
},
"require": {
@ -5496,7 +5445,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-03-10T20:07:02+00:00"
"time": "2019-04-10T16:20:36+00:00"
},
{
"name": "symfony/psr-http-message-bridge",
@ -5565,16 +5514,16 @@
},
{
"name": "symfony/routing",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "319f600c1ea0f981f6bdc2f042cfc1690957c0e0"
"reference": "0e5719d216017b1a0342fa48e86467cedca1c954"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/319f600c1ea0f981f6bdc2f042cfc1690957c0e0",
"reference": "319f600c1ea0f981f6bdc2f042cfc1690957c0e0",
"url": "https://api.github.com/repos/symfony/routing/zipball/0e5719d216017b1a0342fa48e86467cedca1c954",
"reference": "0e5719d216017b1a0342fa48e86467cedca1c954",
"shasum": ""
},
"require": {
@ -5637,20 +5586,20 @@
"uri",
"url"
],
"time": "2019-03-30T15:58:42+00:00"
"time": "2019-04-14T18:04:59+00:00"
},
{
"name": "symfony/translation",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "e46933cc31b68f51f7fc5470fb55550407520f56"
"reference": "46c0dede1f925383d13dc783857be2c41efd0b24"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/e46933cc31b68f51f7fc5470fb55550407520f56",
"reference": "e46933cc31b68f51f7fc5470fb55550407520f56",
"url": "https://api.github.com/repos/symfony/translation/zipball/46c0dede1f925383d13dc783857be2c41efd0b24",
"reference": "46c0dede1f925383d13dc783857be2c41efd0b24",
"shasum": ""
},
"require": {
@ -5672,7 +5621,9 @@
"symfony/console": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/intl": "~3.4|~4.0",
"symfony/var-dumper": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0"
},
"suggest": {
@ -5710,20 +5661,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-04-01T14:13:08+00:00"
"time": "2019-04-10T16:20:36+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.2.5",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf"
"reference": "e760a38e12b15032325e64be63f7ffc1817af617"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/9f87189ac10b42edf7fb8edc846f1937c6d157cf",
"reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/e760a38e12b15032325e64be63f7ffc1817af617",
"reference": "e760a38e12b15032325e64be63f7ffc1817af617",
"shasum": ""
},
"require": {
@ -5786,20 +5737,20 @@
"debug",
"dump"
],
"time": "2019-02-23T15:17:42+00:00"
"time": "2019-04-17T14:57:01+00:00"
},
{
"name": "tightenco/collect",
"version": "v5.8.10",
"version": "v5.8.15",
"source": {
"type": "git",
"url": "https://github.com/tightenco/collect.git",
"reference": "1e4120c90b3536a9ebd080d50ecaae7b75719054"
"reference": "d1d78dbdd8884c35a79f9750743177297e7f31a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tightenco/collect/zipball/1e4120c90b3536a9ebd080d50ecaae7b75719054",
"reference": "1e4120c90b3536a9ebd080d50ecaae7b75719054",
"url": "https://api.github.com/repos/tightenco/collect/zipball/d1d78dbdd8884c35a79f9750743177297e7f31a9",
"reference": "d1d78dbdd8884c35a79f9750743177297e7f31a9",
"shasum": ""
},
"require": {
@ -5836,7 +5787,7 @@
"collection",
"laravel"
],
"time": "2019-04-02T20:31:59+00:00"
"time": "2019-04-18T18:52:05+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -5939,16 +5890,16 @@
},
{
"name": "zendframework/zend-diactoros",
"version": "2.1.1",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "c3c330192bc9cc51b7e9ce968ff721dc32ffa986"
"reference": "37bf68b428850ee26ed7c3be6c26236dd95a95f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/c3c330192bc9cc51b7e9ce968ff721dc32ffa986",
"reference": "c3c330192bc9cc51b7e9ce968ff721dc32ffa986",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/37bf68b428850ee26ed7c3be6c26236dd95a95f1",
"reference": "37bf68b428850ee26ed7c3be6c26236dd95a95f1",
"shasum": ""
},
"require": {
@ -6001,7 +5952,7 @@
"psr",
"psr-7"
],
"time": "2019-01-05T20:13:32+00:00"
"time": "2019-04-29T21:11:00+00:00"
}
],
"packages-dev": [
@ -6287,16 +6238,16 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.8.1",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8"
"reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8",
"reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"shasum": ""
},
"require": {
@ -6331,7 +6282,7 @@
"object",
"object graph"
],
"time": "2018-06-11T23:09:50+00:00"
"time": "2019-04-07T13:18:21+00:00"
},
{
"name": "nunomaduro/collision",
@ -6555,16 +6506,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.0",
"version": "4.3.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "94fd0001232e47129dd3504189fa1c7225010d08"
"reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
"reference": "94fd0001232e47129dd3504189fa1c7225010d08",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c",
"reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c",
"shasum": ""
},
"require": {
@ -6602,7 +6553,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-11-30T07:14:17+00:00"
"time": "2019-04-30T17:48:53+00:00"
},
{
"name": "phpdocumentor/type-resolver",
@ -6968,16 +6919,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.8",
"version": "7.5.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a"
"reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c29c0525cf4572c11efe1db49a8b8aee9dfac58a",
"reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/134669cf0eeac3f79bc7f0c793efbc158bffc160",
"reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160",
"shasum": ""
},
"require": {
@ -7048,7 +6999,7 @@
"testing",
"xunit"
],
"time": "2019-03-26T13:23:54+00:00"
"time": "2019-04-19T15:50:46+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -7217,16 +7168,16 @@
},
{
"name": "sebastian/environment",
"version": "4.1.0",
"version": "4.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656"
"reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656",
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3095910f0f0fb155ac4021fc51a4a7a39ac04e8a",
"reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a",
"shasum": ""
},
"require": {
@ -7241,7 +7192,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
"dev-master": "4.2-dev"
}
},
"autoload": {
@ -7266,7 +7217,7 @@
"environment",
"hhvm"
],
"time": "2019-02-01T05:27:49+00:00"
"time": "2019-04-25T07:55:20+00:00"
},
{
"name": "sebastian/exporter",
@ -7710,9 +7661,7 @@
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"greggilbert/recaptcha": 20
},
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
@ -7720,6 +7669,7 @@
"ext-bcmath": "*",
"ext-ctype": "*",
"ext-curl": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*"

View file

@ -150,7 +150,6 @@ return [
/*
* Package Service Providers...
*/
Greggilbert\Recaptcha\RecaptchaServiceProvider::class,
Jackiedo\DotenvEditor\DotenvEditorServiceProvider::class,
/*
@ -211,7 +210,6 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
'DotenvEditor' => Jackiedo\DotenvEditor\Facades\DotenvEditor::class,
'PrettyNumber' => App\Util\Lexer\PrettyNumber::class,
'Purify' => Stevebauman\Purify\Facades\Purify::class,

View file

@ -3,6 +3,7 @@
return [
'lc' => env('EXP_LC', false),
'rec' => env('EXP_REC', false)
'rec' => env('EXP_REC', false),
'ns' => env('EXP_NS', false)
];

View file

@ -74,14 +74,14 @@ return [
/*
|--------------------------------------------------------------------------
| Enable Google Recaptcha v2
| ActivityPub
|--------------------------------------------------------------------------
|
| Enable/disable recaptcha on login/registration forms. API Keys required.
|
*/
'recaptcha' => env('RECAPTCHA_ENABLED', false),
'ap_inbox' => env('ACTIVITYPUB_INBOX', false),
'ap_shared' => env('ACTIVITYPUB_SHAREDINBOX', false),
'ap_delivery_timeout' => env('ACTIVITYPUB_DELIVERY_TIMEOUT', 2.0),
'ap_delivery_concurrency' => env('ACTIVITYPUB_DELIVERY_CONCURRENCY', 10),
'remote_follow_enabled' => env('REMOTE_FOLLOW', false),
'activitypub_enabled' => env('ACTIVITY_PUB', false),
@ -262,11 +262,6 @@ return [
'enforce_account_limit' => env('LIMIT_ACCOUNT_SIZE', true),
'ap_inbox' => env('ACTIVITYPUB_INBOX', false),
'ap_shared' => env('ACTIVITYPUB_SHAREDINBOX', false),
'ap_delivery_timeout' => env('ACTIVITYPUB_DELIVERY_TIMEOUT', 2.0),
'ap_delivery_concurrency' => env('ACTIVITYPUB_DELIVERY_CONCURRENCY', 10),
'import' => [
'instagram' => [
'enabled' => false,

View file

@ -1,66 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| API Keys
|--------------------------------------------------------------------------
|
| Set the public and private API keys as provided by reCAPTCHA.
|
| In version 2 of reCAPTCHA, public_key is the Site key,
| and private_key is the Secret key.
|
*/
'public_key' => env('RECAPTCHA_PUBLIC_KEY', ''),
'private_key' => env('RECAPTCHA_PRIVATE_KEY', ''),
/*
|--------------------------------------------------------------------------
| Template
|--------------------------------------------------------------------------
|
| Set a template to use if you don't want to use the standard one.
|
*/
'template' => '',
/*
|--------------------------------------------------------------------------
| Driver
|--------------------------------------------------------------------------
|
| Determine how to call out to get response; values are 'curl' or 'native'.
| Only applies to v2.
|
*/
'driver' => 'curl',
/*
|--------------------------------------------------------------------------
| Options
|--------------------------------------------------------------------------
|
| Various options for the driver
|
*/
'options' => [
'curl_timeout' => 1,
'curl_verify' => true,
],
/*
|--------------------------------------------------------------------------
| Version
|--------------------------------------------------------------------------
|
| Set which version of ReCaptcha to use.
|
*/
'version' => 2,
];

BIN
public/js/timeline.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -42,6 +42,7 @@
</p>
</div>
</div>
<div class="small text-muted" data-toggle="tooltip" data-placement="bottom" :title="n.created_at">{{timeAgo(n.created_at)}}</div>
</div>
<div v-if="notifications.length">
<infinite-loading @infinite="infiniteNotifications">
@ -127,6 +128,38 @@
}
return text.slice(0,15) + '...'
},
timeAgo(ts) {
let date = Date.parse(ts);
let seconds = Math.floor((new Date() - date) / 1000);
let interval = Math.floor(seconds / 31536000);
if (interval >= 1) {
return interval + "y";
}
interval = Math.floor(seconds / 604800);
if (interval >= 1) {
return interval + "w";
}
interval = Math.floor(seconds / 86400);
if (interval >= 1) {
return interval + "d";
}
interval = Math.floor(seconds / 3600);
if (interval >= 1) {
return interval + "h";
}
interval = Math.floor(seconds / 60);
if (interval >= 1) {
return interval + "m";
}
return Math.floor(seconds) + "s";
},
mentionUrl(status) {
let username = status.account.username;
let id = status.id;
return '/p/' + username + '/' + id;
}
}
}

View file

@ -132,7 +132,7 @@
<div v-if="modes.infinite == true && !loading && feed.length > 0">
<div class="card">
<div class="card-body">
<infinite-loading @infinite="infiniteTimeline" distance="800">
<infinite-loading @infinite="infiniteTimeline" :distance="800">
<div slot="no-more" class="font-weight-bold">No more posts to load</div>
<div slot="no-results" class="font-weight-bold">No posts found</div>
</infinite-loading>

View file

@ -24,18 +24,6 @@
</div>
</div>
</div>
<div class="form-group row">
<label for="app_url" class="col-sm-3 col-form-label font-weight-bold text-right">Recaptcha</label>
<div class="col-sm-9">
<div class="form-check pb-2">
<input class="form-check-input" type="checkbox" id="recaptcha" name="recaptcha" {{config('pixelfed.recaptcha') === true ? 'checked=""' : '' }}>
<label class="form-check-label font-weight-bold" for="open_registration">
{{config('pixelfed.recaptcha') == true ? 'Enabled' : 'Disabled' }}
</label>
<p class="text-muted small help-text font-weight-bold">When this option is enabled, new user registration is open.</p>
</div>
</div>
</div>
<div class="form-group row">
<label for="app_url" class="col-sm-3 col-form-label font-weight-bold text-right">ActivityPub</label>
<div class="col-sm-9">

View file

@ -26,12 +26,6 @@
</div>
</div>
@if(config('pixelfed.recaptcha'))
<div class="row my-3">
{!! Recaptcha::render() !!}
</div>
@endif
<div class="form-group row mb-0">
<div class="col-md-12">
<button type="submit" class="btn btn-success btn-block font-weight-bold">

View file

@ -47,12 +47,6 @@
</div>
</div>
@if(config('pixelfed.recaptcha'))
<div class="row my-3">
{!! Recaptcha::render() !!}
</div>
@endif
<div class="form-group row mb-0">
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">

View file

@ -75,12 +75,6 @@
</div>
</div>
@if(config('pixelfed.recaptcha'))
<div class="row my-3">
{!! Recaptcha::render() !!}
</div>
@endif
<div class="form-group row">
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">

View file

@ -26,12 +26,6 @@
</div>
</div>
@if(config('pixelfed.recaptcha'))
<div class="row my-3">
{!! Recaptcha::render() !!}
</div>
@endif
<div class="form-group row mb-0">
<div class="col-md-12">
<button type="submit" class="btn btn-success btn-block font-weight-bold">

View file

@ -140,11 +140,6 @@
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="{{ __('Confirm Password') }}" required>
</div>
</div>
@if(config('pixelfed.recaptcha'))
<div class="row my-3">
{!! Recaptcha::render() !!}
</div>
@endif
<div class="form-group row">
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">