mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 08:44:49 +00:00
commit
ac6922ab59
18 changed files with 307 additions and 148 deletions
|
@ -22,6 +22,7 @@
|
||||||
- Fix profile masonry layout on mobile. Fixes #3203 ([fdf90f2d](https://github.com/pixelfed/pixelfed/commit/fdf90f2d))
|
- Fix profile masonry layout on mobile. Fixes #3203 ([fdf90f2d](https://github.com/pixelfed/pixelfed/commit/fdf90f2d))
|
||||||
- Add search bar to mobile breakpoints and adjust avatar size when necessary ([77b9b6bd](https://github.com/pixelfed/pixelfed/commit/77b9b6bd))
|
- Add search bar to mobile breakpoints and adjust avatar size when necessary ([77b9b6bd](https://github.com/pixelfed/pixelfed/commit/77b9b6bd))
|
||||||
- Improved profile layout on mobile breakpoints ([77b9b6bd](https://github.com/pixelfed/pixelfed/commit/77b9b6bd))
|
- Improved profile layout on mobile breakpoints ([77b9b6bd](https://github.com/pixelfed/pixelfed/commit/77b9b6bd))
|
||||||
|
- New Discover layout with My Hashtags, My Memories, Account Insights, Find Friends and Server Timelines ([0b680099](https://github.com/pixelfed/pixelfed/commit/0b680099))
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
- Updated MediaStorageService, fix remote avatar bug. ([1c20d696](https://github.com/pixelfed/pixelfed/commit/1c20d696))
|
- Updated MediaStorageService, fix remote avatar bug. ([1c20d696](https://github.com/pixelfed/pixelfed/commit/1c20d696))
|
||||||
|
@ -60,6 +61,8 @@
|
||||||
- Updated StatusController, redirect status view for authed users to Metro 2.0 UI. ([71dff472](https://github.com/pixelfed/pixelfed/commit/71dff472))
|
- Updated StatusController, redirect status view for authed users to Metro 2.0 UI. ([71dff472](https://github.com/pixelfed/pixelfed/commit/71dff472))
|
||||||
- Updated ProfileController, redirect profile view for authed users to Metro 2.0 UI. ([7f8129a7](https://github.com/pixelfed/pixelfed/commit/7f8129a7))
|
- Updated ProfileController, redirect profile view for authed users to Metro 2.0 UI. ([7f8129a7](https://github.com/pixelfed/pixelfed/commit/7f8129a7))
|
||||||
- Updated SpaController, fix variable typo. Fixes #3268. ([8d1af1d6](https://github.com/pixelfed/pixelfed/commit/8d1af1d6))
|
- Updated SpaController, fix variable typo. Fixes #3268. ([8d1af1d6](https://github.com/pixelfed/pixelfed/commit/8d1af1d6))
|
||||||
|
- Updated ComposeModal, fix post redirect on old UI. ([160e32a5](https://github.com/pixelfed/pixelfed/commit/160e32a5))
|
||||||
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
||||||
|
|
|
@ -7,6 +7,8 @@ use App\{
|
||||||
Follower,
|
Follower,
|
||||||
Hashtag,
|
Hashtag,
|
||||||
HashtagFollow,
|
HashtagFollow,
|
||||||
|
Instance,
|
||||||
|
Like,
|
||||||
Profile,
|
Profile,
|
||||||
Status,
|
Status,
|
||||||
StatusHashtag,
|
StatusHashtag,
|
||||||
|
@ -14,13 +16,7 @@ use App\{
|
||||||
};
|
};
|
||||||
use Auth, DB, Cache;
|
use Auth, DB, Cache;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Transformer\Api\AccountTransformer;
|
use App\Services\ConfigCacheService;
|
||||||
use App\Transformer\Api\AccountWithStatusesTransformer;
|
|
||||||
use App\Transformer\Api\StatusTransformer;
|
|
||||||
use App\Transformer\Api\StatusStatelessTransformer;
|
|
||||||
use League\Fractal;
|
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
|
||||||
use App\Services\StatusHashtagService;
|
use App\Services\StatusHashtagService;
|
||||||
use App\Services\SnowflakeService;
|
use App\Services\SnowflakeService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
|
@ -28,14 +24,6 @@ use App\Services\UserFilterService;
|
||||||
|
|
||||||
class DiscoverController extends Controller
|
class DiscoverController extends Controller
|
||||||
{
|
{
|
||||||
protected $fractal;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->fractal = new Fractal\Manager();
|
|
||||||
$this->fractal->setSerializer(new ArraySerializer());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function home(Request $request)
|
public function home(Request $request)
|
||||||
{
|
{
|
||||||
abort_if(!Auth::check() && config('instance.discover.public') == false, 403);
|
abort_if(!Auth::check() && config('instance.discover.public') == false, 403);
|
||||||
|
@ -103,8 +91,7 @@ class DiscoverController extends Controller
|
||||||
|
|
||||||
public function profilesDirectory(Request $request)
|
public function profilesDirectory(Request $request)
|
||||||
{
|
{
|
||||||
return redirect('/')
|
return redirect('/')->with('statusRedirect', 'The Profile Directory is unavailable at this time.');
|
||||||
->with('statusRedirect', 'The Profile Directory is unavailable at this time.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function profilesDirectoryApi(Request $request)
|
public function profilesDirectoryApi(Request $request)
|
||||||
|
@ -192,4 +179,167 @@ class DiscoverController extends Controller
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function myMemories(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 404);
|
||||||
|
$pid = $request->user()->profile_id;
|
||||||
|
abort_if(!$this->config()['memories']['enabled'], 404);
|
||||||
|
$type = $request->input('type') ?? 'posts';
|
||||||
|
|
||||||
|
switch($type) {
|
||||||
|
case 'posts':
|
||||||
|
$res = Status::whereProfileId($pid)
|
||||||
|
->whereDay('created_at', date('d'))
|
||||||
|
->whereMonth('created_at', date('m'))
|
||||||
|
->whereYear('created_at', '!=', date('Y'))
|
||||||
|
->whereNull(['reblog_of_id', 'in_reply_to_id'])
|
||||||
|
->limit(20)
|
||||||
|
->pluck('id')
|
||||||
|
->map(function($id) {
|
||||||
|
return StatusService::get($id, false);
|
||||||
|
})
|
||||||
|
->filter(function($post) {
|
||||||
|
return $post && isset($post['account']);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'liked':
|
||||||
|
$res = Like::whereProfileId($pid)
|
||||||
|
->whereDay('created_at', date('d'))
|
||||||
|
->whereMonth('created_at', date('m'))
|
||||||
|
->whereYear('created_at', '!=', date('Y'))
|
||||||
|
->orderByDesc('status_id')
|
||||||
|
->limit(20)
|
||||||
|
->pluck('status_id')
|
||||||
|
->map(function($id) {
|
||||||
|
return StatusService::get($id, false);
|
||||||
|
})
|
||||||
|
->filter(function($post) {
|
||||||
|
return $post && isset($post['account']);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function accountInsightsPopularPosts(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 404);
|
||||||
|
$pid = $request->user()->profile_id;
|
||||||
|
abort_if(!$this->config()['insights']['enabled'], 404);
|
||||||
|
$posts = Cache::remember('pf:discover:metro2:accinsights:popular:' . $pid, 43200, function() use ($pid) {
|
||||||
|
return Status::whereProfileId($pid)
|
||||||
|
->whereNotNull('likes_count')
|
||||||
|
->orderByDesc('likes_count')
|
||||||
|
->limit(12)
|
||||||
|
->pluck('id')
|
||||||
|
->map(function($id) {
|
||||||
|
return StatusService::get($id, false);
|
||||||
|
})
|
||||||
|
->filter(function($post) {
|
||||||
|
return $post && isset($post['account']);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
});
|
||||||
|
|
||||||
|
return $posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function config()
|
||||||
|
{
|
||||||
|
$cc = ConfigCacheService::get('config.discover.features');
|
||||||
|
if($cc) {
|
||||||
|
return is_string($cc) ? json_decode($cc, true) : $cc;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'hashtags' => [
|
||||||
|
'enabled' => false,
|
||||||
|
],
|
||||||
|
'memories' => [
|
||||||
|
'enabled' => false,
|
||||||
|
],
|
||||||
|
'insights' => [
|
||||||
|
'enabled' => false,
|
||||||
|
],
|
||||||
|
'friends' => [
|
||||||
|
'enabled' => false,
|
||||||
|
],
|
||||||
|
'server' => [
|
||||||
|
'enabled' => false,
|
||||||
|
'mode' => 'allowlist',
|
||||||
|
'domains' => []
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function serverTimeline(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 404);
|
||||||
|
abort_if(!$this->config()['server']['enabled'], 404);
|
||||||
|
$pid = $request->user()->profile_id;
|
||||||
|
$domain = $request->input('domain');
|
||||||
|
$config = $this->config();
|
||||||
|
$domains = explode(',', $config['server']['domains']);
|
||||||
|
abort_unless(in_array($domain, $domains), 400);
|
||||||
|
|
||||||
|
$res = Status::whereNotNull('uri')
|
||||||
|
->where('uri', 'like', 'https://' . $domain . '%')
|
||||||
|
->whereNull(['in_reply_to_id', 'reblog_of_id'])
|
||||||
|
->orderByDesc('id')
|
||||||
|
->limit(12)
|
||||||
|
->pluck('id')
|
||||||
|
->map(function($id) {
|
||||||
|
return StatusService::get($id);
|
||||||
|
})
|
||||||
|
->filter(function($post) {
|
||||||
|
return $post && isset($post['account']);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enabledFeatures(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 404);
|
||||||
|
return $this->config();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFeatures(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 404);
|
||||||
|
abort_if(!$request->user()->is_admin, 404);
|
||||||
|
$pid = $request->user()->profile_id;
|
||||||
|
$this->validate($request, [
|
||||||
|
'features.friends.enabled' => 'boolean',
|
||||||
|
'features.hashtags.enabled' => 'boolean',
|
||||||
|
'features.insights.enabled' => 'boolean',
|
||||||
|
'features.memories.enabled' => 'boolean',
|
||||||
|
'features.server.enabled' => 'boolean',
|
||||||
|
]);
|
||||||
|
$res = $request->input('features');
|
||||||
|
if($res['server'] && isset($res['server']['domains']) && !empty($res['server']['domains'])) {
|
||||||
|
$parts = explode(',', $res['server']['domains']);
|
||||||
|
$parts = array_filter($parts, function($v) {
|
||||||
|
$len = strlen($v);
|
||||||
|
$pos = strpos($v, '.');
|
||||||
|
$domain = trim($v);
|
||||||
|
if($pos == false || $pos == ($len + 1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!Instance::whereDomain($domain)->exists()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
$parts = array_slice($parts, 0, 10);
|
||||||
|
$d = implode(',', array_map('trim', $parts));
|
||||||
|
$res['server']['domains'] = $d;
|
||||||
|
}
|
||||||
|
ConfigCacheService::put('config.discover.features', json_encode($res));
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
public/js/compose-chunk.js
vendored
BIN
public/js/compose-chunk.js
vendored
Binary file not shown.
BIN
public/js/compose.js
vendored
BIN
public/js/compose.js
vendored
Binary file not shown.
BIN
public/js/daci-chunk.js
vendored
Normal file
BIN
public/js/daci-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/dffc-chunk.js
vendored
Normal file
BIN
public/js/dffc-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/dmyh-chunk.js
vendored
Normal file
BIN
public/js/dmyh-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/dmym-chunk.js
vendored
Normal file
BIN
public/js/dmym-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/dsfc-chunk.js
vendored
Normal file
BIN
public/js/dsfc-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/dssc-chunk.js
vendored
Normal file
BIN
public/js/dssc-chunk.js
vendored
Normal file
Binary file not shown.
BIN
public/js/home-chunk.js
vendored
BIN
public/js/home-chunk.js
vendored
Binary file not shown.
BIN
public/js/manifest.js
vendored
BIN
public/js/manifest.js
vendored
Binary file not shown.
BIN
public/js/post-chunk.js
vendored
BIN
public/js/post-chunk.js
vendored
Binary file not shown.
BIN
public/js/profile-chunk.js
vendored
BIN
public/js/profile-chunk.js
vendored
Binary file not shown.
BIN
public/js/spa.js
vendored
BIN
public/js/spa.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -1262,7 +1262,7 @@ export default {
|
||||||
if(location.pathname === '/i/web/compose' && res.data && res.data.length) {
|
if(location.pathname === '/i/web/compose' && res.data && res.data.length) {
|
||||||
location.href = '/i/web/post/' + res.data.split('/').slice(-1)[0];
|
location.href = '/i/web/post/' + res.data.split('/').slice(-1)[0];
|
||||||
} else {
|
} else {
|
||||||
location.href = data;
|
location.href = res.data;
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if(err.response) {
|
if(err.response) {
|
||||||
|
@ -1330,6 +1330,7 @@ export default {
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
$('#composeModal').modal('hide');
|
$('#composeModal').modal('hide');
|
||||||
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
|
|
|
@ -216,6 +216,11 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::post('status/{id}/archive', 'ApiController@archive');
|
Route::post('status/{id}/archive', 'ApiController@archive');
|
||||||
Route::post('status/{id}/unarchive', 'ApiController@unarchive');
|
Route::post('status/{id}/unarchive', 'ApiController@unarchive');
|
||||||
Route::get('statuses/archives', 'ApiController@archivedPosts');
|
Route::get('statuses/archives', 'ApiController@archivedPosts');
|
||||||
|
Route::get('discover/memories', 'DiscoverController@myMemories');
|
||||||
|
Route::get('discover/account-insights', 'DiscoverController@accountInsightsPopularPosts');
|
||||||
|
Route::get('discover/server-timeline', 'DiscoverController@serverTimeline');
|
||||||
|
Route::get('discover/meta', 'DiscoverController@enabledFeatures');
|
||||||
|
Route::post('discover/admin/features', 'DiscoverController@updateFeatures');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('discover/accounts/popular', 'Api\ApiV1Controller@discoverAccountsPopular');
|
Route::get('discover/accounts/popular', 'Api\ApiV1Controller@discoverAccountsPopular');
|
||||||
|
|
Loading…
Reference in a new issue