aboutsummaryrefslogtreecommitdiff
path: root/js/config.js
blob: 5fc456c0267c7f071b7d600c24aed4e0c09f1c8b (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
const courseId = 2466361;
function getCourseId() {
	return courseId;
}

// TODO(muhq): retrieve when loading activities/DBs
const cockpidId = 93017047;
function getCockpitId() {
	return cockpidId;
}

function getCourseParticipantsUrl() {
	return `https://lernplattform.bycs.de/user/index.php?id=${courseId}`;
}

async function getUserIconUrl(userId) {
	console.assert(userId, "getUserIconUrl needs a userId");
	const userRes = await fetch(`https://lernplattform.bycs.de/user/profile.php?id=${userId}`)
	const userDoc = new DOMParser().parseFromString(await userRes.text(), 'text/html')
	const userpicture = userDoc.querySelector(".userpicture");
	return userpicture ? userpicture.src : "";
}

export {
	getCourseId,
	getCockpitId,
	getUserIconUrl,
	getCourseParticipantsUrl
};