25 lines
828 B
JavaScript
25 lines
828 B
JavaScript
let xhr = new XMLHttpRequest();
|
|
|
|
xhr.open("GET", 'https://gitea.guams.fr/api/v1/repos/Guams/guams_homepage/commits?sha=main');
|
|
xhr.send();
|
|
|
|
xhr.onload = () => {
|
|
if (xhr.status === 200) {
|
|
let commits = JSON.parse(xhr.response);
|
|
commits.forEach(commit => {
|
|
const ul = document.getElementById("changelog-content");
|
|
const li = document.createElement("li");
|
|
const h2 = document.createElement("h2");
|
|
const span = document.createElement("span");
|
|
h2.innerText = new Date(commit.created).toLocaleDateString();
|
|
span.innerText = commit.commit.message;
|
|
li.appendChild(h2);
|
|
li.appendChild(span);
|
|
ul.appendChild(li);
|
|
})
|
|
}
|
|
}
|
|
|
|
xhr.onerror = function () {
|
|
console.error("Network error with gitea");
|
|
}; |