Skip to content

Commit 68d3140

Browse files
committed
clean up demo code
1 parent cf1e147 commit 68d3140

File tree

4 files changed

+18
-95
lines changed

4 files changed

+18
-95
lines changed

demo/index.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
button {
2020
margin-top: 10px;
21-
font-family: system,-apple-system,"BlinkMacSystemFont",".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande","Ubuntu","arial",sans-serif;
21+
font-family: system, -apple-system, "BlinkMacSystemFont",
22+
".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI",
23+
"Helvetica Neue", "Lucida Grande", "Ubuntu", "arial", sans-serif;
2224
background-color: rgba(20, 20, 25);
2325
border: 1px solid rgba(60, 60, 70);
2426
border-radius: 12px;
@@ -27,7 +29,7 @@
2729
font-size: 14px;
2830
padding: 12px 16px;
2931
text-align: center;
30-
transition: transform .2s, background-color .2s, border-color .2s;
32+
transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
3133
width: fit-content;
3234
}
3335

@@ -41,7 +43,7 @@
4143
}
4244

4345
button:active {
44-
transform: scale(.98)
46+
transform: scale(0.98);
4547
}
4648
.source {
4749
color: black;
@@ -77,11 +79,12 @@
7779
>Source code</a
7880
>
7981
</body>
80-
82+
83+
<!--
8184
<script src="https://cdn.jsdelivr.net/npm/@cap.js/widget"></script>
8285
<script src="https://cdn.jsdelivr.net/npm/@cap.js/widget/cap-floating.min.js"></script>
83-
84-
<!-- to use local resources, uncomment this: -->
85-
<!-- <script src="/cap.js"></script>
86-
<script src="/cap-floating.js"></script> -->
86+
-->
87+
88+
<script src="/cap.js"></script>
89+
<script src="/cap-floating.js"></script>
8790
</html>

demo/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
},
1313
"dependencies": {
1414
"@cap.js/server": "^1.0.5",
15-
"@fastify/static": "^8.1.1",
1615
"fastify": "^5.2.1"
1716
}
1817
}

demo/server.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1+
import fs from "fs";
12
import path from "path";
23
import Cap from "@cap.js/server";
3-
import fastifyStatic from "@fastify/static";
44
import Fastify from "fastify";
55

66
const fastify = Fastify();
77
const cap = new Cap({
88
tokens_store_path: ".data/tokensList.json",
99
});
1010

11-
fastify.register(fastifyStatic, {
12-
root: path.join(__dirname),
13-
prefix: "/",
14-
});
15-
1611
fastify.get("/", (req, res) => {
17-
res.sendFile("index.html");
12+
res.header("Content-Type", "text/html");
13+
res.send(fs.createReadStream(path.join(__dirname, "index.html")));
1814
});
1915

2016
fastify.get("/cap.js", (req, res) => {
21-
res.sendFile("../widget/src/cap.js");
17+
res.header("Content-Type", "application/javascript");
18+
res.send(fs.createReadStream(path.join(__dirname, "../widget/src/cap.js")));
2219
});
2320

2421
fastify.get("/cap-floating.js", (req, res) => {
25-
res.sendFile("../widget/src/cap-floating.js");
22+
res.header("Content-Type", "application/javascript");
23+
res.send(fs.createReadStream(path.join(__dirname, "../widget/src/cap-floating.js")));
2624
});
2725

2826
fastify.post("/api/challenge", (req, res) => {

server/index.test.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)