mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-03-31 06:24:00 -04:00
Implemented KIOSK_EMAIL environment variable. Lowered log output from unifi.js. Implemented kiosk email toggle. Fixed missing kiosk printer check causing errors. Updated README.md
This commit is contained in:
20
README.md
20
README.md
@@ -39,6 +39,17 @@ UniFi Voucher Site is a web-based platform for generating and managing UniFi net
|
||||
|
||||
---
|
||||
|
||||
## Version Compatibility
|
||||
|
||||
| UniFi Voucher Site | Cloud Gateways | Cloud Key | UniFi Network Server | UniFi OS Server | UniFi OS | UniFi Network |
|
||||
|------------------------------------------------------------------------------------------|----------------|-----------|----------------------|-----------------|----------|---------------|
|
||||
| ≥ 8.x | ✔️ | ✔️ | ✖️ | ✔️ | v4.2.8+ | v9.1.119+ |
|
||||
| [≤ 7.x](https://github.com/glenndehaan/unifi-voucher-site/tree/7.2.2#unifi-voucher-site) | ✔️ | ✔️ | ✔️ | ✔️ | - | v5.4.9+ |
|
||||
|
||||
> **Note**: Running the Legacy UniFi Network Server but want to upgrade to 8.x? Follow the official guide to migrate to UniFi OS Server: https://help.ui.com/hc/en-us/articles/34210126298775-Self-Hosting-UniFi
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- UniFi OS v4.2.8+
|
||||
@@ -137,6 +148,8 @@ services:
|
||||
KIOSK_VOUCHER_TYPES: '480,1,,,;'
|
||||
# Enable/disable the requirement for a guest to enter their name before generating a voucher
|
||||
KIOSK_NAME_REQUIRED: 'false'
|
||||
# Enable/disable the email voucher button (Requires SMTP to be setup)
|
||||
KIOSK_EMAIL: 'false'
|
||||
# Enable/disable a printer for Kiosk Vouchers (this automatically prints vouchers), currently supported: escpos ip (Example: 192.168.1.10)
|
||||
KIOSK_PRINTER: ''
|
||||
# Enable/disable an override to redirect to the Kiosk on the / url (Also enables a link from the Kiosk back to the Admin UI)
|
||||
@@ -204,6 +217,7 @@ The structure of the file should use lowercase versions of the environment varia
|
||||
"kiosk_enabled": false,
|
||||
"kiosk_voucher_types": "480,1,,,;",
|
||||
"kiosk_name_required": false,
|
||||
"kiosk_email": false,
|
||||
"kiosk_printer": "",
|
||||
"kiosk_homepage": false,
|
||||
"log_level": "info",
|
||||
@@ -712,6 +726,12 @@ KIOSK_VOUCHER_TYPES: '480,1,,,;'
|
||||
- Set to `'true'` to enable the requirement for a guest to enter their name before generating a voucher.
|
||||
- Set to `'false'` to disable to allow generation of vouchers without a name.
|
||||
|
||||
- **`KIOSK_EMAIL`**:
|
||||
- Set to `'true'` to enable the email voucher form.
|
||||
- Set to `'false'` to disable hide the email voucher form.
|
||||
|
||||
> **Note**: SMTP needs to be setup before the email form is shown!
|
||||
|
||||
* **`KIOSK_PRINTER`**:
|
||||
|
||||
* Set this to the IP address of an ESC/POS-compatible network printer to enable automatic voucher printing.
|
||||
|
||||
@@ -86,7 +86,7 @@ module.exports = {
|
||||
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
|
||||
error: req.flashMessage.type === 'error',
|
||||
error_text: req.flashMessage.message || '',
|
||||
email_enabled: variables.smtpFrom !== '' && variables.smtpHost !== '' && variables.smtpPort !== '',
|
||||
email_enabled: variables.kioskEmail && variables.smtpFrom !== '' && variables.smtpHost !== '' && variables.smtpPort !== '',
|
||||
unifiSsid: variables.unifiSsid,
|
||||
unifiSsidPassword: variables.unifiSsidPassword,
|
||||
qr: await qr(),
|
||||
@@ -142,10 +142,12 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Auto print voucher if enabled
|
||||
await print.escpos(voucherData, req.locale.language, variables.kioskPrinter).catch((e) => {
|
||||
log.error(`[Kiosk] Unable to auto-print voucher on printer: ${variables.kioskPrinter}!`);
|
||||
log.error(e);
|
||||
});
|
||||
if(variables.kioskPrinter !== '') {
|
||||
await print.escpos(voucherData, req.locale.language, variables.kioskPrinter).catch((e) => {
|
||||
log.error(`[Kiosk] Unable to auto-print voucher on printer: ${variables.kioskPrinter}!`);
|
||||
log.error(e);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('kiosk', {
|
||||
t: translation('kiosk', req.locale.language),
|
||||
@@ -154,7 +156,7 @@ module.exports = {
|
||||
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
|
||||
error: req.flashMessage.type === 'error',
|
||||
error_text: req.flashMessage.message || '',
|
||||
email_enabled: variables.smtpFrom !== '' && variables.smtpHost !== '' && variables.smtpPort !== '',
|
||||
email_enabled: variables.kioskEmail && variables.smtpFrom !== '' && variables.smtpHost !== '' && variables.smtpPort !== '',
|
||||
unifiSsid: variables.unifiSsid,
|
||||
unifiSsidPassword: variables.unifiSsidPassword,
|
||||
qr: await qr(),
|
||||
|
||||
@@ -93,7 +93,7 @@ module.exports = {
|
||||
fetch('/hotspot/vouchers', 'GET', {
|
||||
limit: 10000
|
||||
}).then((vouchers) => {
|
||||
log.info(`[UniFi] Found ${vouchers.length} voucher(s)`);
|
||||
log.debug(`[UniFi] Found ${vouchers.length} voucher(s)`);
|
||||
resolve(vouchers.sort((a, b) => {
|
||||
if (a.createdAt > b.createdAt) return -1;
|
||||
if (a.createdAt < b.createdAt) return 1;
|
||||
@@ -118,7 +118,7 @@ module.exports = {
|
||||
// limit: 10000
|
||||
// }).then((clients) => {
|
||||
// console.log(clients);
|
||||
// log.info(`[UniFi] Found ${clients.length} guest(s)`);
|
||||
// log.debug(`[UniFi] Found ${clients.length} guest(s)`);
|
||||
// }).catch((e) => {
|
||||
// log.error('[UniFi] Error while getting guests!');
|
||||
// log.debug(e);
|
||||
|
||||
@@ -42,6 +42,7 @@ module.exports = {
|
||||
kioskEnabled: config('kiosk_enabled') || (process.env.KIOSK_ENABLED === 'true') || false,
|
||||
kioskVoucherTypes: config('kiosk_voucher_types') || process.env.KIOSK_VOUCHER_TYPES || '480,1,,,;',
|
||||
kioskNameRequired: config('kiosk_name_required') || (process.env.KIOSK_NAME_REQUIRED === 'true') || false,
|
||||
kioskEmail: config('kiosk_email') || (process.env.KIOSK_EMAIL === 'true') || false,
|
||||
kioskPrinter: config('kiosk_printer') || process.env.KIOSK_PRINTER || '',
|
||||
kioskHomepage: config('kiosk_homepage') || (process.env.KIOSK_HOMEPAGE === 'true') || false,
|
||||
logLevel: config('log_level') || process.env.LOG_LEVEL || 'info',
|
||||
|
||||
Reference in New Issue
Block a user