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

Auto pint #178

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0ee460d
Pint fixes
Poseidon281 May 5, 2024
b6a03b0
Merge branch 'main' into Command-Translations
Poseidon281 May 5, 2024
299be4b
New translations activity.php (Greek)
lancepioch May 5, 2024
234aeb7
New translations auth.php (German)
lancepioch May 5, 2024
e181a0b
New translations auth.php (Greek)
lancepioch May 5, 2024
69da773
New translations auth.php (Portuguese)
lancepioch May 5, 2024
226eaeb
New translations exceptions.php (Greek)
lancepioch May 5, 2024
f28e83a
New translations passwords.php (Greek)
lancepioch May 5, 2024
e00af42
New translations strings.php (German)
lancepioch May 5, 2024
4605269
New translations strings.php (Greek)
lancepioch May 5, 2024
fb7fd50
New translations strings.php (Hungarian)
lancepioch May 5, 2024
c8467b3
New translations strings.php (Italian)
lancepioch May 5, 2024
f13b34b
New translations strings.php (Portuguese)
lancepioch May 5, 2024
1b904cc
New translations validation.php (Greek)
lancepioch May 5, 2024
6b1df20
New translations eggs.php (Greek)
lancepioch May 5, 2024
4eb7162
New translations eggs.php (Korean)
lancepioch May 5, 2024
0e1dc61
New translations node.php (Greek)
lancepioch May 5, 2024
981771b
New translations server.php (Greek)
lancepioch May 5, 2024
f36b087
New translations server.php (Hungarian)
lancepioch May 5, 2024
8299a31
New translations user.php (Greek)
lancepioch May 5, 2024
5209381
New translations messages.php (Greek)
lancepioch May 5, 2024
36abe2c
New translations messages.php (Hungarian)
lancepioch May 5, 2024
ec5961f
New translations account.php (Danish)
lancepioch May 5, 2024
59e556b
New translations account.php (Greek)
lancepioch May 5, 2024
1c763a9
New translations account.php (Hungarian)
lancepioch May 5, 2024
76aa27b
New translations account.php (Portuguese)
lancepioch May 5, 2024
ac2a47c
New translations users.php (Greek)
lancepioch May 5, 2024
0c57798
New translations auth.php (Thai)
lancepioch May 5, 2024
ad53e89
New translations eggs.php (Thai)
lancepioch May 5, 2024
8c4323c
New translations node.php (Thai)
lancepioch May 5, 2024
86fa718
New translations server.php (Thai)
lancepioch May 5, 2024
6ce78b7
New translations user.php (Thai)
lancepioch May 5, 2024
6ab3680
New translations auth.php (Lithuanian)
lancepioch May 5, 2024
360cc57
New translations strings.php (Lithuanian)
lancepioch May 5, 2024
4f7bda6
New translations account.php (Lithuanian)
lancepioch May 5, 2024
ed31b75
New translations index.php (German)
lancepioch May 5, 2024
2705694
New translations index.php (Greek)
lancepioch May 5, 2024
8fc3b00
Pint fixes on the whole lang folder
Poseidon281 May 5, 2024
fb0c881
Revert "Pint fixes on the whole lang folder"
Poseidon281 May 5, 2024
af53ebd
Pint fixes lang folder
Poseidon281 May 5, 2024
8cd6352
Run pint
lancepioch May 6, 2024
9b759ca
Merge branch 'main' into translate
lancepioch May 6, 2024
0416969
Merge pull request #174 from pelican-dev/translate
lancepioch May 6, 2024
435b5fc
Merge branch 'main' into Command-Translations
lancepioch May 6, 2024
9ec3dc2
Merge pull request #100 from Poseidon281/Command-Translations
lancepioch May 6, 2024
4683a82
Replacing lint with pint
Poseidon281 May 6, 2024
50c14c9
Added Auto Commit
Poseidon281 May 6, 2024
bedf36f
Previous Pint has not functional. Now trying the old Lint with auto c…
Poseidon281 May 6, 2024
f71cc64
Rename Auto Commit
Poseidon281 May 6, 2024
7fe23dc
Added the right permissions & test
Poseidon281 May 6, 2024
9aa1bd5
Test to see if pint now works
Poseidon281 May 6, 2024
3c1c50f
Pint Fixes
Poseidon281 May 6, 2024
c93ae97
This now should fix the error with pint
Poseidon281 May 6, 2024
9cf66cb
Merge branch 'Auto-Pint' of https://github.com/Poseidon281/Pelican-Pa…
Poseidon281 May 6, 2024
c744da1
Wrong variable.
Poseidon281 May 6, 2024
c688cfb
Test Pint
Poseidon281 May 6, 2024
b9c41f5
Pint Fixes
Poseidon281 May 6, 2024
d841f73
Test Pint
Poseidon281 May 6, 2024
7e47113
Pint Fixes
Poseidon281 May 6, 2024
8c652db
Test to see if this somehow fixes the failed job
Poseidon281 May 6, 2024
2564fdb
Merge branch 'Auto-Pint' of https://github.com/Poseidon281/Pelican-Pa…
Poseidon281 May 6, 2024
7b9f341
Pint Fixes
Poseidon281 May 6, 2024
11c41a6
No longer running on PR's, but only on commits
Poseidon281 May 6, 2024
a49b34e
Merge branch 'Auto-Pint' of https://github.com/Poseidon281/Pelican-Pa…
Poseidon281 May 6, 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
20 changes: 14 additions & 6 deletions .github/workflows/lint.yaml → .github/workflows/pint.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Lint
name: Pint

