mirror of
https://github.com/kmein/niveum
synced 2026-03-29 08:41:07 +02:00
Compare commits
5 Commits
5e62f0363d
...
08ada6b818
| Author | SHA1 | Date | |
|---|---|---|---|
| 08ada6b818 | |||
| a128813990 | |||
| 5eaee95ba1 | |||
| 5eba5b84f1 | |||
| 2a8495a92c |
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"url": "https://cgit.krebsco.de/krops",
|
||||
"rev": "55aa2c77ce8183f3d2b24f54efa33ab6a42e1e02",
|
||||
"date": "2020-04-19T01:06:20+02:00",
|
||||
"path": "/nix/store/08wg2yrcgkr6iwipjd6g0fbwb7gacqax-krops",
|
||||
"sha256": "00rvx9h596ync8wgic6xc9srzajzm28wlp9q7mv4z0jsb27l5bj8",
|
||||
"rev": "cccebf3ff7a53336b3f106cb96dddd5892d427ed",
|
||||
"date": "2021-03-23T22:47:37+01:00",
|
||||
"path": "/nix/store/mz13xxnil35lwsf90hwnrm2agir7hb51-krops",
|
||||
"sha256": "07mg3iaqjf1w49vmwfchi7b1w55bh7rvsbgicp2m47gnj9alwdb6",
|
||||
"fetchSubmodules": false,
|
||||
"deepClone": false,
|
||||
"leaveDotGit": false
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"url": "https://github.com/NixOS/nixpkgs.git",
|
||||
"rev": "12d9950bf47e0ac20d4d04e189448ee075242117",
|
||||
"date": "2021-03-17T19:23:07+01:00",
|
||||
"path": "/nix/store/mbls4zp8c2jml8n4kg59nw13b2aks0y8-nixpkgs",
|
||||
"sha256": "09wy33zbzxj33296ddrrb79630kxpj1c3kiv38zs4wrw24206c2v",
|
||||
"rev": "d395190b24b27a65588f4539c423d9807ad8d4e7",
|
||||
"date": "2021-03-24T17:35:36-06:00",
|
||||
"path": "/nix/store/gdzjw6k680vcilvnpdhv93qxkzkl05qy-nixpkgs",
|
||||
"sha256": "0r1kj8gf97z9ydh36vmgrar1q4l9ggaqiygxjvp8jmr1948y0nh2",
|
||||
"fetchSubmodules": false,
|
||||
"deepClone": false,
|
||||
"leaveDotGit": false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"url": "https://github.com/krebs/retiolum",
|
||||
"rev": "5b067937a10ea43f88f14cc6e0a5485c2ddcc826",
|
||||
"date": "2021-03-04T21:02:17+01:00",
|
||||
"rev": "d53f785c9237810e976554a509093ce8c58ff483",
|
||||
"date": "2021-03-22T03:02:16+01:00",
|
||||
"path": "/nix/store/4w2pk0lr86li1lb5zhlmal94c15xgx5v-retiolum",
|
||||
"sha256": "0kczrr6dr5dmhx2kbanw46w6ig2v3w42rqhjanv87xhwkgw81l08",
|
||||
"fetchSubmodules": false,
|
||||
|
||||
@@ -199,6 +199,7 @@ in {
|
||||
./ccc.nix
|
||||
./kleiter.nix
|
||||
./calcurse.nix
|
||||
./engiadina.nix
|
||||
./chromium.nix
|
||||
./cloud.nix
|
||||
./compton.nix
|
||||
|
||||
31
configs/engiadina.nix
Normal file
31
configs/engiadina.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (import <niveum/lib>) tmpfilesConfig;
|
||||
cdnRoot = "/run/engiadina";
|
||||
in
|
||||
{
|
||||
systemd.tmpfiles.rules = [
|
||||
(tmpfilesConfig {
|
||||
type = "d";
|
||||
path = cdnRoot;
|
||||
mode = "0775";
|
||||
user = config.users.users.me.name;
|
||||
})
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.default = {
|
||||
root = cdnRoot;
|
||||
listen = [{
|
||||
addr = "0.0.0.0";
|
||||
port = 3333;
|
||||
}];
|
||||
};
|
||||
};
|
||||
|
||||
environment.shellAliases = {
|
||||
engiadina-watch = "${pkgs.findutils}/bin/find extra-src src | ${pkgs.entr}/bin/entr -s 'build-component && ${pkgs.rsync}/bin/rsync -avu dist/*.js ${cdnRoot}/'";
|
||||
engiadina-edit = "$EDITOR ${cdnRoot}/index.html";
|
||||
};
|
||||
}
|
||||
@@ -1,59 +1,54 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (import <niveum/lib>) kieran;
|
||||
|
||||
moodle-dl = pkgs.callPackage <niveum/packages/moodle-dl> {};
|
||||
|
||||
moodle-dl-config = {
|
||||
telegram = {
|
||||
token = lib.strings.fileContents <system-secrets/telegram/moodle-dl.token>;
|
||||
chat_id = "18980945";
|
||||
send_error_msg = true;
|
||||
};
|
||||
token = lib.strings.fileContents <system-secrets/moodle.token>;
|
||||
moodle_domain = "moodle.hu-berlin.de";
|
||||
moodle_path = "/";
|
||||
download_course_ids = [
|
||||
99881 # Dialektologie
|
||||
100183 # Onomastik
|
||||
100353 # Sanskrit I
|
||||
100692 # Sanskrit Tutorium
|
||||
99832 # Germanisch
|
||||
99823 # Gotisch
|
||||
99813 # Altalbanisch
|
||||
98681 # Geistliche Lyrik von Luther bis Lehnert
|
||||
99667 # Antike Mythologie
|
||||
# 52365 # FSR KlassPhil
|
||||
];
|
||||
download_submissions = true;
|
||||
download_descriptions = true;
|
||||
download_links_in_descriptions = false;
|
||||
download_databases = false;
|
||||
download_forums = false;
|
||||
download_linked_files = false;
|
||||
download_also_with_cookie = false;
|
||||
nixpkgs-kmein = builtins.fetchGit {
|
||||
url = "https://github.com/kmein/nixpkgs";
|
||||
ref = "refs/heads/feature/moodle-dl-module";
|
||||
rev = "98ec084fe4dd9608769d592318d211dff3d32d86";
|
||||
};
|
||||
|
||||
moodle-dl-json = pkgs.writeText "moodle-dl.json" (builtins.toJSON moodle-dl-config);
|
||||
|
||||
moodle-dl-directory = "/var/lib/moodle";
|
||||
moodle-dl-package = (import nixpkgs-kmein {}).moodle-dl.overrideAttrs (old: old // {
|
||||
patches = old.patches ++ [ <niveum/packages/moodle-dl/telegram-format.patch> ];
|
||||
});
|
||||
in
|
||||
{
|
||||
users.extraUsers.moodle = {
|
||||
isNormalUser = false;
|
||||
home = moodle-dl-directory;
|
||||
createHome = true;
|
||||
openssh.authorizedKeys.keys = [
|
||||
# for sshfs mount
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDtIFmbspaBHaSkLEx43V0uaVd7l9NUFiwt2VOP++KzLjvRMLkyF2hg2HjmogTjUvTyoDs7RHwEH/cHZlJ5JQkM1jRqQpnYwGfkZEwYvmXAl6LY9+vQMP36gNPfXmKX3y3LelO7oD2uhUs0guTtg0tHUyN5/UY5u+VinyD6djxDkHaCUn3S7CS/odBcs/4flXT654wsvzgYicnSKH9R4W+7C0YsckZ/NoIkA4jnuwtWZYWrUkxd4/290buX6pAc5+zVVZqyy0sI4i8s6pO9RL5W7xvYt+w+U0u0dMxm5ckiRmLVKfIbMN4YtDxsZbZDajlQ1nDbOsEsrSXWz4H4cSNot7J820x1qh5SSxL4GSQlcT+6xCFk9kKyflxoS3oLoPLttx3rmOMkZKJWxF/IKLW47orxV6wkG5mHxdeR3cf6jX4j3nkwFVyC9R+WG4w2Z4vKONVE7uWGYU3y4OpR1e6MGHVShkNKqEvC/Kjcc/6v7I7AKRAuPZB0WEw36tA65/8= root@wilde"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFFPHt+FPQ6gq8Ev65YsBZrafdtpWGpCNnlVvy67S1BK root@manakish"
|
||||
];
|
||||
useDefaultShell = true;
|
||||
imports = [ "${nixpkgs-kmein}/nixos/modules/services/networking/moodle-dl.nix" ];
|
||||
|
||||
services.moodle-dl = {
|
||||
enable = true;
|
||||
startAt = "hourly";
|
||||
package = moodle-dl-package;
|
||||
config = {
|
||||
telegram = {
|
||||
token = lib.strings.fileContents <system-secrets/telegram/moodle-dl.token>;
|
||||
chat_id = "18980945";
|
||||
send_error_msg = true;
|
||||
};
|
||||
token = lib.strings.fileContents <system-secrets/moodle.token>;
|
||||
moodle_domain = "moodle.hu-berlin.de";
|
||||
moodle_path = "/";
|
||||
download_course_ids = [
|
||||
99881 # Dialektologie
|
||||
100183 # Onomastik
|
||||
100353 # Sanskrit I
|
||||
100692 # Sanskrit Tutorium
|
||||
99832 # Germanisch
|
||||
99823 # Gotisch
|
||||
99813 # Altalbanisch
|
||||
98681 # Geistliche Lyrik von Luther bis Lehnert
|
||||
99667 # Antike Mythologie
|
||||
# 52365 # FSR KlassPhil
|
||||
];
|
||||
download_submissions = true;
|
||||
download_descriptions = true;
|
||||
download_links_in_descriptions = false;
|
||||
download_databases = false;
|
||||
download_forums = false;
|
||||
download_linked_files = false;
|
||||
download_also_with_cookie = false;
|
||||
};
|
||||
};
|
||||
|
||||
system.activationScripts.moodle-dl-config = "ln -sfn ${toString moodle-dl-json} ${config.users.extraUsers.moodle.home}/config.json";
|
||||
|
||||
services.syncthing = {
|
||||
services.syncthing = let moodle-dl-directory = config.services.moodle-dl.directory; in {
|
||||
enable = true;
|
||||
user = "moodle"; # config.users.extraUsers.moodle.name;
|
||||
openDefaultPorts = true;
|
||||
@@ -71,16 +66,4 @@ in
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.moodle-dl = {
|
||||
enable = true;
|
||||
startAt = "hourly";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = config.users.extraUsers.moodle.name;
|
||||
WorkingDirectory = config.users.extraUsers.moodle.home;
|
||||
};
|
||||
wants = [ "network-online.target" ];
|
||||
script = "${moodle-dl}/bin/moodle-dl";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,35 +10,42 @@ let
|
||||
{
|
||||
name = "Corona-Verordnung";
|
||||
url = "https://www.berlin.de/corona/massnahmen/verordnung/";
|
||||
filter = [
|
||||
{
|
||||
css = "[role=main]";
|
||||
}
|
||||
"html2text"
|
||||
"strip"
|
||||
];
|
||||
filter = [ { css = "[role=main]"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "HU Semester";
|
||||
url = "https://agnes.hu-berlin.de/lupo/rds?state=change&type=6&moduleParameter=semesterSelect&nextdir=change&next=SearchSelect.vm&subdir=applications&targettype=7&targetstate=change&getglobal=semester";
|
||||
filter = [
|
||||
{
|
||||
css = "fieldset";
|
||||
}
|
||||
"html2text"
|
||||
"strip"
|
||||
];
|
||||
filter = [ { css = "fieldset"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "Kratylos";
|
||||
url = "https://kratylos.reichert-online.org/current_issue/KRATYLOS";
|
||||
filter = [ { element-by-id = "content"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "Indogermanische Forschungen";
|
||||
url = "https://www.degruyter.com/journal/key/INDO/html";
|
||||
filter = [ { element-by-id = "latestIssue"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "IG Nekrolog";
|
||||
url = "https://www.indogermanistik.org/aktuelles/nekrologe.html";
|
||||
filter = [ { css = "[itemprop=articleBody]"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "IG Neuigkeiten";
|
||||
url = "https://www.indogermanistik.org/aktuelles/neuigkeiten.html";
|
||||
filter = [ { css = "[itemprop=articleBody]"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "IG Tagungen";
|
||||
url = "https://www.indogermanistik.org/tagungen/tagungen-der-ig.html";
|
||||
filter = [ { css = "[itemprop=articleBody]"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "Christian-Metz-Blamage";
|
||||
url = "https://www.deutschlandfunk.de/meine-nacht-schlaeft-nicht-pflanze-mich-nicht-in-dein-herz.700.de.html?dram:article_id=486475";
|
||||
filter = [
|
||||
{
|
||||
element-by-class = "dlf-articledetail";
|
||||
}
|
||||
"html2text"
|
||||
"strip"
|
||||
];
|
||||
filter = [ { element-by-class = "dlf-articledetail"; } "html2text" "strip" ];
|
||||
}
|
||||
{
|
||||
name = "fxght.or.flxght";
|
||||
|
||||
@@ -18,7 +18,7 @@ let
|
||||
system.file = toString path;
|
||||
nixos-config.symlink = "system/configuration.nix";
|
||||
|
||||
nixpkgs.git = gitFromJson .versions/nixpkgs.json;
|
||||
nixpkgs.git = gitFromJson .versions/nixpkgs.json // { shallow = true; };
|
||||
home-manager.git = gitFromJson .versions/home-manager.json;
|
||||
stockholm.git = gitFromJson .versions/stockholm.json;
|
||||
retiolum.git = gitFromJson .versions/retiolum.json;
|
||||
@@ -49,7 +49,9 @@ in {
|
||||
path = systems/toum;
|
||||
name = "toum";
|
||||
address = "toum.r";
|
||||
});
|
||||
}) // {
|
||||
buildTarget = "${builtins.getEnv "USER"}@localhost/${builtins.getEnv "HOME"}/.cache/krops";
|
||||
};
|
||||
makanek = writeDeploy "deploy-makanek" (regularSystem {
|
||||
path = systems/makanek;
|
||||
name = "makanek";
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
{ stdenv, lib, python3Packages }:
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "moodle-dl";
|
||||
version = "2.1.1.1";
|
||||
|
||||
src = python3Packages.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0nv2gm4x6mfsa0wywm4xbsx6nf6hx4kb63s4lczaxb9m4ybjd45h";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./readchar-version.patch
|
||||
./telegram-format.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
sentry-sdk
|
||||
colorama
|
||||
readchar
|
||||
youtube-dl
|
||||
certifi
|
||||
html2text
|
||||
requests
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "https://github.com/C0D3D3V/Moodle-Downloader-2";
|
||||
maintainers = [ maintainers.kmein ];
|
||||
description = "A Moodle downloader that downloads course content fast from Moodle";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 180139d..5582359 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -32,7 +32,7 @@ setup(
|
||||
install_requires=[
|
||||
'sentry_sdk>=0.13.5',
|
||||
'colorama>=0.4.3',
|
||||
- 'readchar>=2.0.1',
|
||||
+ 'readchar>=2.0.0',
|
||||
'youtube_dl>=2020.9.20',
|
||||
'certifi>=2020.4.5.2',
|
||||
'html2text>=2020.1.16',
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/moodle_dl/notification_services/telegram/telegram_formater.py b/moodle_dl/notification_services/telegram/telegram_formater.py
|
||||
index 05180b6..33009b0 100644
|
||||
index 470ff32..9ff1fa4 100644
|
||||
--- a/moodle_dl/notification_services/telegram/telegram_formater.py
|
||||
+++ b/moodle_dl/notification_services/telegram/telegram_formater.py
|
||||
@@ -15,10 +15,10 @@ def create_full_moodle_diff_message(changed_courses: [Course]) -> [str]:
|
||||
@@ -37,24 +37,24 @@ def create_full_moodle_diff_messages(changed_courses: [Course]) -> [str]:
|
||||
diff_count += len(course.files)
|
||||
|
||||
result_list = []
|
||||
@@ -10,36 +10,27 @@ index 05180b6..33009b0 100644
|
||||
+ one_msg_content = "%s changes in Moodle!" % (diff_count)
|
||||
|
||||
for course in changed_courses:
|
||||
- new_line = '\r\n\r\n\r\n> <b>' + course.fullname + '</b>\r\n'
|
||||
- new_line = '\r\n\r\n\r\n> **' + course.fullname + '**\r\n'
|
||||
+ new_line = "\r\n\r\n<b>" + course.fullname + "</b>"
|
||||
if len(one_msg_content) + len(new_line) >= 4096:
|
||||
result_list.append(one_msg_content)
|
||||
one_msg_content = new_line
|
||||
@@ -27,16 +27,16 @@ def create_full_moodle_diff_message(changed_courses: [Course]) -> [str]:
|
||||
one_msg_content = append_with_limit(new_line, one_msg_content, result_list)
|
||||
|
||||
for file in course.files:
|
||||
if file.modified:
|
||||
- new_line = '\r\n<i>* Modified:</i> ' + file.saved_to
|
||||
- new_line = '\r\n__* Modified:__ ' + file.saved_to
|
||||
+ new_line = "\r\n✍️ " + file.saved_to
|
||||
elif file.moved:
|
||||
if file.new_file is not None:
|
||||
- new_line = '\r\n<i>* Moved:</i> ' + file.new_file.saved_to
|
||||
- new_line = '\r\n__* Moved:__ ' + file.new_file.saved_to
|
||||
+ new_line = "\r\n📂 " + file.new_file.saved_to
|
||||
else:
|
||||
- new_line = '\r\n<i>* Moved:</i> ' + file.saved_to
|
||||
- new_line = '\r\n__* Moved:__ ' + file.saved_to
|
||||
+ new_line = "\r\n📂 " + file.saved_to
|
||||
elif file.deleted:
|
||||
- new_line = '\r\n<i>- Deleted:</i> ' + file.saved_to
|
||||
- new_line = '\r\n__- Deleted:__ ' + file.saved_to
|
||||
+ new_line = "\r\n🗑️ " + file.saved_to
|
||||
else:
|
||||
- new_line = '\r\n<i>+ Added:</i> ' + file.saved_to
|
||||
- new_line = '\r\n__+ Added:__ ' + file.saved_to
|
||||
+ new_line = "\r\n🎉 " + file.saved_to
|
||||
|
||||
if len(one_msg_content) + len(new_line) >= 4096:
|
||||
result_list.append(one_msg_content)
|
||||
@@ -52,4 +52,4 @@ def create_full_error_message(details) -> (str, {str: str}):
|
||||
"""
|
||||
Creates an error message
|
||||
"""
|
||||
- return 'The following error occurred during execution:' + details
|
||||
+ return "The following error occurred during execution:" + details
|
||||
one_msg_content = append_with_limit(new_line, one_msg_content, result_list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user