Compare commits

...

35 commits

Author SHA1 Message Date
Christian Hesse
9911c8a0be Merge branch 'html-class-shadow' into next 2026-05-20 09:16:44 +02:00
Christian Hesse
d08f01c5d3 contrib/logo-color: add class (and shadow) for screenshots 2026-05-20 09:16:44 +02:00
Christian Hesse
9bc9238598 contrib/html: support any class name from image alt text 2026-05-20 09:16:44 +02:00
Christian Hesse
16223b7a03 general/style: add shadow for code blocks 2026-05-20 09:16:44 +02:00
Christian Hesse
024405c43d contrib/html: add class and shadow for screenshots 2026-05-20 09:16:44 +02:00
Christian Hesse
ac28f5661a contrib/html: add a class and shadow for notifications 2026-05-20 09:16:44 +02:00
Christian Hesse
1c15667b7b doc/telegram-chat: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
e1e98bee69 doc/sms-forward: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
5fe68bc79c doc/netwatch-notify: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
9010282a71 doc/mod/scriptrunonce: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
304c936323 doc/mod/notification-telegram: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
643389672f doc/mod/notification-matrix: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
f850e71c27 doc/mod/notification-gotify: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
3bd101472d doc/mod/ipcalc: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
e002259ecb doc/mod/inspectvar: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
dd39f8022b doc/log-forward: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
834f32e70b doc/daily-psk: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
85c26f26e6 doc/collect-wireless-mac: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
9dc23f80af doc/check-routeros-update: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
0470f51e29 doc/check-perpetual-license: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
52a8d19def doc/check-lte-firmware-upgrade: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
801f56377d doc/check-health: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
0b860e46a6 doc/check-certificates: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
ff3e565991 doc/backup-upload: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
f30b560c1b doc/backup-cloud: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
88edc82b06 README: start image alt text with 'notification:' or 'screenshot:' 2026-05-20 09:16:44 +02:00
Christian Hesse
b2db005f6f contrib/html: give the head table a class 2026-05-20 09:16:44 +02:00
Christian Hesse
2589115f50 contrib/html: enclose content in span tag with class 2026-05-20 09:16:44 +02:00
Christian Hesse
d0588231f6 Merge branch 'convert-to-url' into next 2026-05-20 09:16:39 +02:00
Christian Hesse
2c5b708f88 global-functions: deprecate $UrlEncode 2026-05-20 09:04:52 +02:00
Christian Hesse
3cdcd24428 mod/notification-telegram: use :convert for url-encoding 2026-05-20 09:02:13 +02:00
Christian Hesse
ef3edd3b3d mod/notification-ntfy: use :convert for url-encoding 2026-05-20 09:01:16 +02:00
Christian Hesse
7dd3c86fe0 mod/notification-matrix: use :convert for url-encoding 2026-05-20 09:00:33 +02:00
Christian Hesse
f380d0ae66 daily-psk: use :convert for url-encoding 2026-05-20 08:59:25 +02:00
Christian Hesse
332b91e75d check-certificates: use :convert for url-encoding 2026-05-20 08:58:22 +02:00
35 changed files with 94 additions and 92 deletions

View file

@ -226,7 +226,7 @@ everything is up-to-date it will not produce any output.
If the update includes news or requires configuration changes a notification
is sent - in addition to terminal output and log messages.
![news and changes notification](README.d/notification-news-and-changes.avif)
![notification: news and changes](README.d/notification-news-and-changes.avif)
Adding a script
---------------

View file

@ -30,7 +30,6 @@
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitFullyConnected;
:local CheckCertificatesDownloadImport do={
@ -46,11 +45,10 @@
:global FetchUserAgentStr;
:global LogPrint;
:global RmFile;
:global UrlEncode;
:global WaitForFile;
:foreach Type in={ "p12"; "pem" } do={
:local CertFileName ([ $UrlEncode $FetchName ] . "." . $Type);
:local CertFileName ([ :convert to=url $FetchName ] . "." . $Type);
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
"' (file '" . $CertFileName . "')...");
@ -202,7 +200,7 @@
} else={
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ :convert to=url $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ];
:local CertNewVal [ /certificate/get $CertNew ];

