mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-11 06:30:46 +00:00
commit
c4556b5963
9 changed files with 25350 additions and 25170 deletions
|
@ -33,14 +33,14 @@ class CollectionController extends Controller
|
|||
return view('collection.create', compact('collection'));
|
||||
}
|
||||
|
||||
public function show(Request $request, int $collection)
|
||||
public function show(Request $request, int $id)
|
||||
{
|
||||
$collection = Collection::with('profile')->whereNotNull('published_at')->findOrFail($collection);
|
||||
if($collection->profile->status != null) {
|
||||
abort(404);
|
||||
$user = $request->user();
|
||||
$collection = Collection::findOrFail($id);
|
||||
if($collection->published_at == null || $collection->visibility != 'public') {
|
||||
if(!$user || $user->profile_id != $collection->profile_id) {
|
||||
abort_unless($user && $user->is_admin, 404);
|
||||
}
|
||||
if($collection->visibility !== 'public') {
|
||||
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 404);
|
||||
}
|
||||
return view('collection.show', compact('collection'));
|
||||
}
|
||||
|
@ -144,20 +144,23 @@ class CollectionController extends Controller
|
|||
|
||||
public function get(Request $request, $id)
|
||||
{
|
||||
$profile = Auth::check() ? Auth::user()->profile : [];
|
||||
|
||||
$collection = Collection::whereVisibility('public')->findOrFail($id);
|
||||
if($collection->published_at == null) {
|
||||
if(!Auth::check() || $profile->id !== $collection->profile_id) {
|
||||
abort(404);
|
||||
$user = $request->user();
|
||||
$collection = Collection::findOrFail($id);
|
||||
if($collection->published_at == null || $collection->visibility != 'public') {
|
||||
if(!$user || $user->profile_id != $collection->profile_id) {
|
||||
abort_unless($user && $user->is_admin, 404);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $collection->id,
|
||||
'id' => (string) $collection->id,
|
||||
'visibility' => $collection->visibility,
|
||||
'title' => $collection->title,
|
||||
'description' => $collection->description,
|
||||
'visibility' => $collection->visibility
|
||||
'thumb' => $collection->posts()->first()->thumb(),
|
||||
'url' => $collection->url(),
|
||||
'post_count' => $collection->posts()->count(),
|
||||
'published_at' => $collection->published_at
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -183,26 +186,28 @@ class CollectionController extends Controller
|
|||
|
||||
public function getUserCollections(Request $request, int $id)
|
||||
{
|
||||
$user = $request->user();
|
||||
$pid = $user ? $user->profile_id : null;
|
||||
|
||||
$profile = Profile::whereNull('status')
|
||||
->whereNull('domain')
|
||||
->findOrFail($id);
|
||||
|
||||
if($profile->is_private) {
|
||||
abort_if(!Auth::check(), 404);
|
||||
abort_if(!$profile->followedBy(Auth::user()->profile) && $profile->id != Auth::user()->profile_id, 404);
|
||||
abort_if(!$pid, 404);
|
||||
abort_if(!$profile->id != $pid, 404);
|
||||
}
|
||||
|
||||
return $profile
|
||||
->collections()
|
||||
->has('posts')
|
||||
->with('posts')
|
||||
->whereVisibility('public')
|
||||
->whereNotNull('published_at')
|
||||
->orderByDesc('published_at')
|
||||
$visibility = $pid == $profile->id ? ['public', 'private'] : ['public'];
|
||||
|
||||
return Collection::whereProfileId($profile->id)
|
||||
->whereIn('visibility', $visibility)
|
||||
->orderByDesc('id')
|
||||
->paginate(9)
|
||||
->map(function($collection) {
|
||||
return [
|
||||
'id' => (string) $collection->id,
|
||||
'visibility' => $collection->visibility,
|
||||
'title' => $collection->title,
|
||||
'description' => $collection->description,
|
||||
'thumb' => $collection->posts()->first()->thumb(),
|
||||
|
|
|
@ -207,7 +207,7 @@ class PublicApiController extends Controller
|
|||
->paginate($limit);
|
||||
}
|
||||
|
||||
$resource = new Fractal\Resource\Collection($replies, new StatusTransformer(), 'data');
|
||||
$resource = new Fractal\Resource\Collection($replies, new StatusStatelessTransformer(), 'data');
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($replies));
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||
|
|
|
@ -61,8 +61,8 @@ return [
|
|||
],
|
||||
|
||||
'oauth' => [
|
||||
'token_expiration' => env('OAUTH_TOKEN_DAYS', 15),
|
||||
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 30),
|
||||
'token_expiration' => env('OAUTH_TOKEN_DAYS', 365),
|
||||
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 400),
|
||||
'pat' => [
|
||||
'enabled' => env('OAUTH_PAT_ENABLED', false),
|
||||
'id' => env('OAUTH_PAT_ID'),
|
||||
|
@ -77,5 +77,5 @@ return [
|
|||
]
|
||||
],
|
||||
|
||||
'enable_cc' => env('ENABLE_CONFIG_CACHE', false)
|
||||
'enable_cc' => env('ENABLE_CONFIG_CACHE', false),
|
||||
];
|
||||
|
|
2886
package-lock.json
generated
2886
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@
|
|||
"resolve-url-loader": "^2.3.2",
|
||||
"sass": "^1.32.11",
|
||||
"sass-loader": "^7.3.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue": "^2.6.14",
|
||||
"vue-masonry-css": "^1.0.3",
|
||||
"vue-router": "^3.5.1",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
|
@ -31,6 +31,7 @@
|
|||
"@fancyapps/fancybox": "^3.5.7",
|
||||
"@trevoreyre/autocomplete-vue": "^2.2.0",
|
||||
"animate.css": "^4.1.0",
|
||||
"bigpicture": "^2.6.1",
|
||||
"blurhash": "^1.1.3",
|
||||
"bootstrap-vue": "^2.16.0",
|
||||
"chart.js": "^2.7.2",
|
||||
|
|
BIN
public/js/collections.js
vendored
BIN
public/js/collections.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/spa.js
vendored
BIN
public/js/spa.js
vendored
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue