feat(timetable): add ical URL getter
Closed this issue · 3 comments
get the url for the ical timetable that might be available in some instances that have the feature enabled (defaults to disabled)
Dans la réponse à PageEmploiDuTemps
, on retrouve ParametreExportiCal
là donneesSec.donnees.ParametreExportiCal
.
Le format de l'url est instanceURL
/pronote/ical/Edt.ics?icalsecurise=ParametreExportiCal
&version=version
¶m=options
setLien(aSansRessource) {
const lSansRessource = !!aSansRessource ? aSansRessource : false;
let lParams = 'fh=' + this.fuseauHoraire;
if (!this.semainesPubliees) {
lParams += '&d=' + GChaine.domaineToStr(GEtatUtilisateur.getDomaineSelectionne());
}
if (this.genreICal) {
lParams += '&o=' + this.genreICal;
}
let lHref;
let lInformationMasquee;
if (!lSansRessource) {
lHref = 'ical/' + this.getPrefixICal() + '.ics';
lInformationMasquee = 'icalsecurise=' + this.ParametreExportICal + '&version=' + GParametres.versionPN;
} else {
lHref = 'ical/exportSalles.ics';
lInformationMasquee = 'icalSansRessource=Salles&version=' + GParametres.versionPN;
}
lHref = lHref + '?' + (lInformationMasquee) + '¶m=' + new forge.util.ByteBuffer(lParams).toHex();
GHtml.setLien(this.idHrefICal, lHref);
GHtml.setValue(this.idLienPermanent, GChaine.encoderUrl(GNavigateur.getHost() + lHref));
$('#' + this.idQRCode.escapeJQ()).html(kjua({
render: 'image',
size: 175,
text: GNavigateur.getHost() + lHref
}).outerHTML);
}
this.fuseauHoraire
à l'air d'être toujours à 1
setDonnees(aElement, aParametreExportICal, aGenreRessource, aDomaine, aFiltre, aSansRessource) {
this.element = aElement;
this.ParametreExportICal = aParametreExportICal;
this.genreRessource = aGenreRessource;
this.domaine = (aDomaine !== null && aDomaine !== undefined) ? aDomaine : 0;
this.filtre = aFiltre;
this.semainesPubliees = true;
this.fuseauHoraire = this.getValeurFuseauHoraireParDefaut();
this.setLien(aSansRessource);
this.afficher();
}
getValeurFuseauHoraireParDefaut() {
return 1;
}
D'après ce code, j'en déduis que EDT vaut 0
et Agenda vaut 1
;IE.fModule({
f: function(exports, require, module, global) {
const EGenreICal = {
EDT: 0,
Agenda: 1
};
module.exports = EGenreICal;
},
fn: 'enumere_ical.js'
});
Donc quand on veut récupérer pour l'edt, le paramètre &o=
de options
est omis.
Résumé:
On peut donc garder une version définitive de l'url:
instanceURL
/pronote/ical/Edt.ics?icalsecurise=ParametreExportiCal
&version=version
¶m=66683d31
PS: On peut remplacé Edt.ics
par Agenda.ics
sans incidences.
the following is only compatible with latest version of pronote (2024) : querying PageInfosPerso (49) gives out a new JSON property iCal
"iCal": {
"avecLienPerso": true,
"avecAgenda": false,
"avecEDT": true,
"liste": {
"_T": 24,
"V": [
{
"G": 2,
"L": "Mes Informations",
"P": 0,
"paramICal": "B34F8FBE7F2BD40C3C222AEAE7A4AE7C7B7158F052BC7E7E56B186914CAE98E20C481ADB781F4BFFECD1BFFCC58062DC",
"exportAgenda": false,
"exportEDT": true
}
]
}
}
paramICal
is the same token as the one given in PageEmploiDuTemps
on property ParametreExportiCal
which mean we could use that token on mobile to retrieve
also the param
property can be omited
also the 2024 version shows us a new URL : /ical/mesinformations.ics?icalsecurise={paramICal}&version=2024.1.3¶m=266f3d32
(param
can be omited) but it's exactly the same as the Edt.ics or Agenda.ics
finally, i think the file name has absolutely no incidence on the file content : it's just the name of the file downloaded, if you need to modify the response, it all happens in the query parameters.
Implemented in 640dc01, closing this issue.
Example
Pawnote/examples/student-information.ts
Lines 4 to 11 in 640dc01
Pawnote/examples/student-information.ts
Line 13 in 640dc01
Pawnote/examples/student-information.ts
Lines 26 to 28 in 640dc01
-> Timetable .ics URL: https://demo.index-education.net/pronote/ical/timetable.ics?icalsecurise=B34F8FBE7F2BD40C3C222AEAE7A4AE7C7B7158F052BC7E7E56B186914CAE98E20C481ADB781F4BFFECD1BFFCC58062DC&version=2024.1.3¶m=266f3d32