diff options
Diffstat (limited to 'config/services/web')
| -rw-r--r-- | config/services/web/dav/default.nix | 15 | ||||
| -rw-r--r-- | config/services/web/default.nix | 27 | ||||
| -rw-r--r-- | config/services/web/git/about.html | 3 | ||||
| -rw-r--r-- | config/services/web/git/cgit.css | 943 | ||||
| -rw-r--r-- | config/services/web/git/default.nix | 49 | ||||
| -rw-r--r-- | config/services/web/git/head.html | 1 | ||||
| -rw-r--r-- | config/services/web/quentin/default.nix | 20 | ||||
| -rw-r--r-- | config/services/web/rss/DeutschLernenDeutscheWelleBridge.php | 39 | ||||
| -rw-r--r-- | config/services/web/rss/FipAlbumsBridge.php | 56 | ||||
| -rw-r--r-- | config/services/web/rss/MaisonDeLaRadioBridge.php | 137 | ||||
| -rw-r--r-- | config/services/web/rss/RandonavigoBridge.php | 33 | ||||
| -rw-r--r-- | config/services/web/rss/default.nix | 45 | ||||
| -rw-r--r-- | config/services/web/webkeydirectory/default.nix | 25 | ||||
| -rw-r--r-- | config/services/web/webkeydirectory/hu/44hqjnz5rw4mrr9d18fmecyskbmwxetw | bin | 0 -> 3578 bytes |
14 files changed, 1393 insertions, 0 deletions
diff --git a/config/services/web/dav/default.nix b/config/services/web/dav/default.nix new file mode 100644 index 0000000..06b9639 --- /dev/null +++ b/config/services/web/dav/default.nix @@ -0,0 +1,15 @@ +{ config, ... }: + +{ + services.nginx.virtualHosts.dav = { + serverName = "dav.${config.networking.domain}"; + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:5232/"; # default radicale host + extraConfig = '' + proxy_redirect default; + ''; + }; + }; +} diff --git a/config/services/web/default.nix b/config/services/web/default.nix new file mode 100644 index 0000000..cb7038f --- /dev/null +++ b/config/services/web/default.nix @@ -0,0 +1,27 @@ +{ ... }: + +{ + imports = [ + ./dav + ./git + ./quentin + ./rss + ./webkeydirectory + ]; + + security.acme = { + acceptTerms = true; + defaults.email = "quentin@aristote.fr"; + }; + + services.nginx = { + enable = true; + # return 444 when trying to connect to some unknown virtual host + virtualHosts."_" = { + default = true; + extraConfig = '' + return 444; + ''; + }; + }; +} diff --git a/config/services/web/git/about.html b/config/services/web/git/about.html new file mode 100644 index 0000000..32f909c --- /dev/null +++ b/config/services/web/git/about.html @@ -0,0 +1,3 @@ +<p> + This website lists <a href="https://quentin.aristote.fr/">my</a> personal Git repositories. See also the Git repositories for <a href="https://git.eleves.ens.fr/qaristote">my student projects</a> and for <a href="https://gitlab.math.univ-paris-diderot.fr/aristote">my professional projects</a>. +</p> diff --git a/config/services/web/git/cgit.css b/config/services/web/git/cgit.css new file mode 100644 index 0000000..633fead --- /dev/null +++ b/config/services/web/git/cgit.css @@ -0,0 +1,943 @@ +/* inspired by https://github.com/MatejaMaric/responsive-cgit-css */ + +div#cgit { + padding: 0em; + margin: 0em; + font-family: sans-serif; + font-size: 10pt; + color: #333; + background: white; + padding: 4px; +} + +div#cgit a { + color: blue; + text-decoration: none; +} + +div#cgit a:hover { + text-decoration: underline; +} + +div#cgit table { + border-collapse: collapse; +} + +div#cgit table#header { + width: 100%; + margin-bottom: 1em; +} + +div#cgit table#header td.logo { + width: 96px; + vertical-align: top; +} + +div#cgit table#header td.main { + font-size: 250%; + padding-left: 10px; + white-space: nowrap; +} + +div#cgit table#header td.main a { + color: #000; +} + +div#cgit table#header td.form { + text-align: right; + vertical-align: bottom; + padding-right: 1em; + padding-bottom: 2px; + white-space: nowrap; +} + +div#cgit table#header td.form form, +div#cgit table#header td.form input, +div#cgit table#header td.form select { + font-size: 90%; +} + +div#cgit table#header td.sub { + color: #777; + border-top: solid 1px #ccc; + padding-left: 10px; +} + +div#cgit table.tabs { + border-bottom: solid 3px #ccc; + border-collapse: collapse; + margin-top: 2em; + margin-bottom: 0px; + width: 100%; +} + +div#cgit table.tabs td { + padding: 0px 1em; + vertical-align: bottom; +} + +div#cgit table.tabs td a { + padding: 2px 0.75em; + color: #777; + font-size: 110%; +} + +div#cgit table.tabs td a.active { + color: #000; + background-color: #ccc; +} + +div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after { + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgAhcJDQY+gm2TAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVkIHdpdGggR0lNUGQuZQcAAABbSURBVAhbY2BABs4MU4CwhYHBh2Erww4wrGFQZHjI8B8IgUIscJWyDHcggltQhI4zGDCcRwhChPggHIggP1QoAVmQkSETrGoHsiAEsACtBYN0oDAMbgU6EBcAAL2eHUt4XUU4AAAAAElFTkSuQmCC); + opacity: 0.5; + margin: 0 0 0 5px; +} + +div#cgit table.tabs td.form { + text-align: right; +} + +div#cgit table.tabs td.form form { + padding-bottom: 2px; + font-size: 90%; + white-space: nowrap; +} + +div#cgit table.tabs td.form input, +div#cgit table.tabs td.form select { + font-size: 90%; +} + +div#cgit div.path { + margin: 0px; + padding: 5px 2em 2px 2em; + color: #000; + background-color: #eee; +} + +div#cgit div.content { + margin: 0px; + padding: 2em; + border-bottom: solid 3px #ccc; +} + + +div#cgit table.list { + width: 100%; + border: none; + border-collapse: collapse; +} + +div#cgit table.list tr { + background: white; +} + +div#cgit table.list tr.logheader { + background: #eee; +} + +div#cgit table.list tr:nth-child(even) { + background: #f7f7f7; +} + +div#cgit table.list tr:nth-child(odd) { + background: white; +} + +div#cgit table.list tr:hover { + background: #eee; +} + +div#cgit table.list tr.nohover { + background: white; +} + +div#cgit table.list tr.nohover:hover { + background: white; +} + +div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { + background: #f7f7f7; +} + +div#cgit table.list tr.nohover-highlight:hover:nth-child(odd) { + background: white; +} + +div#cgit table.list th { + font-weight: bold; + /* color: #888; + border-top: dashed 1px #888; + border-bottom: dashed 1px #888; + */ + padding: 0.1em 0.5em 0.05em 0.5em; + vertical-align: baseline; +} + +div#cgit table.list td { + border: none; + padding: 0.1em 0.5em 0.1em 0.5em; +} + +div#cgit table.list td.commitgraph { + font-family: monospace; + white-space: pre; +} + +div#cgit table.list td.commitgraph .column1 { + color: #a00; +} + +div#cgit table.list td.commitgraph .column2 { + color: #0a0; +} + +div#cgit table.list td.commitgraph .column3 { + color: #aa0; +} + +div#cgit table.list td.commitgraph .column4 { + color: #00a; +} + +div#cgit table.list td.commitgraph .column5 { + color: #a0a; +} + +div#cgit table.list td.commitgraph .column6 { + color: #0aa; +} + +div#cgit table.list td.logsubject { + font-family: monospace; + font-weight: bold; +} + +div#cgit table.list td.logmsg { + font-family: monospace; + white-space: pre; + padding: 0 0.5em; +} + +div#cgit table.list td a { + color: black; +} + +div#cgit table.list td a.ls-dir { + font-weight: bold; + color: #00f; +} + +div#cgit table.list td a:hover { + color: #00f; +} + +div#cgit img { + border: none; +} + +div#cgit input#switch-btn { + margin: 2px 0px 0px 0px; +} + +div#cgit td#sidebar input.txt { + width: 100%; + margin: 2px 0px 0px 0px; +} + +div#cgit table#grid { + margin: 0px; +} + +div#cgit td#content { + vertical-align: top; + padding: 1em 2em 1em 1em; + border: none; +} + +div#cgit div#summary { + vertical-align: top; + margin-bottom: 1em; +} + +div#cgit table#downloads { + float: right; + border-collapse: collapse; + border: solid 1px #777; + margin-left: 0.5em; + margin-bottom: 0.5em; +} + +div#cgit table#downloads th { + background-color: #ccc; +} + +div#cgit div#blob { + border: solid 1px black; +} + +div#cgit div.error { + color: red; + font-weight: bold; + margin: 1em 2em; +} + +div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit .ls-mod { + font-family: monospace; +} + +div#cgit td.ls-size { + text-align: right; + font-family: monospace; + width: 10em; +} + +div#cgit td.ls-mode { + font-family: monospace; + width: 10em; +} + +div#cgit table.blob { + margin-top: 0.5em; + border-top: solid 1px black; +} + +div#cgit table.blob td.hashes, +div#cgit table.blob td.lines { + margin: 0; padding: 0 0 0 0.5em; + vertical-align: top; + color: black; +} + +div#cgit table.blob td.linenumbers { + margin: 0; padding: 0 0.5em 0 0.5em; + vertical-align: top; + text-align: right; + border-right: 1px solid gray; +} + +div#cgit table.blob pre { + padding: 0; margin: 0; +} + +div#cgit table.blob td.linenumbers a, +div#cgit table.ssdiff td.lineno a { + color: gray; + text-align: right; + text-decoration: none; +} + +div#cgit table.blob td.linenumbers a:hover, +div#cgit table.ssdiff td.lineno a:hover { + color: black; +} + +div#cgit table.blame td.hashes, +div#cgit table.blame td.lines, +div#cgit table.blame td.linenumbers { + padding: 0; +} + +div#cgit table.blame td.hashes div.alt, +div#cgit table.blame td.lines div.alt { + padding: 0 0.5em 0 0.5em; +} + +div#cgit table.blame td.linenumbers div.alt { + padding: 0 0.5em 0 0; +} + +div#cgit table.blame div.alt:nth-child(even) { + background: #eee; +} + +div#cgit table.blame div.alt:nth-child(odd) { + background: white; +} + +div#cgit table.blame td.lines > div { + position: relative; +} + +div#cgit table.blame td.lines > div > pre { + padding: 0 0 0 0.5em; + position: absolute; + top: 0; +} + +div#cgit table.bin-blob { + margin-top: 0.5em; + border: solid 1px black; +} + +div#cgit table.bin-blob th { + font-family: monospace; + white-space: pre; + border: solid 1px #777; + padding: 0.5em 1em; +} + +div#cgit table.bin-blob td { + font-family: monospace; + white-space: pre; + border-left: solid 1px #777; + padding: 0em 1em; +} + +div#cgit table.nowrap td { + white-space: nowrap; +} + +div#cgit table.commit-info { + border-collapse: collapse; + margin-top: 1.5em; +} + +div#cgit div.cgit-panel { + float: right; + margin-top: 1.5em; +} + +div#cgit div.cgit-panel table { + border-collapse: collapse; + border: solid 1px #aaa; + background-color: #eee; +} + +div#cgit div.cgit-panel th { + text-align: center; +} + +div#cgit div.cgit-panel td { + padding: 0.25em 0.5em; +} + +div#cgit div.cgit-panel td.label { + padding-right: 0.5em; +} + +div#cgit div.cgit-panel td.ctrl { + padding-left: 0.5em; +} + +div#cgit table.commit-info th { + text-align: left; + font-weight: normal; + padding: 0.1em 1em 0.1em 0.1em; + vertical-align: top; +} + +div#cgit table.commit-info td { + font-weight: normal; + padding: 0.1em 1em 0.1em 0.1em; +} + +div#cgit div.commit-subject { + font-weight: bold; + font-size: 125%; + margin: 1.5em 0em 0.5em 0em; + padding: 0em; +} + +div#cgit div.commit-msg { + white-space: pre; + font-family: monospace; +} + +div#cgit div.notes-header { + font-weight: bold; + padding-top: 1.5em; +} + +div#cgit div.notes { + white-space: pre; + font-family: monospace; + border: solid 1px #ee9; + background-color: #ffd; + padding: 0.3em 2em 0.3em 1em; + float: left; +} + +div#cgit div.notes-footer { + clear: left; +} + +div#cgit div.diffstat-header { + font-weight: bold; + padding-top: 1.5em; +} + +div#cgit table.diffstat { + border-collapse: collapse; + border: solid 1px #aaa; + background-color: #eee; +} + +div#cgit table.diffstat th { + font-weight: normal; + text-align: left; + text-decoration: underline; + padding: 0.1em 1em 0.1em 0.1em; + font-size: 100%; +} + +div#cgit table.diffstat td { + padding: 0.2em 0.2em 0.1em 0.1em; + font-size: 100%; + border: none; +} + +div#cgit table.diffstat td.mode { + white-space: nowrap; +} + +div#cgit table.diffstat td span.modechange { + padding-left: 1em; + color: red; +} + +div#cgit table.diffstat td.add a { + color: green; +} + +div#cgit table.diffstat td.del a { + color: red; +} + +div#cgit table.diffstat td.upd a { + color: blue; +} + +div#cgit table.diffstat td.graph { + width: 500px; + vertical-align: middle; +} + +div#cgit table.diffstat td.graph table { + border: none; +} + +div#cgit table.diffstat td.graph td { + padding: 0px; + border: 0px; + height: 7pt; +} + +div#cgit table.diffstat td.graph td.add { + background-color: #5c5; +} + +div#cgit table.diffstat td.graph td.rem { + background-color: #c55; +} + +div#cgit div.diffstat-summary { + color: #888; + padding-top: 0.5em; +} + +div#cgit table.diff { + width: 100%; +} + +div#cgit table.diff td { + font-family: monospace; + white-space: pre; +} + +div#cgit table.diff td div.head { + font-weight: bold; + margin-top: 1em; + color: black; +} + +div#cgit table.diff td div.hunk { + color: #009; +} + +div#cgit table.diff td div.add { + color: green; +} + +div#cgit table.diff td div.del { + color: red; +} + +div#cgit .sha1 { + font-family: monospace; + font-size: 90%; +} + +div#cgit .left { + text-align: left; +} + +div#cgit .right { + text-align: right; +} + +div#cgit table.list td.reposection { + font-style: italic; + color: #888; +} + +div#cgit a.button { + font-size: 80%; + padding: 0em 0.5em; +} + +div#cgit a.primary { + font-size: 100%; +} + +div#cgit a.secondary { + font-size: 90%; +} + +div#cgit td.toplevel-repo { + +} + +div#cgit table.list td.sublevel-repo { + padding-left: 1.5em; +} + +div#cgit ul.pager { + list-style-type: none; + text-align: center; + margin: 1em 0em 0em 0em; + padding: 0; +} + +div#cgit ul.pager li { + display: inline-block; + margin: 0.25em 0.5em; +} + +div#cgit ul.pager a { + color: #777; +} + +div#cgit ul.pager .current { + font-weight: bold; +} + +div#cgit span.age-mins { + font-weight: bold; + color: #080; +} + +div#cgit span.age-hours { + color: #080; +} + +div#cgit span.age-days { + color: #040; +} + +div#cgit span.age-weeks { + color: #444; +} + +div#cgit span.age-months { + color: #888; +} + +div#cgit span.age-years { + color: #bbb; +} + +div#cgit span.insertions { + color: #080; +} + +div#cgit span.deletions { + color: #800; +} + +div#cgit div.footer { + margin-top: 0.5em; + text-align: center; + font-size: 80%; + color: #ccc; +} + +div#cgit div.footer a { + color: #ccc; + text-decoration: none; +} + +div#cgit div.footer a:hover { + text-decoration: underline; +} + +div#cgit a.branch-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #88ff88; + border: solid 1px #007700; +} + +div#cgit a.tag-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ffff88; + border: solid 1px #777700; +} + +div#cgit a.tag-annotated-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ffcc88; + border: solid 1px #777700; +} + +div#cgit a.remote-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ccccff; + border: solid 1px #000077; +} + +div#cgit a.deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ff8888; + border: solid 1px #770000; +} + +div#cgit div.commit-subject a.branch-deco, +div#cgit div.commit-subject a.tag-deco, +div#cgit div.commit-subject a.tag-annotated-deco, +div#cgit div.commit-subject a.remote-deco, +div#cgit div.commit-subject a.deco { + margin-left: 1em; + font-size: 75%; +} + +div#cgit table.stats { + border: solid 1px black; + border-collapse: collapse; +} + +div#cgit table.stats th { + text-align: left; + padding: 1px 0.5em; + background-color: #eee; + border: solid 1px black; +} + +div#cgit table.stats td { + text-align: right; + padding: 1px 0.5em; + border: solid 1px black; +} + +div#cgit table.stats td.total { + font-weight: bold; + text-align: left; +} + +div#cgit table.stats td.sum { + color: #c00; + font-weight: bold; +/* background-color: #eee; */ +} + +div#cgit table.stats td.left { + text-align: left; +} + +div#cgit table.vgraph { + border-collapse: separate; + border: solid 1px black; + height: 200px; +} + +div#cgit table.vgraph th { + background-color: #eee; + font-weight: bold; + border: solid 1px white; + padding: 1px 0.5em; +} + +div#cgit table.vgraph td { + vertical-align: bottom; + padding: 0px 10px; +} + +div#cgit table.vgraph div.bar { + background-color: #eee; +} + +div#cgit table.hgraph { + border: solid 1px black; + width: 800px; +} + +div#cgit table.hgraph th { + background-color: #eee; + font-weight: bold; + border: solid 1px black; + padding: 1px 0.5em; +} + +div#cgit table.hgraph td { + vertical-align: middle; + padding: 2px 2px; +} + +div#cgit table.hgraph div.bar { + background-color: #eee; + height: 1em; +} + +div#cgit table.ssdiff { + width: 100%; +} + +div#cgit table.ssdiff td { + font-size: 75%; + font-family: monospace; + white-space: pre; + padding: 1px 4px 1px 4px; + border-left: solid 1px #aaa; + border-right: solid 1px #aaa; +} + +div#cgit table.ssdiff td.add { + color: black; + background: #cfc; + min-width: 50%; +} + +div#cgit table.ssdiff td.add_dark { + color: black; + background: #aca; + min-width: 50%; +} + +div#cgit table.ssdiff span.add { + background: #cfc; + font-weight: bold; +} + +div#cgit table.ssdiff td.del { + color: black; + background: #fcc; + min-width: 50%; +} + +div#cgit table.ssdiff td.del_dark { + color: black; + background: #caa; + min-width: 50%; +} + +div#cgit table.ssdiff span.del { + background: #fcc; + font-weight: bold; +} + +div#cgit table.ssdiff td.changed { + color: black; + background: #ffc; + min-width: 50%; +} + +div#cgit table.ssdiff td.changed_dark { + color: black; + background: #cca; + min-width: 50%; +} + +div#cgit table.ssdiff td.lineno { + color: black; + background: #eee; + text-align: right; + width: 3em; + min-width: 3em; +} + +div#cgit table.ssdiff td.hunk { + color: black; + background: #ccf; + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; +} + +div#cgit table.ssdiff td.head { + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; +} + +div#cgit table.ssdiff td.head div.head { + font-weight: bold; + color: black; +} + +div#cgit table.ssdiff td.foot { + border-top: solid 1px #aaa; + border-left: none; + border-right: none; + border-bottom: none; +} + +div#cgit table.ssdiff td.space { + border: none; +} + +div#cgit table.ssdiff td.space div { + min-height: 3em; +} + +@media only screen and (max-width: 800px) { + /* FORMS */ + /* hide forms */ + div#cgit td.form { + display: none; + } + + /* HEADER */ + /* wrap title text */ + div#cgit table#header td.main { + white-space: normal; + } + /* Don't display author (save space) */ + div#cgit table#header td.sub.right { + display: none; + } + + /* CONTENT */ + div#cgit div.content { + overflow-x: auto; + padding: 0.5em; + } + td.ls-mode { + white-space: nowrap; + } + + /* TABLES */ + div#cgit table.nowrap td { + white-space: normal; + } + div#cgit table.list td { + vertical-align: top; + } + div#cgit { + span.age-mins, span.age-hours, span.age-days, span.age-weeks, span.age-months, span.age-years { + white-space: nowrap; + } + } + + + /* PANEL ALIGNMENT */ + div#cgit div.cgit-panel { + float: left; + } +}
\ No newline at end of file diff --git a/config/services/web/git/default.nix b/config/services/web/git/default.nix new file mode 100644 index 0000000..5223927 --- /dev/null +++ b/config/services/web/git/default.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + scanPath = "/srv/git"; + gitconfig = '' + [safe] + directory = ${scanPath}/* + ''; +in +{ + services.cgit.default = { + enable = true; + inherit scanPath; + gitHttpBackend = { + enable = true; + checkExportOkFiles = false; + }; + nginx.virtualHost = "git"; + settings = { + head-include = "${./head.html}"; + root-title = "repositories"; + root-desc = "by Quentin Aristote"; + root-readme = "${./about.html}"; + source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; + clone-prefix = "https://git.aristote.fr"; + section-from-path = 1; + snapshots = "tar.gz tar.bz2 tar.xz"; # for nix support + enable-index-owner = 0; + }; + }; + + services.nginx.virtualHosts.git = { + serverName = "git.${config.networking.domain}"; + enableACME = true; + forceSSL = true; + locations."= /cgit.css".alias = lib.mkForce ./cgit.css; + }; + + # give access to the repos + users.users.cgit.extraGroups = [ "git" ]; + ## for the http backend + systemd.services.fcgiwrap-cgit-default.environment.XDG_CONFIG_HOME = + "${pkgs.writeTextDir "git/config" gitconfig}"; +} diff --git a/config/services/web/git/head.html b/config/services/web/git/head.html new file mode 100644 index 0000000..44dca77 --- /dev/null +++ b/config/services/web/git/head.html @@ -0,0 +1 @@ +<meta name="viewport" content="width=device-width initial-scale=1.0"/> diff --git a/config/services/web/quentin/default.nix b/config/services/web/quentin/default.nix new file mode 100644 index 0000000..7194190 --- /dev/null +++ b/config/services/web/quentin/default.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + pkgs, + ... +}: { + services.nginx.virtualHosts.quentin = { + serverName = "quentin.${config.networking.domain}"; + locations."/".root = "${pkgs.personal.webpage}"; + forceSSL = true; + enableACME = true; + extraConfig = '' + add_header Cache-Control no-cache; + add_header Content-Security-Policy "default-src 'none'; form-action 'none'; frame-ancestors 'none'; font-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline';"; + ''; + }; + + # automatically fetch (non-structural) website updates when updating the system + personal.system.autoUpgrade.autoUpdateInputs = lib.mkOptionDefault ["personal-webpage/data"]; +} diff --git a/config/services/web/rss/DeutschLernenDeutscheWelleBridge.php b/config/services/web/rss/DeutschLernenDeutscheWelleBridge.php new file mode 100644 index 0000000..710f8e6 --- /dev/null +++ b/config/services/web/rss/DeutschLernenDeutscheWelleBridge.php @@ -0,0 +1,39 @@ +<?php + +class DeutschLernenDeutscheWelleBridge extends XPathAbstract { + const NAME = 'Deutsche Welle Lernen Bridge'; + const URI = 'https://learngerman.dw.com/de/'; + const DESCRIPTION = 'Cost-free German-learning material'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 3600; // 24h + + const PARAMETERS = [ + '' => [ + 'id' => [ + 'name' => 'Identifier', + 'type' => 'text', + 'description' => 'An identifier of the shape [a-z]-[0-9]*. Found at the end of the target URL.', + 'exampleValue' => 's-60040484' + ] + ] + ]; + + const XPATH_EXPRESSION_ITEM = '//div[@class="teaser-wrap"]/a'; + const XPATH_EXPRESSION_ITEM_TITLE = './@title'; + const XPATH_EXPRESSION_ITEM_URI = './@href'; + // not given + // const XPATH_EXPRESSION_ITEM_AUTHOR = + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime'; + // requires javascript + // const XPATH_EXPRESSION_ITEM_ENCLOSURES = './figure/img[2]/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './div[2]/span[1]/text()'; + + + public function getIcon() { + return 'https://learngerman.dw.com/favicon.png'; + } + + public function getSourceUrl() { + return self::URI . $this->getInput('id'); + } +} diff --git a/config/services/web/rss/FipAlbumsBridge.php b/config/services/web/rss/FipAlbumsBridge.php new file mode 100644 index 0000000..aa5e597 --- /dev/null +++ b/config/services/web/rss/FipAlbumsBridge.php @@ -0,0 +1,56 @@ +<?php + +$GLOBALS['DATE_FORMATTER'] = new IntlDateFormatter( + 'fr-FR', + IntlDateFormatter::FULL, + IntlDateFormatter::SHORT, + 'Etc/UTC', + IntlDateFormatter::GREGORIAN, + "d MMMM y" +); + +class FipAlbumsBridge extends XPathAbstract { + const NAME = 'Fip Albums Bridge'; + const URI = 'https://www.radiofrance.fr/fip/albums/'; + const DESCRIPTION = 'Albums promoted by Fip.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 86400; // 6h + + const PARAMETERS = [ + '' => [ + 'category' => [ + 'name' => 'Category', + 'type' => 'text', + 'description' => 'See examples for available options.', + 'exampleValue' => 'can be empty, "selections" or "album-jazz-de-la-semaine"' + ] + ] + ]; + + const XPATH_EXPRESSION_ITEM = '//div[starts-with(@class, "CardSide ")]'; + const XPATH_EXPRESSION_ITEM_TITLE = './/a/@aria-label'; + const XPATH_EXPRESSION_ITEM_CONTENT = './/img/@alt'; + const XPATH_EXPRESSION_ITEM_URI = './/a/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './/div[starts-with(@class, "title-zone ")]/p[2]/text()'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/div[starts-with(@class, "AdditionalInfos ")]/p[1]/text()'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[starts-with(@class, "AdditionalInfos ")]/p[2]/text()'; + + public function getSourceUrl() { + return self::URI . $this->getInput('category'); + } + + public function getIcon() { + return 'https://www.radiofrance.fr/dist/favicons/fip/favicon.png'; + } + + protected function formatItemTimestamp($value) { + $monthyear = explode(": ", $value)[1]; + return $GLOBALS['DATE_FORMATTER']->parse('1 ' . $monthyear); + } + + # enclosure links don't have an extension + protected function cleanMediaUrl($mediaUrl) { + return $mediaUrl; + } +} diff --git a/config/services/web/rss/MaisonDeLaRadioBridge.php b/config/services/web/rss/MaisonDeLaRadioBridge.php new file mode 100644 index 0000000..7fd4b4f --- /dev/null +++ b/config/services/web/rss/MaisonDeLaRadioBridge.php @@ -0,0 +1,137 @@ +<?php + +$GLOBALS['DATE_FORMATTER'] = new IntlDateFormatter( + 'fr-FR', + IntlDateFormatter::FULL, + IntlDateFormatter::SHORT, + 'Etc/UTC', + IntlDateFormatter::GREGORIAN, + "dd MMMM y EEEE hh'h'mm" +); + +class MaisonDeLaRadioBridge extends XPathAbstract { + const NAME = 'Maison de la Radio Bridge'; + const URI = 'https://www.maisondelaradioetdelamusique.fr/agenda'; + const DESCRIPTION = 'Agenda of the Maison de la Radio et de la Musique.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 3600; // 1h + + const FEED_SOURCE_URL = 'https://www.maisondelaradioetdelamusique.fr/agenda'; + const XPATH_EXPRESSION_ITEM = '//div[@class="hero-header--agenda text-white"]'; + const XPATH_EXPRESSION_ITEM_TITLE = './/div[@class="Bolder-Large-XL mb-5 field_title"]'; + const XPATH_EXPRESSION_ITEM_URI = './/div[@class="d-flex"]//a/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './/div[@class="d-flex flex-column"]/div[2]'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/div[@class="date text-uppercase text-center"]'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/div[@class="bg-wrapper"]/img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[@class="SurTitre mb-5 field_event_type"]/text()'; + + const PARAMETERS = array( + '' => array ( + 'type' => array( + 'name' => 'Type', + 'type' => 'list', + 'title' => 'Concert types.', + 'values' => array( + 'Tous' => 0, + 'Concert' => 2543, + 'Émission en public' => 1270, + 'Évènement' => 1273, + 'Rencontre' => 1272, + 'Exposition' => 1768, + 'Festival' => 2544, + 'Conert jeune public' => 1482 + ) + ), + 'genre' => array( + 'name' => 'Genre', + 'type' => 'list', + 'title' => 'Music genre.', + 'values' => array( + 'Tous' => 0, + 'Symphonique' => '1207', + 'Opéra' => '1212', + 'Musique baroque' => '1208', + 'Musique chorale' => '1211', + 'Musique de film' => '2542', + 'Récital et musique de chambre' => '1210', + 'Orgue' => '1214', + 'Jazz' => '1761', + 'Création contemporaine' => '1215', + 'Concert Jeune public' => '2584', + 'Tournée' => '2583', + 'Pop, rock et électro' => '2541', + 'Concert Fip' => '1225', + 'Atelier musical' => '1258', + 'Masterclasse' => '1251', + 'Concerts du soir et avant-concerts pour les scolaires' => '2560', + 'Concerts jeune public pour le champ social' =>'2581' + ) + ), + 'formation' => array( + 'name' => 'Formation', + 'type' => 'list', + 'title' => 'Performing formations.', + 'values' => array( + 'Tous' => 0, + 'Orchestre Philharmonique de Radio France' => '864%2B2660%2B3333', + 'Orchestre National de France' => '861%2B1786', + 'Chœur de Radio France' => '703%2B2946', + 'Maîtrise de Radio France' => '832%2B2947' + ) + ), + 'chef' => array( + 'name' => 'Chef', + 'type' => 'number', + 'title' => 'ID of the conductor (optional).', + 'exampleValue' => '53', + ), + 'compositeur' => array( + 'name' => 'Compositeur', + 'type' => 'number', + 'title' => 'ID of the composer (optional).', + 'exampleValue' => '131', + ), + 'soliste' => array( + 'name' => 'Soliste', + 'type' => 'number', + 'title' => 'ID of the solist (optional).', + 'exampleValue' => '3064', + ) + ) + ); + + public function getSourceUrl() { + $query = 'layout=row' . '&a-partir=' . date('Y-m-d'); + foreach(self::PARAMETERS[''] as $param => $paramSpec) { + $val = $this->getInput($param); + if($val != 0 && !is_null($val)) { + if($paramSpec['type'] == 'list') { + $assignmentOp = '[]='; + } else { + $assignmentOp = '='; + } + $query = $query . '&' . $param . $assignmentOp . $val; + } + } + return self::URI . '?' . $query; + } + + public function getIcon() { + return 'https://rf-maisondelaradio-production.s3.eu-west-3.amazonaws.com/s3fs-public/mdlrfavicon22.ico'; + } + + protected function getExpressionItemContent() { + return 'string(.//div[contains(@class, "Serif-small")])'; + } + protected function formatItemContent($value) { + $normalizedWhitespace = preg_replace('/\s\s+/m', ' ', $value); + return preg_replace('/\s*,/', ',', $normalizedWhitespace); + } + + protected function getExpressionItemTimestamp() { + return 'normalize-space(concat(string(' . self::XPATH_EXPRESSION_ITEM_TIMESTAMP . '), .//div[@class="d-flex flex-column"]/div[1]))'; + } + protected function formatItemTimestamp($value) { + return $GLOBALS['DATE_FORMATTER']->parse($value); + } +} diff --git a/config/services/web/rss/RandonavigoBridge.php b/config/services/web/rss/RandonavigoBridge.php new file mode 100644 index 0000000..ebc64c2 --- /dev/null +++ b/config/services/web/rss/RandonavigoBridge.php @@ -0,0 +1,33 @@ +<?php + +class RandonavigoBridge extends XPathAbstract { + const NAME = 'Randonavigo Bridge'; + const URI = 'https://www.randonavigo.fr/'; + const DESCRIPTION = 'Hiking trails in Île-de-France.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 86400; // 24h + + const FEED_SOURCE_URL = 'https://www.randonavigo.fr/'; + const XPATH_EXPRESSION_ITEM = '//article'; + const XPATH_EXPRESSION_ITEM_TITLE = './/h2/a/text()'; + const XPATH_EXPRESSION_ITEM_CONTENT = './div/div[1]/div[2]/text()'; + const XPATH_EXPRESSION_ITEM_URI = './a/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './div/div[1]/div[1]/div/text()'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './a/@href'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './a//img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './div/div[2]//a/@title'; + + public function getIcon() { + return 'https://www.randonavigo.fr/apple-touch-icon.png'; + } + + protected function formatItemTimestamp($value) { + $pattern = "/\/([0-9]+)/"; + preg_match_all($pattern, $value, $matches); + return strtotime(join('-', $matches[1])); + } + + protected function cleanMediaUrl($value) { + return $value; + } +} diff --git a/config/services/web/rss/default.nix b/config/services/web/rss/default.nix new file mode 100644 index 0000000..8884aee --- /dev/null +++ b/config/services/web/rss/default.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + ... +}: +let + cfg = config.services.rss-bridge; +in +{ + services.rss-bridge = { + enable = true; + config.system.enabled_bridges = [ "Instagram" ]; + extraBridges = [ + { + name = "Randonavigo"; + source = ./RandonavigoBridge.php; + } + { + name = "DeutschLernenDeutscheWelle"; + source = ./DeutschLernenDeutscheWelleBridge.php; + } + # Music + { + name = "FipAlbums"; + source = ./FipAlbumsBridge.php; + } + ## Concerts + { + name = "MaisonDeLaRadio"; + source = ./MaisonDeLaRadioBridge.php; + } + ]; + virtualHost = "rss"; + }; + + services.nginx = lib.mkIf (cfg.virtualHost != null) { + virtualHosts.${cfg.virtualHost} = { + serverName = "rss.${config.networking.domain}"; + forceSSL = true; + enableACME = true; + }; + }; + + systemd.services.phpfpm-rss-bridge.personal.monitor = true; +} diff --git a/config/services/web/webkeydirectory/default.nix b/config/services/web/webkeydirectory/default.nix new file mode 100644 index 0000000..cf96119 --- /dev/null +++ b/config/services/web/webkeydirectory/default.nix @@ -0,0 +1,25 @@ +{ config, ... }: + +let + webkeydirectoryPath = "/.well-known/openpgpkey/${config.networking.domain}"; +in +{ + services.nginx.virtualHosts.webkeydirectory = { + serverName = "openpgpkey.${config.networking.domain}"; + locations = { + "${webkeydirectoryPath}/hu/" = { + alias = "${./hu}/"; + extraConfig = '' + default_type "application/octet-stream"; + add_header Access-Control-Allow-Origin * always; + ''; + }; + "=${webkeydirectoryPath}/policy".alias = builtins.toFile "policy" ""; + "/".extraConfig = '' + return 444; + ''; + }; + forceSSL = true; + enableACME = true; + }; +} diff --git a/config/services/web/webkeydirectory/hu/44hqjnz5rw4mrr9d18fmecyskbmwxetw b/config/services/web/webkeydirectory/hu/44hqjnz5rw4mrr9d18fmecyskbmwxetw Binary files differnew file mode 100644 index 0000000..ba11e50 --- /dev/null +++ b/config/services/web/webkeydirectory/hu/44hqjnz5rw4mrr9d18fmecyskbmwxetw |
