Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
renomureza committed Apr 3, 2021
0 parents commit a00cecb
Show file tree
Hide file tree
Showing 20 changed files with 1,414 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
Binary file added monipel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions monipel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Monipel | Mikmoni Template Login Hotspot

Template login hotspot RouterOS ini dirancang untuk pelanggan mikmoni, meskipun demikian pengguna umum juga bisa menggunakan template ini, namun mungkin perlu beberapa penyesuaian.

Template ini juga dibuat agar lebih mudah diatur oleh pengguna awam, pengguna hanya perlu mengubah beberapa nilai untuk menyesuaikan halaman login.

## Konfigurasi

Buka file `config.js`, ubah sesuai kebutuhan.

### Mengaktifkan/Menonaktifkan Metode Login

Untuk mengaktifkan metode login, ubah bagian metode login di dalam blok `loginMethod` menjadi `true`, untuk menonaktifkan ubah menjadi `false`.

Untuk menentukan default metode login, dimana ketika pengguna membuka halaman login dan metode ini yang akan ditampil terlebih dahulu, ubah bagian `default` ke metode yang diinginkan (`member`, `voucher`, `qrCode`) pasti metode tersebut disetel ke `true`.

Contoh di bawah ini akan mengaktifkan metode login Member dan Voucher, QR Code dimatikan, sementara metode login defaultnya disetel menggunakan voucher.

```javascript
//...
loginMethod: {
member: true,
voucher: true,
qrCode: false,
default: "voucher", // member, voucher, qrCode
}
//...
```

### QR Code Scanner

Jika Anda mengaktifkan metode login `qrCode` masukkan URL tempat pengguna memindai QR Code voucher, jika tidak abaikan.

```javascript
// ...
qrCodeScannerURL: "https://example.com/qrcode-scanner",
// ..
```

Pengguna tentunya harus bisa mengunjungi URL/domain tersebut meskipun mereka belum login, oleh karena itu silahkan buka Terminal di Winbox kemudian copy paste kode di bawah kemudian enter.

```
/ip hotspot walled-garden ip add action=accept comment="Mikmoni" disabled=no dst-host=*.mikmoni.com
```

**Apa Artinya Perintah di Atas?**

Pengguna hotspot termasuk yang tidak login akan bisa mengakses situs yang ditujukan pada nilai `dst-host` dalam hal ini `mikmoni.com` termasuk subdomainnya.

Selain bisa dimanfaatkan untuk tujuan pemindaian QR Code, fitur ini juga bisa berguna jika Anda ingin menyematkan video/audio berukuran besar untuk menghiasi halaman login, alih-alih menyimpannya di penyimpanan RouterOS yang dapat mempersempit ruang penyimpanan, Anda bisa menyematkan video/audio ke halaman login melalui URL.

**Aktifkan HTTP PAP**

Agar metode login melalui QR Code ini dapat berjalan dengan baik kita perlu mengaktifkan HTTP PAP di RouterOS.

1. Buka **Winbox**
2. **IP**
3. **Hotspot**
4. **Server Profile**
5. _pilih server profile yang digunakan_
6. **Login**
7.**HTTP PAP**

### Mengaktifkan Pemeriksa Expired Voucher

Secara default beberapa informasi yang ditampilkan pada halaman status dihitung dalam satu sesi, misalnya nilai Uptime, ketika pengguna keluar itu akan dihitung mulai dari awal lagi.

Oleh karena itu mikmoni menyediakan route/URL khusus untuk memeriksa informasi voucher tanpa batas sesi termasuk masa aktif (expired), URL ini bisa kita dapat melalui halaman dashboard daftar Router.

URL ini akan mengembalikan data pengguna hotspot dalam format JSON:

```json
{
"data": {
".id": "*5",
"server": "hotspot1",
"name": "OD32N",
"password": "5DQMQ",
"mac-address": "XX:XX:XX:XX:XX:XX",
"profile": "1Hari",
"uptime": "22s",
"bytes-in": "23937",
"bytes-out": "24147",
"packets-in": "186",
"packets-out": "156",
"dynamic": "false",
"disabled": "false",
"comment": "apr/04/2021 20:25:02"
}
}
```

Di template ini kita hanya menggunakan masa aktif voucher yang diambil dari nilai comment, namun Anda bisa memanfaatkan data yang dikembalikan untuk menampilkan data yang lain di halaman status jika dibutuhkan.

Mari kita lihat pada file `config.js`:

```javascript
//...
expiredChecker: {
active: false,
URL: "https://example.com/v1/expired",
token: "69ee773d4xxxxxxxx:00628cdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
}
//...
```

Jika Anda tidak memerlukan fitur ini, atur nilai `active` menjadi `false` dan abaikan bagian yang lain. Namun jika Anda ingin mengaktifkan fitur ini, atur nilainya menjadi `true`.

