Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const passedUrl = url.searchParams.get("url");
const passedSvg = url.searchParams.get("svg");
return new Response(
/* html */ `<html>
<head>
<script type="module" src="https://esm.sh/@bitjson/qr-code/dist/qr-code.js"></script>
<style>
</style>
</head>
<body>
<qr-code
id="qr-code"
contents="https://${passedUrl}"
module-color="#000000"
position-ring-color="#000000"
position-center-color="#000000"
mask-x-to-y-ratio="1.2"
style="
width: 100%;
height: 100%;
margin: 3rem auto;
background-color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
"
>
<img
slot="icon"
src="https://${passedSvg}"
alt="qr code middle icon"
style="border-radius:7.5px; width: 100%;"
/>
</qr-code>
<script>
// document.querySelector('#qr-code').addEventListener('codeRendered', () =>
// document.querySelector('#qr-code').animateQRCode('MaterializeIn')
// );
</script>
</body>
</html>`,
{ headers: { "Content-Type": "text/html" } },
);
}
git-union69.web.val.run
July 30, 2024