mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(panoptikon): add library to flake outputs and use
This commit is contained in:
@@ -2,128 +2,106 @@
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
niveumLib,
|
||||
niveumPackages,
|
||||
...
|
||||
}: let
|
||||
kpaste = pkgs.writers.writeDash "kpaste" ''
|
||||
${pkgs.curl}/bin/curl -sS -sS http://p.r --data-binary @"''${1:--}" | ${pkgs.gnused}/bin/sed '$ {p;s|http://p.r|https://p.krebsco.de|}'
|
||||
'';
|
||||
panoptikon = niveumLib.panoptikon {inherit pkgs lib niveumPackages config;};
|
||||
|
||||
url = address:
|
||||
pkgs.writers.writeDash "watch-url" ''
|
||||
${pkgs.w3m}/bin/w3m -dump ${lib.escapeShellArg address}
|
||||
'';
|
||||
irc-xxx = panoptikon.kpaste-irc {
|
||||
target = "#xxx";
|
||||
retiolumLink = true;
|
||||
};
|
||||
|
||||
urlJSON = address:
|
||||
pkgs.writers.writeDash "watch-url-json" ''
|
||||
${pkgs.curl}/bin/curl -sSL ${lib.escapeShellArg address} | ${pkgs.jq}/bin/jq
|
||||
'';
|
||||
|
||||
urlSelector = selector: address:
|
||||
pkgs.writers.writeDash "watch-url-selector" ''
|
||||
${pkgs.curl}/bin/curl -sSL ${lib.escapeShellArg address} \
|
||||
| ${pkgs.htmlq}/bin/htmlq ${lib.escapeShellArg selector} \
|
||||
| ${pkgs.python3Packages.html2text}/bin/html2text
|
||||
'';
|
||||
|
||||
reporters.irc-xxx = pkgs.writers.writeDash "irc-xxx" ''
|
||||
${kpaste} \
|
||||
| ${pkgs.gnused}/bin/sed -n '2s/^/change detected: /p' \
|
||||
| ${config.nur.repos.mic92.ircsink}/bin/ircsink \
|
||||
--nick "$PANOPTIKON_WATCHER"-watcher \
|
||||
--server irc.r \
|
||||
--target '#xxx'
|
||||
'';
|
||||
|
||||
reporters.irc-kmein = pkgs.writers.writeDash "irc-xxx" ''
|
||||
${kpaste} \
|
||||
| ${pkgs.gnused}/bin/sed -n "3s/^/$PANOPTIKON_WATCHER: /p" \
|
||||
| ${config.nur.repos.mic92.ircsink}/bin/ircsink \
|
||||
--nick panoptikon-kmein \
|
||||
--server irc.r \
|
||||
--target 'kmein'
|
||||
'';
|
||||
irc-kmein = panoptikon.kpaste-irc {
|
||||
messagePrefix = "$PANOPTIKON_WATCHER: ";
|
||||
target = "kmein";
|
||||
nick = "panoptikon-kmein";
|
||||
retiolumLink = false;
|
||||
};
|
||||
in {
|
||||
services.panoptikon = {
|
||||
enable = true;
|
||||
watchers = {
|
||||
"github-meta" = {
|
||||
script = urlJSON "https://api.github.com/meta";
|
||||
reporters = [reporters.irc-xxx];
|
||||
script = panoptikon.urlJSON {} "https://api.github.com/meta";
|
||||
reporters = [irc-xxx];
|
||||
};
|
||||
lammla = {
|
||||
script = url "http://lammla.info/index.php?reihe=30";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.url "http://lammla.info/index.php?reihe=30";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
kratylos = {
|
||||
script = url "https://kratylos.reichert-online.org/current_issue/KRATYLOS";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.url "https://kratylos.reichert-online.org/current_issue/KRATYLOS";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
zeno-free = {
|
||||
script = urlSelector ".zenoCOMain" "http://www.zeno.org/Lesesaal/M/E-Books";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector ".zenoCOMain" "http://www.zeno.org/Lesesaal/M/E-Books";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
carolinawelslau = {
|
||||
script = urlSelector "#main" "https://carolinawelslau.de/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#main" "https://carolinawelslau.de/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
lisalittmann = {
|
||||
script = urlSelector "#site-content" "https://lisalittmann.de/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://lisalittmann.de/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
lisalittmann-archive = {
|
||||
script = urlSelector "#site-content" "https://lisalittmann.de/archive/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://lisalittmann.de/archive/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
lisalittmann-projects = {
|
||||
script = urlSelector "#site-content" "https://lisalittmann.de/projects/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://lisalittmann.de/projects/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
tatort = {
|
||||
script = urlSelector ".linklist" "https://www.daserste.de/unterhaltung/krimi/tatort/sendung/index.html";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector ".linklist" "https://www.daserste.de/unterhaltung/krimi/tatort/sendung/index.html";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
warpgrid-idiomarium = {
|
||||
script = urlSelector "#site-content" "https://warpgrid.de/idiomarium/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://warpgrid.de/idiomarium/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
warpgrid-futurism = {
|
||||
script = urlSelector "#site-content" "https://warpgrid.de/futurism/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://warpgrid.de/futurism/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
warpgrid-imagiary = {
|
||||
script = urlSelector "#site-content" "https://warpgrid.de/imagiary/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://warpgrid.de/imagiary/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
warpgrid-alchemy = {
|
||||
script = urlSelector "#site-content" "https://warpgrid.de/alchemy/";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#site-content" "https://warpgrid.de/alchemy/";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
indogermanische-forschungen = {
|
||||
script = urlSelector "#latestIssue" "https://www.degruyter.com/journal/key/INDO/html";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "#latestIssue" "https://www.degruyter.com/journal/key/INDO/html";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
ig-neuigkeiten = {
|
||||
script = urlSelector "[itemprop=articleBody]" "https://www.indogermanistik.org/aktuelles/neuigkeiten.html";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "[itemprop=articleBody]" "https://www.indogermanistik.org/aktuelles/neuigkeiten.html";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
ig-tagungen = {
|
||||
script = urlSelector "[itemprop=articleBody]" "https://www.indogermanistik.org/tagungen/tagungen-der-ig.html";
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlSelector "[itemprop=articleBody]" "https://www.indogermanistik.org/tagungen/tagungen-der-ig.html";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
fxght-or-flxght = {
|
||||
script = pkgs.writers.writeDash "watch-url-json" ''
|
||||
${pkgs.curl}/bin/curl -sSL 'https://api.tellonym.me/profiles/name/fxght.or.flxght?limit=20' \
|
||||
| ${pkgs.jq}/bin/jq '.answers | map(
|
||||
select(.type == "answer")
|
||||
| {
|
||||
question: .tell,
|
||||
answer: .answer,
|
||||
date: .createdAt,
|
||||
media: .media | map(.url)
|
||||
}
|
||||
)'
|
||||
'';
|
||||
reporters = [reporters.irc-kmein];
|
||||
script = panoptikon.urlJSON {
|
||||
jqScript = ''
|
||||
.answers | map(
|
||||
select(.type == "answer")
|
||||
| {
|
||||
question: .tell,
|
||||
answer: .answer,
|
||||
date: .createdAt,
|
||||
media: .media | map(.url)
|
||||
}
|
||||
)
|
||||
'';
|
||||
} "https://api.tellonym.me/profiles/name/fxght.or.flxght?limit=20";
|
||||
reporters = [irc-kmein];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user