Compare commits

..

66 commits

Author SHA1 Message Date
ed6fafda45
feat(nix): Rework a bit 2024-10-24 00:08:51 +02:00
a648941bac
chore(npins): Update nixpkgs 2024-10-24 00:08:33 +02:00
f523cb1e4a
chore(data): Reformat 2024-10-24 00:08:22 +02:00
5c5e0c356b
feat: Add Valse 2024-10-23 23:32:21 +02:00
f631751da4 feat(calendars.json): ajout du calendrier DGNum
Signed-off-by: jemagius <jmg@dgnum.eu>
2024-10-12 12:31:47 +02:00
505074dfc3 feat: add DGNum's NextCloud as provider for calendars in metis
Signed-off-by: jemagius <jmg@dgnum.eu>
2024-10-12 11:12:00 +02:00
9eaa1f2897
fix(calendars.json): K-Fêt was recreated 2024-09-18 14:20:39 +02:00
sinavir
23839b284e fix(locations.json): Add some location renaming 2024-09-04 16:17:41 +02:00
sinavir
8923b8293d fix(calendars.json): fix rentrée 2024-09-04 11:05:14 +02:00
sinavir
6eeeea3654 fix(calendars.json): Add "Visites" 2024-08-28 16:54:08 +02:00
sinavir
e91154c9db feat(synoptic view): Display only occupied rooms 2024-08-13 01:45:50 +02:00
sinavir
57e9bc2474 feat(calendars.json): Rentrée 2024-08-13 01:45:14 +02:00
sinavir
505f15372d fix(calendars.json): Disable "Crémeaux encadrés" par défaut 2024-08-12 08:41:53 +02:00
sinavir
49b136a43a fix(calendars): Remove obsolete calendars 2024-06-27 21:34:15 +02:00
sinavir
3fd72124c0 fix(calendars.js): Remove unused function 2024-06-27 21:30:54 +02:00
f2bbd93c75 Merge pull request 'Nouveau calendrier pour hackENS' (#67) from ecoppens/metis:master into master
Reviewed-on: #67
2024-01-17 08:47:40 +01:00
7c256a6dcc
feat(calendars.json): Add new hackENS calendar 2024-01-16 18:35:35 +01:00
sinavir
dbfd1de2b9 fix(calendars.json): Remove failing calendars 2024-01-06 23:51:19 +01:00
a14d334c75 fix(calendars.json): Update K-Fêt url 2023-11-08 17:44:08 +01:00
sinavir
1a151d6cf4 adding providers.nix
The file providers.nix specify upstream endpoints for reverse proxy rules.
2023-10-20 17:20:46 +02:00
sinavir
b5b9941560 Add ENSelle 2023-10-05 16:37:32 +02:00
c444b702b2 Rebrand from Club Réseau to DGNum 2023-09-28 12:48:18 +02:00
d5a7f39384 Add analytics 2023-09-28 12:11:22 +02:00
f086aab2bf Merge pull request 'Add arts-pla'' (#66) from add_arts_pla into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/66
2023-09-20 15:44:48 +02:00
sinavir
85570af7af Add arts-pla' 2023-09-20 15:37:55 +02:00
1a225d10ca Merge pull request 'Add rentrée' (#65) from add_rentree into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/65
2023-07-23 16:46:26 +02:00
sinavir
7c5df4e790 Add rentrée 2023-07-23 16:44:40 +02:00
ab00fede2e Merge pull request 'thubrecht/multiday-event' (#58) from thubrecht/multiday-event into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/58
2023-07-23 16:31:03 +02:00
32d9b4d60c Fix display or real allDay events 2023-07-23 16:29:12 +02:00
642b45f018 Display events spanning more than 24h as allDay events 2023-07-23 16:29:12 +02:00
49d62aa749 Delete build output of bundle 2023-07-23 16:28:24 +02:00
ea468c2469 Merge pull request 'Modernize' (#64) from modernize into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/64
2023-07-23 16:21:57 +02:00
sinavir
8d0c245e35 Add link to source code 2023-07-23 16:21:13 +02:00
sinavir
22b5ee34d5 update deps 2023-07-23 16:21:13 +02:00
sinavir
4143cb84c2 switch to npins and buildNpmPackage 2023-07-23 16:21:13 +02:00
4f72214717 calendars: Add Créneaux Encadrés 2023-07-23 16:13:25 +02:00
cfd94cb02a calendars: Add BOcal 2023-07-23 16:13:08 +02:00
sinavir
d4254e19fd Remove compiled tarball 2023-07-22 21:41:46 +02:00
64534b2bf7 Répare l'indentation 2023-03-07 22:45:04 +01:00
871b7eaaf8 Rajoute PLS 2023-03-06 18:42:07 +01:00
7d2662d00a Merge pull request 'change_bds' (#63) from change_bds into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/63
2023-02-24 15:47:43 +01:00
sinavir
629bb480ea change_bds 2023-02-24 14:30:29 +01:00
86da9646d8 Merge pull request 'add_ulmity' (#61) from add_ulmity into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/61
2023-02-22 19:38:21 +01:00
sinavir
05c7174f5f add_ulmity 2023-02-22 19:38:01 +01:00
7ce999c365 Merge pull request 'add_club_bouffe' (#62) from add_club_bouffe into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/62
2023-02-22 19:37:46 +01:00
sinavir
985e6561b8 add_club_bouffe 2023-02-22 17:32:16 +01:00
f9ebe70653 Merge pull request 'Add psychédéliste' (#60) from add_liste_cof into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/60
2022-12-04 11:53:48 +01:00
sinavir
036ba938ae Add psychédéliste 2022-12-03 22:38:42 +01:00
4af6452003 Merge pull request 'add_homonerie' (#59) from add_homonerie into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/59
2022-11-12 22:10:34 +01:00
sinavir
0e172f5569 add_homonerie 2022-11-12 21:54:48 +01:00
aa697799bc Change things 2022-10-28 13:39:31 +02:00
58597c8076 Set timeout during loading to prevent a calendar from blocking the view 2022-10-28 13:34:43 +02:00
142b841397 Formatting 2022-10-25 10:39:28 +02:00
75e9a5c281 Merge pull request 'remove rentrée' (#57) from remove_rentree into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/57
2022-10-25 10:26:15 +02:00
sinavir
d958b817f3 remove rentrée 2022-10-25 10:23:24 +02:00
06ef17e8f5 Merge pull request 'Add ambassadeurices santé' (#56) from add_ambassadeurices_sante into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/56
2022-10-25 10:07:19 +02:00
sinavir
a5353b0c9e revert remove of "rentrée" 2022-10-25 10:04:41 +02:00
sinavir
b40b7494a4 Add ambassadeurices santé 2022-10-24 18:59:25 +02:00
26cb575a54 Don't try to show a tooltip when no title is defined 2022-10-10 18:20:54 +02:00
3e84c21e00 Merge pull request 'add club jeux' (#55) from add_club_jeux into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/55
2022-10-10 14:08:14 +02:00
sinavir
4a1e24c1d3 add club jeux 2022-10-10 13:26:24 +02:00
3a2502acbe Add Écocampus 2022-09-29 18:44:41 +02:00
7eb5ee2dfd Merge pull request 'add separate calendar for bda' (#54) from add_separate_calendar_for_bda into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/54
2022-09-29 08:52:11 +02:00
sinavir
5c415b6a04 better naming 2022-09-28 17:11:46 +02:00
sinavir
4444649136 add separate calendar for bda 2022-09-28 13:38:33 +02:00
e420cdd0b4 Move room and calendar data to a specific folder (#52)
On met tout dans /data pour décorréler les sources du calendrier de la logique au maximum

Co-authored-by: Tom Hubrecht <tom.hubrecht@ens.fr>
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/52
Co-authored-by: tomate <tom.hubrecht@ens.fr>
Co-committed-by: tomate <tom.hubrecht@ens.fr>
2022-09-12 17:46:54 +02:00
17 changed files with 735 additions and 3642 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
node_modules
public/build
result
.direnv
.direnv

View file

@ -1,37 +1,75 @@
{
"tree": {
"Rentrée": {
"Évènements pour les masteriens": {},
"Exchange and international students": {},
"Départements": {},
"Amphis de rentrée": {},
"Divers rentrée": {},
"Associatif divers": {},
"Visites": {}
},
"Délégation Générale Numérique": {},
"COF": {
"BdA": {},
"Évènements (COF)": {},
"Assemblées Générales (COF)": {}
"Rentrée du COF": {},
"Assemblées Générales (COF)": {},
"BdA": {
"Évènements (BdA)": {},
"Spectacles du tirage BdA": {}
}
},
"Clubs COF": {
"Club réseau": {},
"hackENS": {},
"PLS": {},
"HackENS": {},
"Club Bouffe": {},
"Écriv'ENS": {},
"BOcal": {},
"CinéClub": {},
"Ernestophone": {},
"Club Jeux": {},
"DDR": {},
"BandarrêtdurgENS": {},
"L'Hômonerie": {},
"Ulmity": {},
"Arts pla'": {},
"Club Inutile ☔": {}
},
"BDS": {},
"BDS": {
"Évènements (BDS)": {},
"Rentrée du BDS": {}
},
"Clubs BDS": {
"Valse": {},
"Créneaux encadrés": {},
"ENSelle": {}
},
"La Nuit de l'ENS": {},
"Délégation Générale": {},
"K-Fêt": {},
"Rentrée académique": {
"Amphis de rentrée": {},
"Rentrée des départements": {},
"Conférences de recherche": {},
"Visites de bibliothèques": {},
"Réunions de rentrée des Masters": {},
"Activités pour les étudiants internationaux": {}
},
"Divers": {}
"Écocampus": {},
"La Psychédéliste": {},
"Ambassadeur·rice·s santé": {}
},
"sources": {
"dgnum-nc": {
"dmo7DgdmTnsMd8zo": {
"name": "Valse"
},
"eEPk6miCzozgPb42": {
"name": "Délégation Générale Numérique",
"short_name": "DGNum",
"color": "#27327a"
}
},
"eleves-ens": {
"qG6jpJPfK37Nw8ZC": {
"name": "PLS"
},
"caey6jt6pTgKengA": {
"name": "BOcal",
"color": "#e6973e"
},
"LLWm8qK9iC5YGrrR": {
"name": "Délégation Générale",
"short_name": "DG"
@ -43,7 +81,7 @@
"w442JdS5AaQ6czrP": {
"name": "Écriv'ENS"
},
"fRtjDkjrZyn6fxd8": {
"aoazRGFcjHSe4LxG": {
"name": "K-Fêt",
"color": "#c63b52",
"default_location": "K-Fêt"
@ -60,7 +98,12 @@
"short_name": "AG COF"
},
"r4yJZDHjwNtH8wkR": {
"name": "BdA"
"name": "Évènements (BdA)"
},
"83AkowSYPnYrjSFr": {
"name": "Spectacles du tirage BdA",
"short_name": "Spectacles",
"initial": false
},
"ZtWm3MYSi388k2yk": {
"name": "DDR"
@ -72,59 +115,99 @@
"name": "Club Inutile ☔",
"initial": false
},
"Ekjb4kDqMMqwJXZF": {
"name": "Rentrée des départements",
"short_name": "Dpt"
},
"8SKP62tQJP65K8EW": {
"name": "Conférences de recherche",
"short_name": "Conf"
},
"PnRXqeq4SsSC33FM": {
"name": "Visites de bibliothèques",
"short_name": "Bibli",
"initial": false
},
"NWPtiEiz62LTtjo2": {
"name": "Amphis de rentrée",
"short_name": "Prés. de rentrée"
},
"JiRt58aJXay9kfyk": {
"name": "Réunions de rentrée des Masters",
"short_name": "Masters"
},
"5Rb4bRjCDcsFjDdQ": {
"name": "Activités pour les étudiants internationaux",
"short_name": "Internationaux"
},
"62wKfQRrLNz2WXjt": {
"name": "Divers"
},
"TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS",
"short_name": "Banda"
},
"TyMrLaPPDzT7yAGC": {
"name": "BDS"
}
},
"klub-reseau": {
"5WrcagPPARQ3BD87": {
"name": "Club réseau",
"default_location": "Cave d'hackENS"
"kR8fMzmf4ciop9Je": {
"name": "Club Jeux",
"short_name": "Jeux",
"color": "#5f9ae0"
},
"TFEAKjAgNFQZpNjo": {
"name": "hackENS",
"22rQF3gjjz8LifZC": {
"name": "La Psychédéliste",
"short_name": "Psychédéliste"
},
"AfHYkm3gqQ4fRRj5": {
"name": "HackENS",
"default_location": "Cave d'hackENS"
}
},
"frama-agenda": {
"qZcPZdGb5YtJHrNZ": {
"name": "ENSelle"
},
"K6iGBG47WXaKWs3Q": {
"name": "Créneaux encadrés",
"initial": false
},
"TFjE83ASCMK9rfRi": {
"name": "BandarrêtdurgENS",
"short_name": "Banda"
},
"dSYCtdC6bgyWpKyt": {
"name": "Évènements (BDS)"
},
"goXLq2dQ8LgFAjkM": {
"name": "Club Bouffe"
},
"Q8w6dw4jGLBP9ftB": {
"name": "Écocampus"
},
"T5WoHbs4FT5A945Z": {
"name": "CinéClub"
},
"zmgdYw62RatzmGDt": {
"name": "Ulmity"
},
"iXGysEGxo7EsKjwG": {
"name": "Ambassadeur·rice·s santé",
"short_name": "Amba. santé",
"color": "#f5a142"
},
"AYNpoC674yAjEmRy": {
"name": "L'Hômonerie"
},
"MJf2wnQafbLc2arS": {
"name": "Arts pla'",
"color": "#ffb969"
},
"qS7WJwyBaGRQFyX3": {
"name": "Exchange and international students",
"short_name": "Exchange"
},
"fGmpGCNZrHQkNt7L": {
"name": "Départements",
"short_name": "Dpt",
"initial": false
},
"W6qjeqEzEekNieWk": {
"name": "Évènements pour les masteriens",
"short_name": "Master"
},
"oDPMTBSma2bfo6WS": {
"name": "Amphis de rentrée",
"short_name": "Amphis",
"initial": false
},
"aPXtDmXDxmLxkERg": {
"name": "Divers rentrée",
"short_name": "Rentrée"
},
"fqK3nqqPtXLyo4Y4": {
"name": "Rentrée du COF",
"short_name": "COF"
},
"YQnfcozPDoRgNSBb": {
"name": "Rentrée du BDS",
"short_name": "BDS"
},
"tfA32kgc3GM2fH2C": {
"name": "Visites"
},
"KDNA4GrFMkkJrwNd": {
"name": "Associatif divers",
"short_name": "Asso"
}
}
}

View file

@ -1,10 +1,20 @@
{
"nameMap": {
"Amphi Jourdan": "Amphithéâtre Jourdan",
"Cour aux Ernest": "Cour aux Ernests",
"R2-21 (Jourdan)": "R2-21",
"Salle Jean Ibanes (Jourdan, R1-07)": "Salle Jean Ibanes (R1-07)",
"Salle Madeleine Rebérioux (Jourdan, R2-02)": "Salle Madeleine Rebérioux (R2-02)",
"Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)"
"Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)",
"Cour des bibliothèques": "Cour du NIR",
"Salle Jaurès": "Amphithéâtre Jaurès",
"Jaurès": "Amphithéâtre Jaurès",
"Dussane": "Salle Dussane",
"Cour aux Ernest": "Cour aux Ernests",
"Restaurant": "Pôt",
"29 rue d'Ulm": "Bâtiment du 29",
"Gymnase": "Gymnase Jean Prévost",
"Pôt (Restaurant)": "Pôt"
},
"rooms": {
@ -12,6 +22,7 @@
"Amphithéâtre Galois",
"Bibliothèque Lettres",
"Salle Histoire",
"Salle Aron",
"Salle Cavaillès",
"Salle Dussane",
"Salle des Actes",
@ -20,6 +31,10 @@
"Salle Cartan",
"Salle Noether",
"Salle Bourbaki",
"Petite salle ECLA",
"Salle Reig ECLA",
"Salle Césaire ECLA",
"Salle Beckett",
"Cour aux Ernests",
"Cour du NIR",
"Cour Pasteur",
@ -28,11 +43,17 @@
"Canopée",
"K-Fêt",
"Cave d'hackENS",
"Gymnase"
"Gymnase Jean Prévost",
"Salle d'expression artistique (SEA)",
"Locaux des départements lettres et sciences humaines et sociales"
],
"24 rue Lhomond": ["Salle CONF IV"],
"29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"],
"29 rue d'Ulm": [
"Bâtiment du 29",
"Bibliothèque des sciences expérimentales",
"Amphithéâtre Jaurès"],
"Jourdan": [
"Campus de Jourdan",
"Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)",
"Salle Madeleine Rebérioux (R2-02)",

View file

@ -1,9 +1,44 @@
{ pkgs ? import ./nix {} }:
{
production = pkgs.npmlock2nix.build {
src = ./.;
installPhase = "cp -r public/build $out";
buildCommands = [ "npm run build" ];
sources ? import ./npins,
pkgs ? import sources.nixpkgs { },
}:
let
inherit (pkgs.lib.fileset)
fileFilter
gitTrackedWith
intersection
toSource
;
in
{
package = pkgs.buildNpmPackage {
name = "metis";
src = toSource {
root = ./.;
fileset = intersection (gitTrackedWith { } ./.) (
fileFilter ({ name, hasExt, ... }: !(hasExt "nix") && name != "npins") ./.
);
};
npmDepsHash = "sha256-RbjWNVY8KlPP9ajQRnrsWhOZiiyyMGQSY39lmZnTC1I=";
installPhase = ''
cp -r public $out
'';
};
devShell = pkgs.mkShell {
name = "metis.dev";
packages = [ pkgs.nodejs ];
};
providers = {
eleves-ens = "cloud.eleves.ens.fr";
frama-agenda = "framagenda.org";
dgnum-nc = "cloud.dgnum.eu";
};
shell = import ./shell.nix { inherit pkgs; };
}

View file

@ -1,12 +0,0 @@
# nix/default.nix
{ pkgs ? import <nixpkgs> {} }:
let
sources = import ./sources.nix;
in
import sources.nixpkgs {
overlays = [
(self: super: {
npmlock2nix = pkgs.callPackage sources.npmlock2nix { };
})
];
}

View file

@ -1,38 +0,0 @@
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "5830a4dd348d77e39a0f3c4c762ff2663b602d4c",
"sha256": "1d3lsrqvci4qz2hwjrcnd8h5vfkg8aypq3sjd4g3izbc8frwz5sm",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/5830a4dd348d77e39a0f3c4c762ff2663b602d4c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "master",
"description": "Nix Packages collection",
"homepage": "",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "21.05",
"sha256": "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/21.05.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"npmlock2nix": {
"branch": "master",
"description": null,
"homepage": null,
"owner": "nix-community",
"repo": "npmlock2nix",
"rev": "ff17a3c59233911f776d8d462d61d82a3e41df34",
"sha256": "0l624gkkpn1r0g48b204k0wcqm9cwy5rzd5mnxwfjhyjj1wg4nl7",
"type": "tarball",
"url": "https://github.com/nix-community/npmlock2nix/archive/ff17a3c59233911f776d8d462d61d82a3e41df34.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View file

@ -1,174 +0,0 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

47
npins/default.nix Normal file
View file

@ -0,0 +1,47 @@
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
path =
if spec.type == "Git" then mkGitSource spec
else if spec.type == "GitRelease" then mkGitSource spec
else if spec.type == "PyPi" then mkPyPiSource spec
else if spec.type == "Channel" then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = { repository, revision, url ? null, hash, ... }:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else assert repository.type == "Git"; builtins.fetchGit {
url = repository.url;
rev = revision;
# hash = hash;
};
mkPyPiSource = { url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource = { url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
in
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

11
npins/sources.json Normal file
View file

@ -0,0 +1,11 @@
{
"pins": {
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre696114.dfffb2e7a52d/nixexprs.tar.xz",
"hash": "15dj4hcx5wqcnxwfhh1gx2rpcwyip794bkmv0vpz4f01hibr7wd2"
}
},
"version": 3
}

3748
package-lock.json generated

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -4,7 +4,7 @@
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Calendrier du Club Réseau</title>
<title>Calendrier de la DGNum</title>
<link rel='icon' href='/favicon.svg'>
<link rel='stylesheet' href='/global.css'>

View file

@ -1,5 +1 @@
{ pkgs ? import ./nix {} }:
pkgs.npmlock2nix.shell {
src = ./.;
nodejs = pkgs.nodejs-14_x;
}
(import ./. { }).devShell

View file

@ -102,6 +102,7 @@
title: room
}))
),
filterResourcesWithEvents: true,
height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true,
@ -121,6 +122,11 @@
isLoading = b;
if (spinner) {
spinner.$set({ isLoading: b });
if (b) {
setTimeout(() => {
spinner.$set({ isLoading: false });
}, 3000);
}
}
},
eventSources: [],
@ -129,11 +135,14 @@
progressiveEventRendering: true,
expandRows: true,
eventDidMount: info => {
new Tooltip(info.el, {
title: info.event.extendedProps.short_name,
trigger: 'hover',
placement: 'top'
});
const title = info.event.extendedProps.short_name;
if (title !== undefined) {
new Tooltip(info.el, {
title: title,
trigger: 'hover',
placement: 'top'
});
}
},
viewDidMount: arg => {
spinner = new Spinner({
@ -196,6 +205,12 @@
<FullCalendar bind:this={calendar} options={$options} />
<EventModal event={$event} open={openModal} {toggle} />
<script
defer
data-domain="calendrier.dgnum.eu"
src="https://analytics.dgnum.eu/js/script.js"
></script>
</div>
<style>

View file

@ -56,7 +56,10 @@
</span>
<span>
{#if event.allDay}
{#if event.extendedProps.simAllDay}
<Icon name="calendar-range" class="text-primary" />
<span class="ms-1">{dateFormat(event.start)} ({timeFormat(event.extendedProps.realStart)}) - {dateFormat(event.end)} ({timeFormat(event.extendedProps.realEnd)})</span>
{:else if event.allDay}
<Icon name="calendar-range" class="text-primary" />
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
{:else}

View file

@ -17,7 +17,7 @@
<ModalBody>
<p>Calendrier commun de la vie étudiante de l'ENS</p>
<b>Comment rajouter son calendrier :</b>
<b>Comment rajouter son calendrier&nbsp;:</b>
<ul>
<li>
Utiliser un NextCloud, idéalement
@ -26,15 +26,18 @@
</li>
<li>Créer un calendrier dessus, créer un lien de partage public.</li>
<li>
Envoyer le lien de partage public au Club Réseau<br />
(club-reseau [at] lists [.] ens [.] psl [.] eu) pour faire une requête d'ajout.
Envoyer le lien de partage public à la DGNum<br />
(calendrier [at] dgnum [.] eu) pour faire une requête d'ajout.
</li>
</ul>
<p>Code source&nbsp;:
<a href="https://git.dgnum.eu/DGNum/metis">https://git.dgnum.eu/DGNum/metis</a>
</p>
</ModalBody>
<ModalFooter>
<Icon name="balloon-heart" class="text-danger fs-5" />
<span class="fs-7">Propulsé par le Club Réseau de l'ENS</span>
<span class="fs-7">Propulsé par la <a href="https://dgnum.eu">Délégation Générale Numérique</a></span>
</ModalFooter>
</Modal>

View file

@ -132,13 +132,31 @@ function fcEventFromjCalEvent(cal) {
return function (evt) {
const start = new Date(evt.dtstart)
const end = new Date(evt.dtend)
const allDay = !evt.dtstart.endsWith('Z')
const duration = end - start // in ms
const dayMs = 24 * 3600 * 1000
const fcEvent = {
title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
start: evt.dtstart,
end: evt.dtend,
color: cal.color,
textColor: invertColor(cal.color),
duration: end - start // in ms
duration: duration
}
if (!allDay && (duration > dayMs - 1)) {
fcEvent.allDay = true
fcEvent.simAllDay = true
fcEvent.realStart = new Date(start)
fcEvent.realEnd = new Date(end)
fcEvent.start = start.setUTCHours(0, 0, 0)
fcEvent.end = end.setUTCHours(23, 59, 59)
fcEvent.duration = end - start // Update the duration
}
fcEvent.calendar = cal.name
@ -172,14 +190,6 @@ function fcEventFromjCalEvent(cal) {
}
}
function mkEventsFromCalendar(id, cal) {
return fetchCalendar(id, cal).then(calendar => {
if (calendar[0] !== 'vcalendar') return
const cal = new Calendar(id, calendar)
return cal.events.map(fcEventFromjCalEvent(cal))
})
}
export function mkSource(name) {
const calendarId = calendarsByName[name]
if (!calendarId) return null