-
Notifications
You must be signed in to change notification settings - Fork 2
/
util.js
62 lines (57 loc) · 1.21 KB
/
util.js
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
let head = `<!DOCTYPE html><html><head>
<title>E</title>
<style>
body {
max-width:650px;
margin: 2em auto 4em;
padding: 0 1rem;
line-height: 1.5;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
-webkit-font-smoothing: antialiased;
}
img {
max-width: 450px;
display: block;
text-align: center;
margin: 0 auto;
}
ul {
list-style:none;
padding-left:0;
}
li.spacer {
padding-top:15px;
}
pre {
background-color:#f1f1f1;
padding:5px;
border-radius:5px;
}
</style>
</head><body>
<script src="https://jam.dev/jam.js"></script>
<script>Jam.init('weekly-silkworm-395')</script>
<div class="categories"><a href="/">About</a> | <a href="/blog">Blog</a> | <a href="/contact">Contact</a> | <a href="/newsletter">Newsletter</a> </div>
`
let foot = `
</body></html>
`
async function get(key) {
try {
return await kv.get(key)
} catch (e) {
return null
}
}
// put a key in storage.
async function put(key, value) {
return await kv.put(key, value);
}
function render(f) {
return head + f + foot
}
module.exports = {
render:render,
put:put,
get:get
}