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
## [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
- Autocomplete Support (hashtags + mentions) ([de514f7d](https://github.com/pixelfed/pixelfed/commit/de514f7d))
- Creative Commons Licenses ([552e950](https://github.com/pixelfed/pixelfed/commit/552e950))
......@@ -11,6 +13,7 @@
- New admin dashboard layout ([eb7d5a4e](https://github.com/pixelfed/pixelfed/commit/eb7d5a4e))
- Fresh about page layout ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6))
- Instance Rules ([a4efbb75](https://github.com/pixelfed/pixelfed/commit/a4efbb75))
- New Home Timeline ([56215be7](https://github.com/pixelfed/pixelfed/commit/56215be7))
### Updated
- Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940))
......@@ -102,7 +105,13 @@
- 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 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)
### Added
......
......@@ -5,6 +5,7 @@ namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
use League\OAuth2\Server\Exception\OAuthServerException;
use Zttp\ConnectionException;
class Handler extends ExceptionHandler
{
......@@ -14,7 +15,8 @@ class Handler extends ExceptionHandler
* @var array
*/
protected $dontReport = [
OAuthServerException::class
OAuthServerException::class,
ConnectionException::class
];
/**
......
......@@ -596,6 +596,10 @@ class DirectMessageController extends Controller
$q = $request->input('q');
$r = $request->input('remote');
if(!Str::of($q)->contains('.')) {
return [];
}
if($r && Helpers::validateUrl($q)) {
Helpers::profileFetch($q);
}
......
......@@ -12,6 +12,7 @@ use App\{
Profile,
StatusHashtag,
Status,
StatusView,
UserFilter
};
use Auth,Cache;
......@@ -376,9 +377,13 @@ class PublicApiController extends Controller
'page' => 'nullable|integer|max:40',
'min_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');
$min = $request->input('min_id');
$max = $request->input('max_id');
......@@ -393,29 +398,21 @@ class PublicApiController extends Controller
return;
});
// TODO: Use redis for timelines
// $timeline = Timeline::build()->local();
$pid = Auth::user()->profile->id;
$pid = Auth::user()->profile_id;
$following = Cache::remember('profile:following:'.$pid, now()->addMinutes(1440), function() use($pid) {
$following = Follower::whereProfileId($pid)->pluck('following_id');
return $following->push($pid)->toArray();
});
// $private = Cache::remember('profiles:private', now()->addMinutes(1440), function() {
// return Profile::whereIsPrivate(true)
// ->orWhere('unlisted', true)
// ->orWhere('status', '!=', null)
// ->pluck('id');
// });
// $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);
if($recentFeed == true) {
$key = 'profile:home-timeline-cursor:'.$user->id;
$ttl = now()->addMinutes(30);
$min = Cache::remember($key, $ttl, function() use($pid) {
$res = StatusView::whereProfileId($pid)->orderByDesc('status_id')->first();
return $res ? $res->status_id : null;
});
}
$filtered = Auth::check() ? UserFilterService::filters(Auth::user()->profile_id) : [];
......
......@@ -14,7 +14,7 @@ use App\StatusView;
use App\Transformer\ActivityPub\StatusTransformer;
use App\Transformer\ActivityPub\Verb\Note;
use App\User;
use Auth, Cache;
use Auth, DB, Cache;
use Illuminate\Http\Request;
use League\Fractal;
use App\Util\Media\Filter;
......@@ -75,12 +75,6 @@ class StatusController extends Controller
}
$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'));
}
......@@ -403,27 +397,27 @@ class StatusController extends Controller
public function storeView(Request $request)
{
abort_if(!$request->user(), 403);
$this->validate($request, [
'_v' => 'required|array'
]);
$views = $request->input('_v');
$uid = $request->user()->profile_id;
if(empty($views)) {
return;
if(empty($views) || !is_array($views)) {
return response()->json(0);
}
Cache::forget('profile:home-timeline-cursor:' . $request->user()->id);
foreach($views as $view) {
if(!isset($view['sid']) || !isset($view['pid'])) {
continue;
}
StatusView::firstOrCreate([
'status_id' => $view['sid'],
'status_profile_id' => $view['pid'],
'profile_id' => $uid
]);
DB::transaction(function () use($view, $uid) {
StatusView::firstOrCreate([
'status_id' => $view['sid'],
'status_profile_id' => $view['pid'],
'profile_id' => $uid
]);
});
}
return response()->json(1);
......
......@@ -154,13 +154,13 @@ class Inbox
$this->handleDirectMessage();
return;
}
if(!$this->verifyNoteAttachment()) {
return;
}
if($activity['type'] == 'Note' && !empty($activity['inReplyTo'])) {
$this->handleNoteReply();
} elseif($activity['type'] == 'Note' && !empty($activity['attachment'])) {
if(!$this->verifyNoteAttachment()) {
return;
}
$this->handleNoteCreate();
}
}
......
......@@ -4,7 +4,7 @@ namespace App\Util\Lexer;
class PrettyNumber
{
public static function convert($number)
public static function convert($number, $showDecimals = true)
{
if(!is_integer($number)) {
return $number;
......@@ -14,7 +14,7 @@ class PrettyNumber
foreach ($abbrevs as $exponent => $abbrev) {
if(abs($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;
break;
}
......
......@@ -108,8 +108,8 @@ return [
'cipher' => 'AES-256-CBC',
'short_description' => 'Pixelfed - Photo sharing for everyone',
'description' => 'Pixelfed - Photo sharing for everyone',
'short_description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.',
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.',
'rules' => null,
'logo' => '/img/pixelfed-icon-color.svg',
......
......@@ -2,280 +2,280 @@
return [
/*
|--------------------------------------------------------------------------
| Domains
|--------------------------------------------------------------------------
|
| Application domains used for routing
|
*/
'domain' => [
'admin' => env('ADMIN_DOMAIN'),
'app' => env('APP_DOMAIN'),
],
/*
|--------------------------------------------------------------------------
| Domains
|--------------------------------------------------------------------------
|
| Application domains used for routing
|
*/
'domain' => [
'admin' => env('ADMIN_DOMAIN'),
'app' => env('APP_DOMAIN'),
],
/*
|--------------------------------------------------------------------------
| Pixelfed Version
|--------------------------------------------------------------------------
|
| This value is the version of your Pixelfed instance.
|
*/
'version' => '0.10.10',
/*
|--------------------------------------------------------------------------
| Pixelfed Version
|--------------------------------------------------------------------------
|
| This value is the version of your Pixelfed instance.
|
*/
'version' => '0.11.0',
/*
|--------------------------------------------------------------------------
| NodeInfo Route Path
|--------------------------------------------------------------------------
|
| Do not change this value unless you know what you are doing.
|
*/
'nodeinfo' => [
'url' => config('app.url').'/api/nodeinfo/2.0.json',
],
/*
|--------------------------------------------------------------------------
| NodeInfo Route Path
|--------------------------------------------------------------------------
|
| Do not change this value unless you know what you are doing.
|
*/
'nodeinfo' => [
'url' => config('app.url').'/api/nodeinfo/2.0.json',
],
/*
|--------------------------------------------------------------------------
| PHP/ImageMagic/GD Memory Limit
|--------------------------------------------------------------------------
|
| This memory_limit value is only used for image processing. The
| default memory_limit php.ini is used for the rest of the app.
|
*/
'memory_limit' => env('MEMORY_LIMIT', '1024M'),
/*
|--------------------------------------------------------------------------
| PHP/ImageMagic/GD Memory Limit
|--------------------------------------------------------------------------
|
| This memory_limit value is only used for image processing. The
| default memory_limit php.ini is used for the rest of the app.
|
*/
'memory_limit' => env('MEMORY_LIMIT', '1024M'),
/*
|--------------------------------------------------------------------------
| Allow New Registrations
|--------------------------------------------------------------------------
|
| Enable/disable new local account registrations.
|
*/
'open_registration' => env('OPEN_REGISTRATION', true),
/*
|--------------------------------------------------------------------------
| Allow New Registrations
|--------------------------------------------------------------------------
|
| Enable/disable new local account registrations.
|
*/
'open_registration' => env('OPEN_REGISTRATION', true),
/*
|--------------------------------------------------------------------------
| Account file size limit
|--------------------------------------------------------------------------
|
| Update the max account size, the per user limit of files in KB.
|
|
*/
'max_account_size' => env('MAX_ACCOUNT_SIZE', 1000000),
/*
|--------------------------------------------------------------------------
| Account file size limit
|--------------------------------------------------------------------------
|
| Update the max account size, the per user limit of files in KB.
|
|
*/
'max_account_size' => env('MAX_ACCOUNT_SIZE', 1000000),
/*
|--------------------------------------------------------------------------
| Photo file size limit
|--------------------------------------------------------------------------
|
| Update the max photo size, in KB.
|
*/
'max_photo_size' => env('MAX_PHOTO_SIZE', 15000),
/*
|--------------------------------------------------------------------------
| Photo file size limit
|--------------------------------------------------------------------------
|
| Update the max photo size, in KB.
|
*/
'max_photo_size' => env('MAX_PHOTO_SIZE', 15000),
/*
|--------------------------------------------------------------------------
| Avatar file size limit
|--------------------------------------------------------------------------
|
| Update the max avatar size, in KB.
|
*/
'max_avatar_size' => (int) env('MAX_AVATAR_SIZE', 2000),
/*
|--------------------------------------------------------------------------
| Avatar file size limit
|--------------------------------------------------------------------------
|
| Update the max avatar size, in KB.
|
*/
'max_avatar_size' => (int) env('MAX_AVATAR_SIZE', 2000),
/*
|--------------------------------------------------------------------------
| Caption limit
|--------------------------------------------------------------------------
|
| Change the caption length limit for new local posts.
|
*/
'max_caption_length' => env('MAX_CAPTION_LENGTH', 500),
/*
|--------------------------------------------------------------------------
| Caption limit
|--------------------------------------------------------------------------
|
| Change the caption length limit for new local posts.
|
*/
'max_caption_length' => env('MAX_CAPTION_LENGTH', 500),
/*
|--------------------------------------------------------------------------
| Bio length limit
|--------------------------------------------------------------------------
|
| Change the bio length limit for user profiles.
|
*/
'max_bio_length' => env('MAX_BIO_LENGTH', 125),
/*
|--------------------------------------------------------------------------
| Bio length limit
|--------------------------------------------------------------------------
|
| Change the bio length limit for user profiles.
|
*/
'max_bio_length' => env('MAX_BIO_LENGTH', 125),
/*
|--------------------------------------------------------------------------
| User name length limit
|--------------------------------------------------------------------------
|
| Change the length limit for user names.
|
*/
'max_name_length' => env('MAX_NAME_LENGTH', 30),
/*
|--------------------------------------------------------------------------
| User name length limit
|--------------------------------------------------------------------------
|
| Change the length limit for user names.
|
*/
'max_name_length' => env('MAX_NAME_LENGTH', 30),
/*
|--------------------------------------------------------------------------
| Password minimum length limit
|--------------------------------------------------------------------------
|
| Change the minimum length limit for user passwords.
|
*/
'min_password_length' => env('MIN_PASSWORD_LENGTH', 12),
/*
|--------------------------------------------------------------------------
| Password minimum length limit
|--------------------------------------------------------------------------
|
| Change the minimum length limit for user passwords.
|
*/
'min_password_length' => env('MIN_PASSWORD_LENGTH', 8),
/*
|--------------------------------------------------------------------------
| Album size limit
|--------------------------------------------------------------------------
|
| The max number of photos allowed per post.
|
*/
'max_album_length' => env('MAX_ALBUM_LENGTH', 4),
/*
|--------------------------------------------------------------------------
| Album size limit
|--------------------------------------------------------------------------
|
| The max number of photos allowed per post.
|
*/
'max_album_length' => env('MAX_ALBUM_LENGTH', 4),
/*
|--------------------------------------------------------------------------
| Email Verification
|--------------------------------------------------------------------------
|
| Require email verification before a new user can do anything.
|
*/
'enforce_email_verification' => env('ENFORCE_EMAIL_VERIFICATION', true),
/*
|--------------------------------------------------------------------------
| Email Verification
|--------------------------------------------------------------------------
|
| Require email verification before a new user can do anything.
|
*/
'enforce_email_verification' => env('ENFORCE_EMAIL_VERIFICATION', true),
/*
|--------------------------------------------------------------------------
| Image Quality
|--------------------------------------------------------------------------
|
| Set the image optimization quality, must be a value between 1-100.
|
*/
'image_quality' => (int) env('IMAGE_QUALITY', 80),
/*
|--------------------------------------------------------------------------
| Image Quality
|--------------------------------------------------------------------------
|
| Set the image optimization quality, must be a value between 1-100.
|
*/
'image_quality' => (int) env('IMAGE_QUALITY', 80),
/*
|--------------------------------------------------------------------------
| Account deletion
|--------------------------------------------------------------------------
|
| Enable account deletion.
|
*/
'account_deletion' => env('ACCOUNT_DELETION', true),
/*
|--------------------------------------------------------------------------
| Account deletion
|--------------------------------------------------------------------------
|
| Enable account deletion.
|
*/
'account_deletion' => env('ACCOUNT_DELETION', true),
/*
|--------------------------------------------------------------------------
| Account deletion after X days
|--------------------------------------------------------------------------
|
| Set account deletion queue after X days, set to false to delete accounts
| immediately.
|
*/
'account_delete_after' => env('ACCOUNT_DELETE_AFTER', false),
/*
|--------------------------------------------------------------------------
| Account deletion after X days
|--------------------------------------------------------------------------
|
| Set account deletion queue after X days, set to false to delete accounts
| immediately.
|
*/
'account_delete_after' => env('ACCOUNT_DELETE_AFTER', false),
/*
|--------------------------------------------------------------------------
| Enable Cloud Storage
|--------------------------------------------------------------------------
|
| Store media on object storage like S3, Digital Ocean Spaces, Rackspace
|
*/
'cloud_storage' => env('PF_ENABLE_CLOUD', false),
/*
|--------------------------------------------------------------------------
| Enable Cloud Storage
|--------------------------------------------------------------------------
|
| Store media on object storage like S3, Digital Ocean Spaces, Rackspace
|
*/
'cloud_storage' => env('PF_ENABLE_CLOUD', false),
/*
|--------------------------------------------------------------------------
| Max User Limit
|--------------------------------------------------------------------------
|
| Allow a maximum number of user accounts. Default: off
|
*/
'max_users' => env('PF_MAX_USERS', false),
/*
|--------------------------------------------------------------------------
| Max User Limit
|--------------------------------------------------------------------------
|
| Allow a maximum number of user accounts. Default: off
|
*/
'max_users' => env('PF_MAX_USERS', false),
/*
|--------------------------------------------------------------------------