on:
pull_request:
push:
branches:
- '**'
- main

jobs:
lint:
name: Lint
pint:
name: Pint
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
Expand All @@ -28,4 +30,10 @@ jobs:
run: composer install --no-interaction --no-progress --prefer-dist

- name: Pint
run: vendor/bin/pint --test
run: vendor/bin/pint

- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Pint Fixes
commit_user_name: Pint
14 changes: 7 additions & 7 deletions app/Console/Commands/Environment/AppSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
class AppSettingsCommand extends Command
{
use EnvironmentWriterTrait;

public const CACHE_DRIVERS = [
'redis' => 'Redis',
'memcached' => 'Memcached',
Expand Down Expand Up @@ -62,11 +61,12 @@ public function __construct(private Kernel $console)
*/
public function handle(): int
{

if (empty(config('hashids.salt')) || $this->option('new-salt')) {
$this->variables['HASHIDS_SALT'] = str_random(20);
}

$this->output->comment('Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.');
$this->output->comment(__('commands.appsettings.comment.author'));
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
'Egg Author Email',
config('panel.service.author', '[email protected]')
Expand All @@ -78,13 +78,13 @@ public function handle(): int
return 1;
}

$this->output->comment('The application URL MUST begin with https:// or http:// depending on if you are using SSL or not. If you do not include the scheme your emails and other content will link to the wrong location.');
$this->output->comment(__('commands.appsettings.comment.url'));
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
'Application URL',
config('app.url', 'https://example.com')
);

$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.');
$this->output->comment(__('commands.appsettings.comment.timezone'));
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
'Application Timezone',
\DateTimeZone::listIdentifiers(),
Expand Down Expand Up @@ -115,7 +115,7 @@ public function handle(): int
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('Enable UI based settings editor?', true) ? 'false' : 'true';
$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
Expand Down Expand Up @@ -145,7 +145,7 @@ private function checkForRedis()
return;
}

$this->output->note('You\'ve selected the Redis driver for one or more options, please provide valid connection information below. In most cases you can use the defaults provided unless you have modified your setup.');
$this->output->note(__('commands.appsettings.redis.note'));
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
'Redis Host',
config('database.redis.default.host')
Expand All @@ -158,7 +158,7 @@ private function checkForRedis()
}

if ($askForRedisPassword) {
$this->output->comment('By default a Redis server instance has no password as it is running locally and inaccessible to the outside world. If this is the case, simply hit enter without entering a value.');
$this->output->comment(__('commands.appsettings.redis.comment'));
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
'Redis Password'
);
Expand Down
10 changes: 5 additions & 5 deletions app/Console/Commands/Environment/DatabaseSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle(): int
);

