mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 02:24:31 +00:00
commit
c996f37366
12 changed files with 69 additions and 30 deletions
|
@ -41,10 +41,10 @@ jobs:
|
||||||
- vendor
|
- vendor
|
||||||
|
|
||||||
- run: cp .env.testing .env
|
- run: cp .env.testing .env
|
||||||
|
- run: php artisan config:cache
|
||||||
- run: php artisan route:clear
|
- run: php artisan route:clear
|
||||||
- run: php artisan storage:link
|
- run: php artisan storage:link
|
||||||
- run: php artisan key:generate
|
- run: php artisan key:generate
|
||||||
- run: php artisan config:clear
|
|
||||||
|
|
||||||
# run tests with phpunit or codecept
|
# run tests with phpunit or codecept
|
||||||
- run: ./vendor/bin/phpunit
|
- run: ./vendor/bin/phpunit
|
||||||
|
|
|
@ -65,3 +65,5 @@ CS_UNLISTED_DOMAINS='example.org,example.net,example.com'
|
||||||
## Optional
|
## Optional
|
||||||
#HORIZON_DARKMODE=false # Horizon theme darkmode
|
#HORIZON_DARKMODE=false # Horizon theme darkmode
|
||||||
#HORIZON_EMBED=false # Single Docker Container mode
|
#HORIZON_EMBED=false # Single Docker Container mode
|
||||||
|
|
||||||
|
ENABLE_CONFIG_CACHE=false
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
|
|
||||||
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.6...dev)
|
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.6...dev)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added store remote media on S3 config setting, disabled by default ([51768083](https://github.com/pixelfed/pixelfed/commit/51768083))
|
||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
- Update admin dashboard, fix search and dropdown menu ([dac0d083](https://github.com/pixelfed/pixelfed/commit/dac0d083))
|
- Update admin dashboard, fix search and dropdown menu ([dac0d083](https://github.com/pixelfed/pixelfed/commit/dac0d083))
|
||||||
- Update sudo mode view, fix trusted device checkbox ([8ef900bf](https://github.com/pixelfed/pixelfed/commit/8ef900bf))
|
- Update sudo mode view, fix trusted device checkbox ([8ef900bf](https://github.com/pixelfed/pixelfed/commit/8ef900bf))
|
||||||
- Update SearchApiV2Service, improve postgres support ([666e5732](https://github.com/pixelfed/pixelfed/commit/666e5732))
|
- Update SearchApiV2Service, improve postgres support ([666e5732](https://github.com/pixelfed/pixelfed/commit/666e5732))
|
||||||
- Update StoryController, show active self stories on home timeline ([633351f6](https://github.com/pixelfed/pixelfed/commit/633351f6))
|
- Update StoryController, show active self stories on home timeline ([633351f6](https://github.com/pixelfed/pixelfed/commit/633351f6))
|
||||||
|
- Update ApiV1Controller, fix trending accounts format. Closes #4356 ([37bd2ee5](https://github.com/pixelfed/pixelfed/commit/37bd2ee5))
|
||||||
|
- Update instance config, enable config cache by default ([970f77b0](https://github.com/pixelfed/pixelfed/commit/970f77b0))
|
||||||
|
- Update Admin Dashboard, allow admins to designate an admin account for the landing page and instance api endpoint ([6ea2bdc7](https://github.com/pixelfed/pixelfed/commit/6ea2bdc7))
|
||||||
|
- Update config, enable oauth by default ([6a2e9e8f](https://github.com/pixelfed/pixelfed/commit/6a2e9e8f))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.6 (2023-05-03)](https://github.com/pixelfed/pixelfed/compare/v0.11.5...v0.11.6)
|
## [v0.11.6 (2023-05-03)](https://github.com/pixelfed/pixelfed/compare/v0.11.5...v0.11.6)
|
||||||
|
|
|
@ -10,8 +10,10 @@ use App\Models\InstanceActor;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Util\Lexer\PrettyNumber;
|
use App\Util\Lexer\PrettyNumber;
|
||||||
use App\Models\ConfigCache;
|
use App\Models\ConfigCache;
|
||||||
|
use App\Services\AccountService;
|
||||||
use App\Services\ConfigCacheService;
|
use App\Services\ConfigCacheService;
|
||||||
use App\Util\Site\Config;
|
use App\Util\Site\Config;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
trait AdminSettingsController
|
trait AdminSettingsController
|
||||||
{
|
{
|
||||||
|
@ -28,6 +30,9 @@ trait AdminSettingsController
|
||||||
$mp4 = in_array('video/mp4', $types);
|
$mp4 = in_array('video/mp4', $types);
|
||||||
$webp = in_array('image/webp', $types);
|
$webp = in_array('image/webp', $types);
|
||||||
|
|
||||||
|
$availableAdmins = User::whereIsAdmin(true)->get();
|
||||||
|
$currentAdmin = config_cache('instance.admin.pid') ? AccountService::get(config_cache('instance.admin.pid'), true) : null;
|
||||||
|
|
||||||
// $system = [
|
// $system = [
|
||||||
// 'permissions' => is_writable(base_path('storage')) && is_writable(base_path('bootstrap')),
|
// 'permissions' => is_writable(base_path('storage')) && is_writable(base_path('bootstrap')),
|
||||||
// 'max_upload_size' => ini_get('post_max_size'),
|
// 'max_upload_size' => ini_get('post_max_size'),
|
||||||
|
@ -45,6 +50,8 @@ trait AdminSettingsController
|
||||||
'cloud_storage',
|
'cloud_storage',
|
||||||
'cloud_disk',
|
'cloud_disk',
|
||||||
'cloud_ready',
|
'cloud_ready',
|
||||||
|
'availableAdmins',
|
||||||
|
'currentAdmin'
|
||||||
// 'system'
|
// 'system'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -63,8 +70,14 @@ trait AdminSettingsController
|
||||||
'type_gif' => 'nullable',
|
'type_gif' => 'nullable',
|
||||||
'type_mp4' => 'nullable',
|
'type_mp4' => 'nullable',
|
||||||
'type_webp' => 'nullable',
|
'type_webp' => 'nullable',
|
||||||
|
'admin_account_id' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if($request->filled('admin_account_id')) {
|
||||||
|
ConfigCacheService::put('instance.admin.pid', $request->admin_account_id);
|
||||||
|
Cache::forget('api:v1:instance-data:contact');
|
||||||
|
Cache::forget('api:v1:instance-data-response-v1');
|
||||||
|
}
|
||||||
if($request->filled('rule_delete')) {
|
if($request->filled('rule_delete')) {
|
||||||
$index = (int) $request->input('rule_delete');
|
$index = (int) $request->input('rule_delete');
|
||||||
$rules = ConfigCacheService::get('app.rules');
|
$rules = ConfigCacheService::get('app.rules');
|
||||||
|
@ -141,8 +154,8 @@ trait AdminSettingsController
|
||||||
'show_custom_js' => 'uikit.show_custom.js',
|
'show_custom_js' => 'uikit.show_custom.js',
|
||||||
'cloud_storage' => 'pixelfed.cloud_storage',
|
'cloud_storage' => 'pixelfed.cloud_storage',
|
||||||
'account_autofollow' => 'account.autofollow',
|
'account_autofollow' => 'account.autofollow',
|
||||||
'show_directory' => 'landing.show_directory',
|
'show_directory' => 'instance.landing.show_directory',
|
||||||
'show_explore_feed' => 'landing.show_explore_feed',
|
'show_explore_feed' => 'instance.landing.show_explore',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($bools as $key => $value) {
|
foreach ($bools as $key => $value) {
|
||||||
|
|
|
@ -1554,6 +1554,9 @@ class ApiV1Controller extends Controller
|
||||||
{
|
{
|
||||||
$res = Cache::remember('api:v1:instance-data-response-v1', 1800, function () {
|
$res = Cache::remember('api:v1:instance-data-response-v1', 1800, function () {
|
||||||
$contact = Cache::remember('api:v1:instance-data:contact', 604800, 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();
|
$admin = User::whereIsAdmin(true)->first();
|
||||||
return $admin && isset($admin->profile_id) ?
|
return $admin && isset($admin->profile_id) ?
|
||||||
AccountService::getMastodon($admin->profile_id, true) :
|
AccountService::getMastodon($admin->profile_id, true) :
|
||||||
|
|
|
@ -15,7 +15,7 @@ class LandingController extends Controller
|
||||||
return redirect('/');
|
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');
|
return view('site.index');
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,14 @@ class LandingController extends Controller
|
||||||
return redirect('/');
|
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');
|
return view('site.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectoryApi(Request $request)
|
public function getDirectoryApi(Request $request)
|
||||||
{
|
{
|
||||||
abort_if(config('instance.landing.show_directory') == false, 404);
|
abort_if(config_cache('instance.landing.show_directory') == false, 404);
|
||||||
|
|
||||||
return DirectoryProfile::collection(
|
return DirectoryProfile::collection(
|
||||||
Profile::whereNull('domain')
|
Profile::whereNull('domain')
|
||||||
|
|
|
@ -24,7 +24,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
if(config_cache('pixelfed.oauth_enabled') == true) {
|
if(config('app.env') === 'production' && config('pixelfed.oauth_enabled') == true) {
|
||||||
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 356)));
|
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 356)));
|
||||||
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 400)));
|
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 400)));
|
||||||
Passport::enableImplicitGrant();
|
Passport::enableImplicitGrant();
|
||||||
|
|
|
@ -65,6 +65,10 @@ class ConfigCacheService
|
||||||
'pixelfed.directory.latest_response',
|
'pixelfed.directory.latest_response',
|
||||||
'pixelfed.directory.is_synced',
|
'pixelfed.directory.is_synced',
|
||||||
'pixelfed.directory.testimonials',
|
'pixelfed.directory.testimonials',
|
||||||
|
|
||||||
|
'instance.landing.show_directory',
|
||||||
|
'instance.landing.show_explore',
|
||||||
|
'instance.admin.pid',
|
||||||
// 'system.user_mode'
|
// 'system.user_mode'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ class LandingService
|
||||||
});
|
});
|
||||||
|
|
||||||
$contactAccount = Cache::remember('api:v1:instance-data:contact', 604800, function () {
|
$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();
|
$admin = User::whereIsAdmin(true)->first();
|
||||||
return $admin && isset($admin->profile_id) ?
|
return $admin && isset($admin->profile_id) ?
|
||||||
AccountService::getMastodon($admin->profile_id, true) :
|
AccountService::getMastodon($admin->profile_id, true) :
|
||||||
|
@ -53,8 +56,8 @@ class LandingService
|
||||||
'name' => config_cache('app.name'),
|
'name' => config_cache('app.name'),
|
||||||
'url' => config_cache('app.url'),
|
'url' => config_cache('app.url'),
|
||||||
'domain' => config('pixelfed.domain.app'),
|
'domain' => config('pixelfed.domain.app'),
|
||||||
'show_directory' => config('instance.landing.show_directory'),
|
'show_directory' => config_cache('instance.landing.show_directory'),
|
||||||
'show_explore_feed' => config('instance.landing.show_explore'),
|
'show_explore_feed' => config_cache('instance.landing.show_explore'),
|
||||||
'open_registration' => config_cache('pixelfed.open_registration') == 1,
|
'open_registration' => config_cache('pixelfed.open_registration') == 1,
|
||||||
'version' => config('pixelfed.version'),
|
'version' => config('pixelfed.version'),
|
||||||
'about' => [
|
'about' => [
|
||||||
|
|
|
@ -89,7 +89,7 @@ return [
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'enable_cc' => env('ENABLE_CONFIG_CACHE', false),
|
'enable_cc' => env('ENABLE_CONFIG_CACHE', true),
|
||||||
|
|
||||||
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
|
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ return [
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'oauth_enabled' => env('OAUTH_ENABLED', false),
|
'oauth_enabled' => env('OAUTH_ENABLED', true),
|
||||||
|
|
||||||
'bouncer' => [
|
'bouncer' => [
|
||||||
'enabled' => env('PF_BOUNCER_ENABLED', false),
|
'enabled' => env('PF_BOUNCER_ENABLED', false),
|
||||||
|
|
|
@ -148,36 +148,43 @@
|
||||||
<div class="tab-pane" id="landing" role="tabpanel" aria-labelledby="landing-tab">
|
<div class="tab-pane" id="landing" role="tabpanel" aria-labelledby="landing-tab">
|
||||||
<div class="form-group mb-0">
|
<div class="form-group mb-0">
|
||||||
<div class="ml-n4 mr-n2 p-3 border-top border-bottom">
|
<div class="ml-n4 mr-n2 p-3 border-top border-bottom">
|
||||||
<label class="font-weight-bold text-muted">Name</label>
|
<p class="mb-0 small">Configure your landing page</p>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-0">
|
<div class="form-group mb-0">
|
||||||
<div class="ml-n4 mr-n2 p-3 border-bottom">
|
<div class="ml-n4 mr-n2 p-3 border-bottom">
|
||||||
<label class="font-weight-bold text-muted">About</label>
|
<p class="font-weight-bold text-muted">Discovery</p>
|
||||||
<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>
|
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<div class="custom-control custom-checkbox">
|
<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>
|
<label class="custom-control-label font-weight-bold" for="show_directory">Show Directory</label>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<div class="custom-control custom-checkbox">
|
<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>
|
<label class="custom-control-label font-weight-bold" for="show_explore_feed">Show Explore Feed</label>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue