demo knacksicherer: edition im code + launcher prüft dateien
- edition.json entfällt; die Edition steckt als Marker im Code (const BUILD_EDITION). build.ps1 -Demo flippt ihn nur in der gestagten Kopie auf 'demo'; die Quelle bleibt 'full'. Keine lösch-/editierbare Extra-Datei mehr. - Launcher: beim Auspacken wird ein Fingerabdruck (SHA-256 über server.js, package.json, lib\, public\, tools\) in .ok gespeichert und bei JEDEM Start neu geprüft. Wurde im entpackten App-Ordner etwas geändert oder gelöscht (z. B. der Demo-Marker zurückgesetzt), wird automatisch das Original neu ausgepackt. node_modules/node bleiben aussen vor (gross, nicht Teil der Demo-Logik → schneller Start). Getestet: Marker im entpackten server.js auf 'full' gepatcht → nach Neustart wieder 'full'->'demo', Server meldet wieder Demo. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
11
build.ps1
11
build.ps1
@@ -11,7 +11,7 @@
|
||||
# Needs the .NET 8+ SDK (and Node.js on this PC, which is copied into the release exe).
|
||||
#
|
||||
# powershell -ExecutionPolicy Bypass -File build.ps1 -Demo -> release\ProjectDashboard-Demo.exe (+ -Demo-Setup.exe)
|
||||
# the free demo: at most 6 projects (edition.json in the payload). The full build is not touched.
|
||||
# the free demo: at most 6 projects (edition marker in server.js). The full build is not touched.
|
||||
param([switch]$Release, [switch]$Demo)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($Demo) { $Release = [switch]$true }
|
||||
@@ -73,9 +73,14 @@ Enthaltene Software:
|
||||
- Lucide Icons (ISC) - node_modules\lucide-static\LICENSE
|
||||
"@
|
||||
|
||||
# demo edition: server.js reads edition.json (WriteAllText = UTF-8 without BOM)
|
||||
# demo edition: flip the marker in the STAGED server.js only (the source stays 'full')
|
||||
if ($Demo) {
|
||||
[IO.File]::WriteAllText((Join-Path $payload 'edition.json'), '{ "demo": true, "limit": 6, "buyUrl": "https://sn09.itch.io/project-dashboard" }')
|
||||
$sf = Join-Path $payload 'server.js'
|
||||
$txt = [IO.File]::ReadAllText($sf)
|
||||
$flip = $txt.Replace("const BUILD_EDITION = 'full'", "const BUILD_EDITION = 'demo'")
|
||||
if ($flip -eq $txt) { throw "Demo-Marker nicht gefunden in server.js (const BUILD_EDITION = 'full')" }
|
||||
[IO.File]::WriteAllText($sf, $flip, (New-Object Text.UTF8Encoding $false))
|
||||
Write-Host ' edition: demo'
|
||||
}
|
||||
|
||||
Write-Host '2/3 Packen ...'
|
||||
|
||||
Reference in New Issue
Block a user