if ($this->variables['DB_CONNECTION'] === 'mysql') {
$this->output->note('It is highly recommended to not use "localhost" as your database host as we have seen frequent socket connection issues. If you want to use a local connection you should be using "127.0.0.1".');
$this->output->note(__('commands.database_settings.DB_HOST_note'));
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
'Database Host',
config('database.connections.mysql.host', '127.0.0.1')
Expand All @@ -65,7 +65,7 @@ public function handle(): int
config('database.connections.mysql.database', 'panel')
);

$this->output->note('Using the "root" account for MySQL connections is not only highly frowned upon, it is also not allowed by this application. You\'ll need to have created a MySQL user for this software.');
$this->output->note(__('commands.database_settings.DB_USERNAME_note'));
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
'Database Username',
config('database.connections.mysql.username', 'pelican')
Expand All @@ -74,7 +74,7 @@ public function handle(): int
$askForMySQLPassword = true;
if (!empty(config('database.connections.mysql.password')) && $this->input->isInteractive()) {
$this->variables['DB_PASSWORD'] = config('database.connections.mysql.password');
$askForMySQLPassword = $this->confirm('It appears you already have a MySQL connection password defined, would you like to change it?');
$askForMySQLPassword = $this->confirm(__('commands.database_settings.DB_PASSWORD_note'));
}

if ($askForMySQLPassword) {
Expand All @@ -85,9 +85,9 @@ public function handle(): int
$this->testMySQLConnection();
} catch (\PDOException $exception) {
$this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage()));
$this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');
$this->output->error(__('commands.database_settings.DB_error_2'));

if ($this->confirm('Go back and try again?')) {
if ($this->confirm(__('commands.database_settings.go_back'))) {
$this->database->disconnect('_panel_command_test');

return $this->handle();
Expand Down
33 changes: 17 additions & 16 deletions app/Console/Commands/Node/MakeNodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,28 @@ public function __construct(private NodeCreationService $creationService)
*/
public function handle(): void
{
$data['name'] = $this->option('name') ?? $this->ask('Enter a short identifier used to distinguish this node from others');
$data['description'] = $this->option('description') ?? $this->ask('Enter a description to identify the node');
$data['name'] = $this->option('name') ?? $this->ask(__('commands.make_node.name'));
$data['description'] = $this->option('description') ?? $this->ask(__('commands.make_node.description'));
$data['scheme'] = $this->option('scheme') ?? $this->anticipate(
'Please either enter https for SSL or http for a non-ssl connection',
__('commands.make_node.scheme'),
['https', 'http'],
'https'
);
$data['fqdn'] = $this->option('fqdn') ?? $this->ask('Enter a domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node');
$data['public'] = $this->option('public') ?? $this->confirm('Should this node be public? As a note, setting a node to private you will be denying the ability to auto-deploy to this node.', true);
$data['behind_proxy'] = $this->option('proxy') ?? $this->confirm('Is your FQDN behind a proxy?');
$data['maintenance_mode'] = $this->option('maintenance') ?? $this->confirm('Should maintenance mode be enabled?');
$data['memory'] = $this->option('maxMemory') ?? $this->ask('Enter the maximum amount of memory');
$data['memory_overallocate'] = $this->option('overallocateMemory') ?? $this->ask('Enter the amount of memory to over allocate by, -1 will disable checking and 0 will prevent creating new servers');
$data['disk'] = $this->option('maxDisk') ?? $this->ask('Enter the maximum amount of disk space');
$data['disk_overallocate'] = $this->option('overallocateDisk') ?? $this->ask('Enter the amount of memory to over allocate by, -1 will disable checking and 0 will prevent creating new server');
$data['upload_size'] = $this->option('uploadSize') ?? $this->ask('Enter the maximum filesize upload', '100');
$data['daemon_listen'] = $this->option('daemonListeningPort') ?? $this->ask('Enter the daemon listening port', '8080');
$data['daemon_sftp'] = $this->option('daemonSFTPPort') ?? $this->ask('Enter the daemon SFTP listening port', '2022');
$data['daemon_base'] = $this->option('daemonBase') ?? $this->ask('Enter the base folder', '/var/lib/pelican/volumes');

$data['fqdn'] = $this->option('fqdn') ?? $this->ask(__('commands.make_node.fqdn'));
$data['public'] = $this->option('public') ?? $this->confirm(__('commands.make_node.public'), true);
$data['behind_proxy'] = $this->option('proxy') ?? $this->confirm(__('commands.make_node.behind_proxy'));
$data['maintenance_mode'] = $this->option('maintenance') ?? $this->confirm(__('commands.make_node.maintenance_mode'));
$data['memory'] = $this->option('maxMemory') ?? $this->ask(__('commands.make_node.memory'));
$data['memory_overallocate'] = $this->option('overallocateMemory') ?? $this->ask(__('commands.make_node.memory_overallocate'));
$data['disk'] = $this->option('maxDisk') ?? $this->ask(__('commands.make_node.disk'));
$data['disk_overallocate'] = $this->option('overallocateDisk') ?? $this->ask(__('commands.make_node.disk_overallocate'));
$data['upload_size'] = $this->option('uploadSize') ?? $this->ask(__('commands.make_node.upload_size'), '100');
$data['daemon_listen'] = $this->option('daemonListeningPort') ?? $this->ask(__('commands.make_node.daemonListen'), '8080');
$data['daemon_sftp'] = $this->option('daemonSFTPPort') ?? $this->ask(__('commands.make_node.daemonSFTP'), '2022');
$data['daemon_base'] = $this->option('daemonBase') ?? $this->ask(__('commands.make_node.daemonBase'), '/var/lib/pelican/volumes');

$node = $this->creationService->handle($data);
$this->line('Successfully created a new node with the name ' . $data['name'] . ' and has an id of ' . $node->id . '.');
$this->line(__('commands.make_node.succes1') . $data['name'] . __('commands.make_node.succes2') . $node->id . '.');
}
}
4 changes: 2 additions & 2 deletions app/Console/Commands/Node/NodeConfigurationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public function handle(): int

/** @var \App\Models\Node $node */
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
$this->error('The selected node does not exist.');
$this->error(__('commands.node_config.error_not_exist'));

exit(1);
});

