Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions config/nativephp.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
/**
* The updater provider to use.
* Supported: "github", "s3", "spaces"
* Note: The "s3" provider is compatible with S3-compatible services like Cloudflare R2.
*/
'default' => env('NATIVEPHP_UPDATER_PROVIDER', 'spaces'),

Expand All @@ -125,6 +126,13 @@
'bucket' => env('AWS_BUCKET'),
'endpoint' => env('AWS_ENDPOINT'),
'path' => env('NATIVEPHP_UPDATER_PATH', null),
/**
* Optional public URL for serving updates (e.g., CDN or custom domain).
* When set, updates will be downloaded from this URL instead of the S3 endpoint.
* Useful for S3 with CloudFront or Cloudflare R2 with public access
* Example: 'https://updates.yourdomain.com'
*/
'public_url' => env('AWS_PUBLIC_URL'),
],

'spaces' => [
Expand Down
10 changes: 9 additions & 1 deletion resources/electron/electron-plugin/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,16 @@ class NativePHP {
}
}
startAutoUpdater(config) {
var _a;
var _a, _b, _c, _d, _e;
if (((_a = config === null || config === void 0 ? void 0 : config.updater) === null || _a === void 0 ? void 0 : _a.enabled) === true) {
const defaultProvider = (_b = config === null || config === void 0 ? void 0 : config.updater) === null || _b === void 0 ? void 0 : _b.default;
const publicUrl = (_e = (_d = (_c = config === null || config === void 0 ? void 0 : config.updater) === null || _c === void 0 ? void 0 : _c.providers) === null || _d === void 0 ? void 0 : _d[defaultProvider]) === null || _e === void 0 ? void 0 : _e.public_url;
if (publicUrl) {
autoUpdater.setFeedURL({
provider: 'generic',
url: publicUrl
});
}
autoUpdater.checkForUpdatesAndNotify();
}
}
Expand Down
12 changes: 11 additions & 1 deletion resources/electron/electron-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class NativePHP {
cert: string,
appPath: string
) {

initialize();

state.icon = icon;
Expand Down Expand Up @@ -216,6 +215,17 @@ class NativePHP {

private startAutoUpdater(config) {
if (config?.updater?.enabled === true) {
// If a public URL is configured for the current provider, use it for updates
const defaultProvider = config?.updater?.default;
const publicUrl = config?.updater?.providers?.[defaultProvider]?.public_url;

if (publicUrl) {
autoUpdater.setFeedURL({
provider: 'generic',
url: publicUrl
});
}

autoUpdater.checkForUpdatesAndNotify();
}
}
Expand Down