Fix proxy path resolution for portable builds, simplify landing page

The proxy launch used __dirname to find aware-cam-proxy.exe, which
points to a temp extraction directory in portable builds. Added
getAppDirectory() helper that resolves the actual .exe location via
PORTABLE_EXECUTABLE_FILE. Rewrote landing page as a simple kit download
page. Added build-kit script to bundle app + proxy + extension into zip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Zac
2026-02-10 19:23:48 -05:00
parent 3a6be50e31
commit 099cc252fe
4 changed files with 193 additions and 168 deletions
+72
View File
@@ -0,0 +1,72 @@
# build-kit.ps1 — Build the Alta Proxy Tool Kit zip for distribution
# Usage: powershell -ExecutionPolicy Bypass -File build-kit.ps1
#
# Produces: dist/AltaProxyToolKit.zip containing:
# - AltaCameraProxy-<version>-portable.exe
# - aware-cam-proxy.exe
# - chrome-extension/ (folder)
$ErrorActionPreference = "Stop"
# Read version from package.json
$pkg = Get-Content "package.json" -Raw | ConvertFrom-Json
$version = $pkg.version
Write-Host "Building Alta Proxy Tool Kit v$version" -ForegroundColor Cyan
# Step 1: Build the Electron portable exe
Write-Host "`n[1/4] Building Electron app..." -ForegroundColor Yellow
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
$portableExe = "dist\AltaCameraProxy-$version-portable.exe"
if (-not (Test-Path $portableExe)) {
Write-Host "Expected output not found: $portableExe" -ForegroundColor Red
exit 1
}
Write-Host " Built: $portableExe" -ForegroundColor Green
# Step 2: Verify aware-cam-proxy.exe exists
Write-Host "`n[2/4] Checking for aware-cam-proxy.exe..." -ForegroundColor Yellow
if (-not (Test-Path "aware-cam-proxy.exe")) {
Write-Host "aware-cam-proxy.exe not found in project root!" -ForegroundColor Red
Write-Host "Place aware-cam-proxy.exe in the project root and try again." -ForegroundColor Red
exit 1
}
Write-Host " Found: aware-cam-proxy.exe" -ForegroundColor Green
# Step 3: Verify chrome-extension folder exists
Write-Host "`n[3/4] Checking for chrome-extension/..." -ForegroundColor Yellow
if (-not (Test-Path "chrome-extension\manifest.json")) {
Write-Host "chrome-extension/ folder not found or missing manifest.json!" -ForegroundColor Red
exit 1
}
Write-Host " Found: chrome-extension/" -ForegroundColor Green
# Step 4: Create the kit zip
Write-Host "`n[4/4] Creating AltaProxyToolKit.zip..." -ForegroundColor Yellow
$kitDir = "dist\AltaProxyToolKit"
$zipPath = "dist\AltaProxyToolKit.zip"
# Clean previous kit
if (Test-Path $kitDir) { Remove-Item $kitDir -Recurse -Force }
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
# Assemble kit contents
New-Item -ItemType Directory -Path $kitDir | Out-Null
Copy-Item $portableExe "$kitDir\AltaCameraProxy.exe"
Copy-Item "aware-cam-proxy.exe" "$kitDir\aware-cam-proxy.exe"
Copy-Item "chrome-extension" "$kitDir\chrome-extension" -Recurse
# Create zip
Compress-Archive -Path "$kitDir\*" -DestinationPath $zipPath -Force
# Clean up temp directory
Remove-Item $kitDir -Recurse -Force
$zipSize = [math]::Round((Get-Item $zipPath).Length / 1MB, 1)
Write-Host "`nKit ready: $zipPath ($zipSize MB)" -ForegroundColor Green
Write-Host "Upload this file as a release asset named 'AltaProxyToolKit.zip'" -ForegroundColor Cyan
+108 -166
View File
@@ -13,7 +13,6 @@
--text-secondary: #999999; --text-secondary: #999999;
--accent-primary: #0E7AFE; --accent-primary: #0E7AFE;
--accent-primary-hover: #0A5FD9; --accent-primary-hover: #0A5FD9;
--success: #4CAF50;
--card-bg: #2D2D30; --card-bg: #2D2D30;
} }
@@ -29,6 +28,9 @@
color: var(--text-primary); color: var(--text-primary);
font-size: 16px; font-size: 16px;
line-height: 1.6; line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
} }
a { a {
@@ -48,7 +50,7 @@
} }
.container { .container {
max-width: 960px; max-width: 720px;
margin: 0 auto; margin: 0 auto;
padding: 0 24px; padding: 0 24px;
} }
@@ -86,9 +88,13 @@
} }
/* Hero */ /* Hero */
main {
flex: 1;
}
.hero { .hero {
text-align: center; text-align: center;
padding: 80px 0 64px; padding: 100px 0 48px;
} }
.hero-icon { .hero-icon {
@@ -105,10 +111,10 @@
} }
.hero .tagline { .hero .tagline {
font-size: 20px; font-size: 18px;
color: var(--text-secondary); color: var(--text-secondary);
margin-bottom: 36px; margin-bottom: 40px;
max-width: 600px; max-width: 500px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
@@ -119,7 +125,7 @@
color: #fff; color: #fff;
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
padding: 14px 36px; padding: 16px 40px;
border-radius: 6px; border-radius: 6px;
transition: background 0.2s; transition: background 0.2s;
} }
@@ -135,125 +141,111 @@
color: var(--text-secondary); color: var(--text-secondary);
} }
/* Sections */ /* Kit contents */
section { .kit-info {
padding: 56px 0; padding: 48px 0;
}
section + section {
border-top: 1px solid var(--border); border-top: 1px solid var(--border);
} }
section h2 { .kit-info h2 {
font-size: 24px; font-size: 20px;
font-weight: 600; font-weight: 600;
color: var(--accent-primary); color: var(--text-primary);
margin-bottom: 24px; margin-bottom: 16px;
text-align: center;
} }
/* Features */ .kit-contents {
.features-grid { display: flex;
display: grid; gap: 16px;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); justify-content: center;
gap: 20px;
} }
.feature-card { .kit-item {
background: var(--card-bg); background: var(--card-bg);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 8px; border-radius: 8px;
padding: 24px; padding: 20px 28px;
text-align: center;
} }
.feature-card h3 { .kit-item strong {
font-size: 16px; display: block;
font-weight: 600;
margin-bottom: 8px;
color: var(--text-primary);
}
.feature-card p {
font-size: 14px; font-size: 14px;
margin-bottom: 4px;
}
.kit-item span {
font-size: 13px;
color: var(--text-secondary); color: var(--text-secondary);
line-height: 1.5;
} }
/* Setup Steps */ /* Setup */
.steps { .setup {
counter-reset: step; padding: 48px 0;
list-style: none;
}
.steps li {
counter-increment: step;
position: relative;
padding: 16px 0 16px 52px;
}
.steps li + li {
border-top: 1px solid var(--border); border-top: 1px solid var(--border);
} }
.steps li::before { .setup h2 {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 20px;
text-align: center;
}
.setup-steps {
list-style: none;
max-width: 480px;
margin: 0 auto;
counter-reset: step;
}
.setup-steps li {
counter-increment: step;
padding: 12px 0 12px 44px;
position: relative;
font-size: 15px;
color: var(--text-secondary);
}
.setup-steps li + li {
border-top: 1px solid var(--border);
}
.setup-steps li::before {
content: counter(step); content: counter(step);
position: absolute; position: absolute;
left: 0; left: 0;
top: 16px; top: 12px;
width: 32px; width: 28px;
height: 32px; height: 28px;
background: var(--accent-primary); background: var(--accent-primary);
color: #fff; color: #fff;
font-weight: 700; font-weight: 700;
font-size: 14px; font-size: 13px;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.steps li strong { .setup-steps code {
display: block;
margin-bottom: 4px;
color: var(--text-primary);
}
.steps li span {
font-size: 14px;
color: var(--text-secondary);
}
.steps code {
background: var(--bg-primary); background: var(--bg-primary);
border: 1px solid var(--border); border: 1px solid var(--border);
padding: 2px 6px; padding: 1px 5px;
border-radius: 4px; border-radius: 3px;
font-size: 13px; font-size: 13px;
color: var(--accent-primary); color: var(--accent-primary);
} }
/* Requirements */ .setup-note {
.requirements-list { text-align: center;
list-style: none; margin-top: 20px;
display: grid; font-size: 13px;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
}
.requirements-list li {
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: 6px;
padding: 14px 18px;
font-size: 14px;
color: var(--text-secondary); color: var(--text-secondary);
} }
.requirements-list li strong {
color: var(--text-primary);
display: block;
margin-bottom: 2px;
}
/* Footer */ /* Footer */
.footer { .footer {
border-top: 1px solid var(--border); border-top: 1px solid var(--border);
@@ -274,7 +266,7 @@
/* Responsive */ /* Responsive */
@media (max-width: 600px) { @media (max-width: 600px) {
.hero { .hero {
padding: 48px 0 40px; padding: 60px 0 36px;
} }
.hero h1 { .hero h1 {
@@ -290,16 +282,14 @@
padding: 12px 28px; padding: 12px 28px;
} }
section { .kit-contents {
padding: 36px 0; flex-direction: column;
align-items: center;
} }
.features-grid { .kit-item {
grid-template-columns: 1fr; width: 100%;
} max-width: 280px;
.requirements-list {
grid-template-columns: 1fr;
} }
} }
</style> </style>
@@ -322,87 +312,39 @@
<div class="hero"> <div class="hero">
<img src="icon.png" alt="" class="hero-icon"> <img src="icon.png" alt="" class="hero-icon">
<h1>Alta Proxy Tool</h1> <h1>Alta Proxy Tool</h1>
<p class="tagline">Connect to Avigilon Alta cameras through a local RTSP proxy &mdash; no cloud relay required.</p> <p class="tagline">Local RTSP proxy for Avigilon Alta cameras. No cloud relay required.</p>
<a href="https://github.com/PageZ948/Alta-Proxy-Tool/releases/latest" class="btn-download">Download for Windows</a> <a href="https://github.com/PageZ948/Alta-Proxy-Tool/releases/latest/download/AltaProxyToolKit.zip" class="btn-download">Download Kit for Windows</a>
<p class="hero-note">Portable .exe &mdash; no installation needed</p> <p class="hero-note">Portable &mdash; extract the zip and run. No installation needed.</p>
</div> </div>
<section> <section class="kit-info">
<h2>Features</h2> <h2>What's in the kit</h2>
<div class="features-grid"> <div class="kit-contents">
<div class="feature-card"> <div class="kit-item">
<h3>Cookie-Based Auth</h3> <strong>AltaCameraProxy.exe</strong>
<p>Authenticate seamlessly via the companion Chrome extension. No credentials stored in the app.</p> <span>Electron desktop app</span>
</div> </div>
<div class="feature-card"> <div class="kit-item">
<h3>Device Discovery</h3> <strong>aware-cam-proxy.exe</strong>
<p>Automatically discovers all on-premise cameras in your Alta deployment with online/offline status.</p> <span>Camera proxy engine</span>
</div> </div>
<div class="feature-card"> <div class="kit-item">
<h3>Local RTSP Proxy</h3> <strong>chrome-extension/</strong>
<p>Launches aware-cam-proxy to establish direct camera connections for RTSP streaming.</p> <span>Cookie bridge for Chrome</span>
</div>
<div class="feature-card">
<h3>Batch Operations</h3>
<p>Connect to multiple cameras at once with batch proxy launch and sequential port assignment.</p>
</div>
<div class="feature-card">
<h3>Self-Updating</h3>
<p>Built-in update checker downloads new releases directly from GitHub.</p>
</div>
<div class="feature-card">
<h3>Portable</h3>
<p>Single .exe, no installer. Run it from anywhere on any Windows machine.</p>
</div> </div>
</div> </div>
</section> </section>
<section> <section class="setup">
<h2>Quick Start</h2> <h2>Setup</h2>
<ol class="steps"> <ol class="setup-steps">
<li> <li>Extract the zip to any folder</li>
<strong>Download the app</strong> <li>Load <code>chrome-extension/</code> in Chrome via <code>chrome://extensions</code> (Developer mode)</li>
<span>Grab the latest <code>.exe</code> from the <a href="https://github.com/PageZ948/Alta-Proxy-Tool/releases/latest">Releases</a> page and place it in a folder alongside <code>aware-cam-proxy.exe</code>.</span> <li>Log into your Alta deployment in Chrome</li>
</li> <li>Click the extension icon and send cookies to the app</li>
<li> <li>Run <strong>AltaCameraProxy.exe</strong> and start proxying</li>
<strong>Install the Chrome extension</strong>
<span>Open <code>chrome://extensions</code>, enable Developer mode, click "Load unpacked", and select the <code>chrome-extension</code> folder from this repo.</span>
</li>
<li>
<strong>Log in to Alta</strong>
<span>Sign in to your Avigilon Alta deployment in Chrome as you normally would.</span>
</li>
<li>
<strong>Send cookies to the app</strong>
<span>Click the extension icon and press "Send Cookie to APT". The app will connect automatically.</span>
</li>
<li>
<strong>Start proxying</strong>
<span>Select cameras from the device list and click Start Proxy. Use the generated RTSP URL in your video client.</span>
</li>
</ol> </ol>
</section> <p class="setup-note">Requires Windows 10+, Google Chrome, and an Avigilon Alta account.</p>
<section>
<h2>Requirements</h2>
<ul class="requirements-list">
<li>
<strong>Windows 10+</strong>
The proxy executable is Windows-only.
</li>
<li>
<strong>Google Chrome</strong>
Required for the cookie bridge extension.
</li>
<li>
<strong>aware-cam-proxy.exe</strong>
Must be in the same folder as the app.
</li>
<li>
<strong>Alta Deployment</strong>
An active Avigilon Alta Video account.
</li>
</ul>
</section> </section>
</div> </div>
+12 -2
View File
@@ -13,6 +13,16 @@ let cookieServer = null;
const COOKIE_SERVER_PORT = 18247; const COOKIE_SERVER_PORT = 18247;
const COOKIE_SERVER_TOKEN = 'apt-local-bridge-token'; const COOKIE_SERVER_TOKEN = 'apt-local-bridge-token';
// Get the directory where the user-facing executable resides.
// In portable builds, __dirname points to a temp extraction directory,
// so we use the actual .exe location instead.
function getAppDirectory() {
if (app.isPackaged) {
return path.dirname(process.env.PORTABLE_EXECUTABLE_FILE || app.getPath('exe'));
}
return __dirname;
}
// Sanitize strings before embedding in batch files to prevent command injection // Sanitize strings before embedding in batch files to prevent command injection
function sanitizeBatchInput(input) { function sanitizeBatchInput(input) {
if (typeof input !== 'string') return ''; if (typeof input !== 'string') return '';
@@ -238,7 +248,7 @@ ipcMain.handle('api-get-auth-info', async (event, { deploymentUrl, cookies }) =>
ipcMain.handle('camera-proxy-cookie-launch', async (event, { deploymentUrl, cookieKey, deviceUuid }) => { ipcMain.handle('camera-proxy-cookie-launch', async (event, { deploymentUrl, cookieKey, deviceUuid }) => {
try { try {
// Path to the cookie-based camera proxy executable // Path to the cookie-based camera proxy executable
const proxyExePath = path.join(__dirname, 'aware-cam-proxy.exe'); const proxyExePath = path.join(getAppDirectory(), 'aware-cam-proxy.exe');
// Check if the executable exists // Check if the executable exists
if (!fs.existsSync(proxyExePath)) { if (!fs.existsSync(proxyExePath)) {
@@ -502,7 +512,7 @@ ipcMain.handle('download-and-install-update', async (event, { downloadUrl }) =>
try { try {
// Determine the path to the currently running executable // Determine the path to the currently running executable
const currentExePath = process.env.PORTABLE_EXECUTABLE_FILE || app.getPath('exe'); const currentExePath = process.env.PORTABLE_EXECUTABLE_FILE || app.getPath('exe');
const currentDir = path.dirname(currentExePath); const currentDir = getAppDirectory();
const currentExeName = path.basename(currentExePath); const currentExeName = path.basename(currentExePath);
// Check write permission on the app directory // Check write permission on the app directory
+1
View File
@@ -8,6 +8,7 @@
"dev": "electron . --dev", "dev": "electron . --dev",
"build": "electron-builder --win --publish=never", "build": "electron-builder --win --publish=never",
"build-test": "electron-builder --win --dir", "build-test": "electron-builder --win --dir",
"build-kit": "powershell -ExecutionPolicy Bypass -File build-kit.ps1",
"prebuild": "echo Checking build requirements..." "prebuild": "echo Checking build requirements..."
}, },
"build": { "build": {