web/public/downloads/ios/index.html

150 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EDUT Platform - iOS</title>
<meta name="description" content="EDUT iOS platform delivery channel.">
<style>
body {
font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
background: #f0f4f8;
color: #2c2c2c;
padding: 40px 20px;
margin: 0;
}
.container {
max-width: 760px;
margin: 0 auto;
line-height: 1.7;
letter-spacing: 0.06em;
font-size: 12px;
}
h1 {
font-size: 18px;
font-weight: 300;
letter-spacing: 0.12em;
text-transform: uppercase;
margin: 10px 0 20px;
}
.muted {
color: #5f646b;
}
.card {
margin-top: 18px;
padding: 16px;
border: 1px solid #d6dce4;
background: #f7fafc;
}
.status {
margin-top: 14px;
color: #4c535c;
min-height: 18px;
}
.status.error {
color: #7a3a3a;
}
.cta {
margin-top: 8px;
border: 1px solid #c8d0da;
background: #ffffff;
color: #2c2c2c;
padding: 8px 14px;
font: inherit;
letter-spacing: 0.1em;
text-transform: lowercase;
cursor: pointer;
}
.download-instructions {
margin-top: 12px;
border-top: 1px solid #d6dce4;
padding-top: 12px;
display: none;
}
.download-instructions.visible {
display: block;
}
a { color: #2c2c2c; text-decoration: underline; text-underline-offset: 2px; }
</style>
</head>
<body>
<div class="container">
<p><a href="/">back</a></p>
<h1>EDUT Platform iOS</h1>
<p class="muted">membership channel verification</p>
<div class="card">
<p>iOS delivery is tied to wallet-authenticated membership state.</p>
<button id="connect-wallet" class="cta" type="button">connect wallet</button>
<p id="status" class="status" aria-live="polite"></p>
<div id="download-instructions" class="download-instructions">
<p>Membership verified. iOS distribution remains staged by designation era.</p>
<p>When your channel opens, this endpoint delivers current install instructions for iOS onboarding.</p>
<p>Member updates and entitlement notices are delivered inside the EDUT app after wallet sign-in.</p>
</div>
</div>
</div>
<script>
const connectWalletButton = document.getElementById('connect-wallet');
const statusNode = document.getElementById('status');
const instructionsNode = document.getElementById('download-instructions');
function setStatus(message, isError) {
statusNode.textContent = message;
statusNode.classList.toggle('error', !!isError);
}
async function fetchMembershipStatus(wallet, chainId) {
const params = new URLSearchParams({ wallet });
if (chainId !== null && chainId !== undefined) {
params.set('chain_id', String(chainId));
}
const res = await fetch('/secret/membership/status?' + params.toString(), {
headers: { Accept: 'application/json' },
});
if (!res.ok) {
const text = await res.text();
throw new Error(text || ('HTTP ' + res.status));
}
return res.json();
}
async function handleConnectWallet() {
instructionsNode.classList.remove('visible');
try {
if (!window.ethereum) {
setStatus('No wallet detected. Install a wallet and retry.', true);
return;
}
setStatus('Connecting wallet...', false);
const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
if (!Array.isArray(accounts) || accounts.length === 0) {
setStatus('Wallet connection was not approved.', true);
return;
}
const wallet = accounts[0];
const chainHex = await window.ethereum.request({ method: 'eth_chainId' });
const chainId = Number.parseInt(chainHex, 16);
setStatus('Checking membership status...', false);
const status = await fetchMembershipStatus(wallet, chainId);
if (status.status === 'active') {
setStatus('Membership active. iOS channel is authorized.', false);
instructionsNode.classList.add('visible');
return;
}
setStatus('Membership is not active for this wallet (' + status.status + ').', true);
} catch (err) {
const message = err && err.message ? err.message : 'Membership check failed.';
setStatus(message, true);
}
}
connectWalletButton.addEventListener('click', handleConnectWallet);
</script>
</body>
</html>