View file

@ -17,6 +17,7 @@ markdown -f toc,idanchor "${1}" | sed \
-e '/<h[1234] /s|-2[1789cd]-||g' \
-e '/<h[1234] /s|-3[f]-||g' \
-e '/^<pre>/s|pre|pre class="code" onclick="CopyToClipboard(this)"|g' \
-e '/<img src=".*" alt="[a-z]\+: .*" \/>/s|alt="\([a-z]\+\):|class="\1" alt="\1:|' \
-e '/The above link may be broken on code hosting sites/s|blockquote|blockquote style="display: none;"|'
sed \

View file

@ -1,3 +1,4 @@
</span>
<p class="foot">RouterOS Scripts documentation generated on <i>__DATE__</i> for <i>__VERSION__</i><br />
Copyright &copy; 2013-2026 Christian Hesse &lt;mail@eworm.de&gt;</p>

View file

@ -6,7 +6,7 @@
<script type="text/javascript" src="__GENERAL__/clipboard.js"></script>
</head><body>
<table><tr>
<table class="head"><tr>
<td><img src="__GENERAL__/eworm-meadow.avif" alt="eworm on meadow" /></td>
<td><img src="__GENERAL__/qr-code.png" alt="QR code: rsc.eworm.de" /></td>
<td class="head"><span class="top">RouterOS Scripts</span><br />
@ -14,3 +14,4 @@
</tr></table>
<hr />
<span class="markdown">

View file

