mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +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);
|
||||
}
|
||||
if($collection->visibility !== 'public') {
|
||||
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 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 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,
|
||||
'title' => $collection->title,
|
||||
'description' => $collection->description,
|
||||
'visibility' => $collection->visibility
|
||||
'id' => (string) $collection->id,
|
||||
'visibility' => $collection->visibility,
|
||||
'title' => $collection->title,
|
||||
'description' => $collection->description,
|
||||
'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),
|
||||
];
|
||||
|
|
50326
package-lock.json
generated
50326
package-lock.json
generated
File diff suppressed because it is too large
Load diff
129
package.json
129
package.json
|
@ -1,66 +1,67 @@
|
|||
{
|
||||
"name": "pixelfed",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "npm run development -- --watch",
|
||||
"watch-poll": "npm run watch -- --watch-poll",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"bootstrap": "^4.5.2",
|
||||
"cross-env": "^5.2.1",
|
||||
"jquery": "^3.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"popper.js": "^1.16.1",
|
||||
"resolve-url-loader": "^2.3.2",
|
||||
"sass": "^1.32.11",
|
||||
"sass-loader": "^7.3.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-masonry-css": "^1.0.3",
|
||||
"vue-router": "^3.5.1",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"vuex": "^3.6.2",
|
||||
"vuex-router-sync": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fancyapps/fancybox": "^3.5.7",
|
||||
"@trevoreyre/autocomplete-vue": "^2.2.0",
|
||||
"animate.css": "^4.1.0",
|
||||
"blurhash": "^1.1.3",
|
||||
"bootstrap-vue": "^2.16.0",
|
||||
"chart.js": "^2.7.2",
|
||||
"filesize": "^3.6.1",
|
||||
"howler": "^2.2.0",
|
||||
"infinite-scroll": "^3.0.6",
|
||||
"jquery-scroll-lock": "^3.1.3",
|
||||
"jquery.scrollbar": "^0.2.11",
|
||||
"js-cookie": "^2.2.0",
|
||||
"laravel-echo": "^1.8.1",
|
||||
"laravel-mix": "^4.1.4",
|
||||
"node-sass": "^4.14.1",
|
||||
"promise-polyfill": "8.1.0",
|
||||
"readmore-js": "^2.2.1",
|
||||
"sweetalert": "^2.1.2",
|
||||
"twitter-text": "^2.0.5",
|
||||
"vue-blurhash": "^0.1.4",
|
||||
"vue-carousel": "^0.18.0",
|
||||
"vue-content-loader": "^0.2.3",
|
||||
"vue-cropperjs": "^4.1.0",
|
||||
"vue-i18n": "^8.26.7",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-intersect": "^1.1.6",
|
||||
"vue-loading-overlay": "^3.3.3",
|
||||
"vue-timeago": "^5.1.2",
|
||||
"vue-tribute": "^1.0.7",
|
||||
"zuck.js": "^1.6.0"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/pixelfed"
|
||||
}
|
||||
"name": "pixelfed",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "npm run development -- --watch",
|
||||
"watch-poll": "npm run watch -- --watch-poll",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"bootstrap": "^4.5.2",
|
||||
"cross-env": "^5.2.1",
|
||||
"jquery": "^3.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"popper.js": "^1.16.1",
|
||||
"resolve-url-loader": "^2.3.2",
|
||||
"sass": "^1.32.11",
|
||||
"sass-loader": "^7.3.1",
|
||||
"vue": "^2.6.14",
|
||||
"vue-masonry-css": "^1.0.3",
|
||||
"vue-router": "^3.5.1",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"vuex": "^3.6.2",
|
||||
"vuex-router-sync": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"filesize": "^3.6.1",
|
||||
"howler": "^2.2.0",
|
||||
"infinite-scroll": "^3.0.6",
|
||||
"jquery-scroll-lock": "^3.1.3",
|
||||
"jquery.scrollbar": "^0.2.11",
|
||||
"js-cookie": "^2.2.0",
|
||||
"laravel-echo": "^1.8.1",
|
||||
"laravel-mix": "^4.1.4",
|
||||
"node-sass": "^4.14.1",
|
||||
"promise-polyfill": "8.1.0",
|
||||
"readmore-js": "^2.2.1",
|
||||
"sweetalert": "^2.1.2",
|
||||
"twitter-text": "^2.0.5",
|
||||
"vue-blurhash": "^0.1.4",
|
||||
"vue-carousel": "^0.18.0",
|
||||
"vue-content-loader": "^0.2.3",
|
||||
"vue-cropperjs": "^4.1.0",
|
||||
"vue-i18n": "^8.26.7",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-intersect": "^1.1.6",
|
||||
"vue-loading-overlay": "^3.3.3",
|
||||
"vue-timeago": "^5.1.2",
|
||||
"vue-tribute": "^1.0.7",
|
||||
"zuck.js": "^1.6.0"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/pixelfed"
|
||||
}
|
||||
}
|
||||
|
|
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