diff --git a/.gitignore b/.gitignore index 8abdc28..9d27373 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.rej # html files (as generated from markdown) +style.css *.html # checksums file as used by $ScriptInstallUpdate diff --git a/Makefile b/Makefile index 0265a51..e376e56 100644 --- a/Makefile +++ b/Makefile @@ -2,18 +2,31 @@ # template scripts -> final scripts # markdown files -> html files -CAPSMAN = $(wildcard *.capsman.rsc) -LOCAL = $(wildcard *.local.rsc) -WIFI = $(wildcard *.wifi.rsc) +ALL_RSC := $(wildcard *.rsc */*.rsc) +GEN_RSC := $(wildcard *.capsman.rsc *.local.rsc *.wifi.rsc) -MARKDOWN = $(wildcard *.md doc/*.md doc/mod/*.md) -HTML = $(MARKDOWN:.md=.html) +MARKDOWN := $(wildcard *.md doc/*.md doc/mod/*.md) +HTML := $(MARKDOWN:.md=.html) style.css -all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML) checksums.json +.PHONY: all checksums docs rsc clean -%.html: %.md contrib/html.sh contrib/html.sh.d/head.html +all: checksums docs rsc + +checksums: checksums.json + +checksums.json: contrib/checksums.sh $(ALL_RSC) + contrib/checksums.sh > $@ + +docs: $(HTML) + +style.css: contrib/general/style.css + cp $< $@ + +%.html: %.md style.css contrib/html.sh contrib/html.sh.d/head.html contrib/html.sh $< > $@ +rsc: $(GEN_RSC) + %.capsman.rsc: %.template.rsc Makefile sed -e '/\/interface\/wifi\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.capsman|' \ -e '/^# NOT \/caps-man\/ #$$/,/^# NOT \/caps-man\/ #$$/d' \ @@ -32,8 +45,5 @@ all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML) checksums.json -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \ < $< > $@ -checksums.json: contrib/checksums.sh *.rsc */*.rsc - contrib/checksums.sh - clean: rm -f $(HTML) checksums.json diff --git a/contrib/checksums.sh b/contrib/checksums.sh index b472b49..ab4e973 100755 --- a/contrib/checksums.sh +++ b/contrib/checksums.sh @@ -6,4 +6,4 @@ set -e md5sum $(find -name '*.rsc' | sort) | \ sed -e "s| \./||" -e 's|.rsc$||' | \ - jq --raw-input --null-input '[ inputs | split (" ") | { (.[1]): (.[0]) }] | add' > 'checksums.json' + jq --raw-input --null-input '[ inputs | split (" ") | { (.[1]): (.[0]) }] | add' diff --git a/contrib/general/style.css b/contrib/general/style.css new file mode 100644 index 0000000..a001f07 --- /dev/null +++ b/contrib/general/style.css @@ -0,0 +1,71 @@ +/* stylesheet for RouterOS Scripts */ +body { + font-family: fira-sans, sans-serif; + font-size: 10pt; + background-color: transparent; + margin-left: 10vw; + margin-right: 10vw; +} +h2 { + border-bottom: 1px solid #ccc; + color: #000; +} +a { + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +blockquote { + border-left: 4px solid #ccc; + padding: 0 10px; + color: #777; +} +code { + margin: 0 2px; + padding: 2px 5px; + border: 1px solid #ccc; + background-color: #f8f8f8; + border-radius: 3px; +} +div.notification { + position: relative; + float: right; + width: 600px; + border: 3px outset #6c5d53; + /* border-radius: 5px; */ + padding: 10px; + background-color: #e6e6e6; +} +div.content { + padding-left: 60px; +} +img.logo { + float: left; + border-radius: 50%; +} +p.heading { + margin: 0px; + font-weight: bold; + text-decoration: underline; +} +p.hint { + display: none; +} +pre { + font-family: fira-mono, monospace; + white-space: pre-wrap; + background-color: #f8f8f8; + border: 1px solid #ccc; + overflow: auto; + padding: 6px 10px; + border-radius: 3px; +} +pre code { + margin: 0; + padding: 0; + border: 0; +} +span.link { + color: #863600; +} diff --git a/contrib/html.sh b/contrib/html.sh index bbd8ba8..3b5b420 100755 --- a/contrib/html.sh +++ b/contrib/html.sh @@ -2,7 +2,12 @@ set -e -sed "s|__TITLE__|$(head -n1 "${1}")|" < "${0}.d/head.html" +RELTO="$(dirname "${1}")" +sed \ + -e "s|__TITLE__|$(head -n1 "${1}")|" \ + -e "s|__STYLE__|$(realpath --relative-to="${RELTO}" style.css)|" \ + -e "s|__LOGO__|$(realpath --relative-to="${RELTO}" logo.png)|" \ + < "${0}.d/head.html" markdown -f toc,idanchor "${1}" | sed \ -e 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' \ -e '/| id="\L\1">|' diff --git a/contrib/html.sh.d/head.html b/contrib/html.sh.d/head.html index 1b1dd03..0ce3ff7 100644 --- a/contrib/html.sh.d/head.html +++ b/contrib/html.sh.d/head.html @@ -1,15 +1,6 @@ -RouterOS Scripts :: __TITLE__ - - - + +RouterOS Scripts :: __TITLE__ + + diff --git a/contrib/logo-color.d/style.css b/contrib/logo-color.d/style.css deleted file mode 100644 index eb2ec6a..0000000 --- a/contrib/logo-color.d/style.css +++ /dev/null @@ -1,5 +0,0 @@ -body { - font-family: fira-sans, sans-serif; - font-size: 10pt; - background-color: transparent; -} diff --git a/contrib/logo-color.html b/contrib/logo-color.html index 17942ce..78d19e6 100644 --- a/contrib/logo-color.html +++ b/contrib/logo-color.html @@ -1,14 +1,14 @@ - - - - -RouterOS-Scripts Logo Color Changer - + + +RouterOS Scripts :: Logo Color Changer + + - - + -

