@cbnventures/nova 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/build/package.json +1 -1
  2. package/build/scaffold-versions.json +20 -0
  3. package/build/src/api/app-store-connect.d.ts +17 -2
  4. package/build/src/api/app-store-connect.d.ts.map +1 -1
  5. package/build/src/api/app-store-connect.js +654 -171
  6. package/build/src/api/app-store-connect.js.map +1 -1
  7. package/build/src/api/github-runner-images.d.ts +13 -0
  8. package/build/src/api/github-runner-images.d.ts.map +1 -0
  9. package/build/src/api/github-runner-images.js +238 -0
  10. package/build/src/api/github-runner-images.js.map +1 -0
  11. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
  12. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  13. package/build/src/cli/generate/github/workflows-blueprint-validate.js +210 -3
  14. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  15. package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -4
  16. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  17. package/build/src/cli/generate/github/workflows-blueprint.js +685 -70
  18. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  19. package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
  20. package/build/src/cli/generate/must-haves/agent-conventions.js +1 -0
  21. package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
  22. package/build/src/cli/index.js +12 -1
  23. package/build/src/cli/index.js.map +1 -1
  24. package/build/src/cli/integration/app-store-connect.d.ts +10 -0
  25. package/build/src/cli/integration/app-store-connect.d.ts.map +1 -1
  26. package/build/src/cli/integration/app-store-connect.js +701 -80
  27. package/build/src/cli/integration/app-store-connect.js.map +1 -1
  28. package/build/src/cli/scaffold/package/pfsense.d.ts +3 -0
  29. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  30. package/build/src/cli/scaffold/package/pfsense.js +140 -6
  31. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  32. package/build/src/cli/scaffold/tool/serverless.d.ts +2 -0
  33. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  34. package/build/src/cli/scaffold/tool/serverless.js +35 -1
  35. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  36. package/build/src/cli/utility/changelog.d.ts +7 -0
  37. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  38. package/build/src/cli/utility/changelog.js +800 -7
  39. package/build/src/cli/utility/changelog.js.map +1 -1
  40. package/build/src/cli/utility/configure.d.ts +3 -1
  41. package/build/src/cli/utility/configure.d.ts.map +1 -1
  42. package/build/src/cli/utility/configure.js +196 -20
  43. package/build/src/cli/utility/configure.js.map +1 -1
  44. package/build/src/lib/docker-packaging.d.ts +1 -0
  45. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  46. package/build/src/lib/docker-packaging.js +39 -2
  47. package/build/src/lib/docker-packaging.js.map +1 -1
  48. package/build/src/lib/env-namespace.d.ts.map +1 -1
  49. package/build/src/lib/env-namespace.js +2 -1
  50. package/build/src/lib/env-namespace.js.map +1 -1
  51. package/build/src/lib/item.d.ts +2 -1
  52. package/build/src/lib/item.d.ts.map +1 -1
  53. package/build/src/lib/item.js +18 -0
  54. package/build/src/lib/item.js.map +1 -1
  55. package/build/src/lib/nova-config.d.ts.map +1 -1
  56. package/build/src/lib/nova-config.js +46 -2
  57. package/build/src/lib/nova-config.js.map +1 -1
  58. package/build/src/lib/regex.d.ts +14 -0
  59. package/build/src/lib/regex.d.ts.map +1 -1
  60. package/build/src/lib/regex.js +14 -0
  61. package/build/src/lib/regex.js.map +1 -1
  62. package/build/src/lib/scaffold.d.ts +3 -3
  63. package/build/src/lib/scaffold.d.ts.map +1 -1
  64. package/build/src/lib/scaffold.js +111 -8
  65. package/build/src/lib/scaffold.js.map +1 -1
  66. package/build/src/lib/workflow-templates.d.ts +4 -1
  67. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  68. package/build/src/lib/workflow-templates.js +60 -2
  69. package/build/src/lib/workflow-templates.js.map +1 -1
  70. package/build/src/types/api/app-store-connect.d.ts +476 -33
  71. package/build/src/types/api/github-runner-images.d.ts +199 -0
  72. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +69 -8
  73. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +132 -9
  74. package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
  75. package/build/src/types/cli/scaffold/package/pfsense.d.ts +83 -0
  76. package/build/src/types/cli/scaffold/tool/serverless.d.ts +30 -0
  77. package/build/src/types/cli/utility/changelog.d.ts +327 -1
  78. package/build/src/types/cli/utility/configure.d.ts +92 -4
  79. package/build/src/types/lib/docker-packaging.d.ts +25 -1
  80. package/build/src/types/lib/env-namespace.d.ts +4 -1
  81. package/build/src/types/lib/item.d.ts +7 -0
  82. package/build/src/types/lib/nova-config.d.ts +24 -0
  83. package/build/src/types/lib/regex.d.ts +91 -0
  84. package/build/src/types/lib/scaffold.d.ts +48 -4
  85. package/build/src/types/lib/workflow-templates.d.ts +26 -0
  86. package/build/src/types/shared.d.ts +241 -2
  87. package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -0
  88. package/build/src/types/tests/api/github-runner-images.test.d.ts +113 -0
  89. package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +19 -0
  90. package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +0 -9
  91. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +109 -26
  92. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +123 -30
  93. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +45 -0
  94. package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +2 -2
  95. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +2 -0
  96. package/build/src/types/tests/cli/integration/app-store-connect.test.d.ts +876 -0
  97. package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +21 -0
  98. package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +14 -0
  99. package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +21 -0
  100. package/build/src/types/tests/cli/utility/changelog-fold.test.d.ts +350 -0
  101. package/build/src/types/tests/cli/utility/changelog.test.d.ts +50 -0
  102. package/build/src/types/tests/cli/utility/configure.test.d.ts +55 -0
  103. package/build/src/types/tests/lib/nova-config.test.d.ts +28 -0
  104. package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
  105. package/build/src/types/tests/scaffold-output-contract.test.d.ts +79 -0
  106. package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -0
  107. package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -0
  108. package/build/templates/generators/must-haves/agent-conventions/conventions/pfsense.md +311 -0
  109. package/build/templates/scaffold/app/android/package.json +1 -1
  110. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
  111. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
  112. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
  113. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
  114. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
  115. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
  116. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
  117. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
  118. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
  119. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
  120. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
  121. package/build/templates/scaffold/app/apple/package.json +1 -1
  122. package/build/templates/scaffold/app/astro/package.json +1 -1
  123. package/build/templates/scaffold/app/discord-bot/package.json +1 -1
  124. package/build/templates/scaffold/app/express/package.json +1 -1
  125. package/build/templates/scaffold/app/nextjs/package.json +1 -1
  126. package/build/templates/scaffold/app/vite/package.json +1 -1
  127. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  128. package/build/templates/scaffold/package/github-action/package.json +1 -1
  129. package/build/templates/scaffold/package/homebridge/package.json +1 -1
  130. package/build/templates/scaffold/package/pfsense/package.json +1 -1
  131. package/build/templates/scaffold/package/pfsense/port/Makefile.template +16 -1
  132. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php +93 -0
  133. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php +40 -0
  134. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php +1667 -0
  135. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +161 -13
  136. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +37 -0
  137. package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +203 -8
  138. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg +12 -0
  139. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub +9 -0
  140. package/build/templates/scaffold/package/pfsense/port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php +437 -0
  141. package/build/templates/scaffold/package/pfsense/port/pkg-plist +6 -0
  142. package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +54 -0
  143. package/build/templates/scaffold/package/pfsense/scripts/check-package.mjs +114 -1
  144. package/build/templates/scaffold/package/pfsense/scripts/regex.mjs +10 -0
  145. package/build/templates/scaffold/package/pfsense/tests/updates.php +695 -0
  146. package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +1 -1
  147. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  148. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  149. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  150. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  151. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  152. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  153. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  154. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  155. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  156. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  157. package/build/templates/scaffold-options/docker-image/common/Dockerfile +7 -0
  158. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
  159. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +40 -2
  160. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/landing-page.d.ts +23 -0
  161. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +119 -4
  162. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +25 -3
  163. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/landing-page.ts +278 -0
  164. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +121 -6
  165. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +49 -12
  166. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +3 -1
  167. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/function/landing-page.ts +278 -0
  168. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +17 -2
  169. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +40 -2
  170. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/function/landing-page.d.ts +23 -0
  171. package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json +3 -1
  172. package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +7 -1
  173. package/package.json +1 -1
  174. package/build/templates/scaffold/package/pfsense-root/.github/workflows/pfsense-[__WORKSPACE_NAME__].yml +0 -62
