Unverified Commit a34fe001 authored by daniel's avatar daniel Committed by GitHub
Browse files

Merge pull request #2776 from pixelfed/staging

v0.11.0
parents 014d6144 91cc9adf
# Release Notes # Release Notes
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.10...dev) ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.0...dev)
## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0)
### Added ### Added
- Autocomplete Support (hashtags + mentions) ([de514f7d](https://github.com/pixelfed/pixelfed/commit/de514f7d)) - Autocomplete Support (hashtags + mentions) ([de514f7d](https://github.com/pixelfed/pixelfed/commit/de514f7d))
- Creative Commons Licenses ([552e950](https://github.com/pixelfed/pixelfed/commit/552e950)) - Creative Commons Licenses ([552e950](https://github.com/pixelfed/pixelfed/commit/552e950))
...@@ -11,6 +13,7 @@ ...@@ -11,6 +13,7 @@
- New admin dashboard layout ([eb7d5a4e](https://github.com/pixelfed/pixelfed/commit/eb7d5a4e)) - New admin dashboard layout ([eb7d5a4e](https://github.com/pixelfed/pixelfed/commit/eb7d5a4e))
- Fresh about page layout ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6)) - Fresh about page layout ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6))
- Instance Rules ([a4efbb75](https://github.com/pixelfed/pixelfed/commit/a4efbb75)) - Instance Rules ([a4efbb75](https://github.com/pixelfed/pixelfed/commit/a4efbb75))
- New Home Timeline ([56215be7](https://github.com/pixelfed/pixelfed/commit/56215be7))
### Updated ### Updated
- Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940)) - Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940))
...@@ -102,7 +105,13 @@ ...@@ -102,7 +105,13 @@
- Updated Timeline component, show counts and make sidebar footer lighter. ([0788bffa](https://github.com/pixelfed/pixelfed/commit/0788bffa)) - Updated Timeline component, show counts and make sidebar footer lighter. ([0788bffa](https://github.com/pixelfed/pixelfed/commit/0788bffa))
- Updated AuthServiceProvider, increase default token + refresh token lifetime. ([178ed63d](https://github.com/pixelfed/pixelfed/commit/178ed63d)) - Updated AuthServiceProvider, increase default token + refresh token lifetime. ([178ed63d](https://github.com/pixelfed/pixelfed/commit/178ed63d))
- Updated liked by, fix remote username urls. ([f767d99a](https://github.com/pixelfed/pixelfed/commit/f767d99a)) - Updated liked by, fix remote username urls. ([f767d99a](https://github.com/pixelfed/pixelfed/commit/f767d99a))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - Updated StatusController, add cache invalidation for timeline cursor. ([f3bf2fd4](https://github.com/pixelfed/pixelfed/commit/f3bf2fd4))
- Updated PublicApiController, add recent feed support to home timeline. ([1e230e80](https://github.com/pixelfed/pixelfed/commit/1e230e80))
- Updated Inbox, fix reply/comment bug by moving attachment validation to Note with attachments. ([28df9f7e](https://github.com/pixelfed/pixelfed/commit/28df9f7e))
- Updated PrettyNumber, add decimal option. ([84520fe1](https://github.com/pixelfed/pixelfed/commit/84520fe1))
- Updated app config, change default descriptions. ([7d24560d](https://github.com/pixelfed/pixelfed/commit/7d24560d))
- Updated NotificationCard, fix loading bug. ([69567e19](https://github.com/pixelfed/pixelfed/commit/69567e19))
- Updated DirectMessageController, disable exception logging for invalid urls. Fixes ([#2752](https://github.com/pixelfed/pixelfed/issues/2752)). ([2d0a253e](https://github.com/pixelfed/pixelfed/commit/2d0a253e))
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10) ## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
### Added ### Added
......
...@@ -5,6 +5,7 @@ namespace App\Exceptions; ...@@ -5,6 +5,7 @@ namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable; use Throwable;
use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\OAuthServerException;
use Zttp\ConnectionException;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
...@@ -14,7 +15,8 @@ class Handler extends ExceptionHandler ...@@ -14,7 +15,8 @@ class Handler extends ExceptionHandler
* @var array * @var array
*/ */
protected $dontReport = [ protected $dontReport = [
OAuthServerException::class OAuthServerException::class,
ConnectionException::class
]; ];
/** /**
......
...@@ -596,6 +596,10 @@ class DirectMessageController extends Controller ...@@ -596,6 +596,10 @@ class DirectMessageController extends Controller
$q = $request->input('q'); $q = $request->input('q');
$r = $request->input('remote'); $r = $request->input('remote');
if(!Str::of($q)->contains('.')) {
return [];
}
if($r && Helpers::validateUrl($q)) { if($r && Helpers::validateUrl($q)) {
Helpers::profileFetch($q); Helpers::profileFetch($q);
} }
......
...@@ -12,6 +12,7 @@ use App\{ ...@@ -12,6 +12,7 @@ use App\{
Profile, Profile,
StatusHashtag, StatusHashtag,
Status, Status,
StatusView,
UserFilter UserFilter
}; };
use Auth,Cache; use Auth,Cache;
...@@ -376,9 +377,13 @@ class PublicApiController extends Controller ...@@ -376,9 +377,13 @@ class PublicApiController extends Controller
'page' => 'nullable|integer|max:40', 'page' => 'nullable|integer|max:40',
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX, 'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
'max_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX, 'max_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
'limit' => 'nullable|integer|max:40' 'limit' => 'nullable|integer|max:40',
'recent_feed' => 'nullable',
'recent_min' => 'nullable|integer'
]); ]);
$recentFeed = $request->input('recent_feed') == 'true';
$recentFeedMin = $request->input('recent_min');
$page = $request->input('page'); $page = $request->input('page');
$min = $request->input('min_id'); $min = $request->input('min_id');
$max = $request->input('max_id'); $max = $request->input('max_id');
...@@ -393,29 +398,21 @@ class PublicApiController extends Controller ...@@ -393,29 +398,21 @@ class PublicApiController extends Controller
return; return;
}); });
// TODO: Use redis for timelines $pid = Auth::user()->profile_id;
// $timeline = Timeline::build()->local();
$pid = Auth::user()->profile->id;
$following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function() use($pid) { $following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function() use($pid) {
$following = Follower::whereProfileId($pid)->pluck('following_id'); $following = Follower::whereProfileId($pid)->pluck('following_id');
return $following->push($pid)->toArray(); return $following->push($pid)->toArray();
}); });
// $private = Cache::remember('profiles:private', now()->addMinutes(1440), function() { if($recentFeed == true) {
// return Profile::whereIsPrivate(true) $key = 'profile:home-timeline-cursor:'.$user->id;
// ->orWhere('unlisted', true) $ttl = now()->addMinutes(30);
// ->orWhere('status', '!=', null) $min = Cache::remember($key, $ttl, function() use($pid) {
// ->pluck('id'); $res = StatusView::whereProfileId($pid)->orderByDesc('status_id')->first();
// }); return $res ? $res->status_id : null;
});
// $private = $private->diff($following)->flatten(); }
// $filters = UserFilter::whereUserId($pid)
// ->whereFilterableType('App\Profile')
// ->whereIn('filter_type', ['mute', 'block'])
// ->pluck('filterable_id')->toArray();
// $filtered = array_merge($private->toArray(), $filters);
$filtered = Auth::check() ? UserFilterService::filters(Auth::user()->profile_id) : []; $filtered = Auth::check() ? UserFilterService::filters(Auth::user()->profile_id) : [];
......
...@@ -14,7 +14,7 @@ use App\StatusView; ...@@ -14,7 +14,7 @@ use App\StatusView;
use App\Transformer\ActivityPub\StatusTransformer; use App\Transformer\ActivityPub\StatusTransformer;
use App\Transformer\ActivityPub\Verb\Note; use App\Transformer\ActivityPub\Verb\Note;
use App\User; use App\User;
use Auth, Cache; use Auth, DB, Cache;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use League\Fractal; use League\Fractal;
use App\Util\Media\Filter; use App\Util\Media\Filter;
...@@ -75,12 +75,6 @@ class StatusController extends Controller ...@@ -75,12 +75,6 @@ class StatusController extends Controller
} }
$template = $status->in_reply_to_id ? 'status.reply' : 'status.show'; $template = $status->in_reply_to_id ? 'status.reply' : 'status.show';
// $template = $status->type === 'video' &&
// $request->has('video_beta') &&
// $request->video_beta == 1 &&
// $request->user() ?
// 'status.show_video' : 'status.show';
return view($template, compact('user', 'status')); return view($template, compact('user', 'status'));
} }
...@@ -403,27 +397,27 @@ class StatusController extends Controller ...@@ -403,27 +397,27 @@ class StatusController extends Controller
public function storeView(Request $request) public function storeView(Request $request)
{ {
abort_if(!$request->user(), 403); abort_if(!$request->user(), 403);
$this->validate($request, [
'_v' => 'required|array'
]);
$views = $request->input('_v'); $views = $request->input('_v');
$uid = $request->user()->profile_id; $uid = $request->user()->profile_id;
if(empty($views)) { if(empty($views) || !is_array($views)) {
return; return response()->json(0);
} }
Cache::forget('profile:home-timeline-cursor:' . $request->user()->id);
foreach($views as $view) { foreach($views as $view) {
if(!isset($view['sid']) || !isset($view['pid'])) { if(!isset($view['sid']) || !isset($view['pid'])) {
continue; continue;
} }
DB::transaction(function () use($view, $uid) {
StatusView::firstOrCreate([ StatusView::firstOrCreate([
'status_id' => $view['sid'], 'status_id' => $view['sid'],
'status_profile_id' => $view['pid'], 'status_profile_id' => $view['pid'],
'profile_id' => $uid 'profile_id' => $uid
]); ]);
});
} }
return response()->json(1); return response()->json(1);
......
...@@ -154,13 +154,13 @@ class Inbox ...@@ -154,13 +154,13 @@ class Inbox
$this->handleDirectMessage(); $this->handleDirectMessage();
return; return;
} }
if(!$this->verifyNoteAttachment()) {
return;
}
if($activity['type'] == 'Note' && !empty($activity['inReplyTo'])) { if($activity['type'] == 'Note' && !empty($activity['inReplyTo'])) {
$this->handleNoteReply(); $this->handleNoteReply();
} elseif($activity['type'] == 'Note' && !empty($activity['attachment'])) { } elseif($activity['type'] == 'Note' && !empty($activity['attachment'])) {
if(!$this->verifyNoteAttachment()) {
return;
}
$this->handleNoteCreate(); $this->handleNoteCreate();
} }
} }
......
...@@ -4,7 +4,7 @@ namespace App\Util\Lexer; ...@@ -4,7 +4,7 @@ namespace App\Util\Lexer;
class PrettyNumber class PrettyNumber
{ {
public static function convert($number) public static function convert($number, $showDecimals = true)
{ {
if(!is_integer($number)) { if(!is_integer($number)) {
return $number; return $number;
...@@ -14,7 +14,7 @@ class PrettyNumber ...@@ -14,7 +14,7 @@ class PrettyNumber
foreach ($abbrevs as $exponent => $abbrev) { foreach ($abbrevs as $exponent => $abbrev) {
if(abs($number) >= pow(10, $exponent)) { if(abs($number) >= pow(10, $exponent)) {
$display = $number / pow(10, $exponent); $display = $number / pow(10, $exponent);
$decimals = ($exponent >= 3 && round($display) < 100) ? 1 : 0; $decimals = !$showDecimals ? 0 : ($exponent >= 3 && round($display) < 100) ? 1 : 0;
$number = number_format($display, $decimals).$abbrev; $number = number_format($display, $decimals).$abbrev;
break; break;
} }
......
...@@ -108,8 +108,8 @@ return [ ...@@ -108,8 +108,8 @@ return [
'cipher' => 'AES-256-CBC', 'cipher' => 'AES-256-CBC',
'short_description' => 'Pixelfed - Photo sharing for everyone', 'short_description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.',
'description' => 'Pixelfed - Photo sharing for everyone', 'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.',
'rules' => null, 'rules' => null,
'logo' => '/img/pixelfed-icon-color.svg', 'logo' => '/img/pixelfed-icon-color.svg',
......
...@@ -2,280 +2,280 @@ ...@@ -2,280 +2,280 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Domains | Domains
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Application domains used for routing | Application domains used for routing
| |
*/ */
'domain' => [ 'domain' => [
'admin' => env('ADMIN_DOMAIN'), 'admin' => env('ADMIN_DOMAIN'),
'app' => env('APP_DOMAIN'), 'app' => env('APP_DOMAIN'),
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Pixelfed Version | Pixelfed Version
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This value is the version of your Pixelfed instance. | This value is the version of your Pixelfed instance.
| |
*/ */
'version' => '0.10.10', 'version' => '0.11.0',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| NodeInfo Route Path | NodeInfo Route Path
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Do not change this value unless you know what you are doing. | Do not change this value unless you know what you are doing.
| |
*/ */
'nodeinfo' => [ 'nodeinfo' => [
'url' => config('app.url').'/api/nodeinfo/2.0.json', 'url' => config('app.url').'/api/nodeinfo/2.0.json',
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| PHP/ImageMagic/GD Memory Limit | PHP/ImageMagic/GD Memory Limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This memory_limit value is only used for image processing. The | This memory_limit value is only used for image processing. The
| default memory_limit php.ini is used for the rest of the app. | default memory_limit php.ini is used for the rest of the app.
| |
*/ */
'memory_limit' => env('MEMORY_LIMIT', '1024M'), 'memory_limit' => env('MEMORY_LIMIT', '1024M'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Allow New Registrations | Allow New Registrations
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Enable/disable new local account registrations. | Enable/disable new local account registrations.
| |
*/ */
'open_registration' => env('OPEN_REGISTRATION', true), 'open_registration' => env('OPEN_REGISTRATION', true),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Account file size limit | Account file size limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Update the max account size, the per user limit of files in KB. | Update the max account size, the per user limit of files in KB.
| |
| |
*/ */
'max_account_size' => env('MAX_ACCOUNT_SIZE', 1000000), 'max_account_size' => env('MAX_ACCOUNT_SIZE', 1000000),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Photo file size limit | Photo file size limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Update the max photo size, in KB. | Update the max photo size, in KB.
| |
*/ */
'max_photo_size' => env('MAX_PHOTO_SIZE', 15000), 'max_photo_size' => env('MAX_PHOTO_SIZE', 15000),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Avatar file size limit | Avatar file size limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Update the max avatar size, in KB. | Update the max avatar size, in KB.
| |
*/ */
'max_avatar_size' => (int) env('MAX_AVATAR_SIZE', 2000), 'max_avatar_size' => (int) env('MAX_AVATAR_SIZE', 2000),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Caption limit | Caption limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Change the caption length limit for new local posts. | Change the caption length limit for new local posts.
| |
*/ */
'max_caption_length' => env('MAX_CAPTION_LENGTH', 500), 'max_caption_length' => env('MAX_CAPTION_LENGTH', 500),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Bio length limit | Bio length limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Change the bio length limit for user profiles. | Change the bio length limit for user profiles.
| |
*/ */
'max_bio_length' => env('MAX_BIO_LENGTH', 125), 'max_bio_length' => env('MAX_BIO_LENGTH', 125),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| User name length limit | User name length limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Change the length limit for user names. | Change the length limit for user names.
| |
*/ */
'max_name_length' => env('MAX_NAME_LENGTH', 30), 'max_name_length' => env('MAX_NAME_LENGTH', 30),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Password minimum length limit | Password minimum length limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Change the minimum length limit for user passwords. | Change the minimum length limit for user passwords.
| |
*/ */
'min_password_length' => env('MIN_PASSWORD_LENGTH', 12), 'min_password_length' => env('MIN_PASSWORD_LENGTH', 8),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Album size limit | Album size limit
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The max number of photos allowed per post. | The max number of photos allowed per post.
| |
*/ */
'max_album_length' => env('MAX_ALBUM_LENGTH', 4), 'max_album_length' => env('MAX_ALBUM_LENGTH', 4),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Email Verification | Email Verification
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Require email verification before a new user can do anything. | Require email verification before a new user can do anything.
| |
*/ */
'enforce_email_verification' => env('ENFORCE_EMAIL_VERIFICATION', true), 'enforce_email_verification' => env('ENFORCE_EMAIL_VERIFICATION', true),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Image Quality | Image Quality
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Set the image optimization quality, must be a value between 1-100. | Set the image optimization quality, must be a value between 1-100.
| |
*/ */
'image_quality' => (int) env('IMAGE_QUALITY', 80),