@ -40,9 +40,9 @@ something that differentiates? Color it!</p>
<p>Then right-click, click "<i>Take Screenshot</i>" and finally select the
logo and download it.</p>
<p><img src="logo-color.d/browser-01.avif" alt="Screenshot Browser 01"></p>
<p><img src="logo-color.d/browser-02.avif" alt="Screenshot Browser 02"></p>
<p><img src="logo-color.d/browser-03.avif" alt="Screenshot Browser 03"></p>
<p><img src="logo-color.d/browser-01.avif" class="screenshot" alt="screenshot: browser 01"></p>
<p><img src="logo-color.d/browser-02.avif" class="screenshot" alt="screenshot: browser 02"></p>
<p><img src="logo-color.d/browser-03.avif" class="screenshot" alt="screenshot: browser 03"></p>
<p>(This example is with
<a href="https://www.mozilla.org/firefox/">Mozilla Firefox ↗️</a>. The workflow

View file

@ -27,7 +27,6 @@
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
@ -78,7 +77,7 @@
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \

View file

@ -27,7 +27,6 @@
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
@ -77,7 +76,7 @@
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \

View file

@ -28,7 +28,6 @@
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
@ -93,7 +92,7 @@
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \

View file

@ -27,7 +27,6 @@
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
@ -78,7 +77,7 @@
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \

View file

@ -26,7 +26,7 @@ This script uploads
### Sample notification
![backup-cloud notification](backup-cloud.d/notification.avif)
![notification: backup-cloud](backup-cloud.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -26,7 +26,7 @@ configuration export (`/export terse show-sensitive`) to external server.
### Sample notification
![backup-upload notification](backup-upload.d/notification.avif)
![notification: backup-upload](backup-upload.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -21,8 +21,8 @@ certificates that are still about to expire.
### Sample notifications
![check-certificates notification warning](check-certificates.d/notification-01-warn.avif)
![check-certificates notification renew](check-certificates.d/notification-02-renew.avif)
![notification: check-certificates warning](check-certificates.d/notification-01-warn.avif)
![notification: check-certificates renew](check-certificates.d/notification-02-renew.avif)
Requirements and installation
-----------------------------

View file

@ -40,27 +40,27 @@ sensors available in hardware:
#### CPU utilization
![check-health notification cpu utilization high](check-health.d/notification-01-cpu-utilization-high.avif)
![check-health notification cpu utilization ok](check-health.d/notification-02-cpu-utilization-ok.avif)
![notification: check-health cpu utilization high](check-health.d/notification-01-cpu-utilization-high.avif)
![notification: check-health cpu utilization ok](check-health.d/notification-02-cpu-utilization-ok.avif)
#### RAM utilization (low available RAM)
![check-health notification ram utilization high](check-health.d/notification-03-ram-utilization-high.avif)
![check-health notification ram utilization ok](check-health.d/notification-04-ram-utilization-ok.avif)
![notification: check-health ram utilization high](check-health.d/notification-03-ram-utilization-high.avif)
![notification: check-health ram utilization ok](check-health.d/notification-04-ram-utilization-ok.avif)
#### Voltage
![check-health notification voltage](check-health.d/notification-05-voltage.avif)
![notification: check-health voltage](check-health.d/notification-05-voltage.avif)
#### Temperature
![check-health notification temperature high](check-health.d/notification-06-temperature-high.avif)
![check-health notification temperature ok](check-health.d/notification-07-temperature-ok.avif)
![notification: check-health temperature high](check-health.d/notification-06-temperature-high.avif)
![notification: check-health temperature ok](check-health.d/notification-07-temperature-ok.avif)
#### PSU state
![check-health notification state fail](check-health.d/notification-08-state-fail.avif)
![check-health notification state ok](check-health.d/notification-09-state-ok.avif)
![notification: check-health state fail](check-health.d/notification-08-state-fail.avif)
![notification: check-health state ok](check-health.d/notification-09-state-ok.avif)
Requirements and installation
-----------------------------

View file

@ -26,7 +26,7 @@ upgrades. Currently supported LTE hardware:
### Sample notification
![check-lte-firmware-upgrade notification](check-lte-firmware-upgrade.d/notification.avif)
![notification: check-lte-firmware-upgrade](check-lte-firmware-upgrade.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -22,8 +22,8 @@ and sends a notification to warn before expiration.
### Sample notifications
![check-perpetual-license notification warn](check-perpetual-license.d/notification-01-warn.avif)
![check-perpetual-license notification renew](check-perpetual-license.d/notification-02-renew.avif)
![notification: check-perpetual-license warn](check-perpetual-license.d/notification-01-warn.avif)
![notification: check-perpetual-license renew](check-perpetual-license.d/notification-02-renew.avif)
Requirements and installation
-----------------------------

View file

@ -37,8 +37,8 @@ automatically is supported.
### Sample notifications
![check-routeros-update notification found](check-routeros-update.d/notification-01-found.avif)
![check-routeros-update notification neighbor](check-routeros-update.d/notification-02-neighbor.avif)
![notification: check-routeros-update found](check-routeros-update.d/notification-01-found.avif)
![notification: check-routeros-update neighbor](check-routeros-update.d/notification-02-neighbor.avif)
Requirements and installation
-----------------------------
@ -88,7 +88,7 @@ Be notified when run from scheduler or run it manually:
If an update is found you can install it right away.
![Terminal](check-routeros-update.d/terminal.avif)
![screenshot: terminal](check-routeros-update.d/terminal.avif)
Installing script [packages-update](packages-update.md) gives extra options.

View file

@ -24,7 +24,7 @@ and modify it to your needs.
### Sample notification
![collect-wireless-mac notification](collect-wireless-mac.d/notification.avif)
![notification: collect-wireless-mac](collect-wireless-mac.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -21,7 +21,7 @@ passphrase to a pseudo-random string daily.
### Sample notification
![daily-psk notification](daily-psk.d/notification.avif)
![notification: daily-psk](daily-psk.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -37,8 +37,8 @@ log messages and forwards them via notification.
### Sample notifications
![log-forward notification info](log-forward.d/notification-01-info.avif)
![log-forward notification warn](log-forward.d/notification-02-warn.avif)
![notification: log-forward info](log-forward.d/notification-01-info.avif)
![notification: log-forward warn](log-forward.d/notification-02-warn.avif)
Requirements and installation
-----------------------------

View file

@ -33,7 +33,7 @@ Call the function `$InspectVar` with a variable as parameter:
$InspectVar $ModeButton;
![InspectVar](inspectvar.d/01-inspectvar.avif)
![screenshot: InspectVar](inspectvar.d/01-inspectvar.avif)
---
[⬅️ Go back to main README](../../README.md)

View file

@ -43,7 +43,7 @@ It expects an IP address in CIDR notation as argument.
$IPCalc 192.168.88.1/24;
![IPCalc](ipcalc.d/01-ipcalc.avif)
![screenshot: IPCalc](ipcalc.d/01-ipcalc.avif)
### IPCalcReturn
@ -53,7 +53,7 @@ the information in a named array.
:put ([ $IPCalcReturn 192.168.88.1/24 ]->"broadcast");
![IPCalcReturn](ipcalc.d/02-ipcalcreturn.avif)
![screenshot: IPCalcReturn](ipcalc.d/02-ipcalcreturn.avif)
---
[⬅️ Go back to main README](../../README.md)

View file

@ -38,7 +38,7 @@ and the [First Login ↗️](https://gotify.net/docs/first-login) setup. Once
you have a user and account you can start creating apps. Each app is an
independent notification feed for a device or application.
![Create new app](notification-gotify.d/appsetup.avif)
![screenshot: Create new app](notification-gotify.d/appsetup.avif)
On creation apps are assigned a *Token* for authentification, you will need
that in configuration.

View file

@ -74,7 +74,7 @@ and write first part of the configuration:
$SetupMatrixAuthenticate "@example:matrix.org" "v3ry-s3cr3t";
![authenticate](notification-matrix.d/01-authenticate.avif)
![screenshot: authenticate](notification-matrix.d/01-authenticate.avif)
The configuration is written to a new configuration snippet
`global-config-overlay.d/mod/notification-matrix`.
@ -94,7 +94,7 @@ the invite.
$SetupMatrixJoinRoom "!WUcxpSjKyxSGelouhA:matrix.org";
![join room](notification-matrix.d/02-join-room.avif)
![screenshot: join room](notification-matrix.d/02-join-room.avif)
The configuration is appended to the configuration snippet
`global-config-overlay.d/mod/notification-matrix`.

View file

@ -36,7 +36,7 @@ Configuration
Open Telegram, then start a chat with [BotFather ↗️](https://t.me/BotFather) and
create your own bot:
![create new bot](notification-telegram.d/01-newbot.avif)
![screenshot: create new bot](notification-telegram.d/01-newbot.avif)
Set that token from *BotFather* (use your own!) to `TelegramTokenId`, for
now just temporarily:
@ -49,7 +49,7 @@ then send your first message. Any text will do. On your device run
$GetTelegramChatId;
![get chat id](notification-telegram.d/02-getchatid.avif)
![screenshot: get chat id](notification-telegram.d/02-getchatid.avif)
Finally edit `global-config-overlay`, add `TelegramTokenId` with the token
from *BotFather* and `TelegramChatId` with your retrieved chat id. Then
@ -104,7 +104,7 @@ Tips & Tricks
You can use a profile photo for your bot to make it recognizable. Open the
chat with [BotFather ↗️](https://t.me/BotFather) and set it there.
![set profile photo](notification-telegram.d/03-setuserpic.avif)
![screenshot: set profile photo](notification-telegram.d/03-setuserpic.avif)
Have a look at my [Logo Color Changer](../../contrib/logo-color.html)
to create a colored version of this scripts' logo.

View file

@ -50,7 +50,7 @@ The function `$ScriptRunOnce` expects an URL (or name if
$ScriptRunOnce https://rsc.eworm.de/main/doc/mod/scriptrunonce.d/hello-world.rsc;
![ScriptRunOnce](scriptrunonce.d/01-scriptrunonce.avif)
![screenshot: ScriptRunOnce](scriptrunonce.d/01-scriptrunonce.avif)
Giving multiple scripts is possible, separated by comma.

View file

@ -24,8 +24,8 @@ optional parent host is not down to avoid false alerts.
### Sample notifications
![netwatch-notify notification down](netwatch-notify.d/notification-01-down.avif)
![netwatch-notify notification up](netwatch-notify.d/notification-02-up.avif)
![notification: netwatch-notify down](netwatch-notify.d/notification-01-down.avif)
![notification: netwatch-notify up](netwatch-notify.d/notification-02-up.avif)
Requirements and installation
-----------------------------

View file

@ -22,7 +22,7 @@ A broadband interface with SMS support is required.
### Sample notification
![sms-forward notification](sms-forward.d/notification.avif)
![notification: sms-forward](sms-forward.d/notification.avif)
Requirements and installation
-----------------------------

View file

@ -61,13 +61,13 @@ containing `! identity` (exclamation mark, optional space and system's
identity). To query all dynamic ip addresses form a device named "*MikroTik*"
send `! MikroTik`, followed by `/ip/address/print where dynamic;`.
![chat to specific device](telegram-chat.d/01-chat-specific.avif)
![screenshot: chat to specific device](telegram-chat.d/01-chat-specific.avif)
Devices can be grouped to chat with them simultaneously. The default group
"*all*" can be activated by sending `! @all`, which will make all devices
act on your commands.
![chat to all devices](telegram-chat.d/02-chat-all.avif)
![screenshot: chat to all devices](telegram-chat.d/02-chat-all.avif)
Send a single exclamation mark or non-existent identity to make all
devices passive again.
@ -78,7 +78,7 @@ Let's assume you received a message from a device before, and want to send
a command to that device. No need to activate it, you can just reply to
that message.
![reply to message](telegram-chat.d/03-reply.avif)
![screenshot: reply to message](telegram-chat.d/03-reply.avif)
Associated messages are cleared on device reboot.

View file

@ -42,6 +42,12 @@ div.content {
hr {
clear: both;
}
img.notification {
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
}
img.screenshot {
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
}
img.logo {
float: left;
/* border-radius: 50%; */
@ -66,6 +72,7 @@ pre {
pre.code {
background-color: #f8f8f8;
border: 1px solid #ccc;
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
overflow: auto;
padding: 6px 10px;
border-radius: 3px;

View file

@ -7,3 +7,32 @@
#
# deprecated global functions
# https://rsc.eworm.de/
:global UrlEncode;
# url encoding
:set UrlEncode do={
:local Input [ :tostr $1 ];
:if ([ :len $Input ] = 0) do={
:return "";
}
:local Return "";
:local Chars ("\n\r !\"#\$%&'()*+,:;<=>?@[\\]^`{|}~");
:local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27";
"%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F";
"%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" };
:for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ];
:local Replace [ :find $Chars $Char ];
:if ([ :typeof $Replace ] = "num") do={
:set Char ($Subs->$Replace);
}
:set Return ($Return . $Char);
}
:return $Return;
}

View file

@ -82,7 +82,6 @@
:global SymbolByUnicodeName;
:global SymbolForNotification;
:global Unix2Dos;
:global UrlEncode;
:global ValidateSyntax;
:global VersionToNum;
:global WaitDefaultRouteReachable;
@ -1795,33 +1794,6 @@
:return [ :tocrlf [ :tostr $1 ] ];
}
# url encoding
:set UrlEncode do={
:local Input [ :tostr $1 ];
:if ([ :len $Input ] = 0) do={
:return "";
}
:local Return "";
:local Chars ("\n\r !\"#\$%&'()*+,:;<=>?@[\\]^`{|}~");
:local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27";
"%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F";
"%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" };
:for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ];
:local Replace [ :find $Chars $Char ];
:if ([ :typeof $Replace ] = "num") do={
:set Char ($Subs->$Replace);
}
:set Return ($Return . $Char);
}
:return $Return;
}
# basic syntax validation
:set ValidateSyntax do={
:local Code [ :tostr $1 ];

View file

@ -242,7 +242,6 @@
:global FetchUserAgentStr;
:global LogPrint;
:global UrlEncode;
:global MatrixAccessToken;
:global MatrixHomeServer;
@ -251,8 +250,8 @@
:onerror Err {
/tool/fetch check-certificate=yes-without-crl output=none \
http-header-field=({ [ $FetchUserAgentStr $0 ] }) http-method=post http-data="" \
("https://" . $MatrixHomeServer . "/_matrix/client/r0/rooms/" . [ $UrlEncode $MatrixRoom ] . \
"/join?access_token=" . [ $UrlEncode $MatrixAccessToken ]) as-value;
("https://" . $MatrixHomeServer . "/_matrix/client/r0/rooms/" . [ :convert to=url $MatrixRoom ] . \
"/join?access_token=" . [ :convert to=url $MatrixAccessToken ]) as-value;
$LogPrint debug $0 ("Joined the room.");
} do={
$LogPrint error $0 ("Failed joining the room: " . $Err);

View file

@ -80,7 +80,6 @@
:global IfThenElse;
:global LogPrint;
:global SymbolForNotification;
:global UrlEncode;
:local Server [ $EitherOr ($NtfyServerOverride->($Notification->"origin")) $NtfyServer ];
:local User [ $EitherOr ($NtfyServerUserOverride->($Notification->"origin")) $NtfyServerUser ];
@ -92,7 +91,7 @@
:return false;
}
:local Url ("https://" . $Server . "/" . [ $UrlEncode $Topic ]);
:local Url ("https://" . $Server . "/" . [ :convert to=url $Topic ]);
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ]; \
("Priority: " . [ $IfThenElse ($Notification->"silent") "low" "default" ]); \
("Title: " . "[" . $IdentityExtra . $Identity . "] " . ($Notification->"subject")) });

View file

@ -126,7 +126,6 @@
:global LogPrint;
:global ProtocolStrip;
:global SymbolForNotification;
:global UrlEncode;
:local EscapeMD do={
:local Text [ :tostr $1 ];
@ -203,7 +202,7 @@
}
:local Data ([ /tool/fetch check-certificate=yes-without-crl output=user http-method=post \
("https://api.telegram.org/bot" . $TokenId . "/sendMessage") \
http-data=($HTTPData . "&text=" . [ $UrlEncode $Text ]) as-value ]->"data");
http-data=($HTTPData . "&text=" . [ :convert to=url $Text ]) as-value ]->"data");
:set ($TelegramMessageIDs->[ :tostr ([ :deserialize from=json value=$Data ]->"result"->"message_id") ]) 1;
} do={
$LogPrint info $0 ("Failed sending Telegram notification: " . $Err . " - Queuing...");
@ -215,7 +214,7 @@
[ $EscapeMD ("This message was queued since _" . [ /system/clock/get date ] . \
" " . [ /system/clock/get time ] . "_ and may be obsolete.") "plain" "_" ]);
:set ($TelegramQueue->[ :len $TelegramQueue ]) { tokenid=$TokenId;
http-data=($HTTPData . "&text=" . [ $UrlEncode $Text ]) };
http-data=($HTTPData . "&text=" . [ :convert to=url $Text ]) };
:if ([ :len [ /system/scheduler/find where name="_FlushTelegramQueue" ] ] = 0) do={
/system/scheduler/add name="_FlushTelegramQueue" interval=1m start-time=startup \
on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;");