summaryrefslogtreecommitdiff
path: root/alarm/node_modules/pronote-api/src/fetch/pronote/params.js
blob: 12fc2e963a7fa20d78664b7765c50ea491e7318e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
const parse = require('../../data/types');
const { fromPronote } = require('../../data/objects');

const request = require('../../request');

const { getUUID } = require('../../cipher');

async function getParams(session)
{
    const { donnees: params } = await request(session, 'FonctionParametres', {
        donnees: { Uuid: getUUID(session, session.aesIV) }
    });

    const general = params.General;
    if (!general) {
        return;
    }
    return {
        navigatorId: params.identifiantNav,
        fonts: parse(params.listePolices, false).map(o => o.L),
        withMember: params.avecMembre,
        forNewCaledonia: params.pourNouvelleCaledonie,
        loginImageId: params.genreImageConnexion,
        loginImageUrl: params.urlImageConnexion,
        cssLogo: params.logoProduitCss,
        theme: params.Theme,
        serverTime: parse(params.DateServeurHttp),
        mobileURL: params.URLMobile,
        mobileSupport: params.AvecEspaceMobile,
        title: params.Nom,
        indexEducationWebsite: parse(general.urlSiteIndexEducation),
        version: general.versionPN,
        versionFull: general.version,
        year: ~~general.millesime,
        language: { id: general.langID, name: general.langue },
        supportedLanguages: parse(general.listeLangues, false).map(({ langID, description }) => ({
            id: langID,
            name: description
        })),
        infoPage: general.lienMentions,
        hasForum: general.avecForum,
        helpURL: parse(general.UrlAide),
        videosURL: parse(general.urlAccesVideos),
        twitterURL: parse(general.urlAccesTwitter),
        withLoginOptions: general.AvecChoixConnexion,
        establishment: general.NomEtablissement,
        displayWeeks: general.afficherSemainesCalendaires,
        schoolYear: general.AnneeScolaire,
        firstCycle: parse(general.dateDebutPremierCycle),
        firstDay: parse(general.PremiereDate),
        firstMonday: parse(general.PremierLundi),
        lastDay: parse(general.DerniereDate),
        ticksPerDay: general.PlacesParJour,
        ticksPerHour: general.PlacesParHeure,
        sequenceDuration: general.DureeSequence,
        ticksForHalfDayAbsence: general.PlaceDemiJourneeAbsence,
        hasLunch: general.activationDemiPension,
        lunchStart: general.debutDemiPension,
        lunchEnd: general.finDemiPension,
        withPlainAfternoonHours: general.AvecHeuresPleinesApresMidi,
        firstOrLastWorkingDay: parse(general.JourOuvre),
        workingDays: parse(general.JoursOuvres),
        lunchDays: parse(general.JoursDemiPension),
        parentsChat: general.ActivationMessagerieEntreParents,
        workingDaysPerCycle: general.joursOuvresParCycle,
        firstDayOfWeek: general.premierJourSemaine,
        timetableGridsInCycle: general.grillesEDTEnCycle,
        workingDaysCycle: parse(general.setOfJoursCycleOuvre),
        halfWorkingDays: general.DemiJourneesOuvrees.map(parse),
        frequenciesRanges: general.DomainesFrequences.map(parse),
        frequenciesLabels: general.LibellesFrequences,
        defaultMarkMax: parse(general.BaremeNotation),
        allowedAnnotations: parse(general.listeAnnotationsAutorisees),
        acquisitionLevels: parse(general.ListeNiveauxDAcquisitions, ({
            listePositionnements, positionJauge, actifPour, abbreviation, raccourci,
            couleur, ponderation, nombrePointsBrevet, estAcqui, estNotantPourTxReussite
        }) => ({
            positions: parse(listePositionnements, ({ abbreviation, abbreviationAvecPrefixe }) => ({
                shortName: abbreviation,
                shortNameWithPrefix: abbreviationAvecPrefixe
            }), 'count'),
            triggerPosition: positionJauge,
            activeFor: parse(actifPour),
            shortName: abbreviation,
            shortPath: raccourci,
            color: couleur,
            weighting: parse(ponderation),
            brevetPoints: parse(nombrePointsBrevet),
            acquired: estAcqui,
            countsForSuccess: estNotantPourTxReussite
        }), 'count'),
        displayAcquisitionShortLabel: general.AfficherAbbreviationNiveauDAcquisition,
        withEvaluationHistory: general.AvecEvaluationHistorique,
        withoutIntermediaryLevelAutoValidation: general.SansValidationNivIntermediairesDsValidAuto,
        onlySchoolYearEvaluationsInAutoValidation: general.NeComptabiliserQueEvalsAnneeScoDsValidAuto,
        CECRLLevelsSupport: general.AvecGestionNiveauxCECRL,
        langActivityColor: general.couleurActiviteLangagiere,
        minMarkMCQ: general.minBaremeQuestionQCM,
        maxMarkMCQ: general.maxBaremeQuestionQCM,
        maxPointsMCQ: general.maxNbPointQCM,
        skillsGridLabelSize: general.tailleLibelleElementGrilleCompetence,
        homeworkCommentSize: general.tailleCommentaireDevoir,
        officeEnabled: general.O365_Actif,
        officeFederatedMode: general.O365_ModeFederated,
        officeTutorial: parse(general.O365_UrlTuto_Office),
        oneDriveTutorial: parse(general.O365_UrlTuto_OneDrive),
        connexionInfoRetrieval: general.AvecRecuperationInfosConnexion,
        font: general.Police,
        fontSize: general.TaillePolice,
        attachedStudents: general.AvecElevesRattaches,
        phoneMask: general.maskTelephone,
        maxECTS: general.maxECTS,
        maxAppreciationSizes: general.TailleMaxAppreciation,
        publicHolidays: parse(general.listeJoursFeries, ({ dateDebut, dateFin }) => ({
            from: parse(dateDebut),
            to: parse(dateFin)
        })),
        displaySequences: general.afficherSequences,
        firstHour: parse(general.PremiereHeure),
        hours: parse(general.ListeHeures, ({ A }) => ({
            round: A === undefined
        }), 'count'),
        endHours: parse(general.ListeHeuresFin, ({ A }) => ({
            round: A === undefined
        }), 'count'),
        sequences: general.sequences,
        periods: general.ListePeriodes.map(p => fromPronote(p, ({ G, periodeNotation, dateDebut, dateFin }) => ({
            kind: G === 1 ? 'trimester' : (G === 2 ? 'semester' : (G === 3 ? 'year' : 'other')),
            notationPeriod: periodeNotation,
            from: parse(dateDebut),
            to: parse(dateFin)
        }), false)),
        logo: parse(general.logo),
        breaks: parse(general.recreations, ({ place }) => ({
            position: place
        })),
        appCookieName: general.nomCookieAppli
    };
}

module.exports = getParams;