mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-25 22:10:47 +00:00
Update admin settings
This commit is contained in:
parent
24e77f647d
commit
29947e157c
2 changed files with 12 additions and 7 deletions
|
@ -5,7 +5,8 @@ namespace App\Http\Controllers\Admin;
|
||||||
use Artisan, Cache, DB;
|
use Artisan, Cache, DB;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\{Comment, InstanceActor, Like, Media, Page, Profile, Report, Status, User};
|
use App\{Comment, Like, Media, Page, Profile, Report, Status, User};
|
||||||
|
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;
|
||||||
|
|
|
@ -8,12 +8,13 @@ use App\Models\ConfigCache as ConfigCacheModel;
|
||||||
|
|
||||||
class ConfigCacheService
|
class ConfigCacheService
|
||||||
{
|
{
|
||||||
const CACHE_KEY = 'config_cache:_key:';
|
const CACHE_KEY = 'config_cache:_v0-key:';
|
||||||
|
|
||||||
public static function get($key)
|
public static function get($key)
|
||||||
{
|
{
|
||||||
$cacheKey = "config_cache:_key:{$key}";
|
$cacheKey = self::CACHE_KEY . $key;
|
||||||
$ttl = now()->addHours(12);
|
$ttl = now()->addHours(12);
|
||||||
|
|
||||||
return Cache::remember($cacheKey, $ttl, function() use($key) {
|
return Cache::remember($cacheKey, $ttl, function() use($key) {
|
||||||
|
|
||||||
$allowed = [
|
$allowed = [
|
||||||
|
@ -29,8 +30,8 @@ class ConfigCacheService
|
||||||
|
|
||||||
'pixelfed.open_registration',
|
'pixelfed.open_registration',
|
||||||
'federation.activitypub.enabled',
|
'federation.activitypub.enabled',
|
||||||
'pixelfed.oauth_enabled',
|
|
||||||
'instance.stories.enabled',
|
'instance.stories.enabled',
|
||||||
|
'pixelfed.oauth_enabled',
|
||||||
'pixelfed.import.instagram.enabled',
|
'pixelfed.import.instagram.enabled',
|
||||||
'pixelfed.bouncer.enabled',
|
'pixelfed.bouncer.enabled',
|
||||||
|
|
||||||
|
@ -41,7 +42,10 @@ class ConfigCacheService
|
||||||
'uikit.custom.css',
|
'uikit.custom.css',
|
||||||
'uikit.custom.js',
|
'uikit.custom.js',
|
||||||
'uikit.show_custom.css',
|
'uikit.show_custom.css',
|
||||||
'uikit.show_custom.js'
|
'uikit.show_custom.js',
|
||||||
|
'about.title',
|
||||||
|
|
||||||
|
'pixelfed.cloud_storage'
|
||||||
];
|
];
|
||||||
|
|
||||||
if(!config('instance.enable_cc')) {
|
if(!config('instance.enable_cc')) {
|
||||||
|
@ -79,7 +83,7 @@ class ConfigCacheService
|
||||||
if($exists) {
|
if($exists) {
|
||||||
$exists->v = $val;
|
$exists->v = $val;
|
||||||
$exists->save();
|
$exists->save();
|
||||||
Cache::forget(self::CACHE_KEY . $key);
|
Cache::put(self::CACHE_KEY . $key, $val, now()->addHours(12));
|
||||||
return self::get($key);
|
return self::get($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +92,7 @@ class ConfigCacheService
|
||||||
$cc->v = $val;
|
$cc->v = $val;
|
||||||
$cc->save();
|
$cc->save();
|
||||||
|
|
||||||
Cache::forget(self::CACHE_KEY . $key);
|
Cache::put(self::CACHE_KEY . $key, $val, now()->addHours(12));
|
||||||
|
|
||||||
return self::get($key);
|
return self::get($key);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue