Add files via upload
This commit is contained in:
parent
f594dc5159
commit
b1a8bd7d6d
81
ASAshop.html
81
ASAshop.html
|
|
@ -338,7 +338,10 @@
|
|||
<div class="wrap">
|
||||
<div class="row">
|
||||
<h1>BESTWCOAST Shop</h1>
|
||||
<a class="cart-btn" href="https://discord.gg/kQrAQSSrez" id="loginDiscord">Login to our Discord</a>
|
||||
<a class="cart-btn"
|
||||
href="#"
|
||||
id="loginDiscord"
|
||||
data-client-id="1423370765578797126">Login to our Discord</a>
|
||||
<span id="whoami" class="muted"></span>
|
||||
<div class="spacer"></div>
|
||||
<nav class="links" aria-label="Primary">
|
||||
|
|
@ -372,6 +375,64 @@
|
|||
<section id="grid" class="grid"></section>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
const API = "https://affiliated-lets-automatic-oak.trycloudflare.com"; // unchanged
|
||||
|
||||
// ---- whoami banner (unchanged logic) ----
|
||||
async function getWhoAmI() {
|
||||
try {
|
||||
const r = await fetch(`${API}/api/inventory`, { credentials: 'include' });
|
||||
if (!r.ok) return null;
|
||||
const j = await r.json();
|
||||
const u = j?.user ?? j;
|
||||
const label = u?.global_name ?? u?.username ?? (u?.id ? `User ${u.id}` : null);
|
||||
return label ? { label, raw: u } : null;
|
||||
} catch { return null; }
|
||||
}
|
||||
(async () => {
|
||||
const who = await getWhoAmI();
|
||||
document.getElementById('whoami').textContent =
|
||||
who ? `Signed in as ${who.label}` : 'Not signed in';
|
||||
})();
|
||||
|
||||
// ---- FIXED Discord login button ----
|
||||
document.getElementById('loginDiscord').addEventListener('click', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const backTo = encodeURIComponent(location.href);
|
||||
const clientId = document.getElementById('loginDiscord').dataset.clientId;
|
||||
const backendStart = `${API}/api/auth/discord?redirect=${backTo}`;
|
||||
const callback = encodeURIComponent(`${API}/api/auth/discord/callback`);
|
||||
const direct = `https://discord.com/oauth2/authorize?client_id=${clientId}&redirect_uri=${callback}&response_type=code&scope=identify`;
|
||||
|
||||
try {
|
||||
// If backend is reachable, use the backend start route
|
||||
const ping = await fetch(`${API}/healthz`, { mode: 'no-cors' }).catch(() => null);
|
||||
// no-cors fetch won’t throw on 200, but if DNS/route fails we hit catch above
|
||||
location.href = backendStart;
|
||||
} catch {
|
||||
// Fallback: go straight to Discord’s authorize page
|
||||
location.href = direct;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('checkoutBtn').addEventListener('click', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const entries = Object.entries(state.cart || {});
|
||||
if (!entries.length) return alert('Your cart is empty.');
|
||||
|
||||
alert("⚠️ IMPORTANT: After checkout, you must contact a team member to receive your order.\n\nPlease open a ticket in Discord once payment is complete.");
|
||||
|
||||
const items = entries.map(([id, qty]) => {
|
||||
const p = products.find(p => p.id === id);
|
||||
return { id, name: p?.name || id, qty: Number(qty || 1), price: p?.price || 0 };
|
||||
});
|
||||
|
||||
await checkout(items);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Drawer (Cart) -->
|
||||
<aside id="drawer" aria-hidden="true">
|
||||
|
|
@ -508,22 +569,22 @@
|
|||
|
||||
/* ===== Products (unique IDs) ===== */
|
||||
const products = [
|
||||
{ id: 'server1', name: 'Server Class 1', price: 25.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS01.png'},
|
||||
{ id: 'server2', name: 'Server Class 2', price: 50.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS02.png'},
|
||||
{ id: 'server1', name: 'Server Class 1', price: 25.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS01.png' },
|
||||
{ id: 'server2', name: 'Server Class 2', price: 50.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS02.png' },
|
||||
{ id: 'server3', name: 'Server Class 3', price: 75.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS03.png' },
|
||||
|
||||
{ id: 'slot30', name: 'ASA Server Slot x30 days', price: 5.00, category: 'perks', tag: 'Server Perk monthly', img: 'img/ServerSlotX30.png' },
|
||||
{ id: 'mutants', name: 'Mutated Creatures', price: 1.50, category: 'bundles', tag: 'Dino Pack One Time Payment 10 non-breedable', img: 'img/MutatedCretures.png'},
|
||||
{ id: 'starter', name: 'Starter Pack', price: 1.50, category: 'bundles', tag: 'Starter Pack One Time Payment', img: 'img/StarterPack.png'},
|
||||
{ id: 'mutants', name: 'Mutated Creatures', price: 1.50, category: 'bundles', tag: 'Dino Pack One Time Payment 10 non-breedable', img: 'img/MutatedCretures.png' },
|
||||
{ id: 'starter', name: 'Starter Pack', price: 1.50, category: 'bundles', tag: 'Starter Pack One Time Payment', img: 'img/StarterPack.png' },
|
||||
|
||||
{ id: 'supporter1', name: 'ASA Server Supporter Pack 1', price: 5.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 50,000 Points every week🎁 50,000 Bonus Points at the start of each wipe 🏅 Exclusive VIP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP1.png' },
|
||||
{ id: 'supporter2', name: 'ASA Server Supporter Pack 2', price: 10.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 100,000 Points every week🎁 100,000 Bonus Points at the start of each wipe 🏅 Exclusive VIP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP2.png' },
|
||||
{ id: 'supporter3', name: 'ASA Server Supporter Pack 3', price: 15.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 150,000 Points every week🎁 150,000 Bonus Points at the start of each wipe 🏅 Exclusive VIP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP3.png'},
|
||||
{ id: 'supporter4', name: 'ASA Server Supporter Pack 4', price: 20.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 500,000 Points every week🎁 500,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP4.png'},
|
||||
{ id: 'supporter5', name: 'ASA Server Supporter Pack 5', price: 25.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 1,000,000 Points every week🎁 1,000,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP5.png'},
|
||||
{ id: 'supporter6', name: 'ASA Server Supporter Pack 6', price: 35.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 1,500,000 Points every week🎁 1,500,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP6.png'},
|
||||
{ id: 'supporter3', name: 'ASA Server Supporter Pack 3', price: 15.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 150,000 Points every week🎁 150,000 Bonus Points at the start of each wipe 🏅 Exclusive VIP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP3.png' },
|
||||
{ id: 'supporter4', name: 'ASA Server Supporter Pack 4', price: 20.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 500,000 Points every week🎁 500,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP4.png' },
|
||||
{ id: 'supporter5', name: 'ASA Server Supporter Pack 5', price: 25.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 1,000,000 Points every week🎁 1,000,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP5.png' },
|
||||
{ id: 'supporter6', name: 'ASA Server Supporter Pack 6', price: 35.00, category: 'vip', tag: 'Server Perk monthly <br> ✨ Perks Included ✨ 💎 1,500,000 Points every week🎁 1,500,000 Bonus Points at the start of each wipe 🏅 Exclusive MVP Role on Discord 🔒 Access to the Donator - Only Chat', img: 'img/SP6.png' },
|
||||
|
||||
{ id: 'map-small', name: 'Small Map manipulation', price: 5.00, category: 'maps', tag: 'Small Map manipulation Pack One Time Payment', img: 'img/SmallMap.png'},
|
||||
{ id: 'map-small', name: 'Small Map manipulation', price: 5.00, category: 'maps', tag: 'Small Map manipulation Pack One Time Payment', img: 'img/SmallMap.png' },
|
||||
{ id: 'map-medium', name: 'Medium Map manipulation', price: 10.00, category: 'maps', tag: 'Medium Map manipulation Pack One Time Payment', img: 'img/MediumMap.png' },
|
||||
{ id: 'map-large', name: 'Large Map manipulation', price: 15.00, category: 'maps', tag: 'Large Map manipulation Pack One Time Payment', img: 'img/LargeMap.png' },
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue