mirror of
https://github.com/agent0ai/a0-launcher.git
synced 2026-12-04 01:09:29 +00:00
Use Agent Zero's dark palette and bundled Rubik font so update controls stay legible over transparent desktop backgrounds. Keep the initial prompt to Update and Continue while preserving status feedback for progress and failures.
241 lines
8.6 KiB
HTML
241 lines
8.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; img-src 'self' data:">
|
|
<title>Agent Zero Launcher</title>
|
|
<style>
|
|
@font-face {
|
|
font-family: "Rubik";
|
|
font-style: normal;
|
|
font-weight: 500;
|
|
font-display: swap;
|
|
src: url("../app/a0ui/vendor/google/rubik/rubik-500.ttf") format("truetype");
|
|
}
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
html {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: transparent;
|
|
overflow: hidden;
|
|
}
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
|
background: transparent;
|
|
color: #fff;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
-webkit-app-region: drag;
|
|
user-select: none;
|
|
}
|
|
body.requires-action {
|
|
font-family: "Rubik", Arial, Helvetica, sans-serif;
|
|
font-weight: 500;
|
|
}
|
|
.container {
|
|
text-align: center;
|
|
transform-origin: center;
|
|
animation: splash-open 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
}
|
|
.logo {
|
|
width: 132px;
|
|
height: 132px;
|
|
margin-bottom: 0;
|
|
border-radius: 30px;
|
|
filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.32));
|
|
}
|
|
@keyframes splash-open {
|
|
0% { transform: scale(0.78); opacity: 0; }
|
|
45% { opacity: 1; }
|
|
100% { transform: scale(1); opacity: 1; }
|
|
}
|
|
@keyframes splash-close {
|
|
0% { transform: scale(1); opacity: 1; }
|
|
100% { transform: scale(1.22); opacity: 0; }
|
|
}
|
|
body.is-opening-app .container {
|
|
animation: splash-close 120ms cubic-bezier(0.2, 0, 0.18, 1) both;
|
|
}
|
|
.update-panel {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 10px;
|
|
min-height: 38px;
|
|
margin: 2px 0 14px;
|
|
-webkit-app-region: no-drag;
|
|
}
|
|
.update-panel[hidden] {
|
|
display: none;
|
|
}
|
|
.update-button {
|
|
min-width: 104px;
|
|
height: 36px;
|
|
border: 0;
|
|
border-radius: 7px;
|
|
padding: 0 16px;
|
|
color: #fff;
|
|
background: #2b5ab9;
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
}
|
|
.update-button.secondary {
|
|
color: #fff;
|
|
background: #1a1a1a;
|
|
box-shadow: inset 0 0 0 1px #444444a8;
|
|
}
|
|
.update-button:disabled {
|
|
cursor: default;
|
|
filter: saturate(0.45) brightness(0.82);
|
|
}
|
|
.status {
|
|
font-size: 14px;
|
|
color: #fff;
|
|
background: #131313;
|
|
border-radius: 7px;
|
|
display: none;
|
|
margin: 12px 0 0;
|
|
padding: 6px 10px;
|
|
}
|
|
.spinner {
|
|
display: none;
|
|
}
|
|
.error {
|
|
color: #ff6b6b;
|
|
display: none;
|
|
max-width: 300px;
|
|
margin-top: 12px;
|
|
font-size: 13px;
|
|
line-height: 1.35;
|
|
text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
|
|
}
|
|
.error.visible {
|
|
display: block;
|
|
}
|
|
body.requires-action .status:not([hidden]) {
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<img class="logo" src="assets/icon.png" alt="Agent Zero Launcher" onerror="this.style.display='none'">
|
|
<div class="update-panel" id="launcherUpdatePanel" hidden>
|
|
<button class="update-button" id="launcherUpdateBtn" type="button">Update</button>
|
|
<button class="update-button secondary" id="launcherContinueBtn" type="button" disabled>Continue</button>
|
|
</div>
|
|
<p class="status" id="status">Checking for updates...</p>
|
|
<div class="spinner" id="spinner"></div>
|
|
<p class="error" id="error"></p>
|
|
</div>
|
|
<script>
|
|
const statusEl = document.getElementById('status');
|
|
const spinnerEl = document.getElementById('spinner');
|
|
const errorEl = document.getElementById('error');
|
|
const updatePanel = document.getElementById('launcherUpdatePanel');
|
|
const updateBtn = document.getElementById('launcherUpdateBtn');
|
|
const continueBtn = document.getElementById('launcherContinueBtn');
|
|
let latestLauncherUpdateState = { state: 'idle', readyToContinue: false };
|
|
|
|
function isActionableUpdateState(state) {
|
|
return ['update-available', 'downloading', 'downloaded', 'installing'].includes(state);
|
|
}
|
|
|
|
function renderLauncherUpdate(info = {}) {
|
|
const state = typeof info.state === 'string' ? info.state : 'idle';
|
|
const version = typeof info.version === 'string' ? info.version : '';
|
|
latestLauncherUpdateState = { ...latestLauncherUpdateState, ...info, state, version };
|
|
|
|
if (!isActionableUpdateState(state)) {
|
|
return;
|
|
}
|
|
|
|
if (state === 'downloaded') {
|
|
updateBtn.textContent = 'Restart';
|
|
updateBtn.disabled = false;
|
|
} else if (state === 'downloading') {
|
|
updateBtn.textContent = 'Downloading';
|
|
updateBtn.disabled = true;
|
|
} else if (state === 'installing') {
|
|
updateBtn.textContent = 'Restarting';
|
|
updateBtn.disabled = true;
|
|
} else {
|
|
updateBtn.textContent = version ? `Update ${version}` : 'Update';
|
|
updateBtn.disabled = false;
|
|
}
|
|
|
|
if (typeof info.message === 'string' && info.message) {
|
|
statusEl.textContent = info.message;
|
|
} else if (version) {
|
|
statusEl.textContent = `Update ${version} is available.`;
|
|
}
|
|
statusEl.hidden = state === 'update-available';
|
|
|
|
continueBtn.disabled = !info.readyToContinue || state === 'installing';
|
|
updatePanel.hidden = false;
|
|
document.body.classList.add('requires-action');
|
|
}
|
|
|
|
window.electronAPI?.onStatusUpdate?.((status) => {
|
|
statusEl.textContent = status;
|
|
});
|
|
window.electronAPI?.onError?.((error) => {
|
|
spinnerEl.style.display = 'none';
|
|
errorEl.textContent = error;
|
|
errorEl.classList.add('visible');
|
|
document.body.classList.add('requires-action');
|
|
});
|
|
window.electronAPI?.onLauncherUpdateAvailable?.((info) => {
|
|
renderLauncherUpdate(info);
|
|
});
|
|
window.electronAPI?.onLauncherUpdateStatus?.((info) => {
|
|
renderLauncherUpdate(info);
|
|
});
|
|
window.electronAPI?.onLauncherOpeningApp?.(() => {
|
|
document.body.classList.add('is-opening-app');
|
|
});
|
|
|
|
updateBtn.addEventListener('click', async () => {
|
|
updateBtn.disabled = true;
|
|
const state = latestLauncherUpdateState.state;
|
|
statusEl.hidden = false;
|
|
statusEl.textContent = state === 'downloaded' ? 'Restarting to install update...' : 'Preparing update...';
|
|
const result = await window.electronAPI?.beginLauncherUpdate?.();
|
|
if (!result?.ok) {
|
|
statusEl.textContent = result?.message || 'Could not start update.';
|
|
updateBtn.disabled = false;
|
|
return;
|
|
}
|
|
if (result.status === 'installing') {
|
|
updateBtn.textContent = 'Restarting';
|
|
} else if (result.status === 'downloaded') {
|
|
updateBtn.textContent = 'Restart';
|
|
updateBtn.disabled = false;
|
|
}
|
|
});
|
|
|
|
continueBtn.addEventListener('click', async () => {
|
|
continueBtn.disabled = true;
|
|
statusEl.hidden = false;
|
|
statusEl.textContent = 'Opening launcher...';
|
|
const result = await window.electronAPI?.continueAfterLauncherUpdate?.();
|
|
if (!result?.ok) {
|
|
statusEl.textContent = result?.message || 'Could not continue.';
|
|
continueBtn.disabled = false;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|