$format = $this->option('format');
if (!in_array($format, ['yaml', 'yml', 'json'])) {
$this->error('Invalid format specified. Valid options are "yaml" and "json".');
$this->error(__('commands.node_config.error_invalid_format'));

return 1;
}
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/Overrides/KeyGenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand
public function handle(): void
{
if (!empty(config('app.key')) && $this->input->isInteractive()) {
$this->output->warning('It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.');
if (!$this->confirm('I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.')) {
$this->output->warning(__('commands.key_generate.error_already_exist'));
if (!$this->confirm(__('commands.key_generate.understand'))) {
return;
}

if (!$this->confirm('Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.')) {
if (!$this->confirm(__('commands.key_generate.continue'))) {
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/Schedule/ProcessRunnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function handle(): int
->get();

if ($schedules->count() < 1) {
$this->line('There are no scheduled tasks for servers that need to be run.');
$this->line(__('commands.schedule.process.no_tasks'));

return 0;
}
Expand Down Expand Up @@ -66,7 +66,7 @@ protected function processSchedule(Schedule $schedule)
} catch (\Throwable|\Exception $exception) {
logger()->error($exception, ['schedule_id' => $schedule->id]);

$this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage());
$this->error(__('commands.schedule.process.no_tasks') . " #$schedule->id: " . $exception->getMessage());
}
}
}
24 changes: 13 additions & 11 deletions app/Console/Commands/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,30 @@ public function handle(): void
{
$skipDownload = $this->option('skip-download');
if (!$skipDownload) {
$this->output->warning('This command does not verify the integrity of downloaded assets. Please ensure that you trust the download source before continuing. If you do not wish to download an archive, please indicate that using the --skip-download flag, or answering "no" to the question below.');
$this->output->comment('Download Source (set with --url=):');
$this->output->warning(__('commands.upgrade.integrity'));
$this->output->comment(__('commands.upgrade.source_url'));
$this->line($this->getUrl());
}

if (version_compare(PHP_VERSION, '7.4.0') < 0) {
$this->error('Cannot execute self-upgrade process. The minimum required PHP version required is 7.4.0, you have [' . PHP_VERSION . '].');
$this->error(__('commands.upgrade.php_version') . ' [' . PHP_VERSION . '].');
}

$user = 'www-data';
$group = 'www-data';
if ($this->input->isInteractive()) {
if (!$skipDownload) {
$skipDownload = !$this->confirm('Would you like to download and unpack the archive files for the latest version?', true);
$skipDownload = !$this->confirm(__('commands.upgrade.skipDownload'), true);
}

if (is_null($this->option('user'))) {
$userDetails = function_exists('posix_getpwuid') ? posix_getpwuid(fileowner('public')) : [];
$user = $userDetails['name'] ?? 'www-data';

if (!$this->confirm("Your webserver user has been detected as <fg=blue>[{$user}]:</> is this correct?", true)) {
$message = __('commands.upgrade.webserver_user', ['user' => $user]);
if (!$this->confirm($message, true)) {
$user = $this->anticipate(
'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data", "nginx", or "apache".',
__('commands.upgrade.name_webserver'),
[
'www-data',
'nginx',
Expand All @@ -70,9 +71,10 @@ public function handle(): void
$groupDetails = function_exists('posix_getgrgid') ? posix_getgrgid(filegroup('public')) : [];
$group = $groupDetails['name'] ?? 'www-data';

if (!$this->confirm("Your webserver group has been detected as <fg=blue>[{$group}]:</> is this correct?", true)) {
$message = __('commands.upgrade.group_webserver', ['group' => $user]);
if (!$this->confirm($message, true)) {
$group = $this->anticipate(
'Please enter the name of the group running your webserver process. Normally this is the same as your user.',
__('commands.upgrade.group_webserver_question'),
[
'www-data',
'nginx',
Expand All @@ -82,8 +84,8 @@ public function handle(): void
}
}

if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) {
$this->warn('Upgrade process terminated by user.');
if (!$this->confirm(__('commands.upgrade.are_your_sure'))) {
$this->warn(__('commands.upgrade.terminated'));

return;
}
Expand Down Expand Up @@ -173,7 +175,7 @@ public function handle(): void
});

$this->newLine(2);
$this->info('Panel has been successfully upgraded. Please ensure you also update any Daemon instances');
$this->info(__('commands.upgrade.success'));
}

protected function withProgress(ProgressBar $bar, \Closure $callback)
Expand Down
12 changes: 6 additions & 6 deletions lang/da/dashboard/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
return [
'title' => 'Konto Oversigt',
'email' => [
'title' => 'Opdater Email Adresse',
'title' => 'Opdater din e-mail',
'button' => 'Opdater Email',
'updated' => 'Din primære email er blevet opdateret',
'updated' => 'Din e-mailadresse er blevet opdateret.',
],
'password' => [
'title' => 'Opdater Adgangskode',
'title' => 'Skift din adgangskode',
'button' => 'Opdater Adgangskode',
'requirements' => 'Din nye adgangskode skal være mindst 8 tegn langt og unikt for dette websted.',
'requirements' => 'Din nye adgangskode skal være mindst 8 tegn lang.',
'validation' => [
'account_password' => 'Du skal angive adgangskoden til din konto.',
'current_password' => 'Du skal angive din nuværende adgangskode.',
Expand All @@ -35,9 +35,9 @@
'button' => 'Disable Two-Step',
],
'setup' => [
'title' => 'Enable Two-Step Verification',
'title' => 'Opsætning af 2-faktor godkendelse',
'subtitle' => "Help protect your account from unauthorized access. You'll be prompted for a verification code each time you sign in.",
'help' => 'Scan the QR code above using the two-step authentication app of your choice. Then, enter the 6-digit code generated into the field below.',
'help' => 'Kan ikke scanne koden? Indtast koden nedenfor i din applikation:',
],

'required' => [
Expand Down
2 changes: 1 addition & 1 deletion lang/de/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'subtitle' => 'Ein kurzer Blick auf dein System.',
],
'content' => [
'title' => 'System Informationen',
'title' => 'System-Informationen',
'up-to-date' => 'Du verwendest die Pelican Version <code>:version</code>. Dein Panel ist aktuell!',
'not-up-to-date1' => 'Dein Panel ist <strong>nicht auf dem neuesten Stand!</strong> Die neueste Version ist',
'not-up-to-date2' => 'und du verwendest zur Zeit die Version <code>:version</code>.',
Expand Down
Loading
Loading