Reorganize lib

This commit is contained in:
Tiago Rangel
2025-01-12 11:53:54 +00:00
parent ba639fadca
commit 62d5af07e4
11 changed files with 12 additions and 16 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
Cap — A modern, lightning-quick PoW captcha
Copyright (C) 2025 Tiago Rangel
Copyright © 2025 Tiago Rangel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
+2 -2
View File
@@ -3,8 +3,8 @@ const babel = require("@babel/core");
const { minify } = require("terser");
const paths = [
["./src/js/cap.js", "./src/js/min/cap.min.js"],
["./src/js/cap-floating.js", "./src/js/min/cap-floating.min.js"],
["./src/cap.js", "./lib/cap.min.js"],
["./src/cap-floating.js", "./lib/cap-floating.min.js"],
];
paths.forEach(async function ([inpath, outpath]) {
+2 -2
View File
@@ -9,8 +9,8 @@ Cap can automatically hide the captcha until the form is submitted. To use this
You'll also need to import both the Cap library and the floating mode script from JSDelivr:
```html
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/src/js/min/cap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/src/js/min/cap-floating.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/cap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/cap-floating.min.js"></script>
```
The following attributes are supported:
+1 -1
View File
@@ -10,7 +10,7 @@ Cap is a library designed for safeguarding against spam and abuse by utilizing a
Cap is built to be straightforward and requires no API tokens for setup. Start by importing the Cap library from JSDelivr:
```html
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/src/js/min/cap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/cap.min.js"></script>
```
Next, add the `<cap-widget>` component to your HTML.
+2 -6
View File
@@ -151,13 +151,9 @@ router.post("/api/validate", createRateLimit(), async (ctx) => {
router.get("/", async (ctx) => {
ctx.redirect("/docs");
});
router.get("/demo", async (ctx) => {
await send(ctx, "src/index.html", { root: __dirname });
});
router.get("/wasm-hashes.min.js", async (ctx) => {
ctx.type = "application/javascript";
await send(ctx, "src/js/min/wasm-hashes.min.js", { root: __dirname });
router.get("/demo", async (ctx) => {
await send(ctx, "src/demo.html", { root: __dirname });
});
setInterval(async () => {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -494,7 +494,7 @@
setTimeout(async function () {
workerScript =
(await (await fetch("/wasm-hashes.min.js")).text()) +
(await (await fetch("https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/wasm-hashes.min.js")).text()) +
workerFunct
.toString()
.replace(/^function\s*\([^\)]*\)\s*{|\}$/g, "")
+2 -2
View File
@@ -77,6 +77,6 @@
}
</script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/src/js/min/cap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/src/js/min/cap-floating.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/cap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/cap-floating.min.js"></script>
</html>