Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings page #486

Merged
merged 27 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c9ecee5
remove old settings stuff
Boy132 Jul 16, 2024
5f3a489
add basic settings page
Boy132 Jul 16, 2024
8667a53
add some settings
Boy132 Jul 16, 2024
e605e47
add "test mail" button
Boy132 Jul 16, 2024
2121f98
fix mail fields not updating
Boy132 Jul 16, 2024
8b280de
fix phpstan
Boy132 Jul 16, 2024
68bf4cc
fix default for "top navigation"
Boy132 Jul 16, 2024
b092fb0
force toggle buttons to be bool
Boy132 Jul 16, 2024
09c06a6
force toggle to be bool
Boy132 Jul 16, 2024
25536e8
add class to view to allow customization
Boy132 Jul 16, 2024
04d5b4b
add mailgun settings
Boy132 Jul 16, 2024
070df10
add notification settings
Boy132 Jul 16, 2024
a668a73
add timeout settings
Boy132 Jul 16, 2024
e0769b2
organize tabs into sub-functions
Boy132 Jul 18, 2024
325e11d
add more settings
Boy132 Jul 18, 2024
ed25939
add backup settings
Boy132 Jul 18, 2024
8f879d5
add sections to mail settings
Boy132 Jul 18, 2024
e063447
add setting for trusted_proxies
Boy132 Jul 18, 2024
47ae2da
Merge branch 'pelican-dev:main' into feature/settings
Boy132 Jul 18, 2024
a3187c0
fix unsaved data alert not showing
Boy132 Jul 18, 2024
9a79234
fix clear action
Boy132 Jul 19, 2024
7e0cc46
Fix clear action v2
notAreYouScared Jul 20, 2024
d250a2c
Add App favicon
notAreYouScared Jul 20, 2024
c09f59f
Remove defaults, collapse misc sections
notAreYouScared Jul 20, 2024
f9d1c64
Move Save btn, Add API rate limit
notAreYouScared Jul 20, 2024
893ccf3
Merge branch 'pelican-dev:main' into feature/settings
Boy132 Jul 20, 2024
6dbcb90
small cleanup
Boy132 Jul 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ APP_KEY=
APP_TIMEZONE=UTC
APP_URL=http://panel.test
APP_LOCALE=en
APP_ENVIRONMENT_ONLY=true

LOG_CHANNEL=daily
LOG_STACK=single
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
APP_KEY: ThisIsARandomStringForTests12345
APP_TIMEZONE: UTC
APP_URL: http://localhost/
APP_ENVIRONMENT_ONLY: "true"
CACHE_DRIVER: array
MAIL_MAILER: array
SESSION_DRIVER: array
Expand Down Expand Up @@ -104,7 +103,6 @@ jobs:
APP_KEY: ThisIsARandomStringForTests12345
APP_TIMEZONE: UTC
APP_URL: http://localhost/
APP_ENVIRONMENT_ONLY: "true"
CACHE_DRIVER: array
MAIL_MAILER: array
SESSION_DRIVER: array
Expand Down Expand Up @@ -166,7 +164,6 @@ jobs:
APP_KEY: ThisIsARandomStringForTests12345
APP_TIMEZONE: UTC
APP_URL: http://localhost/
APP_ENVIRONMENT_ONLY: "true"
CACHE_DRIVER: array
MAIL_MAILER: array
SESSION_DRIVER: array
Expand Down
9 changes: 1 addition & 8 deletions app/Console/Commands/Environment/AppSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class AppSettingsCommand extends Command
{--queue= : The queue driver backend to use.}
{--redis-host= : Redis host to use for connections.}
{--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}
{--settings-ui= : Enable or disable the settings UI.}';
{--redis-port= : Port to connect to redis over.}';

protected array $variables = [];

Expand Down Expand Up @@ -87,12 +86,6 @@ public function handle(): int
array_key_exists($selected, self::QUEUE_DRIVERS) ? $selected : null
);

if (!is_null($this->option('settings-ui'))) {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
} else {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(__('commands.appsettings.comment.settings_ui'), true) ? 'false' : 'true';
}

// Make sure session cookies are set as "secure" when using HTTPS
if (str_starts_with($this->variables['APP_URL'], 'https://')) {
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
Expand Down
10 changes: 0 additions & 10 deletions app/Filament/Clusters/Settings.php

This file was deleted.

342 changes: 342 additions & 0 deletions app/Filament/Pages/Settings.php

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions app/Http/Controllers/Admin/Settings/AdvancedController.php

This file was deleted.

56 changes: 0 additions & 56 deletions app/Http/Controllers/Admin/Settings/IndexController.php

This file was deleted.

82 changes: 0 additions & 82 deletions app/Http/Controllers/Admin/Settings/MailController.php

This file was deleted.

58 changes: 0 additions & 58 deletions app/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,62 +24,4 @@ class Setting extends Model
'key' => 'required|string|between:1,255',
'value' => 'string',
];

private static array $cache = [];

private static array $databaseMiss = [];

/**
* Store a new persistent setting in the database.
*/
public static function set(string $key, string $value = null): void
{
// Clear item from the cache.
self::clearCache($key);

self::query()->updateOrCreate(['key' => $key], ['value' => $value ?? '']);

self::$cache[$key] = $value;
}

/**
* Retrieve a persistent setting from the database.
*/
public static function get(string $key, mixed $default = null): mixed
{
// If item has already been requested return it from the cache. If
// we already know it is missing, immediately return the default value.
if (array_key_exists($key, self::$cache)) {
return self::$cache[$key];
} elseif (array_key_exists($key, self::$databaseMiss)) {
return value($default);
}

$instance = self::query()->where('key', $key)->first();
if (is_null($instance)) {
self::$databaseMiss[$key] = true;

return value($default);
}

return self::$cache[$key] = $instance->value;
}

/**
* Remove a key from the database cache.
*/
public static function forget(string $key)
{
self::clearCache($key);

return self::query()->where('key', $key)->delete();
}

/**
* Remove a key from the cache.
*/
private static function clearCache(string $key): void
{
unset(self::$cache[$key], self::$databaseMiss[$key]);
}
}
5 changes: 0 additions & 5 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ public function boot(): void
*/
public function register(): void
{
// Only load the settings service provider if the environment is configured to allow it.
if (!config('panel.load_environment_only', false) && $this->app->environment() !== 'testing') {
$this->app->register(SettingsServiceProvider::class);
}

$this->app->singleton('extensions.themes', function () {
return new Theme();
});
Expand Down
Loading
Loading