aboutsummaryrefslogtreecommitdiff
path: root/js/config.js
blob: f07c5ec2eb1138dc01b745f6075f1d7141391583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const courseId = 2466361;
function getCourseId() {
	return courseId;
}

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,
	getUserIconUrl,
	getCourseParticipantsUrl
};