Initial commit: iOS OTA app store
This commit is contained in:
374
public/css/style.css
Normal file
374
public/css/style.css
Normal file
@@ -0,0 +1,374 @@
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #0a0a0a;
|
||||
--surface: #1a1a1a;
|
||||
--surface-hover: #222;
|
||||
--border: #333;
|
||||
--text: #f5f5f5;
|
||||
--text-muted: #888;
|
||||
--accent: #007AFF;
|
||||
--accent-hover: #0066d6;
|
||||
--danger: #ff3b30;
|
||||
--success: #30d158;
|
||||
--radius: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', system-ui, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
header h1 { font-size: 20px; font-weight: 700; }
|
||||
|
||||
nav { display: flex; gap: 8px; }
|
||||
|
||||
nav a {
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
nav a:hover, nav a.active {
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
nav a.logout { color: var(--danger); }
|
||||
nav a.logout:hover { background: rgba(255,59,48,0.1); }
|
||||
|
||||
/* Main */
|
||||
main { max-width: 900px; margin: 0 auto; padding: 24px; }
|
||||
|
||||
/* App Grid */
|
||||
.app-grid { display: flex; flex-direction: column; gap: 12px; }
|
||||
|
||||
.app-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.app-card:hover { background: var(--surface-hover); border-color: #444; }
|
||||
|
||||
.app-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 14px;
|
||||
background: #2a2a2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28px;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
|
||||
|
||||
.app-info { flex: 1; min-width: 0; }
|
||||
.app-name { font-weight: 600; font-size: 16px; }
|
||||
.app-bundle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
|
||||
.app-version { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
|
||||
|
||||
.app-action { flex-shrink: 0; }
|
||||
|
||||
.btn, button[type="submit"] {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 24px;
|
||||
border-radius: 20px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn:hover, button[type="submit"]:hover { background: var(--accent-hover); }
|
||||
.btn-sm { padding: 6px 16px; font-size: 13px; }
|
||||
.btn-danger { background: var(--danger); }
|
||||
.btn-danger:hover { background: #e0342a; }
|
||||
|
||||
.install-btn {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 20px;
|
||||
border-radius: 20px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Empty state */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 80px 20px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.empty-state p { font-size: 18px; margin-bottom: 16px; }
|
||||
|
||||
/* Login */
|
||||
.login-page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
padding: 40px;
|
||||
width: 320px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-icon { font-size: 48px; margin-bottom: 12px; }
|
||||
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
|
||||
.login-card .subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
|
||||
|
||||
.login-card input {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 16px;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.login-card input:focus { border-color: var(--accent); }
|
||||
|
||||
.login-card button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.login-card .error { color: var(--danger); font-size: 14px; margin-bottom: 8px; }
|
||||
|
||||
/* Upload */
|
||||
.upload-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.upload-card h2 { margin-bottom: 16px; font-size: 20px; }
|
||||
|
||||
.drop-zone {
|
||||
border: 2px dashed var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 48px 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.drop-zone:hover, .drop-zone.drag-over {
|
||||
border-color: var(--accent);
|
||||
background: rgba(0,122,255,0.05);
|
||||
}
|
||||
|
||||
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
|
||||
.drop-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
|
||||
.drop-zone p { color: var(--text-muted); font-size: 14px; }
|
||||
|
||||
.file-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12px 0;
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
resize: vertical;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: var(--accent); }
|
||||
|
||||
.upload-card button[type="submit"] { width: 100%; }
|
||||
|
||||
.progress {
|
||||
height: 4px;
|
||||
background: var(--border);
|
||||
border-radius: 2px;
|
||||
margin-top: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
width: 0;
|
||||
transition: width 0.2s;
|
||||
}
|
||||
|
||||
.result { margin-top: 16px; padding: 12px; border-radius: 10px; font-size: 14px; }
|
||||
.result.success { background: rgba(48,209,88,0.1); color: var(--success); }
|
||||
.result.error { background: rgba(255,59,48,0.1); color: var(--danger); }
|
||||
.result a { color: var(--accent); }
|
||||
|
||||
.api-info {
|
||||
margin-top: 24px;
|
||||
padding-top: 24px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.api-info h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
|
||||
|
||||
.api-info pre {
|
||||
background: var(--bg);
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Modal */
|
||||
.modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
max-width: 500px;
|
||||
width: 100%;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
padding: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 16px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.modal-close:hover { color: var(--text); }
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.modal-header .app-icon { width: 64px; height: 64px; }
|
||||
|
||||
.build-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.build-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px;
|
||||
background: var(--bg);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.build-meta { flex: 1; }
|
||||
.build-version { font-weight: 600; font-size: 14px; }
|
||||
.build-date { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
|
||||
.build-notes { color: var(--text-muted); font-size: 12px; margin-top: 4px; font-style: italic; }
|
||||
.build-size { color: var(--text-muted); font-size: 12px; }
|
||||
|
||||
.build-actions { display: flex; gap: 8px; align-items: center; }
|
||||
|
||||
.delete-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.delete-btn:hover { color: var(--danger); background: rgba(255,59,48,0.1); }
|
||||
|
||||
.modal-footer {
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 600px) {
|
||||
header { padding: 12px 16px; }
|
||||
header h1 { font-size: 17px; }
|
||||
nav a { padding: 6px 10px; font-size: 13px; }
|
||||
main { padding: 16px; }
|
||||
.app-card { padding: 12px; gap: 12px; }
|
||||
.app-icon { width: 48px; height: 48px; border-radius: 11px; font-size: 22px; }
|
||||
.app-name { font-size: 15px; }
|
||||
.upload-card { padding: 16px; }
|
||||
.drop-zone { padding: 32px 16px; }
|
||||
}
|
||||
121
public/js/app.js
Normal file
121
public/js/app.js
Normal file
@@ -0,0 +1,121 @@
|
||||
document.addEventListener('DOMContentLoaded', loadApps);
|
||||
|
||||
async function loadApps() {
|
||||
const res = await fetch('/api/apps');
|
||||
if (res.status === 401) { location.href = '/login'; return; }
|
||||
const apps = await res.json();
|
||||
|
||||
const grid = document.getElementById('apps');
|
||||
const empty = document.getElementById('empty');
|
||||
|
||||
if (apps.length === 0) {
|
||||
grid.style.display = 'none';
|
||||
empty.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
grid.innerHTML = apps.map(app => `
|
||||
<div class="app-card" onclick="showApp('${app.id}')">
|
||||
<div class="app-icon">
|
||||
${app.latest_icon
|
||||
? `<img src="/icons/${app.latest_icon}" alt="${app.name}">`
|
||||
: app.name.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div class="app-info">
|
||||
<div class="app-name">${esc(app.name)}</div>
|
||||
<div class="app-bundle">${esc(app.bundle_id)}</div>
|
||||
<div class="app-version">v${esc(app.latest_version || '?')}${app.latest_build_number ? ` (${esc(app.latest_build_number)})` : ''} · ${timeAgo(app.latest_uploaded_at)}</div>
|
||||
</div>
|
||||
<div class="app-action">
|
||||
<a class="install-btn" href="itms-services://?action=download-manifest&url=${encodeURIComponent(location.origin + '/api/manifest/' + app.latest_build_id)}" onclick="event.stopPropagation()">Install</a>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
async function showApp(appId) {
|
||||
const res = await fetch(`/api/apps/${appId}`);
|
||||
const app = await res.json();
|
||||
|
||||
const modal = document.getElementById('modal');
|
||||
const body = document.getElementById('modal-body');
|
||||
|
||||
const icon = app.builds[0]?.icon_filename;
|
||||
|
||||
body.innerHTML = `
|
||||
<div class="modal-header">
|
||||
<div class="app-icon">
|
||||
${icon ? `<img src="/icons/${icon}" alt="${app.name}">` : app.name.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div>
|
||||
<div class="app-name" style="font-size:18px">${esc(app.name)}</div>
|
||||
<div class="app-bundle">${esc(app.bundle_id)}</div>
|
||||
</div>
|
||||
</div>
|
||||
<h3 style="font-size:14px;color:var(--text-muted);margin-bottom:8px">Builds (${app.builds.length})</h3>
|
||||
<div class="build-list">
|
||||
${app.builds.map(b => `
|
||||
<div class="build-item" id="build-${b.id}">
|
||||
<div class="build-meta">
|
||||
<div class="build-version">v${esc(b.version)} (${esc(b.build_number || '?')})</div>
|
||||
<div class="build-date">${new Date(b.uploaded_at + 'Z').toLocaleDateString()} · ${formatSize(b.size)}</div>
|
||||
${b.notes ? `<div class="build-notes">${esc(b.notes)}</div>` : ''}
|
||||
</div>
|
||||
<div class="build-actions">
|
||||
<a class="install-btn btn-sm" href="itms-services://?action=download-manifest&url=${encodeURIComponent(location.origin + '/api/manifest/' + b.id)}">Install</a>
|
||||
<button class="delete-btn" onclick="deleteBuild('${b.id}', '${appId}')" title="Delete">×</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteApp('${appId}')">Delete App</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
modal.style.display = 'flex';
|
||||
modal.onclick = (e) => { if (e.target === modal) closeModal(); };
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('modal').style.display = 'none';
|
||||
}
|
||||
|
||||
async function deleteBuild(buildId, appId) {
|
||||
if (!confirm('Delete this build?')) return;
|
||||
await fetch(`/api/builds/${buildId}`, { method: 'DELETE' });
|
||||
closeModal();
|
||||
loadApps();
|
||||
}
|
||||
|
||||
async function deleteApp(appId) {
|
||||
if (!confirm('Delete this app and all its builds?')) return;
|
||||
await fetch(`/api/apps/${appId}`, { method: 'DELETE' });
|
||||
closeModal();
|
||||
loadApps();
|
||||
}
|
||||
|
||||
function esc(s) {
|
||||
if (!s) return '';
|
||||
const d = document.createElement('div');
|
||||
d.textContent = s;
|
||||
return d.innerHTML;
|
||||
}
|
||||
|
||||
function formatSize(bytes) {
|
||||
if (!bytes) return '';
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
||||
}
|
||||
|
||||
function timeAgo(dateStr) {
|
||||
if (!dateStr) return '';
|
||||
const d = new Date(dateStr + 'Z');
|
||||
const now = new Date();
|
||||
const diff = (now - d) / 1000;
|
||||
if (diff < 60) return 'just now';
|
||||
if (diff < 3600) return Math.floor(diff / 60) + 'm ago';
|
||||
if (diff < 86400) return Math.floor(diff / 3600) + 'h ago';
|
||||
if (diff < 604800) return Math.floor(diff / 86400) + 'd ago';
|
||||
return d.toLocaleDateString();
|
||||
}
|
||||
Reference in New Issue
Block a user