RouterOS-Scripts Logo Color Changer

+

Logo Color Changer

+ +

⬅️ Go back to main README

You want the logo for your own notifications? But you joined the Telegram Group and want @@ -36,5 +36,8 @@ for other browsers may differ.)

Set a profile photo for your Telegram bot.

- - +
+ +

⬅️ Go back to main README
+⬆️ Go back to top

+ diff --git a/contrib/notification.d/style.css b/contrib/notification.d/style.css deleted file mode 100644 index 648ea23..0000000 --- a/contrib/notification.d/style.css +++ /dev/null @@ -1,36 +0,0 @@ -body { - font-family: fira-sans, sans-serif; - font-size: 10pt; - background-color: transparent; -} -div.notification { - position: relative; - float: right; - width: 600px; - border: 3px outset #6c5d53; - /* border-radius: 5px; */ - padding: 10px; - background-color: #e6e6e6; -} -div.content { - padding-left: 60px; -} -img.logo { - float: left; - border-radius: 50%; -} -p.heading { - margin: 0px; - font-weight: bold; - text-decoration: underline; -} -p.hint { - display: none; -} -pre { - font-family: fira-mono, monospace; - white-space: pre-wrap; -} -span.link { - color: #863600; -} diff --git a/contrib/notification.html b/contrib/notification.html index 7875036..298e3bd 100644 --- a/contrib/notification.html +++ b/contrib/notification.html @@ -1,14 +1,14 @@ - - - - -RouterOS-Scripts Notification Generator - - - - + + +RouterOS Scripts :: Notification Generator + + + + -

RouterOS-Scripts Notification Generator

+

Notification Generator

+ +

⬅️ Go back to main README

@@ -16,8 +16,8 @@

[MikroTik] ℹ️ Subject

Message
-

⏰ This message was queued since oct/18/2022 18:30:48 and may be obsolete.

-

✂️ The message was too long and has been truncated, cut off 13%!

+

⏰ This message was queued since 2025-10-29 16:06:18 and may be obsolete.

+

✂️ The message was too long and has been truncated, cut off 13%!

@@ -25,11 +25,14 @@

Subject:

Message:

Show link:

-

Queued since

+

Queued since

Cut-off with percent

Then right-click, click "Take Screenshot" and finally select the notification and download it.

- - +
+ +

⬅️ Go back to main README
+⬆️ Go back to top

+ diff --git a/global-functions.rsc b/global-functions.rsc index 5ede654..6323249 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -1310,9 +1310,19 @@ } } do={ $LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "': " . $Err); + :if ($Err != "Fetch failed with status 404") do={ + :error false; + } + :if ($ScriptVal->"source" = "#!rsc by RouterOS\n") do={ $LogPrint warning $0 ("Removing dummy. Typo on installation?"); /system/script/remove $Script; + :error false; + } + :if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \ + [ :len $CheckSum ] = 0) do={ + $LogPrintOnce warning $0 \ + ("Added the script manually? Skip updates with 'ignore=true' in comment."); } :error false; }