Reorganize lib
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -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, "")
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user