mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 08:44:49 +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'));
|
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);
|
$user = $request->user();
|
||||||
if($collection->profile->status != null) {
|
$collection = Collection::findOrFail($id);
|
||||||
abort(404);
|
if($collection->published_at == null || $collection->visibility != 'public') {
|
||||||
}
|
if(!$user || $user->profile_id != $collection->profile_id) {
|
||||||
if($collection->visibility !== 'public') {
|
abort_unless($user && $user->is_admin, 404);
|
||||||
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 404);
|
}
|
||||||
}
|
}
|
||||||
return view('collection.show', compact('collection'));
|
return view('collection.show', compact('collection'));
|
||||||
}
|
}
|
||||||
|
@ -144,20 +144,23 @@ class CollectionController extends Controller
|
||||||
|
|
||||||
public function get(Request $request, $id)
|
public function get(Request $request, $id)
|
||||||
{
|
{
|
||||||
$profile = Auth::check() ? Auth::user()->profile : [];
|
$user = $request->user();
|
||||||
|
$collection = Collection::findOrFail($id);
|
||||||
$collection = Collection::whereVisibility('public')->findOrFail($id);
|
if($collection->published_at == null || $collection->visibility != 'public') {
|
||||||
if($collection->published_at == null) {
|
if(!$user || $user->profile_id != $collection->profile_id) {
|
||||||
if(!Auth::check() || $profile->id !== $collection->profile_id) {
|
abort_unless($user && $user->is_admin, 404);
|
||||||
abort(404);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $collection->id,
|
'id' => (string) $collection->id,
|
||||||
'title' => $collection->title,
|
'visibility' => $collection->visibility,
|
||||||
'description' => $collection->description,
|
'title' => $collection->title,
|
||||||
'visibility' => $collection->visibility
|
'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)
|
public function getUserCollections(Request $request, int $id)
|
||||||
{
|
{
|
||||||
|
$user = $request->user();
|
||||||
|
$pid = $user ? $user->profile_id : null;
|
||||||
|
|
||||||
$profile = Profile::whereNull('status')
|
$profile = Profile::whereNull('status')
|
||||||
->whereNull('domain')
|
->whereNull('domain')
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
if($profile->is_private) {
|
if($profile->is_private) {
|
||||||
abort_if(!Auth::check(), 404);
|
abort_if(!$pid, 404);
|
||||||
abort_if(!$profile->followedBy(Auth::user()->profile) && $profile->id != Auth::user()->profile_id, 404);
|
abort_if(!$profile->id != $pid, 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $profile
|
$visibility = $pid == $profile->id ? ['public', 'private'] : ['public'];
|
||||||
->collections()
|
|
||||||
->has('posts')
|
return Collection::whereProfileId($profile->id)
|
||||||
->with('posts')
|
->whereIn('visibility', $visibility)
|
||||||
->whereVisibility('public')
|
->orderByDesc('id')
|
||||||
->whereNotNull('published_at')
|
|
||||||
->orderByDesc('published_at')
|
|
||||||
->paginate(9)
|
->paginate(9)
|
||||||
->map(function($collection) {
|
->map(function($collection) {
|
||||||
return [
|
return [
|
||||||
'id' => (string) $collection->id,
|
'id' => (string) $collection->id,
|
||||||
|
'visibility' => $collection->visibility,
|
||||||
'title' => $collection->title,
|
'title' => $collection->title,
|
||||||
'description' => $collection->description,
|
'description' => $collection->description,
|
||||||
'thumb' => $collection->posts()->first()->thumb(),
|
'thumb' => $collection->posts()->first()->thumb(),
|
||||||
|
|
|
@ -207,7 +207,7 @@ class PublicApiController extends Controller
|
||||||
->paginate($limit);
|
->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));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($replies));
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||||
|
|
|
@ -61,8 +61,8 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'oauth' => [
|
'oauth' => [
|
||||||
'token_expiration' => env('OAUTH_TOKEN_DAYS', 15),
|
'token_expiration' => env('OAUTH_TOKEN_DAYS', 365),
|
||||||
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 30),
|
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 400),
|
||||||
'pat' => [
|
'pat' => [
|
||||||
'enabled' => env('OAUTH_PAT_ENABLED', false),
|
'enabled' => env('OAUTH_PAT_ENABLED', false),
|
||||||
'id' => env('OAUTH_PAT_ID'),
|
'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",
|
"name": "pixelfed",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "npm run development",
|
"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",
|
"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": "npm run development -- --watch",
|
||||||
"watch-poll": "npm run watch -- --watch-poll",
|
"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",
|
"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",
|
"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"
|
"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": {
|
"devDependencies": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bootstrap": "^4.5.2",
|
"bootstrap": "^4.5.2",
|
||||||
"cross-env": "^5.2.1",
|
"cross-env": "^5.2.1",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"popper.js": "^1.16.1",
|
"popper.js": "^1.16.1",
|
||||||
"resolve-url-loader": "^2.3.2",
|
"resolve-url-loader": "^2.3.2",
|
||||||
"sass": "^1.32.11",
|
"sass": "^1.32.11",
|
||||||
"sass-loader": "^7.3.1",
|
"sass-loader": "^7.3.1",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.14",
|
||||||
"vue-masonry-css": "^1.0.3",
|
"vue-masonry-css": "^1.0.3",
|
||||||
"vue-router": "^3.5.1",
|
"vue-router": "^3.5.1",
|
||||||
"vue-template-compiler": "^2.6.11",
|
"vue-template-compiler": "^2.6.11",
|
||||||
"vuex": "^3.6.2",
|
"vuex": "^3.6.2",
|
||||||
"vuex-router-sync": "^5.0.0"
|
"vuex-router-sync": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fancyapps/fancybox": "^3.5.7",
|
"@fancyapps/fancybox": "^3.5.7",
|
||||||
"@trevoreyre/autocomplete-vue": "^2.2.0",
|
"@trevoreyre/autocomplete-vue": "^2.2.0",
|
||||||
"animate.css": "^4.1.0",
|
"animate.css": "^4.1.0",
|
||||||
"blurhash": "^1.1.3",
|
"bigpicture": "^2.6.1",
|
||||||
"bootstrap-vue": "^2.16.0",
|
"blurhash": "^1.1.3",
|
||||||
"chart.js": "^2.7.2",
|
"bootstrap-vue": "^2.16.0",
|
||||||
"filesize": "^3.6.1",
|
"chart.js": "^2.7.2",
|
||||||
"howler": "^2.2.0",
|
"filesize": "^3.6.1",
|
||||||
"infinite-scroll": "^3.0.6",
|
"howler": "^2.2.0",
|
||||||
"jquery-scroll-lock": "^3.1.3",
|
"infinite-scroll": "^3.0.6",
|
||||||
"jquery.scrollbar": "^0.2.11",
|
"jquery-scroll-lock": "^3.1.3",
|
||||||
"js-cookie": "^2.2.0",
|
"jquery.scrollbar": "^0.2.11",
|
||||||
"laravel-echo": "^1.8.1",
|
"js-cookie": "^2.2.0",
|
||||||
"laravel-mix": "^4.1.4",
|
"laravel-echo": "^1.8.1",
|
||||||
"node-sass": "^4.14.1",
|
"laravel-mix": "^4.1.4",
|
||||||
"promise-polyfill": "8.1.0",
|
"node-sass": "^4.14.1",
|
||||||
"readmore-js": "^2.2.1",
|
"promise-polyfill": "8.1.0",
|
||||||
"sweetalert": "^2.1.2",
|
"readmore-js": "^2.2.1",
|
||||||
"twitter-text": "^2.0.5",
|
"sweetalert": "^2.1.2",
|
||||||
"vue-blurhash": "^0.1.4",
|
"twitter-text": "^2.0.5",
|
||||||
"vue-carousel": "^0.18.0",
|
"vue-blurhash": "^0.1.4",
|
||||||
"vue-content-loader": "^0.2.3",
|
"vue-carousel": "^0.18.0",
|
||||||
"vue-cropperjs": "^4.1.0",
|
"vue-content-loader": "^0.2.3",
|
||||||
"vue-i18n": "^8.26.7",
|
"vue-cropperjs": "^4.1.0",
|
||||||
"vue-infinite-loading": "^2.4.5",
|
"vue-i18n": "^8.26.7",
|
||||||
"vue-intersect": "^1.1.6",
|
"vue-infinite-loading": "^2.4.5",
|
||||||
"vue-loading-overlay": "^3.3.3",
|
"vue-intersect": "^1.1.6",
|
||||||
"vue-timeago": "^5.1.2",
|
"vue-loading-overlay": "^3.3.3",
|
||||||
"vue-tribute": "^1.0.7",
|
"vue-timeago": "^5.1.2",
|
||||||
"zuck.js": "^1.6.0"
|
"vue-tribute": "^1.0.7",
|
||||||
},
|
"zuck.js": "^1.6.0"
|
||||||
"collective": {
|
},
|
||||||
"type": "opencollective",
|
"collective": {
|
||||||
"url": "https://opencollective.com/pixelfed"
|
"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