diff --git a/.github/funding.yml b/.github/funding.yml index 23b9601c..f91f9af1 100644 --- a/.github/funding.yml +++ b/.github/funding.yml @@ -1,2 +1 @@ -github: simonhamp open_collective: nativephp diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 4ae67bf2..7c6a4c2d 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -37,7 +37,7 @@ jobs: - name: Commit changes if: github.event_name == 'pull_request' - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Fix styling diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index ec40921c..859924d6 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -24,7 +24,7 @@ jobs: release-notes: ${{ github.event.release.body }} - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: branch: main commit_message: Update CHANGELOG diff --git a/config/nativephp-internal.php b/config/nativephp-internal.php index bb7dbf23..186fbcfc 100644 --- a/config/nativephp-internal.php +++ b/config/nativephp-internal.php @@ -48,6 +48,19 @@ 'apple_team_id' => env('NATIVEPHP_APPLE_TEAM_ID'), ], + /** + * The credentials to use Azure Trusted Signing service. + */ + 'azure_trusted_signing' => [ + 'tenant_id' => env('AZURE_TENANT_ID'), + 'client_id' => env('AZURE_CLIENT_ID'), + 'client_secret' => env('AZURE_CLIENT_SECRET'), + 'publisher_name' => env('NATIVEPHP_AZURE_PUBLISHER_NAME'), + 'endpoint' => env('NATIVEPHP_AZURE_ENDPOINT'), + 'certificate_profile_name' => env('NATIVEPHP_AZURE_CERTIFICATE_PROFILE_NAME'), + 'code_signing_account_name' => env('NATIVEPHP_AZURE_CODE_SIGNING_ACCOUNT_NAME'), + ], + /** * The binary path of PHP for NativePHP to use at build. */ diff --git a/config/nativephp.php b/config/nativephp.php index d68245fc..91938bd9 100644 --- a/config/nativephp.php +++ b/config/nativephp.php @@ -60,6 +60,7 @@ */ 'cleanup_env_keys' => [ 'AWS_*', + 'AZURE_*', 'GITHUB_*', 'DO_SPACES_*', '*_SECRET', @@ -68,6 +69,10 @@ 'NATIVEPHP_APPLE_ID', 'NATIVEPHP_APPLE_ID_PASS', 'NATIVEPHP_APPLE_TEAM_ID', + 'NATIVEPHP_AZURE_PUBLISHER_NAME', + 'NATIVEPHP_AZURE_ENDPOINT', + 'NATIVEPHP_AZURE_CERTIFICATE_PROFILE_NAME', + 'NATIVEPHP_AZURE_CODE_SIGNING_ACCOUNT_NAME', ], /** diff --git a/src/Commands/DebugCommand.php b/src/Commands/DebugCommand.php index 504ef7ba..4b8e2464 100644 --- a/src/Commands/DebugCommand.php +++ b/src/Commands/DebugCommand.php @@ -111,6 +111,14 @@ private function processNativePHP(): static && config('nativephp-internal.notarization.apple_id_pass') && config('nativephp-internal.notarization.apple_team_id'); + $isAzureTrustedSigningConfigured = config('nativephp-internal.azure_trusted_signing.tenant_id') + && config('nativephp-internal.azure_trusted_signing.client_id') + && config('nativephp-internal.azure_trusted_signing.client_secret') + && config('nativephp-internal.azure_trusted_signing.publisher_name') + && config('nativephp-internal.azure_trusted_signing.endpoint') + && config('nativephp-internal.azure_trusted_signing.certificate_profile_name') + && config('nativephp-internal.azure_trusted_signing.code_signing_account_name'); + $this->debugInfo->put( 'NativePHP', [ @@ -122,6 +130,7 @@ private function processNativePHP(): static 'Post' => config('nativephp.postbuild'), ], 'NotarizationEnabled' => $isNotarizationConfigured, + 'AzureTrustedSigningEnabled' => $isAzureTrustedSigningConfigured, 'CustomPHPBinary' => config('nativephp-internal.php_binary_path') ?? false, ], ] diff --git a/src/Events/AutoUpdater/Error.php b/src/Events/AutoUpdater/Error.php index 9d2219d3..3e1c29e1 100644 --- a/src/Events/AutoUpdater/Error.php +++ b/src/Events/AutoUpdater/Error.php @@ -15,7 +15,7 @@ class Error implements ShouldBroadcastNow public function __construct( public string $name, public string $message, - public ?string $stack, + public ?string $stack = null, ) {} public function broadcastOn() diff --git a/src/Events/AutoUpdater/UpdateAvailable.php b/src/Events/AutoUpdater/UpdateAvailable.php index 1fb05fb7..dc5ab67a 100644 --- a/src/Events/AutoUpdater/UpdateAvailable.php +++ b/src/Events/AutoUpdater/UpdateAvailable.php @@ -16,10 +16,10 @@ public function __construct( public string $version, public array $files, public string $releaseDate, - public ?string $releaseName, - public string|array|null $releaseNotes, - public ?int $stagingPercentage, - public ?string $minimumSystemVersion, + public ?string $releaseName = null, + public string|array|null $releaseNotes = null, + public ?int $stagingPercentage = null, + public ?string $minimumSystemVersion = null, ) {} public function broadcastOn() diff --git a/src/Events/AutoUpdater/UpdateCancelled.php b/src/Events/AutoUpdater/UpdateCancelled.php index 09d01b69..77ae44fe 100644 --- a/src/Events/AutoUpdater/UpdateCancelled.php +++ b/src/Events/AutoUpdater/UpdateCancelled.php @@ -16,10 +16,10 @@ public function __construct( public string $version, public array $files, public string $releaseDate, - public ?string $releaseName, - public string|array|null $releaseNotes, - public ?int $stagingPercentage, - public ?string $minimumSystemVersion, + public ?string $releaseName = null, + public string|array|null $releaseNotes = null, + public ?int $stagingPercentage = null, + public ?string $minimumSystemVersion = null, ) {} public function broadcastOn() diff --git a/src/Events/AutoUpdater/UpdateDownloaded.php b/src/Events/AutoUpdater/UpdateDownloaded.php index 379d62fa..b5856f1d 100644 --- a/src/Events/AutoUpdater/UpdateDownloaded.php +++ b/src/Events/AutoUpdater/UpdateDownloaded.php @@ -17,10 +17,10 @@ public function __construct( public string $version, public array $files, public string $releaseDate, - public ?string $releaseName, - public string|array|null $releaseNotes, - public ?int $stagingPercentage, - public ?string $minimumSystemVersion + public ?string $releaseName = null, + public string|array|null $releaseNotes = null, + public ?int $stagingPercentage = null, + public ?string $minimumSystemVersion = null, ) {} public function broadcastOn() diff --git a/src/Events/AutoUpdater/UpdateNotAvailable.php b/src/Events/AutoUpdater/UpdateNotAvailable.php index c642d825..f357b0cb 100644 --- a/src/Events/AutoUpdater/UpdateNotAvailable.php +++ b/src/Events/AutoUpdater/UpdateNotAvailable.php @@ -16,10 +16,10 @@ public function __construct( public string $version, public array $files, public string $releaseDate, - public ?string $releaseName, - public string|array|null $releaseNotes, - public ?int $stagingPercentage, - public ?string $minimumSystemVersion, + public ?string $releaseName = null, + public string|array|null $releaseNotes = null, + public ?int $stagingPercentage = null, + public ?string $minimumSystemVersion = null, ) {} public function broadcastOn() diff --git a/src/System.php b/src/System.php index da23025a..6eb2b289 100644 --- a/src/System.php +++ b/src/System.php @@ -62,18 +62,26 @@ public function printers(): array })->toArray(); } - public function print(string $html, ?Printer $printer = null): void + /** + * For $settings options, see https://www.electronjs.org/docs/latest/api/web-contents#contentsprintoptions-callback + */ + public function print(string $html, ?Printer $printer = null, ?array $settings = []): void { $this->client->post('system/print', [ 'html' => $html, 'printer' => $printer->name ?? '', + 'settings' => $settings, ]); } - public function printToPDF(string $html): string + /** + * For $settings options, see https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions + */ + public function printToPDF(string $html, ?array $settings = []): string { return $this->client->post('system/print-to-pdf', [ 'html' => $html, + 'settings' => $settings, ])->json('result'); } diff --git a/src/Windows/Window.php b/src/Windows/Window.php index 7eadd248..92af58b5 100644 --- a/src/Windows/Window.php +++ b/src/Windows/Window.php @@ -44,6 +44,10 @@ class Window protected bool $focusable = true; + protected bool $skipTaskbar = false; + + protected bool $hiddenInMissionControl = false; + protected bool $focused = false; protected bool $hasShadow = true; @@ -157,6 +161,20 @@ public function focusable($value = true): self return $this; } + public function skipTaskbar($value = true): self + { + $this->skipTaskbar = $value; + + return $this; + } + + public function hiddenInMissionControl($value = true): self + { + $this->hiddenInMissionControl = $value; + + return $this; + } + public function hasShadow($value = true): self { $this->hasShadow = $value; @@ -323,6 +341,8 @@ public function toArray() 'maxWidth' => $this->maxWidth, 'maxHeight' => $this->maxHeight, 'focusable' => $this->focusable, + 'skipTaskbar' => $this->skipTaskbar, + 'hiddenInMissionControl' => $this->hiddenInMissionControl, 'hasShadow' => $this->hasShadow, 'frame' => $this->frame, 'titleBarStyle' => $this->titleBarStyle, diff --git a/tests/Windows/WindowTest.php b/tests/Windows/WindowTest.php index 8cf21d6a..cabfde71 100644 --- a/tests/Windows/WindowTest.php +++ b/tests/Windows/WindowTest.php @@ -16,6 +16,8 @@ ->titleBarStyle('milwad') ->rememberState() ->frameless() + ->skipTaskbar() + ->hiddenInMissionControl() ->focusable() ->hasShadow() ->alwaysOnTop() @@ -36,6 +38,8 @@ expect($windowArray['titleBarStyle'])->toBe('milwad'); expect($windowArray['rememberState'])->toBeTrue(); expect($windowArray['frame'])->toBeFalse(); + expect($windowArray['skipTaskbar'])->toBeTrue(); + expect($windowArray['hiddenInMissionControl'])->toBeTrue(); expect($windowArray['focusable'])->toBeTrue(); expect($windowArray['hasShadow'])->toBeTrue(); expect($windowArray['alwaysOnTop'])->toBeTrue();