-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
101 lines (87 loc) · 3.28 KB
/
index.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<!-- Written by TechyGuy (TechyGuy#3470 @ discord, [email protected]) And Coffeboi (Coffeboi#8124) for hugin cache, comes with no warranty but no copyright either. The code is free to edit however you want -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="style.css" rel="stylesheet"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans&display=swap" rel="stylesheet">
<link href="https://raw.githack.com/TechyGuy17/Hugin-cache-homepage/master/style.css" rel="stylesheet">
<title>Hugin Cache</title>
</head>
<body>
<header>
<div class="nav-wrapper container">
<h1 style="color: #ffffff;">Hugin Cache</h1>
<nav>
<a href="/index.html">Home</a>
<a href="/graphs.html">Graphs</a>
</nav>
</div>
</header>
<h2>Last 50 messages:</h2>
<h5>Want more? Use the api instead! {{ index_file_url }}</h5>
<script>
fetch('https://cache.hugin.chat/api/v1/posts?size=50')
.then((response) => {
return response.json()
})
.then((json) => {
var temp = "";
json.items.forEach(item => {
let username = item.nickname
if (username == null) {
username = "Anonymous"
}
let board = item.board
if (item.board.startsWith('SEKR') == true) {
board = item.board.slice(0, 10) + ".....";
}
let reply_tx = item.reply
let reply_message = ""
let reply_nickname = ""
let reply_show = ""
if (reply_tx != null) {
async function getReplyMessageNickname() {
response = await fetch('https://cache.hugin.chat/api/v1/posts/' + reply_tx)
json = await response.json()
reply_message = json.message
reply_nickname = json.nickname
// console.log(reply_nickname,reply_message)
reply_show = 'Original message: "' + reply_nickname + ':' + reply_message + '"' + " | Response: "
}
getReplyMessageNickname()
}
async function populateTable() {
temp += "<tr>";
temp += "<td>" + username + "</td>";
temp += "<td>" + reply_show + item.message + "</td>";
temp += "<td>" + board + "</td>";
temp += "<td>" + new Date(item.time * 1000) + "</td>";
document.getElementById('item').innerHTML = temp;
}
setTimeout(() => {
populateTable()
}, 75)
})
})
</script>
<div class="container">
<table class="table">
<thead>
<tr>
<th>Nickname</th>
<th>Message</th>
<th>Board</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tbody id="item">
</tbody>
</table>
</div>
</body>
</html>