summaryrefslogtreecommitdiff
path: root/includes/external/school/node_modules/pronote-api/src/data/files.js
blob: aea0e8e3cc864bcfb3233a8eaf5eff0f0d8bf8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const { toPronote } = require('./objects');
const { cipher } = require('../cipher');

const EXTERNAL_FILES_FOLDER = 'FichiersExternes/';

function getFileURL(session, { id, name, type })
{
    const fileID = cipher(session, JSON.stringify(toPronote({ id, type })));
    const fileName = encodeURIComponent(encodeURIComponent(name)); // *Clown emoji*

    return session.server + EXTERNAL_FILES_FOLDER + fileID + '/' + fileName + '?Session=' + session.id;
}

module.exports = { getFileURL };