29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
|
|
import { token } from "./getToken";
|
||
|
|
|
||
|
|
import shrekJPEG from "./images/shrekJPEG.txt";
|
||
|
|
import { getCurrentCourse } from "./getCourse";
|
||
|
|
|
||
|
|
const params = new URLSearchParams({
|
||
|
|
COURS_PROGRAMME: await getCurrentCourse().then((c) => (c ? c.COURS_PROGRAMME.toString() : "")),
|
||
|
|
signatureJSON: `data:image/jpeg;base64,${shrekJPEG}`, // your raw base64 (no spaces)
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log(
|
||
|
|
await fetch("https://learning.estia.fr/pegasus/index.php?com=emergement&job=enregistrer-emergement", {
|
||
|
|
headers: {
|
||
|
|
accept: "application/json, text/javascript, */*; q=0.01",
|
||
|
|
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||
|
|
"sec-ch-ua": '"Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138"',
|
||
|
|
"sec-ch-ua-mobile": "?0",
|
||
|
|
"sec-ch-ua-platform": '"macOS"',
|
||
|
|
"x-requested-with": "XMLHttpRequest",
|
||
|
|
cookie: `PHPSESSID=${token}`,
|
||
|
|
},
|
||
|
|
referrer: "https://learning.estia.fr/pegasus/index.php?com=emergement&job=load-cours-programmes-apprenant",
|
||
|
|
body: params.toString(),
|
||
|
|
method: "POST",
|
||
|
|
mode: "cors",
|
||
|
|
credentials: "omit",
|
||
|
|
}).then((response) => response.text())
|
||
|
|
);
|