Ubah nilai `URL` dan `token` dengan nilai yang digenerate dari halaman daftar Router.

Sama seperti QR Code Scanner, Ini juga memerlukan konfigurasi Walled Garden karena nantinya pengguna akan mengirim permintaan ke luar. Jika Anda sebelumnya sudah menjalankan perintah di bawah di Terminal Winbox tidak perlu lagi menjalankan perintah ini, kalau belum silahkan salin dan tempelkan.

Perintahnya sama seperti QR Code Scanner, biar Anda tidak perlu scroll saya sisipkan lagi:

```
/ip hotspot walled-garden ip add action=accept comment="Mikmoni" disabled=no dst-host=*.mikmoni.com
```

## Laporkan Masalah

Jika Anda menemukan masalah silahkan laporkan.
35 changes: 35 additions & 0 deletions monipel/alogin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="2; url=$(link-redirect)" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#06f" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="./style.css" />
<title>Redirect | Hotspot</title>
<script>
function startClock() {
$(if popup == 'true')
open('$(link-status)', 'hotspot_status', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=1,width=290,height=200');
$(endif)
location.href = './success.html';
}
</script>
</head>
<body onload="startClock()">
<div class="container">
<div class="wrapper">
<div class="title-wrapper">
<h1>Berhasil Terhubung!</h1>
<p>Jika belum, <a href="./login">klik di sini</a></p>
</div>
</div>
</div>

<script>
document.title = `Redirect | ${window.location.hostname}`;
</script>
</body>
</html>
16 changes: 16 additions & 0 deletions monipel/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const config = {
loginMethod: {
member: true,
voucher: true,
qrCode: true,
default: "member", // member, voucher, qrCode
},
qrCodeScannerURL: "https://example.com/qrcode-scanner",
expiredChecker: {
active: false,
URL: "https://example.com/v1/expired",
token: "69ee773d4xxxxxxxx:00628cdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
};

export default config;
28 changes: 28 additions & 0 deletions monipel/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="expires" content="-1" />
<meta name="theme-color" content="#06f" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="./style.css" />
<title>Error | Hotspot</title>
</head>
<body>
<div class="container">
<div class="wrapper">
<div class="title-wrapper">
<h1>Error</h1>
<p class="error">$(error)</p>
<p><a href="$(link-login)">Kembali ke halaman login</a></p>
</div>
</div>
</div>

<script>
document.title = `Error | ${window.location.hostname}`;
</script>
</body>
</html>
104 changes: 104 additions & 0 deletions monipel/errors-en.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This file contains error messages which are shown to user, when http/https
# login is used.
# These messages can be changed to make user interface more friendly, including
# translations to different languages.
#
# Various variables can be used here as well. Most frequently used ones are:
# $(error-orig) - original error message from hotspot
# $(ip) - ip address of a client
# $(username) - username of client trying to log in

# internal-error
# It should never happen. If it will, error page will be shown
# displaying this error message (error-orig will describe what has happened)

internal-error = internal error ($(error-orig))

# config-error
# Should never happen if hotspot is configured properly.

config-error = configuration error ($(error-orig))

# not-logged-in
# Will happen, if status or logout page is requested by user,
# which actually is not logged in

not-logged-in = you are not logged in (ip $(ip))

# ippool-empty
# IP address for user is to be assigned from ip pool, but there are no more
# addresses in that pool

ippool-empty = cannot assign ip address - no more free addresses from pool

# shutting-down
# When shutdown is executed, new clients are not accepted

shutting-down = hotspot service is shutting down

# user-session-limit
# If user profile has limit of shared-users, then this error will be shown
# after reaching this limit

user-session-limit = no more sessions are allowed for user $(username)

# license-session-limit
# Depending on licence number of active hotspot clients is limited to
# one or another amount. If this limit is reached, following error is displayed.

license-session-limit = session limit reached ($(error-orig))

# wrong-mac-username
# If username looks like MAC address (12:34:56:78:9a:bc), but is not
# a MAC address of this client, login is rejected

wrong-mac-username = invalid username ($(username)): this MAC address is not yours

# chap-missing
# If http-chap login method is used, but hotspot program does not receive
# back encrypted password, this error message is shown.
# Possible reasons of failure:
# - JavaScript is not enabled in web browser;
# - login.html page is not valid;
# - challenge value has expired on server (more than 1h of inactivity);
# - http-chap login method is recently removed;
# If JavaScript is enabled and login.html page is valid,
# then retrying to login usually fixes this problem.

chap-missing = web browser did not send challenge response (try again, enable JavaScript)

# invalid-username
# Most general case of invalid username or password. If RADIUS server
# has sent an error string with Access-Reject message, then it will
# override this setting.

invalid-username = invalid username or password

# invalid-mac
# Local users (on hotspot server) can be bound to some MAC address. If login
# from different MAC is tried, this error message will be shown.

invalid-mac = user $(username) is not allowed to log in from this MAC address

# uptime-limit, traffic-limit
# For local hotspot users in case if limits are reached

uptime-limit = user $(username) has reached uptime limit
traffic-limit = user $(username) has reached traffic limit

# radius-timeout
# User is authenticated by RADIUS server, but no response is received from it,
# following error will be shown.

radius-timeout = RADIUS server is not responding

# auth-in-progress
# Authorization in progress. Client already has issued an authorization request
# which is not yet complete.

auth-in-progress = already authorizing, retry later

# radius-reply
# Radius server returned some custom error message

radius-reply = $(error-orig)
74 changes: 74 additions & 0 deletions monipel/errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# internal-error
# Ini tidak akan ditampilkan jika memiliki halaman kesalahan, halaman ini akan ditampilkan.
# menampilkan pesan kesalahan ini (error-orig akan menjelaskan apa yang telah terjadi)
internal-error = Kesalahan internal ($(error-orig)).

# config-error
# Seharusnya tidak terjadi jika hotspot dikonfigurasi dengan benar.
config-error = Kesalahan konfigurasi ($(error-orig)).

# not-logged-in
# Akan tampil jika status atau halaman logout diminta oleh pengguna,
# yang sebenarnya belum masuk
not-logged-in = Anda belum masuk (ip $(ip)).

# ippool-empty
# Alamat IP pengguna akan ditetapkan dari kumpulan ip (IP Pool), tetapi tidak ada lagi alamat di IP Pool.
ippool-empty = Tidak dapat menetapkan alamat IP - Alamat IP dari Pool habis.

# shutting-down
# Saat shutdown dijalankan, klien baru tidak diterima
shutting-down = Layanan hotspot sedang ditutup.

# user-session-limit
# Jika profil pengguna memiliki batas pengguna bersama, maka kesalahan ini akan ditampilkan setelah mencapai batas
user-session-limit = Voucher $(username) sedang digunakan .

# license-session-limit
# Bergantung pada nomor lisensi dari klien hotspot aktif yang dibatasi
# satu atau jumlah lain. Jika batas ini tercapai, kesalahan berikut akan ditampilkan.
license-session-limit = Batas durasi penggunaan voucher habis ($(error-orig)).

# wrong-mac-username
# Jika nama pengguna terlihat seperti alamat MAC (12:34:56:78:9a:bc), tetapi bukan
# alamat MAC klien ini, login ditolak
wrong-mac-username = Voucher tidak sesuai ($(username)): MAC address ini bukan milik Anda.

# chap-missing
# Jika metode login http-chap digunakan, tetapi program hotspot tidak menerima kembalian sandi terenkripsi, pesan kesalahan ini ditampilkan.
# Kemungkinan penyebab kegagalan:
# - JavaScript tidak diaktifkan di browser web;
# - halaman login.html tidak valid;
# - nilai tantangan telah kedaluwarsa di server (lebih dari 1 jam tidak aktif);
# - Metode login http-chap baru saja dihapus;
# Jika JavaScript diaktifkan dan halaman login.html valid, coba masuk kembali biasanya memperbaiki masalah ini.
chap-missing = Browser tidak mengirimkan tanggapanan tantangan (Coba lagi, pastikan JavaScript browser aktif).

# invalid-username
# Kasus paling umum dari nama pengguna atau kata sandi tidak valid. Jika server RADIUS
# telah mengirim string kesalahan dengan pesan Access-Reject, maka itu akan menimpa pengaturan ini.
invalid-username = Voucher tidak sesuai, masukkan kembali dengan benar.

# invalid-mac
# Pengguna lokal (di server hotspot) dapat terikat ke beberapa alamat MAC. Jika login
# dari MAC yang berbeda, pesan kesalahan ini akan ditampilkan.
invalid-mac = Voucher $(username) tidak diizinkan untuk masuk dari alamat MAC ini.

# uptime-limit, traffic-limit
# Untuk pengguna hotspot lokal jika batas tercapai
uptime-limit = Voucher $(username) telah mencapai batas waktu.
traffic-limit = Voucher $(username) telah mencapai batas kuota.

# radius-timeout
# Pengguna diautentikasi oleh server RADIUS, tetapi tidak ada tanggapan yang diterima darinya,
# kesalahan berikut akan ditampilkan.
radius-timeout = RADIUS server tidak merespon.

# auth-in-progress
# Otorisasi sedang berlangsung. Klien sudah mengeluarkan permintaan otorisasi
# yang belum selesai.
auth-in-progress = Otorisasi sedang berlangung, coba lagi beberapa saat.

# radius-reply
# Server Radius mengembalikan beberapa pesan kesalahan khusus
radius-reply = Kesalahan dari server Radius $(error-orig).
Binary file added monipel/favicon.ico
Binary file not shown.
Loading

0 comments on commit a00cecb

Please sign in to comment.