add NOTIFY_TITLE - Optional title for notifications, e.g. Pushover, #69

This commit is contained in:
Ralf Vogler 2023-02-23 23:34:27 +01:00
parent e73d3d47d7
commit 114631da4d
3 changed files with 4 additions and 1 deletions

View file

@ -67,6 +67,7 @@ Available options/variables and their default values:
| HEIGHT | 1280 | Height of the opened browser (and of screen for VNC in Docker). | | HEIGHT | 1280 | Height of the opened browser (and of screen for VNC in Docker). |
| VNC_PASSWORD | | VNC password for Docker. No password used by default! | | VNC_PASSWORD | | VNC password for Docker. No password used by default! |
| NOTIFY | | Notification services to use (Pushover, Slack, Telegram...), see below. | | NOTIFY | | Notification services to use (Pushover, Slack, Telegram...), see below. |
| NOTIFY_TITLE | | Optional title for notifications, e.g. for Pushover. |
| BROWSER_DIR | data/browser | Directory for browser profile, e.g. for multiple accounts. | | BROWSER_DIR | data/browser | Directory for browser profile, e.g. for multiple accounts. |
| TIMEOUT | 60 | Timeout for any page action. Should be fine even on slow machines. | | TIMEOUT | 60 | Timeout for any page action. Should be fine even on slow machines. |
| LOGIN_TIMEOUT | 180 | Timeout for login in seconds. Will wait twice (prompt + manual login). | | LOGIN_TIMEOUT | 180 | Timeout for login in seconds. Will wait twice (prompt + manual login). |

View file

@ -15,6 +15,7 @@ export const cfg = {
login_timeout: (Number(process.env.LOGIN_TIMEOUT) || 180) * 1000, // higher timeout for login, will wait twice: prompt + wait for manual login login_timeout: (Number(process.env.LOGIN_TIMEOUT) || 180) * 1000, // higher timeout for login, will wait twice: prompt + wait for manual login
novnc_port: process.env.NOVNC_PORT, // running in docker if set novnc_port: process.env.NOVNC_PORT, // running in docker if set
notify: process.env.NOTIFY, // apprise notification services notify: process.env.NOTIFY, // apprise notification services
notify_title: process.env.NOTIFY_TITLE, // apprise notification title
get dir() { // avoids ReferenceError: Cannot access 'dataDir' before initialization get dir() { // avoids ReferenceError: Cannot access 'dataDir' before initialization
return { return {
browser: process.env.BROWSER_DIR || dataDir('browser'), // for multiple accounts or testing browser: process.env.BROWSER_DIR || dataDir('browser'), // for multiple accounts or testing

View file

@ -101,7 +101,8 @@ import { cfg } from './config.js';
export const notify = (html) => { export const notify = (html) => {
if (!cfg.notify) return; if (!cfg.notify) return;
exec(`apprise ${cfg.notify} -i html -b '${html}'`, (error, stdout, stderr) => { const title = cfg.notify_title ? `-t ${cfg.notify_title}` : '';
exec(`apprise ${cfg.notify} -i html ${title} -b '${html}'`, (error, stdout, stderr) => {
if (error) { if (error) {
console.log(`error: ${error.message}`); console.log(`error: ${error.message}`);
if (error.message.includes('command not found')) { if (error.message.includes('command not found')) {