-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdates.html
77 lines (72 loc) · 2.88 KB
/
updates.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main-styles.css">
<style>
* {
overflow-wrap: break-word;
}
</style>
</head>
<body>
<table width=100% id="commit-history">
<thead>
<tr>
<th>Date and Message</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">Loading commit history...</td>
</tr>
</tbody>
</table>
<script>
// please don't steal my token
// it doesn't have any special perms
// just make your own, i like my api creds
var check = 1;
if (check==1) {
document.addEventListener('DOMContentLoaded', function() {
const PAT = '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';
const repoOwner = 'sebastian-92';
const repoName = 'sebastian-92.github.io';
const commitsUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/commits`;
fetch(commitsUrl, {
headers: {
'Authorization': `${PAT}`,
'Accept': 'application/vnd.github.v3+json'
}
})
.then(response => response.json())
.then(commits => {
const commitHistoryTable = document.getElementById('commit-history').getElementsByTagName('tbody')[0];
commitHistoryTable.innerHTML = '';
commits.forEach(commit => {
const row = document.createElement('tr');
const dateMessageCell = document.createElement('td');
dateMessageCell.className = 'commit-date-message';
dateMessageCell.innerHTML = `
${new Date(commit.commit.author.date).toLocaleDateString()}<br>
${new Date(commit.commit.author.date).toLocaleTimeString()}<br><br>
${commit.commit.message}
`;
row.appendChild(dateMessageCell);
commitHistoryTable.appendChild(row);
});
})
.catch(error => {
const commitHistoryTable = document.getElementById('commit-history').getElementsByTagName('tbody')[0];
commitHistoryTable.innerHTML = '<tr><td colspan="2">Failed to load commit history. Please try again later.</td></tr>';
console.error('Error fetching commit history:', error);
});
});
} else {
const commitHistoryTable = document.getElementById('commit-history').getElementsByTagName('tbody')[0];
commitHistoryTable.innerHTML = '<tr><td colspan="2">Updates are off for maintenance</td></tr>';
}
</script>
</body>
</html>