First (untested) payment and db setup

This commit is contained in:
jwinterm
2025-06-01 14:17:29 -04:00
parent f02e16272e
commit bd97d9d848
14 changed files with 4525 additions and 264 deletions
+35
View File
@@ -53,6 +53,41 @@
</button>
</div>
<!-- Payment System UI -->
<div id="payment-ui" class="payment-section" style="display: none; background: rgba(0,50,0,0.9); border: 2px solid #0f0; padding: 10px; margin: 5px; color: #0f0;">
<div class="payment-header">
<strong>🎮 Game Mode Selection</strong>
<button id="close-payment" style="float: right; background: #500; color: #f00; border: 1px solid #f00; padding: 2px 6px;">✕</button>
</div>
<div class="game-modes" style="margin: 10px 0;">
<div class="mode-option" data-mode="FREE" style="padding: 8px; margin: 5px 0; border: 1px solid #555; cursor: pointer;">
<strong>🆓 FREE PLAY</strong> - No cost, no rewards
</div>
<div class="mode-option" data-mode="PAID_SINGLE" style="padding: 8px; margin: 5px 0; border: 1px solid #555; cursor: pointer;">
<strong>💰 PAID SINGLE</strong> - 0.005 XMR per game, 2x payout for escape, 3x with treasure
</div>
<div class="mode-option" data-mode="PAID_CREDITS" style="padding: 8px; margin: 5px 0; border: 1px solid #555; cursor: pointer;">
<strong>🎫 CREDITS PACKAGE</strong> - 0.03 XMR for 10 games, no payouts
</div>
</div>
<div id="credits-display" style="margin: 10px 0; display: none;">
<strong>Credits remaining: <span id="credits-count">0</span></strong>
</div>
<div id="payment-details" style="display: none; margin: 10px 0;">
<div><strong>Payment Required:</strong></div>
<div>Amount: <span id="payment-amount">0</span> XMR</div>
<div>Address: <input id="payment-address" type="text" readonly style="width: 100%; background: #000; color: #0f0; border: 1px solid #0f0; padding: 5px;"></div>
<div style="margin: 10px 0;">
<button id="copy-address" style="background: #050; color: #0f0; border: 1px solid #0f0; padding: 5px 10px;">📋 Copy Address</button>
<button id="check-payment" style="background: #005; color: #0f0; border: 1px solid #0f0; padding: 5px 10px;">🔄 Check Payment</button>
</div>
<div id="payment-status" style="margin: 10px 0; font-weight: bold;"></div>
</div>
</div>
<!-- Game display -->
<div id="game-display" class="rotdis"></div>
+60
View File
@@ -33,6 +33,10 @@ const SocketHandlers = {
socket.on('game_over', this.onGameOver);
socket.on('queue_cancelled', this.onQueueCancelled);
// Payment/Address handlers
socket.on('address_detected', this.onAddressDetected);
socket.on('address_confirmed', this.onAddressConfirmed);
// Block height handler (broadcast to all clients)
socket.on('blockheight', this.onBlockHeight);
},
@@ -209,6 +213,62 @@ const SocketHandlers = {
UI.updateBlockHeight(height);
$('#statusValue').text('Connected');
$('#statusValue').css('color', '#0f0');
},
onAddressDetected: function(data) {
// Handle address detection confirmation request
console.log('Address detected:', data);
// Display the confirmation message with styling
const confirmationHtml = `
<div class="address-confirmation" style="
background: #ffe066;
color: #333;
padding: 10px;
margin: 5px 0;
border-radius: 4px;
border-left: 4px solid #f0ad4e;
">
<strong>🔍 ADDRESS DETECTED</strong><br>
<strong>Type:</strong> ${data.type}<br>
<strong>Address:</strong> <code style="word-break: break-all; font-size: 11px;">${data.address}</code><br><br>
<strong style="color: #d9534f;">⚠️ WARNING: Verify this is YOUR address!</strong><br>
<strong style="color: #d9534f;">⚠️ Clipboard viruses can change addresses!</strong><br><br>
Type <strong>"confirm"</strong> to set as payout address or <strong>"cancel"</strong> to reject.
</div>
`;
$('#messages').append($(confirmationHtml));
UI.scrollChat();
// Focus chat input for easy confirmation
setTimeout(() => {
$('#chatInput').focus();
}, 100);
},
onAddressConfirmed: function(data) {
// Handle successful address confirmation
console.log('Address confirmed:', data);
const confirmationHtml = `
<div class="address-confirmed" style="
background: #d4edda;
color: #155724;
padding: 10px;
margin: 5px 0;
border-radius: 4px;
border-left: 4px solid #28a745;
">
<strong>✅ PAYOUT ADDRESS CONFIRMED</strong><br>
<strong>Type:</strong> ${data.type}<br>
<strong>Address:</strong> <code style="word-break: break-all; font-size: 11px;">${data.address}</code><br><br>
Future winnings will be sent to this address.
</div>
`;
$('#messages').append($(confirmationHtml));
UI.scrollChat();
}
};