@@ -0,0 +1,437 @@
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ /*
6
+ * [__WORKSPACE_TITLE__] package information.
7
+ * SPDX-License-Identifier: MIT
8
+ */
9
+
10
+ ##|+PRIV
11
+ ##|*IDENT=page-services-[__WORKSPACE_NAME__]-about
12
+ ##|*NAME=Services: [__WORKSPACE_TITLE__]: About
13
+ ##|*DESCR=Allow access to the [__WORKSPACE_TITLE__] package information page.
14
+ ##|*MATCH=[__WORKSPACE_NAME__]-about.php*
15
+ ##|-PRIV
16
+
17
+ use PfSense\[__WORKSPACE_IDENTIFIER__]\Runtime\PackagePaths;
18
+ use PfSense\[__WORKSPACE_IDENTIFIER__]\Runtime\UpdateManager;
19
+
20
+ require_once('guiconfig.inc');
21
+ require_once('pfsense-utils.inc');
22
+ require_once('/usr/local/pkg/[__WORKSPACE_NAME__].inc');
23
+ require_once('/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php');
24
+ require_once('/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php');
25
+
26
+ $escape = static fn (string $value): string => htmlspecialchars(
27
+ $value,
28
+ ENT_QUOTES | ENT_SUBSTITUTE,
29
+ 'UTF-8',
30
+ );
31
+ $packageDataPath = '/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]';
32
+ $packageLogoPath = $packageDataPath . '/logo.svg';
33
+ $packageName = '[__WORKSPACE_TITLE__]';
34
+ $installedPackageVersion = UpdateManager::installedVersion();
35
+ $packageVersion = $installedPackageVersion ?? gettext('Unknown');
36
+ $updatesAvailable = UpdateManager::isAvailable();
37
+
38
+ if ($updatesAvailable && ($_GET['update_status'] ?? '') === '1') {
39
+ header('Content-Type: application/json; charset=UTF-8');
40
+ header('Cache-Control: no-store');
41
+
42
+ try {
43
+ $statusResponse = UpdateManager::readStatusState() ?? ['state' => 'idle'];
44
+ } catch (Throwable $throwable) {
45
+ $statusResponse = [
46
+ 'state' => 'failed',
47
+ 'message' => $throwable->getMessage(),
48
+ ];
49
+ }
50
+
51
+ echo json_encode(
52
+ $statusResponse,
53
+ JSON_INVALID_UTF8_SUBSTITUTE | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR,
54
+ );
55
+ exit;
56
+ }
57
+
58
+ $updateActionError = null;
59
+
60
+ if ($updatesAvailable && ($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
61
+ if (isset($_POST['check_updates'])) {
62
+ $actionOutputLines = [];
63
+
64
+ exec(PackagePaths::UPDATE_CHECK_COMMAND . ' 2>&1', $actionOutputLines, $returnCode);
65
+ $actionOutput = implode(PHP_EOL, $actionOutputLines);
66
+
67
+ if ($returnCode !== 0 || trim($actionOutput) === gettext('Another package operation is already running.')) {
68
+ $updateActionError = $actionOutput !== ''
69
+ ? $actionOutput
70
+ : gettext('The update check could not initialize a secure GitHub request.');
71
+ }
72
+ } elseif (isset($_POST['self_update'])) {
73
+ try {
74
+ $queuedState = UpdateManager::readUpdatesState();
75
+ $queuedVersion = $queuedState['latest_version'] ?? null;
76
+
77
+ if (!is_string($queuedVersion) || $queuedVersion === '') {
78
+ throw new RuntimeException(gettext('Updates have not been checked yet.'));
79
+ }
80
+
81
+ $currentJob = UpdateManager::readStatusState();
82
+
83
+ if (is_array($currentJob) && ($currentJob['state'] ?? null) === 'running') {
84
+ throw new RuntimeException((string) ($currentJob['message'] ?? gettext('The update is starting.')));
85
+ }
86
+
87
+ UpdateManager::queueSelfUpdate($queuedVersion);
88
+
89
+ try {
90
+ mwexec_bg(PackagePaths::SELF_UPDATE_COMMAND);
91
+ } catch (Throwable $throwable) {
92
+ UpdateManager::failQueuedSelfUpdate($throwable->getMessage());
93
+
94
+ throw $throwable;
95
+ }
96
+ } catch (Throwable $throwable) {
97
+ $updateActionError = $throwable->getMessage();
98
+ }
99
+ }
100
+ }
101
+
102
+ $updateState = null;
103
+ $updateStatus = null;
104
+
105
+ if ($updatesAvailable) {
106
+ try {
107
+ $updateState = UpdateManager::readUpdatesState();
108
+ } catch (Throwable $throwable) {
109
+ $updateActionError ??= $throwable->getMessage();
110
+ }
111
+
112
+ try {
113
+ $updateStatus = UpdateManager::readStatusState();
114
+ } catch (Throwable $throwable) {
115
+ $updateActionError ??= $throwable->getMessage();
116
+ }
117
+ }
118
+
119
+ $updateState ??= [
120
+ 'checked_at' => null,
121
+ 'latest_version' => null,
122
+ 'release_url' => null,
123
+ 'last_error' => null,
124
+ ];
125
+ $settings = pfsensePackage[__WORKSPACE_IDENTIFIER__]GetSettings();
126
+ $updateCheckFrequency = (string) ($settings['update_check_frequency'] ?? '[__PFSENSE_UPDATE_DEFAULT_FREQUENCY__]');
127
+ $latestVersion = $updateState['latest_version'] ?? null;
128
+ $checkedAt = $updateState['checked_at'] ?? null;
129
+ $checkedAtDisplay = null;
130
+
131
+ if (is_string($checkedAt) && $checkedAt !== '') {
132
+ $checkedTimestamp = strtotime($checkedAt);
133
+ $checkedAtDisplay = $checkedTimestamp === false
134
+ ? $checkedAt
135
+ : date('Y-m-d H:i:s T', $checkedTimestamp);
136
+ }
137
+
138
+ $releaseUrl = $updateState['release_url'] ?? null;
139
+ $releaseUrl = is_string($releaseUrl) && UpdateManager::isAllowedReleaseUrl($releaseUrl)
140
+ ? $releaseUrl
141
+ : null;
142
+ $updateAvailable = is_string($installedPackageVersion)
143
+ && is_string($latestVersion)
144
+ && UpdateManager::isNewerVersion($installedPackageVersion, $latestVersion);
145
+ $updateError = $updateActionError ?? ($updateState['last_error'] ?? null);
146
+ $updateJobState = is_array($updateStatus) ? ($updateStatus['state'] ?? null) : null;
147
+ $updateJobMessage = is_array($updateStatus) ? ($updateStatus['message'] ?? null) : null;
148
+ $updateJobRunning = $updateJobState === 'running';
149
+ $updateBarTone = match (true) {
150
+ $updateJobState === 'failed', is_string($updateError) && $updateError !== '' => 'is-error',
151
+ $updateJobState === 'succeeded', $updateAvailable => 'is-success',
152
+ $updateJobRunning => 'is-running',
153
+ default => 'is-muted',
154
+ };
155
+
156
+ $packageLogoData = null;
157
+
158
+ if (is_readable($packageLogoPath)) {
159
+ $packageLogo = file_get_contents($packageLogoPath);
160
+
161
+ if (is_string($packageLogo)) {
162
+ $packageLogoData = 'data:image/svg+xml;base64,' . base64_encode($packageLogo);
163
+ }
164
+ }
165
+
166
+ $projectDescription = '[__PROJECT_DESCRIPTION__]';
167
+ $projectDocumentation = '[__PROJECT_DOCUMENTATION__]';
168
+ $projectRepository = '[__PROJECT_REPOSITORY__]';
169
+ $projectBugs = '[__PROJECT_BUGS__]';
170
+ $projectLicense = '[__PROJECT_LICENSE__]';
171
+ $projectReleaseNotes = ($projectRepository === '') ? '' : rtrim($projectRepository, '/') . '/releases';
172
+ $fundSources = [__PROJECT_FUND_SOURCES__];
173
+
174
+ $productLabel = g_get('product_label');
175
+ $productVersion = g_get('product_version');
176
+ $currentEdition = is_string($productLabel) && stripos($productLabel, 'Plus') !== false ? 'Plus' : 'CE';
177
+ $currentVersion = is_string($productVersion) ? trim($productVersion) : '';
178
+ $normalizedVersion = preg_replace('/-RELEASE(?:-p[0-9]+)?$/i', '', $currentVersion);
179
+
180
+ if (is_string($normalizedVersion)) {
181
+ $currentVersion = $normalizedVersion;
182
+ }
183
+
184
+ $normalizedVersion = preg_replace('/-p[0-9]+$/i', '', $currentVersion);
185
+
186
+ if (is_string($normalizedVersion)) {
187
+ $currentVersion = $normalizedVersion;
188
+ }
189
+
190
+ if ($currentVersion === '') {
191
+ $currentVersion = gettext('Unknown');
192
+ }
193
+
194
+ $freeBsdRelease = php_uname('r');
195
+ $currentFreeBsd = gettext('Unknown');
196
+
197
+ if (preg_match('/^([0-9]+\.[0-9]+)/', $freeBsdRelease, $freeBsdReleaseMatches) === 1) {
198
+ $currentFreeBsd = $freeBsdReleaseMatches[1];
199
+ }
200
+
201
+ $testedReleases = [
202
+ // List each pfSense release here after testing the package on it.
203
+ ];
204
+ $currentReleaseTested = false;
205
+
206
+ foreach ($testedReleases as $testedRelease) {
207
+ if (
208
+ $testedRelease['edition'] === $currentEdition
209
+ && $testedRelease['version'] === $currentVersion
210
+ ) {
211
+ $currentReleaseTested = true;
212
+ break;
213
+ }
214
+ }
215
+
216
+ $supportLicenseLabel = gettext('MIT License');
217
+ $supportLicenseLabelEscaped = $escape($supportLicenseLabel);
218
+ $supportLicenseLinkHtml = $supportLicenseLabelEscaped;
219
+
220
+ if ($projectLicense !== '') {
221
+ $projectLicenseEscaped = $escape($projectLicense);
222
+ $supportLicenseLinkHtml = sprintf(
223
+ '<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>',
224
+ $projectLicenseEscaped,
225
+ $supportLicenseLabelEscaped,
226
+ );
227
+ }
228
+
229
+ $supportMessageTemplate = gettext(
230
+ '%1$s is free and open source under the %2$s. If it saves you time, you can support its development.',
231
+ );
232
+ $supportMessageTemplateEscaped = $escape($supportMessageTemplate);
233
+ $packageNameEscaped = $escape($packageName);
234
+ $supportMessage = sprintf(
235
+ $supportMessageTemplateEscaped,
236
+ $packageNameEscaped,
237
+ $supportLicenseLinkHtml,
238
+ );
239
+
240
+ $pgtitle = [
241
+ gettext('Services'),
242
+ $packageName,
243
+ gettext('About'),
244
+ ];
245
+ $pglinks = [
246
+ '',
247
+ '/pkg_edit.php?xml=[__WORKSPACE_NAME__].xml&id=0',
248
+ '@self',
249
+ ];
250
+
251
+ include('head.inc');
252
+
253
+ display_top_tabs(pfsensePackage[__WORKSPACE_IDENTIFIER__]Tabs('about'));
254
+ ?>
255
+ <style>
256
+ .pkg-about .panel-body.pkg-about-pad { padding: 15px; }
257
+ .pkg-about-hero { display: flex; align-items: center; gap: 24px; padding: 24px; }
258
+ .pkg-about-logo { flex: none; width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
259
+ .pkg-about-hero-text { flex: 1; min-width: 0; }
260
+ .pkg-about-name { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.25; }
261
+ .pkg-about-name .label { position: relative; top: -3px; margin-left: 8px; font-size: 12px; font-weight: 500; letter-spacing: .3px; vertical-align: middle; }
262
+ .pkg-about-tagline { margin: 6px 0 16px; font-size: 15px; opacity: .8; }
263
+ .pkg-about-actions { display: flex; flex-wrap: wrap; gap: 8px; }
264
+ .pkg-about .btn i { font-size: 14px; margin-right: 6px; }
265
+ .pkg-about-update { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding: 10px 12px; border: 1px solid rgba(127, 127, 127, .3); border-radius: 4px; background: rgba(127, 127, 127, .07); }
266
+ .pkg-about-update.is-success { border-color: rgba(46, 125, 50, .38); background: rgba(46, 125, 50, .09); }
267
+ .pkg-about-update.is-error { border-color: rgba(198, 40, 40, .38); background: rgba(198, 40, 40, .08); }
268
+ .pkg-about-update.is-running { border-color: rgba(21, 101, 192, .38); background: rgba(21, 101, 192, .08); }
269
+ .pkg-about-update-text { min-width: 0; }
270
+ .pkg-about-update-text i { margin-right: 8px; font-size: 16px; }
271
+ .pkg-about-update.is-success .pkg-about-update-text i { color: #2e7d32; }
272
+ .pkg-about-update.is-error .pkg-about-update-text i { color: #c62828; }
273
+ .pkg-about-update.is-running .pkg-about-update-text i { color: #1565c0; }
274
+ .pkg-about-update-detail { margin-left: 4px; opacity: .75; }
275
+ .pkg-about-update-actions { display: flex; flex-wrap: wrap; gap: 8px; }
276
+ .pkg-about-update-actions form { display: inline; margin: 0; }
277
+ .pkg-about-table > tbody > tr > td, .pkg-about-table > thead > tr > th { padding: 9px 15px !important; vertical-align: middle; }
278
+ .pkg-about-table i { font-size: 15px; margin-right: 8px; }
279
+ .pkg-about-table .label { margin-left: 8px; font-weight: 500; }
280
+ .pkg-about-muted { opacity: .7; }
281
+ .pkg-about-support p { margin: 0 0 14px; }
282
+ .pkg-about-footnote { margin: 0; padding: 9px 15px; font-size: 12px; opacity: .75; border-top: 1px solid rgba(127, 127, 127, .25); }
283
+ @media (max-width: 600px) {
284
+ .pkg-about-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px; }
285
+ .pkg-about-logo { width: 72px; height: 72px; border-radius: 16px; }
286
+ }
287
+ .pkg-about-untested td { opacity: .75; }
288
+ .pkg-about-untested i { opacity: .6; }
289
+ .pkg-about-note { margin-left: 8px; font-size: 12px; font-style: italic; }
290
+ </style>
291
+ <div class="pkg-about">
292
+ <div class="panel panel-default">
293
+ <div class="panel-body">
294
+ <div class="pkg-about-hero">
295
+ <?php if ($packageLogoData !== null): ?>
296
+ <img class="pkg-about-logo" src="<?=$escape($packageLogoData)?>" width="96" height="96" alt="">
297
+ <?php endif; ?>
298
+ <div class="pkg-about-hero-text">
299
+ <h2 class="pkg-about-name"><?=$escape($packageName)?><span class="label label-primary"><?=$escape($packageVersion)?></span></h2>
300
+ <p class="pkg-about-tagline"><?=$escape($projectDescription)?></p>
301
+ <div class="pkg-about-actions">
302
+ <?php if ($projectDocumentation !== ''): ?>
303
+ <a class="btn btn-sm btn-primary" href="<?=$escape($projectDocumentation)?>" target="_blank" rel="noopener noreferrer"><i class="fa fa-book"></i><?=$escape(gettext('Documentation'))?></a>
304
+ <?php endif; ?>
305
+ <?php if ($projectRepository !== ''): ?>
306
+ <a class="btn btn-sm btn-default" href="<?=$escape($projectRepository)?>" target="_blank" rel="noopener noreferrer"><i class="fab fa-github"></i><?=$escape(gettext('Source Code'))?></a>
307
+ <?php endif; ?>
308
+ <?php if ($projectBugs !== ''): ?>
309
+ <a class="btn btn-sm btn-default" href="<?=$escape($projectBugs)?>" target="_blank" rel="noopener noreferrer"><i class="fa fa-bug"></i><?=$escape(gettext('Report an Issue'))?></a>
310
+ <?php endif; ?>
311
+ <?php if ($projectReleaseNotes !== ''): ?>
312
+ <a class="btn btn-sm btn-default" href="<?=$escape($projectReleaseNotes)?>" target="_blank" rel="noopener noreferrer"><i class="fa fa-tag"></i><?=$escape(gettext('Release Notes'))?></a>
313
+ <?php endif; ?>
314
+ </div>
315
+ <?php if ($updatesAvailable): ?>
316
+ <div class="pkg-about-update <?=$escape($updateBarTone)?>">
317
+ <span class="pkg-about-update-text" id="pkg-about-update-status">
318
+ <?php if (is_string($updateJobMessage) && $updateJobMessage !== ''): ?>
319
+ <i class="fa fa-solid <?=$escape($updateJobRunning ? 'fa-spinner fa-spin' : ($updateJobState === 'succeeded' ? 'fa-check-circle' : 'fa-exclamation-circle'))?>"></i><strong><?=$escape($updateJobMessage)?></strong>
320
+ <?php elseif (is_string($updateError) && $updateError !== ''): ?>
321
+ <i class="fa fa-solid fa-exclamation-circle"></i><span><?=$escape(sprintf(gettext('The last update check failed: %1$s'), $updateError))?></span>
322
+ <?php elseif ($updateAvailable && is_string($latestVersion)): ?>
323
+ <i class="fa fa-solid fa-arrow-circle-up"></i><strong><?=$escape(sprintf(gettext('Version %1$s is available.'), $latestVersion))?></strong><?php if (is_string($checkedAtDisplay)): ?><span class="pkg-about-update-detail"><?=$escape(sprintf(gettext('Checked %1$s.'), $checkedAtDisplay))?></span><?php endif; ?>
324
+ <?php elseif ($updateCheckFrequency === 'never'): ?>
325
+ <i class="fa fa-solid fa-pause-circle"></i><span><?=$escape(gettext('Update checks are off.'))?></span>
326
+ <?php elseif (is_string($checkedAtDisplay)): ?>
327
+ <i class="fa fa-solid fa-check-circle"></i><span><?=$escape(sprintf(gettext('Up to date. Checked %1$s.'), $checkedAtDisplay))?></span>
328
+ <?php else: ?>
329
+ <i class="fa fa-solid fa-info-circle"></i><span><?=$escape(gettext('Updates have not been checked yet.'))?></span>
330
+ <?php endif; ?>
331
+ </span>
332
+ <div class="pkg-about-update-actions">
333
+ <?php if ($updateAvailable && is_string($latestVersion) && !$updateJobRunning && $updateJobState !== 'succeeded'): ?>
334
+ <form method="post"><button class="btn btn-sm btn-success" type="submit" name="self_update" value="1"><i class="fa fa-solid fa-download"></i><?=$escape(sprintf(gettext('Update to %1$s'), $latestVersion))?></button></form>
335
+ <?php if (is_string($releaseUrl)): ?>
336
+ <a class="btn btn-sm btn-default" href="<?=$escape($releaseUrl)?>" target="_blank" rel="noopener noreferrer"><i class="fa fa-solid fa-tag"></i><?=$escape(gettext("What's New"))?></a>
337
+ <?php endif; ?>
338
+ <?php elseif (!$updateJobRunning): ?>
339
+ <form method="post"><button class="btn btn-xs btn-default" type="submit" name="check_updates" value="1"><i class="fa fa-solid fa-refresh"></i><?=$escape(gettext('Check Now'))?></button></form>
340
+ <?php endif; ?>
341
+ </div>
342
+ </div>
343
+ <?php endif; ?>
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </div>
348
+ <div class="row">
349
+ <?php if ($testedReleases !== []): ?>
350
+ <div class="col-md-7">
351
+ <div class="panel panel-default">
352
+ <div class="panel-heading"><h2 class="panel-title"><?=$escape(gettext('Tested pfSense Releases'))?></h2></div>
353
+ <div class="panel-body">
354
+ <div class="table-responsive">
355
+ <table class="table table-striped table-hover pkg-about-table">
356
+ <thead><tr><th><?=$escape(gettext('Release'))?></th><th>FreeBSD</th></tr></thead>
357
+ <tbody>
358
+ <?php foreach ($testedReleases as $testedRelease): ?>
359
+ <tr><td><i class="fa fa-check-circle text-success"></i><?=$escape(sprintf('pfSense %s %s', $testedRelease['edition'], $testedRelease['version']))?><?php if ($testedRelease['edition'] === $currentEdition && $testedRelease['version'] === $currentVersion): ?><span class="label label-info"><?=$escape(gettext('This firewall'))?></span><?php endif; ?></td><td><?=$escape($testedRelease['freebsd'])?></td></tr>
360
+ <?php endforeach; ?>
361
+ <?php if ($currentReleaseTested === false): ?>
362
+ <tr class="pkg-about-untested"><td><i class="far fa-circle"></i><?=$escape(sprintf('pfSense %s %s', $currentEdition, $currentVersion))?><span class="label label-info"><?=$escape(gettext('This firewall'))?></span><span class="pkg-about-note"><?=$escape(gettext('Not tested'))?></span></td><td><?=$escape($currentFreeBsd)?></td></tr>
363
+ <?php endif; ?>
364
+ </tbody>
365
+ </table>
366
+ </div>
367
+ <p class="pkg-about-footnote"><?=$escape(gettext('Each tested release passed install, upgrade, a representative package operation, and removal.'))?></p>
368
+ </div>
369
+ </div>
370
+ </div>
371
+ <?php endif; ?>
372
+ <div class="<?=$escape($testedReleases === [] ? 'col-md-12' : 'col-md-5')?>">
373
+ <div class="panel panel-default">
374
+ <div class="panel-heading"><h2 class="panel-title"><?=$escape(gettext('Support the Project'))?></h2></div>
375
+ <div class="panel-body pkg-about-pad pkg-about-support">
376
+ <p><?=$supportMessage?></p>
377
+ <?php if ($fundSources !== []): ?>
378
+ <div class="pkg-about-actions">
379
+ <?php foreach ($fundSources as $fundSourceIndex => $fundSource): ?>
380
+ <?php
381
+ $fundSourceLabel = sprintf(gettext('Support %d'), $fundSourceIndex + 1);
382
+ $fundSourceIconClass = 'fa fa-heart';
383
+
384
+ if (stripos($fundSource, 'github.com/sponsors/') !== false) {
385
+ $fundSourceLabel = 'GitHub Sponsors';
386
+ } elseif (stripos($fundSource, 'paypal') !== false) {
387
+ $fundSourceLabel = 'PayPal';
388
+ $fundSourceIconClass = 'fab fa-paypal';
389
+ }
390
+ ?>
391
+ <a class="btn btn-sm <?=$escape($fundSourceIndex === 0 ? 'btn-success' : 'btn-default')?>" href="<?=$escape($fundSource)?>" target="_blank" rel="noopener noreferrer"><i class="<?=$escape($fundSourceIconClass)?>"></i><?=$escape($fundSourceLabel)?></a>
392
+ <?php endforeach; ?>
393
+ </div>
394
+ <?php endif; ?>
395
+ </div>
396
+ </div>
397
+ </div>
398
+ </div>
399
+ </div>
400
+ <?php if ($updatesAvailable && $updateJobRunning): ?>
401
+ <script>
402
+ (function () {
403
+ 'use strict';
404
+
405
+ var statusLine = document.getElementById('pkg-about-update-status');
406
+ var messageNode = statusLine ? statusLine.querySelector('strong') : null;
407
+
408
+ window.setInterval(function () {
409
+ window.fetch('[__WORKSPACE_NAME__]-about.php?update_status=1', {
410
+ credentials: 'same-origin',
411
+ cache: 'no-store'
412
+ }).then(function (response) {
413
+ if (!response.ok) {
414
+ throw new Error('status');
415
+ }
416
+
417
+ return response.json();
418
+ }).then(function (status) {
419
+ if (status.state !== 'running') {
420
+ window.location.reload();
421
+
422
+ return;
423
+ }
424
+
425
+ if (messageNode && typeof status.message === 'string') {
426
+ messageNode.textContent = status.message;
427
+ }
428
+ }).catch(function () {
429
+ // A later poll can recover from a transient WebGUI or network failure.
430
+ });
431
+ }, 3000);
432
+ }());
433
+ </script>
434
+ <?php endif; ?>
435
+ <?php
436
+
437
+ include('foot.inc');
@@ -1,4 +1,10 @@
1
1
  pkg/[__WORKSPACE_NAME__].inc
2
2
  pkg/[__WORKSPACE_NAME__].xml
3
+ pkg/[__WORKSPACE_NAME__]/FileLock.php
4
+ pkg/[__WORKSPACE_NAME__]/PackagePaths.php
5
+ pkg/[__WORKSPACE_NAME__]/UpdateManager.php
3
6
  sbin/[__WORKSPACE_NAME__]
7
+ www/[__WORKSPACE_NAME__]-about.php
4
8
  %%DATADIR%%/info.xml
9
+ %%DATADIR%%/logo.svg
10
+ %%DATADIR%%/release-signing.pub
@@ -9,8 +9,13 @@ PORTS_DIR="${PFSENSE_PORTS_DIR:-}"
9
9
  PORT_DESTINATION="${PORTS_DIR}/sysutils/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]"
10
10
  RELEASE_DIR="${WORKSPACE_DIR}/build/release"
11
11
  CREATED_PORT_DESTINATION='false'
12
+ PACKAGE_REBUILD_DIR=''
12
13
 
13
14
  cleanup() {
15
+ if [ -n "${PACKAGE_REBUILD_DIR}" ] && [ -d "${PACKAGE_REBUILD_DIR}" ]; then
16
+ rm -rf -- "${PACKAGE_REBUILD_DIR}"
17
+ fi
18
+
14
19
  if [ "${CREATED_PORT_DESTINATION}" = 'true' ] && [ -d "${PORT_DESTINATION}" ]; then
15
20
  rm -rf -- "${PORT_DESTINATION}"
16
21
  fi
@@ -59,6 +64,55 @@ main() {
59
64
  exit 1
60
65
  fi
61
66
 
67
+ PACKAGE_REBUILD_DIR="$(mktemp -d "${PORT_DESTINATION}/work/any-freebsd.XXXXXX")"
68
+
69
+ mkdir -p -- "${PACKAGE_REBUILD_DIR}/root" "${PACKAGE_REBUILD_DIR}/output"
70
+ tar -xf "${artifact}" -C "${PACKAGE_REBUILD_DIR}/root"
71
+ mv -- "${PACKAGE_REBUILD_DIR}/root/+MANIFEST" "${PACKAGE_REBUILD_DIR}/manifest.ucl"
72
+ rm -f -- "${PACKAGE_REBUILD_DIR}/root/+COMPACT_MANIFEST"
73
+
74
+ sed -E '1s/^\{/\{"vital": true,/; s/("abi" *: *")[^"]*(")/\1FreeBSD:*\2/; s/("arch" *: *")[^"]*(")/\1freebsd:*\2/; s/^(abi *[:=] *"?)[^",]*("?)/\1FreeBSD:*\2/; s/^(arch *[:=] *"?)[^",]*("?)/\1freebsd:*\2/' \
75
+ "${PACKAGE_REBUILD_DIR}/manifest.ucl" > "${PACKAGE_REBUILD_DIR}/manifest-any-freebsd.ucl"
76
+ mv -- "${PACKAGE_REBUILD_DIR}/manifest-any-freebsd.ucl" "${PACKAGE_REBUILD_DIR}/manifest.ucl"
77
+
78
+ pkg create \
79
+ -M "${PACKAGE_REBUILD_DIR}/manifest.ucl" \
80
+ -r "${PACKAGE_REBUILD_DIR}/root" \
81
+ -o "${PACKAGE_REBUILD_DIR}/output"
82
+
83
+ rebuilt_artifact=''
84
+
85
+ for candidate in "${PACKAGE_REBUILD_DIR}"/output/*.pkg; do
86
+ if [ -f "${candidate}" ]; then
87
+ rebuilt_artifact="${candidate}"
88
+ break
89
+ fi
90
+ done
91
+
92
+ if [ -z "${rebuilt_artifact}" ]; then
93
+ echo 'Rebuilding the package for any FreeBSD version produced no artifact.' >&2
94
+ exit 1
95
+ fi
96
+
97
+ artifact_directory="$(dirname -- "${artifact}")"
98
+ rebuilt_artifact_name="$(basename -- "${rebuilt_artifact}")"
99
+ artifact="${artifact_directory}/${rebuilt_artifact_name}"
100
+
101
+ mv -f -- "${rebuilt_artifact}" "${artifact}"
102
+
103
+ artifact_abi="$(pkg query -F "${artifact}" '%q')"
104
+ artifact_vital="$(pkg query -F "${artifact}" '%V')"
105
+
106
+ if [ "${artifact_abi}" != 'FreeBSD:*' ]; then
107
+ echo "The rebuilt package ABI is ${artifact_abi}; expected FreeBSD:*." >&2
108
+ exit 1
109
+ fi
110
+
111
+ if [ "${artifact_vital}" != '1' ]; then
112
+ echo "The rebuilt package vital flag is ${artifact_vital}; expected 1." >&2
113
+ exit 1
114
+ fi
115
+
62
116
  mkdir -p -- "${RELEASE_DIR}"
63
117
  cp -- "${artifact}" "${RELEASE_DIR}/"
64
118
 
@@ -2,7 +2,10 @@ import { access, readFile } from 'node:fs/promises';
2
2
  import { dirname, join, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
 
5
- import { semanticVersionPattern } from './regex.mjs';
5
+ import {
6
+ releaseSigningKeyPattern,
7
+ semanticVersionPattern,
8
+ } from './regex.mjs';
6
9
 
7
10
  /**
8
11
  * Check Package - Workspace Directory.
@@ -31,8 +34,15 @@ const requiredFiles = [
31
34
  'port/files/pkg-install.in',
32
35
  'port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc',
33
36
  'port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml',
37
+ 'port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php',
38
+ 'port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php',
39
+ 'port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php',
34
40
  'port/files/usr/local/sbin/[__WORKSPACE_NAME__]',
35
41
  'port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/info.xml',
42
+ 'port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg',
43
+ 'port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub',
44
+ 'port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php',
45
+ 'tests/updates.php',
36
46
  ];
37
47
 
38
48
  await Promise.all(requiredFiles.map(async (requiredFile) => {
@@ -41,6 +51,54 @@ await Promise.all(requiredFiles.map(async (requiredFile) => {
41
51
  return;
42
52
  }));
43
53
 
54
+ /**
55
+ * Check Package - Release Signing Key File.
56
+ *
57
+ * Identifies the staged trust list that installed packages use for releases.
58
+ * Diagnostics retain this relative name so malformed lines are easy to find.
59
+ *
60
+ * @since UNRELEASED
61
+ */
62
+ const releaseSigningKeyFile = 'port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub';
63
+
64
+ /**
65
+ * Check Package - Release Signing Key Raw.
66
+ *
67
+ * Reads the public-key trust list before comments and blank lines are removed.
68
+ * Keeping the raw text preserves exact source line numbers for diagnostics.
69
+ *
70
+ * @since UNRELEASED
71
+ */
72
+ const releaseSigningKeyRaw = await readFile(join(workspaceDirectory, releaseSigningKeyFile), 'utf-8');
73
+
74
+ /**
75
+ * Check Package - Release Signing Key Lines.
76
+ *
77
+ * Splits the trust list without discarding empty lines or carriage returns.
78
+ * Validation normalizes each entry while retaining its one-based position.
79
+ *
80
+ * @since UNRELEASED
81
+ */
82
+ const releaseSigningKeyLines = releaseSigningKeyRaw.split('\n');
83
+
84
+ for (let releaseSigningKeyIndex = 0; releaseSigningKeyIndex < releaseSigningKeyLines.length; releaseSigningKeyIndex += 1) {
85
+ const releaseSigningKeyRawLine = releaseSigningKeyLines[releaseSigningKeyIndex];
86
+
87
+ if (releaseSigningKeyRawLine === undefined) {
88
+ continue;
89
+ }
90
+
91
+ const releaseSigningKeyLine = releaseSigningKeyRawLine.replaceAll('\r', '').trim();
92
+
93
+ if (releaseSigningKeyLine === '' || releaseSigningKeyLine.startsWith('#') === true) {
94
+ continue;
95
+ }
96
+
97
+ if (releaseSigningKeyPattern.test(releaseSigningKeyLine) === false) {
98
+ throw new Error(`${releaseSigningKeyFile} has an invalid release signing key on line ${releaseSigningKeyIndex + 1}.`);
99
+ }
100
+ }
101
+
44
102
  /**
45
103
  * Check Package - package.json Raw.
46
104
  *
@@ -85,8 +143,63 @@ if (typeof version !== 'string' || semanticVersionPattern.test(version) === fals
85
143
  */
86
144
  const makefileTemplate = await readFile(join(workspaceDirectory, 'port', 'Makefile.template'), 'utf-8');
87
145
 
146
+ /**
147
+ * Check Package - Makefile Template Lines.
148
+ *
149
+ * Separates the port recipe so the signing-key install command can be found.
150
+ * The check keeps comments elsewhere from satisfying the installation rule.
151
+ *
152
+ * @since UNRELEASED
153
+ */
154
+ const makefileTemplateLines = makefileTemplate.split('\n');
155
+
156
+ /**
157
+ * Check Package - Makefile Installs Release Signing Key.
158
+ *
159
+ * Confirms one data-install command copies the trust list into the package.
160
+ * This prevents a valid source file from being omitted from installed copies.
161
+ *
162
+ * @since UNRELEASED
163
+ */
164
+ const makefileInstallsReleaseSigningKey = makefileTemplateLines.some((makefileTemplateLine) => {
165
+ return makefileTemplateLine.includes('INSTALL_DATA') === true
166
+ && makefileTemplateLine.includes('/release-signing.pub') === true;
167
+ });
168
+
88
169
  if (makefileTemplate.includes('%%NOVA_PORTVERSION%%') === false) {
89
170
  throw new Error('port/Makefile.template must retain the %%NOVA_PORTVERSION%% build placeholder.');
90
171
  }
91
172
 
173
+ if (makefileTemplate.includes('WWW=\t[__PROJECT_HOMEPAGE__]') === false) {
174
+ throw new Error('port/Makefile.template must publish the configured project homepage.');
175
+ }
176
+
177
+ if (makefileInstallsReleaseSigningKey === false) {
178
+ throw new Error('port/Makefile.template must install release-signing.pub with INSTALL_DATA.');
179
+ }
180
+
181
+ /**
182
+ * Check Package - Package Plist.
183
+ *
184
+ * Reads the installed-file inventory that FreeBSD uses to assemble the package.
185
+ * The signing trust list must remain explicit so package checks can find it.
186
+ *
187
+ * @since UNRELEASED
188
+ */
189
+ const packagePlist = await readFile(join(workspaceDirectory, 'port', 'pkg-plist'), 'utf-8');
190
+
191
+ /**
192
+ * Check Package - Package Plist Lines.
193
+ *
194
+ * Normalizes the inventory for an exact release-signing.pub entry check.
195
+ * Exact matching avoids accepting a comment or similarly named file.
196
+ *
197
+ * @since UNRELEASED
198
+ */
199
+ const packagePlistLines = packagePlist.split('\n').map((packagePlistLine) => packagePlistLine.trim());
200
+
201
+ if (packagePlistLines.includes('%%DATADIR%%/release-signing.pub') === false) {
202
+ throw new Error('port/pkg-plist must list %%DATADIR%%/release-signing.pub.');
203
+ }
204
+
92
205
  process.stdout.write('pfSense package sources are structurally valid.\n');
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Regex - Release Signing Key Pattern.
3
+ *
4
+ * Matches the OpenSSH Ed25519 public-key grammar accepted by release checks.
5
+ * Both package validation and signing use this format for trusted key lines.
6
+ *
7
+ * @since UNRELEASED
8
+ */
9
+ export const releaseSigningKeyPattern = /^ssh-ed25519\s+AAAAC3NzaC1lZDI1NTE5AAAAI[A-Za-z0-9+/]{43}(?:\s.*)?$/;
10
+
1
11
  /**
2
12
  * Regex - Semantic Version Pattern.
3
13
  *