OPEN-ISP v0.5 (pickle-lime) — rilis open-source perdana
Aplikasi billing & manajemen ISP (fiber optic) — PWA pelanggan, portal teknisi & kolektor, admin panel lengkap, multi-vendor OLT, RADIUS, WhatsApp/Telegram, pembayaran QRIS. Kredit & lisensi (ISC): - Base kode & repo: alijayanet/billing-rtrw oleh Alijaya Net — terima kasih banyak atas base kode dan repo yang bermanfaat. - Add-on: GoWA, LibreSpeed/OpenSpeedTest, Uptime Kuma, notification-forwarder. - Dikembangkan menjadi OPEN-ISP oleh oxpoe — https://github.com/oxpoe/open-isp
This commit is contained in:
commit
eaf05f2811
280 files changed
+123975
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Isolir Redirector
|
||||
* Menerima HTTP request dari pelanggan terisolir (host/path apa pun) dan
|
||||
* mengalihkan (302) ke halaman isolir dinamis milik portal billing.
|
||||
*
|
||||
* Dipakai oleh rule NAT MikroTik: dst-address=<server> to-ports=<PORT ini>.
|
||||
* Karena edge publik (Traefik/NetBird) melakukan 308 ke HTTPS dan TLS hanya
|
||||
* melayani domain kanonik, DNAT polos tidak cukup — harus redirect ke URL kanonik.
|
||||
*/
|
||||
const http = require('http');
|
||||
|
||||
const PORT = parseInt(process.env.ISOLIR_REDIRECT_PORT || '8099', 10);
|
||||
let TARGET = process.env.ISOLIR_REDIRECT_URL || '';
|
||||
|
||||
// Coba ambil target dari settings.json bila tersedia
|
||||
try {
|
||||
const { getSetting } = require('/opt/billing-rtrw/config/settingsManager');
|
||||
const s = getSetting('isolir_portal_url', '') || '';
|
||||
if (s) TARGET = s;
|
||||
} catch (_) { /* abaikan */ }
|
||||
|
||||
if (!TARGET) TARGET = 'http://localhost:3001/isolated';
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
// Jangan cache supaya pelanggan selalu diarahkan ke portal terbaru
|
||||
res.writeHead(302, {
|
||||
Location: TARGET,
|
||||
'Cache-Control': 'no-store, no-cache, must-revalidate, max-age=0',
|
||||
Pragma: 'no-cache',
|
||||
Expires: '0',
|
||||
'Content-Type': 'text/html; charset=utf-8',
|
||||
});
|
||||
res.end(
|
||||
'<!doctype html><meta charset="utf-8"><title>Mengalihkan…</title>' +
|
||||
'<meta http-equiv="refresh" content="0;url=' + TARGET + '">' +
|
||||
'<p>Mengalihkan ke portal pembayaran… <a href="' + TARGET + '">Lanjut</a></p>'
|
||||
);
|
||||
});
|
||||
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`[isolir-redirect] listening on 0.0.0.0:${PORT} -> ${TARGET}`);
|
||||
});
|
||||
|
||||
process.on('SIGTERM', () => { server.close(() => process.exit(0)); });
|
||||
Reference in new issue
Block a user