mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update Admin Dashboard, allow admins to designate an admin account for the landing page and instance api endpoint
This commit is contained in:
parent
970f77b078
commit
6ea2bdc782
5 changed files with 36 additions and 19 deletions
|
@ -1554,6 +1554,9 @@ class ApiV1Controller extends Controller
|
|||
{
|
||||
$res = Cache::remember('api:v1:instance-data-response-v1', 1800, function () {
|
||||
$contact = Cache::remember('api:v1:instance-data:contact', 604800, function () {
|
||||
if(config_cache('instance.admin.pid')) {
|
||||
return AccountService::getMastodon(config_cache('instance.admin.pid'), true);
|
||||
}
|
||||
$admin = User::whereIsAdmin(true)->first();
|
||||
return $admin && isset($admin->profile_id) ?
|
||||
AccountService::getMastodon($admin->profile_id, true) :
|
||||
|
|
|
@ -15,7 +15,7 @@ class LandingController extends Controller
|
|||
return redirect('/');
|
||||
}
|
||||
|
||||
abort_if(config('instance.landing.show_directory') == false, 404);
|
||||
abort_if(config_cache('instance.landing.show_directory') == false, 404);
|
||||
|
||||
return view('site.index');
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class LandingController extends Controller
|
|||
return redirect('/');
|
||||
}
|
||||
|
||||
abort_if(config('instance.landing.show_explore') == false, 404);
|
||||
abort_if(config_cache('instance.landing.show_explore') == false, 404);
|
||||
|
||||
return view('site.index');
|
||||
}
|
||||
|
|
|
@ -65,6 +65,10 @@ class ConfigCacheService
|
|||
'pixelfed.directory.latest_response',
|
||||
'pixelfed.directory.is_synced',
|
||||
'pixelfed.directory.testimonials',
|
||||
|
||||
'instance.landing.show_directory',
|
||||
'instance.landing.show_explore',
|
||||
'instance.admin.pid',
|
||||
// 'system.user_mode'
|
||||
];
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ class LandingService
|
|||
});
|
||||
|
||||
$contactAccount = Cache::remember('api:v1:instance-data:contact', 604800, function () {
|
||||
if(config_cache('instance.admin.pid')) {
|
||||
return AccountService::getMastodon(config_cache('instance.admin.pid'), true);
|
||||
}
|
||||
$admin = User::whereIsAdmin(true)->first();
|
||||
return $admin && isset($admin->profile_id) ?
|
||||
AccountService::getMastodon($admin->profile_id, true) :
|
||||
|
@ -53,8 +56,8 @@ class LandingService
|
|||
'name' => config_cache('app.name'),
|
||||
'url' => config_cache('app.url'),
|
||||
'domain' => config('pixelfed.domain.app'),
|
||||
'show_directory' => config('instance.landing.show_directory'),
|
||||
'show_explore_feed' => config('instance.landing.show_explore'),
|
||||
'show_directory' => config_cache('instance.landing.show_directory'),
|
||||
'show_explore_feed' => config_cache('instance.landing.show_explore'),
|
||||
'open_registration' => config_cache('pixelfed.open_registration') == 1,
|
||||
'version' => config('pixelfed.version'),
|
||||
'about' => [
|
||||
|
|
|
@ -148,36 +148,43 @@
|
|||
<div class="tab-pane" id="landing" role="tabpanel" aria-labelledby="landing-tab">
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 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')}}" disabled>
|
||||
<p class="help-text small text-muted mt-3 mb-0">The instance name. Change in Brand section.</p>
|
||||
<p class="mb-0 small">Configure your landing page</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 border-bottom">
|
||||
<label class="font-weight-bold text-muted">About</label>
|
||||
<textarea class="form-control" rows="3" name="long_description" disabled>{{config_cache('app.description')}}</textarea>
|
||||
<p class="help-text small text-muted mt-3 mb-0">Description of instance used on about section. Change in Brand section.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 border-bottom">
|
||||
<label class="font-weight-bold text-muted">Other Settings</label>
|
||||
<p class="font-weight-bold text-muted">Discovery</p>
|
||||
|
||||
<div class="my-3">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="show_directory" name="show_directory" {{ config('instance.landing.show_directory') ? 'checked' : ''}} disabled>
|
||||
<input type="checkbox" class="custom-control-input" id="show_directory" name="show_directory" {{ config_cache('instance.landing.show_directory') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="show_directory">Show Directory</label>
|
||||
</div>
|
||||
<p class="help-text small text-muted mt-3 mb-0">To disable the Directory, set <code>INSTANCE_LANDING_SHOW_DIRECTORY=false</code> in .env</p>
|
||||
</div>
|
||||
|
||||
<div class="my-3">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="show_explore_feed" name="show_explore_feed" {{ config('instance.landing.show_explore') ? 'checked' : ''}} disabled>
|
||||
<input type="checkbox" class="custom-control-input" id="show_explore_feed" name="show_explore_feed" {{ config_cache('instance.landing.show_explore') ? 'checked' : ''}}>
|
||||
<label class="custom-control-label font-weight-bold" for="show_explore_feed">Show Explore Feed</label>
|
||||
</div>
|
||||
<p class="help-text small text-muted mt-3 mb-0">To disable the Explore feed, set <code>INSTANCE_LANDING_SHOW_EXPLORE=false</code> in .env</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-0">
|
||||
<div class="ml-n4 mr-n2 p-3 border-bottom">
|
||||
<p class="font-weight-bold text-muted">Admin Account</p>
|
||||
|
||||
<div class="my-3">
|
||||
<select class="custom-select" name="admin_account_id" style="max-width: 300px;">
|
||||
<option selected disabled>Select an admin account</option>
|
||||
@foreach($availableAdmins as $acct)
|
||||
<option
|
||||
value="{{ $acct->profile_id }}" {!! $currentAdmin && $currentAdmin['id'] == $acct->profile_id ? 'selected' : null !!}
|
||||
>
|
||||
<span class="font-weight-bold">@{{ $acct->username }}</span>
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue