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;
}
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',
......
......@@ -23,7 +23,7 @@ return [
| This value is the version of your Pixelfed instance.
|
*/
'version' => '0.10.10',
'version' => '0.11.0',
/*
|--------------------------------------------------------------------------
......@@ -127,7 +127,7 @@ return [
| Change the minimum length limit for user passwords.
|
*/
'min_password_length' => env('MIN_PASSWORD_LENGTH', 12),
'min_password_length' => env('MIN_PASSWORD_LENGTH', 8),
/*
|--------------------------------------------------------------------------
......
......@@ -27,8 +27,7 @@ class AddFiltersToMediaTable extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn('filter_name');
$table->dropColumn('filter_class');
$table->dropColumn(['filter_name','filter_class']);
});
}
}
......@@ -29,10 +29,7 @@ class Add2faToUsersTable extends Migration
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('2fa_enabled');
$table->dropColumn('2fa_secret');
$table->dropColumn('2fa_backup_codes');
$table->dropColumn('2fa_setup_at');
$table->dropColumn(['2fa_enabled','2fa_secret','2fa_backup_codes','2fa_setup_at']);
});
}
}
......@@ -29,10 +29,7 @@ class UpdateSettingsTable extends Migration
public function down()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn('show_profile_followers');
$table->dropColumn('show_profile_follower_count');
$table->dropColumn('show_profile_following');
$table->dropColumn('show_profile_following_count');
$table->dropColumn(['show_profile_followers','show_profile_follower_count','show_profile_following','show_profile_following_count']);
});
}
}
......@@ -32,13 +32,7 @@ class UpdateMediaTableAddAltText extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn('original_sha256');
$table->dropColumn('optimized_sha256');
$table->dropColumn('caption');
$table->dropColumn('hls_path');
$table->dropColumn('hls_transcoded_at');
$table->dropColumn('key');
$table->dropColumn('metadata');
$table->dropColumn(['original_sha256','optimized_sha256','caption','hls_path','hls_transcoded_at','key','metadata']);
});
}
}
......@@ -27,8 +27,7 @@ class UpdateFollowerTableAddRemoteFlags extends Migration
public function down()
{
Schema::table('followers', function (Blueprint $table) {
$table->dropColumn('local_profile');
$table->dropColumn('local_following');
$table->dropColumn(['local_profile','local_following']);
});
}
}
......@@ -30,11 +30,7 @@ class UpdateMediaAddAltText extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn('license');
$table->dropColumn('is_nsfw');
$table->dropColumn('version');
$table->dropColumn('remote_media');
$table->dropColumn('remote_url');
$table->dropColumn(['license','is_nsfw','version','remote_media','remote_url']);
});
}
}
......@@ -16,10 +16,7 @@ class AddAccountStatusToProfilesTable extends Migration
// Drop old columns, fix stories
if(Schema::hasColumn('profiles', 'hub_url')) {
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('verify_token');
$table->dropColumn('secret');
$table->dropColumn('salmon_url');
$table->dropColumn('hub_url');
$table->dropColumn(['verify_token','secret','salmon_url','hub_url']);
});
}
......
......@@ -28,9 +28,7 @@ class UpdateProfilesTable extends Migration
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('unlisted');
$table->dropColumn('cw');
$table->dropColumn('no_autolink');
$table->dropColumn(['unlisted','cw','no_autolink']);
});
}
}
......@@ -62,12 +62,7 @@ class Stories extends Migration
Schema::dropIfExists('story_views');
Schema::table('stories', function (Blueprint $table) {
$table->dropColumn('title');
$table->dropColumn('preview_photo');
$table->dropColumn('local_only');
$table->dropColumn('is_live');
$table->dropColumn('broadcast_url');
$table->dropColumn('broadcast_key');
$table->dropColumn(['title','preview_photo','local_only','is_live','broadcast_url','broadcast_key']);
});
Schema::table('story_reactions', function (Blueprint $table) {
......
......@@ -27,8 +27,7 @@ class AddRemoteToAvatarsTable extends Migration
public function down()
{
Schema::table('avatars', function (Blueprint $table) {
$table->dropColumn('remote_url');
$table->dropColumn('last_fetched_at');
$table->dropColumn(['remote_url','last_fetched_at']);
});
}
}
......@@ -27,8 +27,7 @@ class AddRepliesCountToStatusesTable extends Migration
public function down()
{
Schema::table('statuses', function (Blueprint $table) {
$table->dropColumn('reply_count');
$table->dropColumn('comments_disabled');
$table->dropColumn(['reply_count','comments_disabled']);
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment