mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
commit
70e3fed0f2
58 changed files with 2415 additions and 1822 deletions
|
@ -4,7 +4,9 @@
|
|||
### Added
|
||||
- Autocomplete Support (hashtags + mentions) ([de514f7d](https://github.com/pixelfed/pixelfed/commit/de514f7d))
|
||||
- Creative Commons Licenses ([552e950](https://github.com/pixelfed/pixelfed/commit/552e950))
|
||||
- Add Network Timeline ([af7face4](https://github.com/pixelfed/pixelfed/commit/af7face4))
|
||||
- Network Timeline ([af7face4](https://github.com/pixelfed/pixelfed/commit/af7face4))
|
||||
- Admin config settings ([f2066b74](https://github.com/pixelfed/pixelfed/commit/f2066b74))
|
||||
- Profile pronouns ([fabb57a9](https://github.com/pixelfed/pixelfed/commit/fabb57a9))
|
||||
|
||||
### Updated
|
||||
- Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940))
|
||||
|
@ -83,6 +85,7 @@
|
|||
- Updated PostComponent, change like logic. ([0a35f5d6](https://github.com/pixelfed/pixelfed/commit/0a35f5d6))
|
||||
- Updated Timeline component, change like logic. ([7bcbf96b](https://github.com/pixelfed/pixelfed/commit/7bcbf96b))
|
||||
- Updated LikeService, fix likedBy method. ([a5e64da6](https://github.com/pixelfed/pixelfed/commit/a5e64da6))
|
||||
- Updated PublicApiController, increase public timeline to 6 months from 3. ([8a736432](https://github.com/pixelfed/pixelfed/commit/8a736432))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
|
||||
|
|
|
@ -8,12 +8,116 @@ use Carbon\Carbon;
|
|||
use App\{Comment, Like, Media, Page, Profile, Report, Status, User};
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use App\Models\ConfigCache;
|
||||
use App\Services\ConfigCacheService;
|
||||
|
||||
trait AdminSettingsController
|
||||
{
|
||||
public function settings(Request $request)
|
||||
{
|
||||
return view('admin.settings.home');
|
||||
$name = ConfigCacheService::get('app.name');
|
||||
$short_description = ConfigCacheService::get('app.short_description');
|
||||
$description = ConfigCacheService::get('app.description');
|
||||
$types = explode(',', ConfigCacheService::get('pixelfed.media_types'));
|
||||
$jpeg = in_array('image/jpg', $types) ? true : in_array('image/jpeg', $types);
|
||||
$png = in_array('image/png', $types);
|
||||
$gif = in_array('image/gif', $types);
|
||||
$mp4 = in_array('video/mp4', $types);
|
||||
|
||||
return view('admin.settings.home', compact(
|
||||
'name',
|
||||
'short_description',
|
||||
'description',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'mp4'
|
||||
));
|
||||
}
|
||||
|
||||
public function settingsHomeStore(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'name' => 'nullable|string',
|
||||
'short_description' => 'nullable',
|
||||
'long_description' => 'nullable',
|
||||
'max_photo_size' => 'nullable|integer|min:1',
|
||||
'max_album_length' => 'nullable|integer|min:1|max:100',
|
||||
'image_quality' => 'nullable|integer|min:1|max:100',
|
||||
'type_jpeg' => 'nullable',
|
||||
'type_png' => 'nullable',
|
||||
'type_gif' => 'nullable',
|
||||
'type_mp4' => 'nullable',
|
||||
]);
|
||||
|
||||
$media_types = explode(',', config_cache('pixelfed.media_types'));
|
||||
$media_types_original = $media_types;
|
||||
|
||||
$mimes = [
|
||||
'type_jpeg' => 'image/jpeg',
|
||||
'type_png' => 'image/png',
|
||||
'type_gif' => 'image/gif',
|
||||
'type_mp4' => 'video/mp4',
|
||||
];
|
||||
|
||||
foreach ($mimes as $key => $value) {
|
||||
if($request->input($key) == 'on') {
|
||||
if(!in_array($value, $media_types)) {
|
||||
array_push($media_types, $value);
|
||||
}
|
||||
} else {
|
||||
$media_types = array_diff($media_types, [$value]);
|
||||
}
|
||||
}
|
||||
|
||||
if($media_types !== $media_types_original) {
|
||||
ConfigCacheService::put('pixelfed.media_types', implode(',', array_unique($media_types)));
|
||||
}
|
||||
|
||||
$keys = [
|
||||
'name' => 'app.name',
|
||||
'short_description' => 'app.short_description',
|
||||
'long_description' => 'app.description',
|
||||
'max_photo_size' => 'pixelfed.max_photo_size',
|
||||
'max_album_length' => 'pixelfed.max_album_length',
|
||||
'image_quality' => 'pixelfed.image_quality',
|
||||
'account_limit' => 'pixelfed.max_account_size',
|
||||
'custom_css' => 'uikit.custom.css',
|
||||
'custom_js' => 'uikit.custom.js'
|
||||
];
|
||||
|
||||
foreach ($keys as $key => $value) {
|
||||
$cc = ConfigCache::whereK($value)->first();
|
||||
$val = $request->input($key);
|
||||
if($cc && $cc->v != $val) {
|
||||
ConfigCacheService::put($value, $val);
|
||||
}
|
||||
}
|
||||
|
||||
$bools = [
|
||||
'activitypub' => 'federation.activitypub.enabled',
|
||||
'open_registration' => 'pixelfed.open_registration',
|
||||
'mobile_apis' => 'pixelfed.oauth_enabled',
|
||||
'stories' => 'instance.stories.enabled',
|
||||
'ig_import' => 'pixelfed.import.instagram.enabled',
|
||||
'spam_detection' => 'pixelfed.bouncer.enabled',
|
||||
'require_email_verification' => 'pixelfed.enforce_email_verification',
|
||||
'enforce_account_limit' => 'pixelfed.enforce_account_limit',
|
||||
'show_custom_css' => 'uikit.show_custom.css',
|
||||
'show_custom_js' => 'uikit.show_custom.js',
|
||||
];
|
||||
|
||||
foreach ($bools as $key => $value) {
|
||||
$active = $request->input($key) == 'on';
|
||||
|
||||
if(config_cache($value) !== $active) {
|
||||
ConfigCacheService::put($value, (bool) $active);
|
||||
}
|
||||
}
|
||||
|
||||
Cache::forget('api:site:configuration:_v0.2');
|
||||
|
||||
return redirect('/i/admin/settings');
|
||||
}
|
||||
|
||||
public function settingsBackups(Request $request)
|
||||
|
@ -84,15 +188,6 @@ trait AdminSettingsController
|
|||
return view('admin.settings.features');
|
||||
}
|
||||
|
||||
public function settingsHomeStore(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'APP_NAME' => 'required|string',
|
||||
]);
|
||||
// Artisan::call('config:clear');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function settingsPages(Request $request)
|
||||
{
|
||||
$pages = Page::orderByDesc('updated_at')->paginate(10);
|
||||
|
|
|
@ -66,7 +66,7 @@ class ApiV1Controller extends Controller
|
|||
|
||||
public function apps(Request $request)
|
||||
{
|
||||
abort_if(!config('pixelfed.oauth_enabled'), 404);
|
||||
abort_if(!config_cache('pixelfed.oauth_enabled'), 404);
|
||||
|
||||
$this->validate($request, [
|
||||
'client_name' => 'required',
|
||||
|
@ -960,31 +960,31 @@ class ApiV1Controller extends Controller
|
|||
$res = [
|
||||
'approval_required' => false,
|
||||
'contact_account' => null,
|
||||
'description' => config('instance.description'),
|
||||
'description' => config_cache('app.description'),
|
||||
'email' => config('instance.email'),
|
||||
'invites_enabled' => false,
|
||||
'rules' => [],
|
||||
'short_description' => 'Pixelfed - Photo sharing for everyone',
|
||||
'languages' => ['en'],
|
||||
'max_toot_chars' => (int) config('pixelfed.max_caption_length'),
|
||||
'registrations' => config('pixelfed.open_registration'),
|
||||
'registrations' => config_cache('pixelfed.open_registration'),
|
||||
'stats' => [
|
||||
'user_count' => 0,
|
||||
'status_count' => 0,
|
||||
'domain_count' => 0
|
||||
],
|
||||
'thumbnail' => config('app.url') . '/img/pixelfed-icon-color.png',
|
||||
'title' => config('app.name'),
|
||||
'title' => config_cache('app.name'),
|
||||
'uri' => config('pixelfed.domain.app'),
|
||||
'urls' => [],
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')',
|
||||
'environment' => [
|
||||
'max_photo_size' => (int) config('pixelfed.max_photo_size'),
|
||||
'max_photo_size' => (int) config_cache('pixelfed.max_photo_size'),
|
||||
'max_avatar_size' => (int) config('pixelfed.max_avatar_size'),
|
||||
'max_caption_length' => (int) config('pixelfed.max_caption_length'),
|
||||
'max_bio_length' => (int) config('pixelfed.max_bio_length'),
|
||||
'max_album_length' => (int) config('pixelfed.max_album_length'),
|
||||
'mobile_apis' => config('pixelfed.oauth_enabled')
|
||||
'max_album_length' => (int) config_cache('pixelfed.max_album_length'),
|
||||
'mobile_apis' => config_cache('pixelfed.oauth_enabled')
|
||||
|
||||
]
|
||||
];
|
||||
|
@ -1033,8 +1033,8 @@ class ApiV1Controller extends Controller
|
|||
'file.*' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'max:' . config('pixelfed.max_photo_size'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
'filter_name' => 'nullable|string|max:24',
|
||||
|
@ -1059,11 +1059,11 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$profile = $user->profile;
|
||||
|
||||
if(config('pixelfed.enforce_account_limit') == true) {
|
||||
if(config_cache('pixelfed.enforce_account_limit') == true) {
|
||||
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
|
||||
return Media::whereUserId($user->id)->sum('size') / 1000;
|
||||
});
|
||||
$limit = (int) config('pixelfed.max_account_size');
|
||||
$limit = (int) config_cache('pixelfed.max_account_size');
|
||||
if ($size >= $limit) {
|
||||
abort(403, 'Account size limit reached.');
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), $mimes) == false) {
|
||||
abort(403, 'Invalid or unsupported mime type.');
|
||||
}
|
||||
|
@ -1742,7 +1742,7 @@ class ApiV1Controller extends Controller
|
|||
$this->validate($request, [
|
||||
'status' => 'nullable|string',
|
||||
'in_reply_to_id' => 'nullable|integer',
|
||||
'media_ids' => 'array|max:' . config('pixelfed.max_album_length'),
|
||||
'media_ids' => 'array|max:' . config_cache('pixelfed.max_album_length'),
|
||||
'media_ids.*' => 'integer|min:1',
|
||||
'sensitive' => 'nullable|boolean',
|
||||
'visibility' => 'string|in:private,unlisted,public',
|
||||
|
@ -1824,7 +1824,7 @@ class ApiV1Controller extends Controller
|
|||
$mimes = [];
|
||||
|
||||
foreach($ids as $k => $v) {
|
||||
if($k + 1 > config('pixelfed.max_album_length')) {
|
||||
if($k + 1 > config_cache('pixelfed.max_album_length')) {
|
||||
continue;
|
||||
}
|
||||
$m = Media::whereUserId($user->id)->whereNull('status_id')->findOrFail($v);
|
||||
|
|
|
@ -34,7 +34,7 @@ class InstanceApiController extends Controller {
|
|||
|
||||
$res = [
|
||||
'uri' => config('pixelfed.domain.app'),
|
||||
'title' => config('app.name'),
|
||||
'title' => config_cache('app.name'),
|
||||
'description' => '',
|
||||
'version' => config('pixelfed.version'),
|
||||
'urls' => [],
|
||||
|
|
|
@ -154,7 +154,7 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
if(config('pixelfed.open_registration')) {
|
||||
if(config_cache('pixelfed.open_registration')) {
|
||||
$limit = config('pixelfed.max_users');
|
||||
if($limit) {
|
||||
abort_if($limit <= User::count(), 404);
|
||||
|
@ -175,12 +175,12 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
abort_if(config('pixelfed.open_registration') == false, 400);
|
||||
abort_if(config_cache('pixelfed.open_registration') == false, 400);
|
||||
|
||||
$count = User::count();
|
||||
$limit = config('pixelfed.max_users');
|
||||
|
||||
if(false == config('pixelfed.open_registration') || $limit && $limit <= $count) {
|
||||
if(false == config_cache('pixelfed.open_registration') || $limit && $limit <= $count) {
|
||||
return abort(403);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ class ComposeController extends Controller
|
|||
'file.*' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'max:' . config('pixelfed.max_photo_size'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
'filter_name' => 'nullable|string|max:24',
|
||||
|
@ -92,11 +92,11 @@ class ComposeController extends Controller
|
|||
|
||||
abort_if($limitReached == true, 429);
|
||||
|
||||
if(config('pixelfed.enforce_account_limit') == true) {
|
||||
if(config_cache('pixelfed.enforce_account_limit') == true) {
|
||||
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
|
||||
return Media::whereUserId($user->id)->sum('size') / 1000;
|
||||
});
|
||||
$limit = (int) config('pixelfed.max_account_size');
|
||||
$limit = (int) config_cache('pixelfed.max_account_size');
|
||||
if ($size >= $limit) {
|
||||
abort(403, 'Account size limit reached.');
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class ComposeController extends Controller
|
|||
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
|
||||
abort_if(in_array($photo->getMimeType(), $mimes) == false, 400, 'Invalid media format');
|
||||
|
||||
|
@ -164,8 +164,8 @@ class ComposeController extends Controller
|
|||
'file' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'max:' . config('pixelfed.max_photo_size'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
]);
|
||||
|
@ -454,7 +454,7 @@ class ComposeController extends Controller
|
|||
$optimize_media = (bool) $request->input('optimize_media');
|
||||
|
||||
foreach($medias as $k => $media) {
|
||||
if($k + 1 > config('pixelfed.max_album_length')) {
|
||||
if($k + 1 > config_cache('pixelfed.max_album_length')) {
|
||||
continue;
|
||||
}
|
||||
$m = Media::findOrFail($media['id']);
|
||||
|
|
|
@ -500,8 +500,8 @@ class DirectMessageController extends Controller
|
|||
'file' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'max:' . config('pixelfed.max_photo_size'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
'to_id' => 'required'
|
||||
|
@ -522,18 +522,18 @@ class DirectMessageController extends Controller
|
|||
$hidden = false;
|
||||
}
|
||||
|
||||
if(config('pixelfed.enforce_account_limit') == true) {
|
||||
if(config_cache('pixelfed.enforce_account_limit') == true) {
|
||||
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
|
||||
return Media::whereUserId($user->id)->sum('size') / 1000;
|
||||
});
|
||||
$limit = (int) config('pixelfed.max_account_size');
|
||||
$limit = (int) config_cache('pixelfed.max_account_size');
|
||||
if ($size >= $limit) {
|
||||
abort(403, 'Account size limit reached.');
|
||||
}
|
||||
}
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), $mimes) == false) {
|
||||
abort(403, 'Invalid or unsupported mime type.');
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userOutbox(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.outbox'), 404);
|
||||
|
||||
$profile = Profile::whereNull('domain')
|
||||
|
@ -99,7 +99,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userInbox(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.inbox'), 404);
|
||||
|
||||
$headers = $request->headers->all();
|
||||
|
@ -110,7 +110,7 @@ class FederationController extends Controller
|
|||
|
||||
public function sharedInbox(Request $request)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.sharedInbox'), 404);
|
||||
|
||||
$headers = $request->headers->all();
|
||||
|
@ -121,7 +121,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userFollowing(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
|
||||
$profile = Profile::whereNull('remote_url')
|
||||
->whereUsername($username)
|
||||
|
@ -144,7 +144,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userFollowers(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
|
||||
$profile = Profile::whereNull('remote_url')
|
||||
->whereUsername($username)
|
||||
|
|
|
@ -12,7 +12,7 @@ class ImportController extends Controller
|
|||
{
|
||||
$this->middleware('auth');
|
||||
|
||||
if(config('pixelfed.import.instagram.enabled') != true) {
|
||||
if(config_cache('pixelfed.import.instagram.enabled') != true) {
|
||||
abort(404, 'Feature not enabled');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ProfileController extends Controller
|
|||
->whereUsername($username)
|
||||
->firstOrFail();
|
||||
|
||||
if($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $user);
|
||||
}
|
||||
return $this->buildProfile($request, $user);
|
||||
|
@ -114,7 +114,7 @@ class ProfileController extends Controller
|
|||
{
|
||||
$user = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
|
||||
if ($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if ($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $user);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ class ProfileController extends Controller
|
|||
|
||||
public function showActivityPub(Request $request, $user)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if($user->domain, 404);
|
||||
|
||||
$fractal = new Fractal\Manager();
|
||||
|
@ -234,7 +234,7 @@ class ProfileController extends Controller
|
|||
|
||||
public function stories(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
$pid = $profile->id;
|
||||
$authed = Auth::user()->profile;
|
||||
|
|
|
@ -314,7 +314,7 @@ class PublicApiController extends Controller
|
|||
->whereNotIn('profile_id', $filtered)
|
||||
->whereLocal(true)
|
||||
->whereScope('public')
|
||||
->where('created_at', '>', now()->subMonths(3))
|
||||
->where('created_at', '>', now()->subMonths(6))
|
||||
->orderBy('created_at', 'desc')
|
||||
->limit($limit)
|
||||
->get();
|
||||
|
@ -343,7 +343,7 @@ class PublicApiController extends Controller
|
|||
->with('profile', 'hashtags', 'mentions')
|
||||
->whereLocal(true)
|
||||
->whereScope('public')
|
||||
->where('created_at', '>', now()->subMonths(3))
|
||||
->where('created_at', '>', now()->subMonths(6))
|
||||
->orderBy('created_at', 'desc')
|
||||
->simplePaginate($limit);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class SearchController extends Controller
|
|||
$hash = hash('sha256', $tag);
|
||||
if( Helpers::validateUrl($tag) != false &&
|
||||
Helpers::validateLocalUrl($tag) != true &&
|
||||
config('federation.activitypub.enabled') == true &&
|
||||
config_cache('federation.activitypub.enabled') == true &&
|
||||
config('federation.activitypub.remoteFollow') == true
|
||||
) {
|
||||
$remote = Helpers::fetchFromUrl($tag);
|
||||
|
@ -203,7 +203,7 @@ class SearchController extends Controller
|
|||
$ttl = now()->addHours(2);
|
||||
if( Helpers::validateUrl($tag) != false &&
|
||||
Helpers::validateLocalUrl($tag) != true &&
|
||||
config('federation.activitypub.enabled') == true &&
|
||||
config_cache('federation.activitypub.enabled') == true &&
|
||||
config('federation.activitypub.remoteFollow') == true
|
||||
) {
|
||||
$remote = Helpers::fetchFromUrl($tag);
|
||||
|
|
|
@ -16,6 +16,7 @@ use Mail;
|
|||
use Purify;
|
||||
use App\Mail\PasswordChange;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PronounService;
|
||||
|
||||
trait HomeSettings
|
||||
{
|
||||
|
@ -25,13 +26,14 @@ trait HomeSettings
|
|||
$id = Auth::user()->profile->id;
|
||||
$storage = [];
|
||||
$used = Media::whereProfileId($id)->sum('size');
|
||||
$storage['limit'] = config('pixelfed.max_account_size') * 1024;
|
||||
$storage['limit'] = config_cache('pixelfed.max_account_size') * 1024;
|
||||
$storage['used'] = $used;
|
||||
$storage['percentUsed'] = ceil($storage['used'] / $storage['limit'] * 100);
|
||||
$storage['limitPretty'] = PrettyNumber::size($storage['limit']);
|
||||
$storage['usedPretty'] = PrettyNumber::size($storage['used']);
|
||||
$pronouns = PronounService::get($id);
|
||||
|
||||
return view('settings.home', compact('storage'));
|
||||
return view('settings.home', compact('storage', 'pronouns'));
|
||||
}
|
||||
|
||||
public function homeUpdate(Request $request)
|
||||
|
@ -40,7 +42,8 @@ trait HomeSettings
|
|||
'name' => 'required|string|max:'.config('pixelfed.max_name_length'),
|
||||
'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'),
|
||||
'website' => 'nullable|url',
|
||||
'language' => 'nullable|string|min:2|max:5'
|
||||
'language' => 'nullable|string|min:2|max:5',
|
||||
'pronouns' => 'nullable|array|max:4'
|
||||
]);
|
||||
|
||||
$changes = false;
|
||||
|
@ -50,12 +53,14 @@ trait HomeSettings
|
|||
$language = $request->input('language');
|
||||
$user = Auth::user();
|
||||
$profile = $user->profile;
|
||||
$pronouns = $request->input('pronouns');
|
||||
$existingPronouns = PronounService::get($profile->id);
|
||||
$layout = $request->input('profile_layout');
|
||||
if($layout) {
|
||||
$layout = !in_array($layout, ['metro', 'moment']) ? 'metro' : $layout;
|
||||
}
|
||||
|
||||
$enforceEmailVerification = config('pixelfed.enforce_email_verification');
|
||||
$enforceEmailVerification = config_cache('pixelfed.enforce_email_verification');
|
||||
|
||||
// Only allow email to be updated if not yet verified
|
||||
if (!$enforceEmailVerification || !$changes && $user->email_verified_at) {
|
||||
|
@ -82,6 +87,14 @@ trait HomeSettings
|
|||
$user->language = $language;
|
||||
session()->put('locale', $language);
|
||||
}
|
||||
|
||||
if($existingPronouns != $pronouns) {
|
||||
if($pronouns && in_array('Select Pronoun(s)', $pronouns)) {
|
||||
PronounService::clear($profile->id);
|
||||
} else {
|
||||
PronounService::put($profile->id, $pronouns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($changes === true) {
|
||||
|
@ -152,7 +165,7 @@ trait HomeSettings
|
|||
$user = Auth::user();
|
||||
$profile = $user->profile;
|
||||
|
||||
$validate = config('pixelfed.enforce_email_verification');
|
||||
$validate = config_cache('pixelfed.enforce_email_verification');
|
||||
|
||||
if ($user->email != $email) {
|
||||
$changes = true;
|
||||
|
|
|
@ -77,13 +77,13 @@ class SettingsController extends Controller
|
|||
|
||||
public function dataImport()
|
||||
{
|
||||
abort_if(!config('pixelfed.import.instagram.enabled'), 404);
|
||||
abort_if(!config_cache('pixelfed.import.instagram.enabled'), 404);
|
||||
return view('settings.import.home');
|
||||
}
|
||||
|
||||
public function dataImportInstagram()
|
||||
{
|
||||
abort_if(!config('pixelfed.import.instagram.enabled'), 404);
|
||||
abort_if(!config_cache('pixelfed.import.instagram.enabled'), 404);
|
||||
return view('settings.import.instagram.home');
|
||||
}
|
||||
|
||||
|
|
|
@ -70,11 +70,16 @@ class StatusController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
if ($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if ($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $status);
|
||||
}
|
||||
|
||||
$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'));
|
||||
}
|
||||
|
@ -340,7 +345,7 @@ class StatusController extends Controller
|
|||
|
||||
public static function mimeTypeCheck($mimes)
|
||||
{
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
$count = count($mimes);
|
||||
$photos = 0;
|
||||
$videos = 0;
|
||||
|
|
|
@ -21,14 +21,14 @@ class StoryController extends Controller
|
|||
{
|
||||
public function apiV1Add(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$this->validate($request, [
|
||||
'file' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:image/jpeg,image/png,video/mp4',
|
||||
'max:' . config('pixelfed.max_photo_size'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
]);
|
||||
|
@ -78,7 +78,7 @@ class StoryController extends Controller
|
|||
|
||||
protected function storePhoto($photo, $user)
|
||||
{
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
|
@ -94,7 +94,7 @@ class StoryController extends Controller
|
|||
$fpath = storage_path('app/' . $path);
|
||||
$img = Intervention::make($fpath);
|
||||
$img->orientate();
|
||||
$img->save($fpath, config('pixelfed.image_quality'));
|
||||
$img->save($fpath, config_cache('pixelfed.image_quality'));
|
||||
$img->destroy();
|
||||
}
|
||||
return $path;
|
||||
|
@ -102,7 +102,7 @@ class StoryController extends Controller
|
|||
|
||||
public function cropPhoto(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$this->validate($request, [
|
||||
'media_id' => 'required|integer|min:1',
|
||||
|
@ -133,7 +133,7 @@ class StoryController extends Controller
|
|||
$img->resize(1080, 1920, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
$img->save($path, config('pixelfed.image_quality'));
|
||||
$img->save($path, config_cache('pixelfed.image_quality'));
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -144,7 +144,7 @@ class StoryController extends Controller
|
|||
|
||||
public function publishStory(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$this->validate($request, [
|
||||
'media_id' => 'required',
|
||||
|
@ -169,7 +169,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Delete(Request $request, $id)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
|
@ -190,7 +190,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Recent(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$profile = $request->user()->profile;
|
||||
$following = $profile->following->pluck('id')->toArray();
|
||||
|
@ -232,7 +232,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Fetch(Request $request, $id)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$authed = $request->user()->profile;
|
||||
$profile = Profile::findOrFail($id);
|
||||
|
@ -270,7 +270,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Item(Request $request, $id)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$authed = $request->user()->profile;
|
||||
$story = Story::with('profile')
|
||||
|
@ -304,7 +304,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Profile(Request $request, $id)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$authed = $request->user()->profile;
|
||||
$profile = Profile::findOrFail($id);
|
||||
|
@ -355,7 +355,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Viewed(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$this->validate($request, [
|
||||
'id' => 'required|integer|min:1|exists:stories',
|
||||
|
@ -391,7 +391,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Exists(Request $request, $id)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$res = (bool) Story::whereProfileId($id)
|
||||
->whereActive(true)
|
||||
|
@ -403,7 +403,7 @@ class StoryController extends Controller
|
|||
|
||||
public function apiV1Me(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$profile = $request->user()->profile;
|
||||
$stories = Story::whereProfileId($profile->id)
|
||||
|
@ -441,14 +441,14 @@ class StoryController extends Controller
|
|||
|
||||
public function compose(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
return view('stories.compose');
|
||||
}
|
||||
|
||||
public function iRedirect(Request $request)
|
||||
{
|
||||
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
|
||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||
|
||||
$user = $request->user();
|
||||
abort_if(!$user, 404);
|
||||
|
|
|
@ -17,7 +17,7 @@ class EmailVerificationCheck
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user() &&
|
||||
config('pixelfed.enforce_email_verification') &&
|
||||
config_cache('pixelfed.enforce_email_verification') &&
|
||||
is_null($request->user()->email_verified_at) &&
|
||||
!$request->is(
|
||||
'i/auth/*',
|
||||
|
|
|
@ -54,7 +54,7 @@ class AvatarOptimize implements ShouldQueue
|
|||
$img->fit(200, 200, function ($constraint) {
|
||||
$constraint->upsize();
|
||||
});
|
||||
$quality = config('pixelfed.image_quality');
|
||||
$quality = config_cache('pixelfed.image_quality');
|
||||
$img->save($file, $quality);
|
||||
|
||||
$avatar = Avatar::whereProfileId($this->profile->id)->firstOrFail();
|
||||
|
|
|
@ -49,7 +49,7 @@ class ImportInstagram implements ShouldQueue
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if(config('pixelfed.import.instagram.enabled') != true) {
|
||||
if(config_cache('pixelfed.import.instagram.enabled') != true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class SharePipeline implements ShouldQueue
|
|||
|
||||
public function remoteAnnounceDeliver()
|
||||
{
|
||||
if(config('federation.activitypub.enabled') == false) {
|
||||
if(config_cache('federation.activitypub.enabled') == false) {
|
||||
return true;
|
||||
}
|
||||
$status = $this->status;
|
||||
|
|
|
@ -11,6 +11,7 @@ use App\{
|
|||
Status,
|
||||
StatusHashtag,
|
||||
};
|
||||
use App\Models\StatusVideo;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
@ -72,7 +73,7 @@ class StatusDelete implements ShouldQueue
|
|||
$profile->status_count = ($count - 1);
|
||||
$profile->save();
|
||||
|
||||
if(config('federation.activitypub.enabled') == true) {
|
||||
if(config_cache('federation.activitypub.enabled') == true) {
|
||||
$this->fanoutDelete($status);
|
||||
} else {
|
||||
$this->unlinkRemoveMedia($status);
|
||||
|
@ -110,7 +111,6 @@ class StatusDelete implements ShouldQueue
|
|||
Report::whereObjectType('App\Status')
|
||||
->whereObjectId($status->id)
|
||||
->delete();
|
||||
|
||||
MediaTag::where('status_id', $status->id)
|
||||
->cursor()
|
||||
->each(function($tag) {
|
||||
|
@ -119,7 +119,7 @@ class StatusDelete implements ShouldQueue
|
|||
->forceDelete();
|
||||
$tag->delete();
|
||||
});
|
||||
|
||||
StatusVideo::whereStatusId($status->id)->delete();
|
||||
AccountInterstitial::where('item_type', 'App\Status')
|
||||
->where('item_id', $status->id)
|
||||
->delete();
|
||||
|
|
|
@ -151,7 +151,7 @@ class StatusEntityLexer implements ShouldQueue
|
|||
{
|
||||
$status = $this->status;
|
||||
|
||||
if(config('pixelfed.bouncer.enabled')) {
|
||||
if(config_cache('pixelfed.bouncer.enabled')) {
|
||||
Bouncer::get($status);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ class StatusEntityLexer implements ShouldQueue
|
|||
PublicTimelineService::add($status->id);
|
||||
}
|
||||
|
||||
if(config('federation.activitypub.enabled') == true && config('app.env') == 'production') {
|
||||
if(config_cache('federation.activitypub.enabled') == true && config('app.env') == 'production') {
|
||||
StatusActivityPubDeliver::dispatch($this->status);
|
||||
}
|
||||
}
|
||||
|
|
14
app/Models/ConfigCache.php
Normal file
14
app/Models/ConfigCache.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ConfigCache extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'config_cache';
|
||||
public $fillable = ['*'];
|
||||
}
|
11
app/Models/UserPronoun.php
Normal file
11
app/Models/UserPronoun.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserPronoun extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -26,7 +26,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
if(config('pixelfed.oauth_enabled')) {
|
||||
if(config_cache('pixelfed.oauth_enabled')) {
|
||||
Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]);
|
||||
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15)));
|
||||
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30)));
|
||||
|
|
95
app/Services/ConfigCacheService.php
Normal file
95
app/Services/ConfigCacheService.php
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Cache;
|
||||
use Config;
|
||||
use App\Models\ConfigCache as ConfigCacheModel;
|
||||
|
||||
class ConfigCacheService
|
||||
{
|
||||
const CACHE_KEY = 'config_cache:_key:';
|
||||
|
||||
public static function get($key)
|
||||
{
|
||||
$cacheKey = "config_cache:_key:{$key}";
|
||||
$ttl = now()->addHours(12);
|
||||
return Cache::remember($cacheKey, $ttl, function() use($key) {
|
||||
|
||||
$allowed = [
|
||||
'app.name',
|
||||
'app.short_description',
|
||||
'app.description',
|
||||
'app.rules',
|
||||
|
||||
'pixelfed.max_photo_size',
|
||||
'pixelfed.max_album_length',
|
||||
'pixelfed.image_quality',
|
||||
'pixelfed.media_types',
|
||||
|
||||
'pixelfed.open_registration',
|
||||
'federation.activitypub.enabled',
|
||||
'pixelfed.oauth_enabled',
|
||||
'instance.stories.enabled',
|
||||
'pixelfed.import.instagram.enabled',
|
||||
'pixelfed.bouncer.enabled',
|
||||
|
||||
'pixelfed.enforce_email_verification',
|
||||
'pixelfed.max_account_size',
|
||||
'pixelfed.enforce_account_limit',
|
||||
|
||||
'uikit.custom.css',
|
||||
'uikit.custom.js',
|
||||
'uikit.show_custom.css',
|
||||
'uikit.show_custom.js'
|
||||
];
|
||||
|
||||
if(!config('instance.enable_cc')) {
|
||||
return config($key);
|
||||
}
|
||||
|
||||
if(!in_array($key, $allowed)) {
|
||||
return config($key);
|
||||
}
|
||||
|
||||
$v = config($key);
|
||||
$c = ConfigCacheModel::where('k', $key)->first();
|
||||
|
||||
if($c) {
|
||||
return $c->v ?? config($key);
|
||||
}
|
||||
|
||||
if(!$v) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cc = new ConfigCacheModel;
|
||||
$cc->k = $key;
|
||||
$cc->v = $v;
|
||||
$cc->save();
|
||||
|
||||
return $v;
|
||||
});
|
||||
}
|
||||
|
||||
public static function put($key, $val)
|
||||
{
|
||||
$exists = ConfigCacheModel::whereK($key)->first();
|
||||
|
||||
if($exists) {
|
||||
$exists->v = $val;
|
||||
$exists->save();
|
||||
Cache::forget(self::CACHE_KEY . $key);
|
||||
return self::get($key);
|
||||
}
|
||||
|
||||
$cc = new ConfigCacheModel;
|
||||
$cc->k = $key;
|
||||
$cc->v = $val;
|
||||
$cc->save();
|
||||
|
||||
Cache::forget(self::CACHE_KEY . $key);
|
||||
|
||||
return self::get($key);
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ class MediaStorageService {
|
|||
empty($h['Content-Length']) ||
|
||||
empty($h['Content-Type']) ||
|
||||
$h['Content-Length'] < 10 ||
|
||||
$h['Content-Length'] > (config('pixelfed.max_photo_size') * 1000)
|
||||
$h['Content-Length'] > (config_cache('pixelfed.max_photo_size') * 1000)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class MediaStorageService {
|
|||
];
|
||||
|
||||
$mime = $head['mime'];
|
||||
$max_size = (int) config('pixelfed.max_photo_size') * 1000;
|
||||
$max_size = (int) config_cache('pixelfed.max_photo_size') * 1000;
|
||||
$media->size = $head['length'];
|
||||
$media->remote_media = true;
|
||||
$media->save();
|
||||
|
|
102
app/Services/PronounService.php
Normal file
102
app/Services/PronounService.php
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Cache;
|
||||
use App\Models\UserPronoun;
|
||||
use App\Profile;
|
||||
|
||||
class PronounService {
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
$key = 'user:pronouns:' . $id;
|
||||
$ttl = now()->addHours(12);
|
||||
|
||||
return Cache::remember($key, $ttl, function() use($id) {
|
||||
$res = UserPronoun::whereProfileId($id)->first();
|
||||
return $res ? json_decode($res->pronouns, true) : [];
|
||||
});
|
||||
}
|
||||
|
||||
public static function put($id, $pronouns)
|
||||
{
|
||||
$res = UserPronoun::whereProfileId($id)->first();
|
||||
$key = 'user:pronouns:' . $id;
|
||||
|
||||
if($res) {
|
||||
$res->pronouns = json_encode($pronouns);
|
||||
$res->save();
|
||||
Cache::forget($key);
|
||||
AccountService::del($id);
|
||||
return $res->pronouns;
|
||||
}
|
||||
|
||||
$res = new UserPronoun;
|
||||
$res->profile_id = $id;
|
||||
$res->pronouns = json_encode($pronouns);
|
||||
$res->save();
|
||||
Cache::forget($key);
|
||||
AccountService::del($id);
|
||||
return $res->pronouns;
|
||||
}
|
||||
|
||||
public static function clear($id)
|
||||
{
|
||||
$res = UserPronoun::whereProfileId($id)->first();
|
||||
if($res) {
|
||||
$res->pronouns = null;
|
||||
$res->save();
|
||||
}
|
||||
$key = 'user:pronouns:' . $id;
|
||||
Cache::forget($key);
|
||||
AccountService::del($id);
|
||||
}
|
||||
|
||||
public static function pronouns()
|
||||
{
|
||||
return [
|
||||
'co',
|
||||
'cos',
|
||||
'e',
|
||||
'ey',
|
||||
'em',
|
||||
'eir',
|
||||
'fae',
|
||||
'faer',
|
||||
'he',
|
||||
'him',
|
||||
'his',
|
||||
'her',
|
||||
'hers',
|
||||
'hir',
|
||||
'mer',
|
||||
'mers',
|
||||
'ne',
|
||||
'nir',
|
||||
'nirs',
|
||||
'nee',
|
||||
'ner',
|
||||
'ners',
|
||||
'per',
|
||||
'pers',
|
||||
'she',
|
||||
'they',
|
||||
'them',
|
||||
'theirs',
|
||||
'thon',
|
||||
'thons',
|
||||
've',
|
||||
'ver',
|
||||
'vis',
|
||||
'vi',
|
||||
'vir',
|
||||
'xe',
|
||||
'xem',
|
||||
'xyr',
|
||||
'ze',
|
||||
'zir',
|
||||
'zie'
|
||||
];
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ namespace App\Transformer\Api;
|
|||
use Auth;
|
||||
use App\Profile;
|
||||
use League\Fractal;
|
||||
use App\Services\PronounService;
|
||||
|
||||
class AccountTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -35,7 +36,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'is_admin' => (bool) $is_admin,
|
||||
'created_at' => $profile->created_at->toJSON(),
|
||||
'header_bg' => $profile->header_bg,
|
||||
'last_fetched_at' => optional($profile->last_fetched_at)->toJSON()
|
||||
'last_fetched_at' => optional($profile->last_fetched_at)->toJSON(),
|
||||
'pronouns' => PronounService::get($profile->id)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class Helpers {
|
|||
|
||||
$activity = $data['object'];
|
||||
|
||||
$mimeTypes = explode(',', config('pixelfed.media_types'));
|
||||
$mimeTypes = explode(',', config_cache('pixelfed.media_types'));
|
||||
$mediaTypes = in_array('video/mp4', $mimeTypes) ? ['Document', 'Image', 'Video'] : ['Document', 'Image'];
|
||||
|
||||
if(!isset($activity['attachment']) || empty($activity['attachment'])) {
|
||||
|
@ -418,7 +418,7 @@ class Helpers {
|
|||
$attachments = isset($data['object']) ? $data['object']['attachment'] : $data['attachment'];
|
||||
$user = $status->profile;
|
||||
$storagePath = MediaPathService::get($user, 2);
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
|
||||
foreach($attachments as $media) {
|
||||
$type = $media['mediaType'];
|
||||
|
|
|
@ -251,8 +251,8 @@ class Inbox
|
|||
if(count($activity['attachment'])) {
|
||||
$photos = 0;
|
||||
$videos = 0;
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$activity['attachment'] = array_slice($activity['attachment'], 0, config('pixelfed.max_album_length'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
$activity['attachment'] = array_slice($activity['attachment'], 0, config_cache('pixelfed.max_album_length'));
|
||||
foreach($activity['attachment'] as $a) {
|
||||
$type = $a['mediaType'];
|
||||
$url = $a['url'];
|
||||
|
|
|
@ -13,7 +13,7 @@ class Outbox {
|
|||
|
||||
public static function get($profile)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.outbox'), 404);
|
||||
|
||||
if($profile->status != null) {
|
||||
|
|
|
@ -163,7 +163,7 @@ class Image
|
|||
$converted = $this->setBaseName($path, $thumbnail, $img->extension);
|
||||
$newPath = storage_path('app/'.$converted['path']);
|
||||
|
||||
$quality = config('pixelfed.image_quality');
|
||||
$quality = config_cache('pixelfed.image_quality');
|
||||
$img->save($newPath, $quality);
|
||||
|
||||
if ($thumbnail == true) {
|
||||
|
|
|
@ -8,26 +8,26 @@ use Illuminate\Support\Str;
|
|||
class Config {
|
||||
|
||||
public static function get() {
|
||||
return Cache::remember('api:site:configuration:_v0.2', now()->addHours(30), function() {
|
||||
return Cache::remember('api:site:configuration:_v0.2', now()->addMinutes(5), function() {
|
||||
return [
|
||||
'open_registration' => config('pixelfed.open_registration'),
|
||||
'open_registration' => (bool) config_cache('pixelfed.open_registration'),
|
||||
'uploader' => [
|
||||
'max_photo_size' => config('pixelfed.max_photo_size'),
|
||||
'max_caption_length' => config('pixelfed.max_caption_length'),
|
||||
'album_limit' => config('pixelfed.max_album_length'),
|
||||
'image_quality' => config('pixelfed.image_quality'),
|
||||
'album_limit' => config_cache('pixelfed.max_album_length'),
|
||||
'image_quality' => config_cache('pixelfed.image_quality'),
|
||||
|
||||
'max_collection_length' => config('pixelfed.max_collection_length', 18),
|
||||
|
||||
'optimize_image' => config('pixelfed.optimize_image'),
|
||||
'optimize_video' => config('pixelfed.optimize_video'),
|
||||
|
||||
'media_types' => config('pixelfed.media_types'),
|
||||
'enforce_account_limit' => config('pixelfed.enforce_account_limit')
|
||||
'media_types' => config_cache('pixelfed.media_types'),
|
||||
'enforce_account_limit' => config_cache('pixelfed.enforce_account_limit')
|
||||
],
|
||||
|
||||
'activitypub' => [
|
||||
'enabled' => config('federation.activitypub.enabled'),
|
||||
'enabled' => config_cache('federation.activitypub.enabled'),
|
||||
'remote_follow' => config('federation.activitypub.remoteFollow')
|
||||
],
|
||||
|
||||
|
@ -39,10 +39,10 @@ class Config {
|
|||
],
|
||||
|
||||
'site' => [
|
||||
'name' => config('app.name', 'pixelfed'),
|
||||
'name' => config_cache('app.name'),
|
||||
'domain' => config('pixelfed.domain.app'),
|
||||
'url' => config('app.url'),
|
||||
'description' => config('instance.description')
|
||||
'description' => config_cache('app.short_description')
|
||||
],
|
||||
|
||||
'username' => [
|
||||
|
@ -54,12 +54,12 @@ class Config {
|
|||
],
|
||||
|
||||
'features' => [
|
||||
'mobile_apis' => config('pixelfed.oauth_enabled'),
|
||||
'mobile_apis' => config_cache('pixelfed.oauth_enabled'),
|
||||
'circles' => false,
|
||||
'stories' => config('instance.stories.enabled'),
|
||||
'video' => Str::contains(config('pixelfed.media_types'), 'video/mp4'),
|
||||
'stories' => config_cache('instance.stories.enabled'),
|
||||
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
|
||||
'import' => [
|
||||
'instagram' => config('pixelfed.import.instagram.enabled'),
|
||||
'instagram' => config_cache('pixelfed.import.instagram.enabled'),
|
||||
'mastodon' => false,
|
||||
'pixelfed' => false
|
||||
],
|
||||
|
|
|
@ -40,7 +40,7 @@ class Nodeinfo {
|
|||
});
|
||||
return [
|
||||
'metadata' => [
|
||||
'nodeName' => config('pixelfed.domain.app'),
|
||||
'nodeName' => config_cache('app.name'),
|
||||
'software' => [
|
||||
'homepage' => 'https://pixelfed.org',
|
||||
'repo' => 'https://github.com/pixelfed/pixelfed',
|
||||
|
@ -70,7 +70,7 @@ class Nodeinfo {
|
|||
'version' => '2.0',
|
||||
];
|
||||
});
|
||||
$res['openRegistrations'] = config('pixelfed.open_registration');
|
||||
$res['openRegistrations'] = (bool) config_cache('pixelfed.open_registration');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
9
app/helpers.php
Normal file
9
app/helpers.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
use App\Services\ConfigCacheService;
|
||||
|
||||
if (!function_exists('config_cache')) {
|
||||
function config_cache($key) {
|
||||
return ConfigCacheService::get($key);
|
||||
}
|
||||
}
|
|
@ -63,7 +63,10 @@
|
|||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
|
|
|
@ -108,6 +108,11 @@ return [
|
|||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'short_description' => 'Pixelfed - Photo sharing for everyone',
|
||||
'description' => 'Pixelfed - Photo sharing for everyone',
|
||||
'rules' => null,
|
||||
'logo' => '/img/pixelfed-icon-color.svg',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|
|
|
@ -72,4 +72,6 @@ return [
|
|||
'org' => env('COVID_LABEL_ORG', 'visit the WHO website')
|
||||
]
|
||||
],
|
||||
|
||||
'enable_cc' => env('ENABLE_CONFIG_CACHE', false)
|
||||
];
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateConfigCachesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('config_cache', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('k')->unique()->index();
|
||||
$table->text('v')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('config_cache');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUserPronounsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_pronouns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('user_id')->nullable()->unique()->index();
|
||||
$table->bigInteger('profile_id')->unique()->index();
|
||||
$table->json('pronouns')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_pronouns');
|
||||
}
|
||||
}
|
BIN
public/js/profile.js
vendored
BIN
public/js/profile.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -145,7 +145,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<p class="mb-0 d-flex align-items-center">
|
||||
<span class="font-weight-bold pr-3">{{profile.display_name}}</span>
|
||||
<span class="font-weight-bold mr-1">{{profile.display_name}}</span>
|
||||
<span v-if="profile.pronouns" class="text-muted small">{{profile.pronouns.join('/')}}</span>
|
||||
</p>
|
||||
<div v-if="profile.note" class="mb-0" v-html="profile.note"></div>
|
||||
<p v-if="profile.website" class=""><a :href="profile.website" class="profile-website" rel="me external nofollow noopener" target="_blank" @click.prevent="remoteRedirect(profile.website)">{{truncate(profile.website,24)}}</a></p>
|
||||
|
@ -387,6 +388,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<b-modal
|
||||
v-if="profile && following"
|
||||
ref="followingModal"
|
||||
|
|
|
@ -5,44 +5,69 @@
|
|||
</button>
|
||||
<div class="collapse navbar-collapse" id="topbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item mx-2 {{request()->is('*admin/dashboard')?'active':''}}">
|
||||
<li class="nav-item mx-4 {{request()->is('*admin/dashboard')?'active':''}}">
|
||||
<a class="nav-link" href="{{route('admin.home')}}">Dashboard</a>
|
||||
</li>
|
||||
{{--<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Configuration</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Content</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Federation</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Moderation</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Platform</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 align-self-center text-lighter">|</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Media</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Profiles</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Statuses</a>
|
||||
</li> --}}
|
||||
<li class="nav-item mx-4 {{request()->is('*messages*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.messages')}}">Messages</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*instances*')?'active':''}}">
|
||||
{{-- <li class="nav-item mx-4 {{request()->is('*instances*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.instances')}}">Instances</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*media*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.media')}}">Media</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*reports*')?'active':''}}">
|
||||
</li> --}}
|
||||
<li class="nav-item mx-4 {{request()->is('*reports*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.reports')}}">Moderation</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*profiles*')?'active':''}}">
|
||||
{{-- <li class="nav-item mx-2 {{request()->is('*profiles*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.profiles')}}">Profiles</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*statuses*')?'active':''}}">
|
||||
</li> --}}
|
||||
<li class="nav-item mx-4 {{request()->is('*statuses*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.statuses')}}">Statuses</a>
|
||||
</li>
|
||||
<li class="nav-item mx-2 {{request()->is('*users*')?'active':''}}">
|
||||
<li class="nav-item mx-4 {{request()->is('*users*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.users')}}">Users</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown mx-3 {{request()->is(['*settings*','*discover*', '*site-news*'])?'active':''}}">
|
||||
<li class="nav-item mx-4 {{request()->is('*settings*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.settings')}}">Settings</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown ml-3 {{request()->is(['*discover*', '*site-news*'])?'active':''}}">
|
||||
<a class="nav-link dropdown-toggle px-4" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
More
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*apps*')?'active':''}}" href="{{route('admin.apps')}}">Apps</a>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*discover*')?'active':''}}" href="{{route('admin.discover')}}">Discover</a>
|
||||
{{-- <a class="dropdown-item font-weight-bold {{request()->is('*discover*')?'active':''}}" href="{{route('admin.discover')}}">Discover</a> --}}
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*hashtags*')?'active':''}}" href="{{route('admin.hashtags')}}">Hashtags</a>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*instances*')?'active':''}}" href="{{route('admin.instances')}}">Instances</a>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*media*')?'active':''}}" href="{{route('admin.media')}}">Media</a>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*site-news*')?'active':''}}" href="/i/admin/site-news">Newsroom</a>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*profiles*')?'active':''}}" href="/i/admin/profiles">Profiles</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item font-weight-bold" href="/horizon">Horizon</a>
|
||||
{{-- <a class="dropdown-item font-weight-bold" href="#">Websockets</a> --}}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item font-weight-bold {{request()->is('*settings*')?'active':''}}" href="{{route('admin.settings')}}">Settings</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -3,61 +3,181 @@
|
|||
@include('admin.settings.sidebar')
|
||||
|
||||
@section('section')
|
||||
<div class="title">
|
||||
<div class="title mb-4">
|
||||
<h3 class="font-weight-bold">Settings</h3>
|
||||
</div>
|
||||
<hr>
|
||||
<form method="post">
|
||||
@if(config('instance.enable_cc'))
|
||||
<p class="lead mb-0">Manage instance settings.</p>
|
||||
<p class="mb-0"><span class="font-weight-bold">Warning</span>: These settings will override .env variables</p>
|
||||
</div>
|
||||
<form method="post">
|
||||
@csrf
|
||||
<div class="form-group row">
|
||||
<label for="app_name" class="col-sm-3 col-form-label font-weight-bold text-right">App Name</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="app_name" name="APP_NAME" placeholder="Application Name ex: pixelfed" value="{{config('app.name')}}" autocomplete="off">
|
||||
<p class="text-muted small help-text font-weight-bold mb-0">Site name, default: pixelfed</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="app_url" class="col-sm-3 col-form-label font-weight-bold text-right">App URL</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="app_url" name="APP_URL" placeholder="Application URL" value="{{config('app.url')}}">
|
||||
<p class="text-muted small help-text font-weight-bold mb-0">App URL, used for building URLs ex: https://example.org</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-tabs nav-fill border-bottom-0" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link font-weight-bold px-4 active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">General</a>
|
||||
</li>
|
||||
<li class="nav-item border-none">
|
||||
<a class="nav-link font-weight-bold px-4" id="media-tab" data-toggle="tab" href="#media" role="tab" aria-controls="media">Media</a>
|
||||
</li>
|
||||
<li class="nav-item border-none">
|
||||
<a class="nav-link font-weight-bold px-4" id="users-tab" data-toggle="tab" href="#users" role="tab" aria-controls="users">Users</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link font-weight-bold px-4" id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced">Advanced</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="app_url" class="col-sm-3 col-form-label font-weight-bold text-right">App Domain</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="app_url" name="app_domain" placeholder="example.org" value="{{config('pixelfed.domain.app')}}">
|
||||
<p class="text-muted small help-text font-weight-bold mb-0">Used for routing ex: example.org</p>
|
||||
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top">
|
||||
<label class="font-weight-bold text-muted">Manage Core Features</label>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="activitypub" class="custom-control-input" id="ap" {{config_cache('federation.activitypub.enabled') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="ap">ActivityPub</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="open_registration" class="custom-control-input" id="openReg" {{config_cache('pixelfed.open_registration') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="openReg">Open Registrations</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="mobile_apis" class="custom-control-input" id="cf2" {{config_cache('pixelfed.oauth_enabled') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="cf2">Mobile APIs</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="stories" class="custom-control-input" id="cf3" {{config_cache('instance.stories.enabled') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="cf3">Stories</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="ig_import" class="custom-control-input" id="cf4" {{config_cache('pixelfed.import.instagram.enabled') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="cf4">Instagram Import</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="spam_detection" class="custom-control-input" id="cf5" {{config_cache('pixelfed.bouncer.enabled') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="cf5">Spam detection</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="app_url" class="col-sm-3 col-form-label font-weight-bold text-right">Admin Domain</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="admin_domain" name="admin_domain" placeholder="admin.example.org" value="{{config('pixelfed.domain.admin')}}">
|
||||
<p class="text-muted small help-text font-weight-bold mb-0">Used for routing the admin dashboard ex: admin.example.org</p>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||
<label class="font-weight-bold text-muted">Name</label>
|
||||
<input class="form-control col-8" name="name" placeholder="Pixelfed" value="{{config_cache('app.name')}}">
|
||||
<p class="help-text small text-muted mt-3 mb-0">The instance name used in titles, metadata and apis.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="alert alert-info border-0">
|
||||
<div class="media d-flex align-items-center">
|
||||
<div class="mr-3">
|
||||
<i class="fas fa-info-circle fa-2x"></i>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-bottom">
|
||||
<label class="font-weight-bold text-muted">Short Description</label>
|
||||
<textarea class="form-control" rows="3" name="short_description">{{config_cache('app.short_description')}}</textarea>
|
||||
<p class="help-text small text-muted mt-3 mb-0">Short description of instance used on various pages and apis.</p>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<p class="mb-0 lead">Tip:</p>
|
||||
<p class="mb-0">You can edit the .env file in the <a href="#" class="font-weight-bold">Configuration</a> settings.</p>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-bottom">
|
||||
<label class="font-weight-bold text-muted">Long Description</label>
|
||||
<textarea class="form-control" rows="3" name="long_description">{{config_cache('app.description')}}</textarea>
|
||||
<p class="help-text small text-muted mt-3 mb-0">Longer description of instance used on about page.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="form-group row mb-0">
|
||||
<div class="tab-pane" id="users" role="tabpanel" aria-labelledby="users-tab">
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top">
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="require_email_verification" class="custom-control-input" id="mailVerification" {{config_cache('pixelfed.enforce_email_verification') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="mailVerification">Require Email Verification</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||
<div class="custom-control custom-checkbox my-2">
|
||||
<input type="checkbox" name="enforce_account_limit" class="custom-control-input" id="userEnforceLimit" {{config_cache('pixelfed.enforce_account_limit') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="userEnforceLimit">Enable account storage limit</label>
|
||||
<p class="help-text small text-muted">Set a storage limit per user account.</p>
|
||||
</div>
|
||||
<label class="font-weight-bold text-muted">Account Limit</label>
|
||||
<input class="form-control" name="account_limit" placeholder="Pixelfed" value="{{config_cache('pixelfed.max_account_size')}}">
|
||||
<p class="help-text small text-muted mt-3 mb-0">Account limit size in KB.</p>
|
||||
<p class="help-text small text-muted mb-0">{{config_cache('pixelfed.max_account_size')}} KB = {{floor(config_cache('pixelfed.max_account_size') / 1024)}} MB</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="media" role="tabpanel" aria-labelledby="media-tab">
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top">
|
||||
<label class="font-weight-bold text-muted">Max Size</label>
|
||||
<input class="form-control" name="max_photo_size" value="{{config_cache('pixelfed.max_photo_size')}}">
|
||||
<p class="help-text small text-muted mt-3 mb-0">Maximum file upload size in KB</p>
|
||||
<p class="help-text small text-muted mb-0">{{config_cache('pixelfed.max_photo_size')}} KB = {{number_format(config_cache('pixelfed.max_photo_size') / 1024)}} MB</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top">
|
||||
<label class="font-weight-bold text-muted">Photo Album Limit</label>
|
||||
<input class="form-control" name="max_album_length" value="{{config_cache('pixelfed.max_album_length')}}">
|
||||
<p class="help-text small text-muted mt-3 mb-0">The maximum number of photos or videos per album</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top">
|
||||
<label class="font-weight-bold text-muted">Image Quality</label>
|
||||
<input class="form-control" name="image_quality" value="{{config_cache('pixelfed.image_quality')}}">
|
||||
<p class="help-text small text-muted mt-3 mb-0">Image optimization quality from 0-100%. Set to 0 to disable image optimization.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||
<label class="font-weight-bold text-muted">Media Types</label>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="type_jpeg" class="custom-control-input" id="mediaType1" {{$jpeg ? 'checked' : ''}}>
|
||||
<label class="custom-control-label" for="mediaType1">Allow <span class="border border-dark px-1 rounded font-weight-bold">JPEG</span> images (image/jpg)</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="type_png" class="custom-control-input" id="mediaType2" {{$png ? 'checked' : ''}}>
|
||||
<label class="custom-control-label" for="mediaType2">Allow <span class="border border-dark px-1 rounded font-weight-bold">PNG</span> images (image/png)</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="type_gif" class="custom-control-input" id="mediaType3" {{$gif ? 'checked' : ''}}>
|
||||
<label class="custom-control-label" for="mediaType3">Allow <span class="border border-dark px-1 rounded font-weight-bold">GIF</span> images (image/gif)</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-2">
|
||||
<input type="checkbox" name="type_mp4" class="custom-control-input" id="mediaType4" {{$mp4 ? 'checked' : ''}}>
|
||||
<label class="custom-control-label" for="mediaType4">Allow <span class="border border-dark px-1 rounded font-weight-bold">MP4</span> video (video/mp4)</label>
|
||||
</div>
|
||||
<p class="help-text small text-muted mt-3 mb-0">Allowed media types.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||
<label class="font-weight-bold text-muted">Custom CSS</label>
|
||||
<div class="custom-control custom-checkbox my-2">
|
||||
<input type="checkbox" name="show_custom_css" class="custom-control-input" id="showCustomCss" {{config_cache('uikit.show_custom.css') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="showCustomCss">Enable custom CSS</label>
|
||||
</div>
|
||||
<textarea class="form-control" name="custom_css" rows="3">{{config_cache('uikit.custom.css')}}</textarea>
|
||||
<p class="help-text small text-muted mt-3 mb-0">Add custom CSS, will be used on all pages</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group row mb-0 mt-4">
|
||||
<div class="col-12 text-right">
|
||||
<button type="submit" class="btn btn-primary font-weight-bold">Submit</button>
|
||||
<button type="submit" class="btn btn-primary font-weight-bold px-5">Save</button>
|
||||
</div>
|
||||
</div> --}}
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
@else
|
||||
</div>
|
||||
<div class="py-5">
|
||||
<p class="lead text-center font-weight-bold">Not enabled</p>
|
||||
<p class="text-center">Add <code>ENABLE_CONFIG_CACHE=true</code> in your <span class="font-weight-bold">.env</span> file <br /> and run <span class="font-weight-bold">php artisan config:cache</span></p>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
|
@ -3,24 +3,27 @@
|
|||
<li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings') ? 'font-weight-bold':''}}" href="{{route('admin.settings')}}">Home</a>
|
||||
</li>
|
||||
<li class="nav-item pl-3">
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/backups') ? 'font-weight-bold':''}}" href="{{route('admin.settings.backups')}}">Backups</a>
|
||||
</li>
|
||||
<li class="nav-item pl-3">
|
||||
</li> --}}
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/config') ? 'font-weight-bold':''}}" href="{{route('admin.settings.config')}}">Configuration</a>
|
||||
</li>
|
||||
<li class="nav-item pl-3">
|
||||
</li> --}}
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/customize') ? 'font-weight-bold':''}}" href="{{route('admin.settings.customize')}}">Customize</a>
|
||||
</li> --}}
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/features') ? 'font-weight-bold':''}}" href="{{route('admin.settings.features')}}">Features</a>
|
||||
</li>
|
||||
<li class="nav-item pl-3">
|
||||
</li> --}}
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/maintenance') ? 'font-weight-bold':''}}" href="{{route('admin.settings.maintenance')}}">Maintenance</a>
|
||||
</li>
|
||||
</li> --}}
|
||||
<li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/page*') ? 'font-weight-bold':''}}" href="{{route('admin.settings.pages')}}">Pages</a>
|
||||
</li>
|
||||
<li class="nav-item pl-3">
|
||||
{{-- <li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/storage') ? 'font-weight-bold':''}}" href="{{route('admin.settings.storage')}}">Storage</a>
|
||||
</li>
|
||||
</li> --}}
|
||||
<li class="nav-item pl-3">
|
||||
<a class="nav-link text-muted {{request()->is('*settings/system') ? 'font-weight-bold':''}}" href="{{route('admin.settings.system')}}">System</a>
|
||||
</li>
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th>
|
||||
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}}</span></td>
|
||||
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config_cache('pixelfed.max_account_size') * 1000)}}</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
<meta name="robots" content="noimageindex, noarchive">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
|
||||
<title>{{ $title ?? config('app.name', 'Laravel') }}</title>
|
||||
<title>{{ $title ?? config_cache('app.name') }}</title>
|
||||
|
||||
@if(isset($title))<meta property="og:site_name" content="{{ config('app.name', 'Laravel') }}">
|
||||
<meta property="og:title" content="{{ $title ?? config('app.name', 'Laravel') }}">
|
||||
@if(isset($title))<meta property="og:site_name" content="{{ config_cache('app.name') }}">
|
||||
<meta property="og:title" content="{{ $title ?? config_cache('app.name') }}">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:url" content="{{request()->url()}}">
|
||||
@endif
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
|
||||
<title>{{ $title ?? config('app.name', 'Pixelfed') }}</title>
|
||||
<title>{{ $title ?? config_cache('app.name') }}</title>
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<meta property="og:site_name" content="{{ config('app.name', 'pixelfed') }}">
|
||||
<meta property="og:title" content="{{ $title ?? config('app.name', 'pixelfed') }}">
|
||||
<meta property="og:site_name" content="{{ config_cache('app.name') }}">
|
||||
<meta property="og:title" content="{{ $title ?? config_cache('app.name') }}">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:url" content="{{url(request()->url())}}">
|
||||
@stack('meta')
|
||||
|
@ -34,6 +34,10 @@
|
|||
|
||||
@stack('styles')
|
||||
|
||||
@if(config_cache('uikit.show_custom.css'))
|
||||
<style type="text/css">{!!config_cache('uikit.custom.css')!!}</style>
|
||||
@endif
|
||||
|
||||
<script type="text/javascript">window._sharedData = {curUser: {}, version: 0}; window.App = {config: {!!App\Util\Site\Config::json()!!}};</script>
|
||||
|
||||
</head>
|
||||
|
@ -54,8 +58,8 @@
|
|||
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/components.js') }}"></script>
|
||||
@stack('scripts')
|
||||
<div class="d-block d-sm-none mt-5"></div>
|
||||
<div class="d-block d-sm-none fixed-bottom">
|
||||
<div class="mobile-footer-spacer d-block d-sm-none mt-5"></div>
|
||||
<div class="mobile-footer d-block d-sm-none fixed-bottom">
|
||||
<div class="card card-body rounded-0 py-2 box-shadow" style="border-top:1px solid #F1F5F8">
|
||||
<ul class="nav nav-pills nav-fill d-flex align-items-middle">
|
||||
<li class="nav-item">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
|
||||
<title>{{ $title ?? config('app.name', 'Laravel') }}</title>
|
||||
<title>{{ $title ?? config_cache('app.name') }}</title>
|
||||
|
||||
<meta property="og:site_name" content="{{ config('app.name', 'pixelfed') }}">
|
||||
<meta property="og:title" content="{{ $title ?? config('app.name', 'pixelfed') }}">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="{{ route('timeline.personal') }}" title="Logo">
|
||||
<img src="/img/pixelfed-icon-color.svg" height="30px" class="px-2" loading="eager" alt="Pixelfed logo">
|
||||
<span class="font-weight-bold mb-0 d-none d-sm-block" style="font-size:20px;">{{ config('app.name', 'pixelfed') }}</span>
|
||||
<span class="font-weight-bold mb-0 d-none d-sm-block" style="font-size:20px;">{{ config_cache('app.name') }}</span>
|
||||
</a>
|
||||
|
||||
<div class="collapse navbar-collapse">
|
||||
|
@ -22,7 +22,7 @@
|
|||
{{ __('Login') }}
|
||||
</a>
|
||||
</li>
|
||||
@if(config('pixelfed.open_registration') && config('instance.restricted.enabled') == false)
|
||||
@if(config_cache('pixelfed.open_registration') && config('instance.restricted.enabled') == false)
|
||||
<li>
|
||||
<a class="ml-3 nav-link font-weight-bold text-dark" href="{{ route('register') }}" title="Register">
|
||||
{{ __('Register') }}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<h3 class="font-weight-bold">Applications</h3>
|
||||
</div>
|
||||
<hr>
|
||||
@if(config('pixelfed.oauth_enabled') == true)
|
||||
@if(config_cache('pixelfed.oauth_enabled') == true)
|
||||
<passport-authorized-clients></passport-authorized-clients>
|
||||
<passport-personal-access-tokens></passport-personal-access-tokens>
|
||||
@else
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<h3 class="font-weight-bold">Developers</h3>
|
||||
</div>
|
||||
<hr>
|
||||
@if(config('pixelfed.oauth_enabled') == true)
|
||||
@if(config_cache('pixelfed.oauth_enabled') == true)
|
||||
<passport-clients></passport-clients>
|
||||
@else
|
||||
<p class="lead">OAuth has not been enabled on this instance.</p>
|
||||
|
|
|
@ -67,7 +67,19 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if(config('pixelfed.enforce_account_limit'))
|
||||
<div class="form-group row">
|
||||
<label for="pronouns" class="col-sm-3 col-form-label font-weight-bold">Pronouns</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="pronouns[]" multiple="" id="pronouns">
|
||||
<option>Select Pronoun(s)</option>
|
||||
@foreach(\App\Services\PronounService::pronouns() as $val)
|
||||
<option value="{{$val}}" {{$pronouns && in_array($val, $pronouns) ? 'selected' : ''}}>{{$val}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<p class="help-text text-muted small">Select up to 4 pronouns that will appear on your profile.</p>
|
||||
</div>
|
||||
</div>
|
||||
@if(config_cache('pixelfed.enforce_account_limit'))
|
||||
<div class="pt-3">
|
||||
<p class="font-weight-bold text-muted text-center">Storage Usage</p>
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<li class="nav-item">
|
||||
<hr>
|
||||
</li>
|
||||
@if(config('pixelfed.import.instagram.enabled'))
|
||||
@if(config_cache('pixelfed.import.instagram.enabled'))
|
||||
<li class="nav-item pl-3 {{request()->is('*import*')?'active':''}}">
|
||||
<a class="nav-link font-weight-light text-muted" href="{{route('settings.import')}}">Import</a>
|
||||
</li>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<a class="nav-link font-weight-light text-muted" href="{{route('settings.dataexport')}}">Data Export</a>
|
||||
</li>
|
||||
|
||||
@if(config('pixelfed.oauth_enabled') == true)
|
||||
@if(config_cache('pixelfed.oauth_enabled') == true)
|
||||
<li class="nav-item">
|
||||
<hr>
|
||||
</li>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<li>Go to <a href="{{config('app.url')}}">{{config('app.url')}}</a>.</li>
|
||||
<li>Click on the register link at the top of the page.</li>
|
||||
<li>Enter your name, email address, username and password.</li>
|
||||
@if(config('pixelfed.enforce_email_verification') != true)
|
||||
@if(config_cache('pixelfed.enforce_email_verification') != true)
|
||||
<li>Wait for an account verification email, it may take a few minutes.</li>
|
||||
@endif
|
||||
</ol>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@extends('layouts.anon',['title' => 'About ' . config('app.name')])
|
||||
@extends('layouts.anon',['title' => 'About ' . config_cache('app.name')])
|
||||
|
||||
@section('content')
|
||||
|
||||
|
|
Loading…
Reference in a new issue