Skip to content

Commit f9a0103

Browse files
committed
Merge branch 'main' into feature/extras
2 parents 6043353 + bcfef44 commit f9a0103

27 files changed

+4044
-3065
lines changed

.github/funding.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
github: simonhamp
21
open_collective: nativephp

.github/workflows/build-plugin.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ jobs:
1818
contents: write
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
22+
with:
23+
ref: ${{ github.event.pull_request.head.ref }}
24+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2225

2326
- name: Use Node.js
24-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v5
2528
with:
2629
node-version: 22.x
2730

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424
with:
2525
ref: ${{ github.head_ref }}
2626

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: phpstan
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2

.github/workflows/run-plugin-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414
- name: Use Node.js
15-
uses: actions/setup-node@v4
15+
uses: actions/setup-node@v5
1616
with:
1717
node-version: 22.x
1818
- name: Install dependencies

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525

2626
steps:
2727
- name: Checkout code
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929

3030
- name: Use Node.js
31-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@v5
3232
with:
3333
node-version: 22.x
3434

.github/workflows/update-changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717
with:
1818
ref: main
1919

resources/js/build/notarize.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { notarize } from '@electron/notarize';
22

33
export default async (context) => {
4-
if (process.platform !== 'darwin') return
4+
// Only notarize when process is running on a Mac
5+
if (process.platform !== 'darwin') return;
6+
7+
// And the current build target is macOS
8+
if (context.packager.platform.name !== 'mac') return;
59

610
console.log('aftersign hook triggered, start to notarize app.')
711

resources/js/electron-builder.mjs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { join } from 'path';
21
import { exec } from 'child_process';
2+
import { join } from 'path';
33

44
const appUrl = process.env.APP_URL;
55
const appId = process.env.NATIVEPHP_APP_ID;
@@ -10,6 +10,13 @@ const fileName = process.env.NATIVEPHP_APP_FILENAME;
1010
const appVersion = process.env.NATIVEPHP_APP_VERSION;
1111
const appCopyright = process.env.NATIVEPHP_APP_COPYRIGHT;
1212
const deepLinkProtocol = process.env.NATIVEPHP_DEEPLINK_SCHEME;
13+
const updaterEnabled = process.env.NATIVEPHP_UPDATER_ENABLED === 'true';
14+
15+
// Azure signing configuration
16+
const azurePublisherName = process.env.NATIVEPHP_AZURE_PUBLISHER_NAME;
17+
const azureEndpoint = process.env.NATIVEPHP_AZURE_ENDPOINT;
18+
const azureCertificateProfileName = process.env.NATIVEPHP_AZURE_CERTIFICATE_PROFILE_NAME;
19+
const azureCodeSigningAccountName = process.env.NATIVEPHP_AZURE_CODE_SIGNING_ACCOUNT_NAME;
1320

1421
// Since we do not copy the php executable here, we only need these for building
1522
const isWindows = process.argv.includes('--win');
@@ -78,6 +85,14 @@ export default {
7885
afterSign: 'build/notarize.js',
7986
win: {
8087
executableName: fileName,
88+
...(azurePublisherName && azureEndpoint && azureCertificateProfileName && azureCodeSigningAccountName ? {
89+
azureSignOptions: {
90+
publisherName: azurePublisherName,
91+
endpoint: azureEndpoint,
92+
certificateProfileName: azureCertificateProfileName,
93+
codeSigningAccountName: azureCodeSigningAccountName
94+
}
95+
} : {}),
8196
},
8297
nsis: {
8398
artifactName: appName + '-${version}-setup.${ext}',
@@ -115,7 +130,6 @@ export default {
115130
artifactName: appName + '-${version}.${ext}',
116131
},
117132
npmRebuild: false,
118-
publish: updaterConfig,
119133
extraMetadata: {
120134
name: fileName,
121135
homepage: appUrl,
@@ -130,5 +144,8 @@ export default {
130144
'**/*'
131145
]
132146
}
133-
]
147+
],
148+
...updaterEnabled
149+
? { publish: updaterConfig }
150+
: {}
134151
};

resources/js/electron-plugin/dist/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { app, session, powerMonitor } from "electron";
1111
import { initialize } from "@electron/remote/main/index.js";
1212
import state from "./server/state.js";
1313
import { electronApp, optimizer } from "@electron-toolkit/utils";
14-
import { retrieveNativePHPConfig, retrievePhpIniSettings, runScheduler, startAPI, startPhpApp, } from "./server/index.js";
14+
import { retrieveNativePHPConfig, retrievePhpIniSettings, runScheduler, killScheduler, startAPI, startPhpApp, } from "./server/index.js";
1515
import { notifyLaravel } from "./server/utils.js";
1616
import { resolve } from "path";
1717
import { stopAllProcesses } from "./server/api/childProcess.js";
@@ -22,8 +22,8 @@ const { autoUpdater } = electronUpdater;
2222
class NativePHP {
2323
constructor() {
2424
this.processes = [];
25-
this.schedulerInterval = undefined;
2625
this.mainWindow = null;
26+
this.schedulerInterval = undefined;
2727
}
2828
bootstrap(app, icon, phpBinary, cert) {
2929
initialize();
@@ -149,7 +149,6 @@ class NativePHP {
149149
event: "\\Native\\Laravel\\Events\\App\\OpenedFromURL",
150150
payload: {
151151
url: commandLine[commandLine.length - 1],
152-
workingDirectory: workingDirectory,
153152
},
154153
});
155154
});
@@ -193,6 +192,7 @@ class NativePHP {
193192
clearInterval(this.schedulerInterval);
194193
this.schedulerInterval = null;
195194
}
195+
killScheduler();
196196
}
197197
startScheduler() {
198198
const now = new Date();
@@ -207,9 +207,14 @@ class NativePHP {
207207
}, delay);
208208
}
209209
killChildProcesses() {
210+
this.stopScheduler();
210211
this.processes
211212
.filter((p) => p !== undefined)
212213
.forEach((process) => {
214+
if (!process || !process.pid)
215+
return;
216+
if (process.killed && process.exitCode !== null)
217+
return;
213218
try {
214219
killSync(process.pid, 'SIGTERM', true);
215220
ps.kill(process.pid);

0 commit comments

Comments
 (0)