From 5d5c7e58abfa9d0abb2a0c3c25347a7f9d989ebc Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Tue, 18 Nov 2025 17:58:38 +0100 Subject: [PATCH 1/2] feat: add support for public URL in updater configuration --- config/nativephp.php | 8 ++++++++ resources/electron/electron-plugin/src/index.ts | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/config/nativephp.php b/config/nativephp.php index 430f5a6..32892bb 100644 --- a/config/nativephp.php +++ b/config/nativephp.php @@ -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'), @@ -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' => [ diff --git a/resources/electron/electron-plugin/src/index.ts b/resources/electron/electron-plugin/src/index.ts index bfd0ea8..7eca5b0 100644 --- a/resources/electron/electron-plugin/src/index.ts +++ b/resources/electron/electron-plugin/src/index.ts @@ -34,7 +34,6 @@ class NativePHP { cert: string, appPath: string ) { - initialize(); state.icon = icon; @@ -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(); } } From c600110406692003e8e4c308e58b2969b5e10ca8 Mon Sep 17 00:00:00 2001 From: SRWieZ <1408020+SRWieZ@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:59:52 +0000 Subject: [PATCH 2/2] Build plugin --- resources/electron/electron-plugin/dist/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/electron/electron-plugin/dist/index.js b/resources/electron/electron-plugin/dist/index.js index 7d811ea..6f089e8 100644 --- a/resources/electron/electron-plugin/dist/index.js +++ b/resources/electron/electron-plugin/dist/index.js @@ -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(); } }