feat: complete v1 — QR invoice generator with i18n, short URLs, offline support
- XMR address validation (standard, subaddress, integrated) - Amount in XMR/EUR/USD/CHF with CoinGecko conversion - QR code generation with monero: URI - Shareable short URLs (/s/abc123) via self-hosted PHP backend - i18n (DE/EN) with browser language detection - Service worker for offline capability - Dark mode, responsive design
This commit is contained in:
28
s.php
Normal file
28
s.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$code = trim($_SERVER['PATH_INFO'] ?? $_GET['c'] ?? '', '/');
|
||||
|
||||
if (empty($code) || !preg_match('/^[a-z0-9]{4,10}$/', $code)) {
|
||||
http_response_code(404);
|
||||
echo 'Not found';
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbFile = __DIR__ . '/data/urls.json';
|
||||
if (!file_exists($dbFile)) {
|
||||
http_response_code(404);
|
||||
echo 'Not found';
|
||||
exit;
|
||||
}
|
||||
|
||||
$urls = json_decode(file_get_contents($dbFile), true) ?: [];
|
||||
|
||||
if (!isset($urls[$code])) {
|
||||
http_response_code(404);
|
||||
echo 'Not found';
|
||||
exit;
|
||||
}
|
||||
|
||||
$hash = $urls[$code];
|
||||
$base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
|
||||
header('Location: ' . $base . '/#' . $hash, true, 302);
|
||||
exit;
|
||||
Reference in New Issue
Block a user