summaryrefslogtreecommitdiff
path: root/includes/external/school/node_modules/pronote-api/src/cas/find.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
committerMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
commit3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch)
tree75be5fba4368472fb11c8015aee026b2b9a71888 /includes/external/school/node_modules/pronote-api/src/cas/find.js
parent8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff)
downloadpluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'includes/external/school/node_modules/pronote-api/src/cas/find.js')
-rw-r--r--includes/external/school/node_modules/pronote-api/src/cas/find.js80
1 files changed, 80 insertions, 0 deletions
diff --git a/includes/external/school/node_modules/pronote-api/src/cas/find.js b/includes/external/school/node_modules/pronote-api/src/cas/find.js
new file mode 100644
index 0000000..020c8fa
--- /dev/null
+++ b/includes/external/school/node_modules/pronote-api/src/cas/find.js
@@ -0,0 +1,80 @@
+const http = require('../http');
+
+const URLS = {
+ 'ac-besancon': 'cas.eclat-bfc.fr',
+ 'ac-bordeaux': 'mon.lyceeconnecte.fr',
+ 'ac-bordeaux2': 'ent2d.ac-bordeaux.fr',
+ 'ac-caen': 'fip.itslearning.com',
+ 'ac-clermont': 'cas.ent.auvergnerhonealpes.fr',
+ 'ac-dijon': 'cas.eclat-bfc.fr',
+ 'ac-grenoble': 'cas.ent.auvergnerhonealpes.fr',
+ 'ac-lille': 'cas.savoirsnumeriques62.fr',
+ 'ac-lille2': 'teleservices.ac-lille.fr',
+ 'ac-limoges': 'mon.lyceeconnecte.fr',
+ 'ac-lyon': 'cas.ent.auvergnerhonealpes.fr',
+ 'ac-montpellier': 'cas.mon-ent-occitanie.fr',
+ 'ac-nancy-metz': 'cas.monbureaunumerique.fr',
+ 'ac-nantes': 'cas3.e-lyco.fr',
+ 'ac-orleans-tours': 'ent.netocentre.fr',
+ 'ac-poitiers': 'mon.lyceeconnecte.fr',
+ 'ac-reims': 'cas.monbureaunumerique.fr',
+ 'ac-rouen': 'nero.l-educdenormandie.fr',
+ 'ac-strasbourg': 'cas.monbureaunumerique.fr',
+ 'ac-toulouse': 'cas.mon-ent-occitanie.fr',
+ 'ac-valdoise': 'cas.moncollege.valdoise.fr',
+ 'agora06': 'cas.agora06.fr',
+ 'arsene76': 'cas.arsene76.fr',
+ 'atrium-sud': 'www.atrium-sud.fr',
+ 'cybercolleges42': 'cas.cybercolleges42.fr',
+ 'eure-normandie': 'cas.ent27.fr',
+ 'haute-garonne': 'cas.ecollege.haute-garonne.fr',
+ 'hdf': 'enthdf.fr',
+ 'iledefrance': 'ent.iledefrance.fr',
+ 'moncollege-essonne': 'www.moncollege-ent.essonne.fr',
+ 'laclasse': 'www.laclasse.com',
+ 'ljr-munich': 'cas.kosmoseducation.com',
+ 'lyceeconnecte': 'mon.lyceeconnecte.fr',
+ 'parisclassenumerique': 'ent.parisclassenumerique.fr',
+ 'portail-famille': 'seshat.ac-orleans-tours.fr:8443',
+ 'seine-et-marne': 'ent77.seine-et-marne.fr',
+ 'somme': 'college.entsomme.fr',
+ 'toutatice': 'www.toutatice.fr',
+ 'monbureaunumerique-educonnect': 'cas.monbureaunumerique.fr'
+};
+
+async function find(url)
+{
+ if (!url.endsWith('/')) {
+ url += '/';
+ }
+
+ let location = await http({ url: url + 'eleve.html', followRedirects: 'get' });
+ if (location.includes('<head>')) {
+ return 'none';
+ }
+
+ if (location.startsWith('http://') || location.startsWith('https://')) {
+ location = location.substring(location.indexOf('/') + 2);
+ }
+
+ const host = location.substring(0, location.indexOf('/'));
+
+ const result = [];
+ for (const [name, casHost] of Object.entries(URLS)) {
+ if (host === casHost) {
+ result.push(name);
+ }
+ }
+
+ if (result.length === 0) {
+ return null;
+ }
+
+ if (result.length === 1) {
+ return result[0];
+ }
+
+ return result;
+}
+
+module.exports = find;