Skip to content

Commit 8fbfee6

Browse files
committed
Add: Cap-Captcha
1 parent 8474b36 commit 8fbfee6

3 files changed

Lines changed: 210 additions & 0 deletions

File tree

‎ct/cap-captcha.sh‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
3+
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
4+
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
5+
# Copyright (c) 2021-2026 community-scripts ORG
6+
# Author: MickLesk (CanbiZ)
7+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
8+
# Source: https://github.com/tiagozip/cap
9+
10+
APP="Cap-Captcha"
11+
var_tags="${var_tags:-captcha;security;anti-bot}"
12+
var_cpu="${var_cpu:-2}"
13+
var_ram="${var_ram:-2048}"
14+
var_disk="${var_disk:-4}"
15+
var_os="${var_os:-debian}"
16+
var_version="${var_version:-13}"
17+
var_arm64="${var_arm64:-yes}"
18+
var_unprivileged="${var_unprivileged:-1}"
19+
20+
export var_admin_key="${var_admin_key:-}"
21+
22+
header_info "$APP"
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
32+
if [[ ! -d /opt/cap-captcha ]]; then
33+
msg_error "No ${APP} Installation Found!"
34+
exit
35+
fi
36+
37+
if check_for_gh_release "cap-captcha" "tiagozip/cap" "" "" "capd@"; then
38+
msg_info "Stopping Cap"
39+
systemctl stop cap-captcha
40+
msg_ok "Stopped Cap"
41+
42+
NODE_VERSION="24" NODE_MODULE="bun" setup_nodejs
43+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "cap-captcha" "tiagozip/cap" "tarball" "latest" "/opt/cap-captcha" "" "capd@"
44+
45+
msg_info "Building Cap"
46+
cd /opt/cap-captcha/capd
47+
$STD bun install --frozen-lockfile
48+
$STD bun run build
49+
rm -rf node_modules
50+
$STD bun install --frozen-lockfile --production
51+
rm -rf node_modules/capjs-core
52+
mkdir -p node_modules/capjs-core
53+
cp -r ../core/package.json ../core/src node_modules/capjs-core/
54+
rm -rf ~/.bun/install/cache
55+
msg_ok "Built Cap"
56+
57+
msg_info "Starting Cap"
58+
systemctl start cap-captcha
59+
msg_ok "Started Cap"
60+
msg_ok "Updated successfully!"
61+
fi
62+
exit
63+
}
64+
65+
start
66+
build_container
67+
description
68+
69+
msg_ok "Completed Successfully!\n"
70+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
71+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
72+
echo -e "${GATEWAY}${BGN}http://${IP}:3000${CL}"
73+
echo -e "${INFO}${YW}Admin key: ADMIN_KEY in /opt/cap-captcha_data/.env${CL}"

‎install/cap-captcha-install.sh‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
6+
# Source: https://github.com/tiagozip/cap
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
var_admin_key="${var_admin_key:-$(random_password 48)}"
17+
if ((${#var_admin_key} < 12)); then
18+
msg_error "The admin key needs at least 12 characters"
19+
exit 64
20+
fi
21+
22+
msg_info "Installing Valkey"
23+
$STD apt install -y valkey-server
24+
sed -i 's/^appendonly no/appendonly yes/' /etc/valkey/valkey.conf
25+
systemctl restart valkey-server
26+
msg_ok "Installed Valkey"
27+
28+
NODE_VERSION="24" NODE_MODULE="bun" setup_nodejs
29+
fetch_and_deploy_gh_release "cap-captcha" "tiagozip/cap" "tarball" "latest" "/opt/cap-captcha" "" "capd@"
30+
31+
msg_info "Building Cap"
32+
cd /opt/cap-captcha/capd
33+
$STD bun install --frozen-lockfile
34+
$STD bun run build
35+
rm -rf node_modules
36+
$STD bun install --frozen-lockfile --production
37+
rm -rf node_modules/capjs-core
38+
mkdir -p node_modules/capjs-core
39+
cp -r ../core/package.json ../core/src node_modules/capjs-core/
40+
rm -rf ~/.bun/install/cache
41+
msg_ok "Built Cap"
42+
43+
msg_info "Configuring Cap"
44+
mkdir -p /opt/cap-captcha_data
45+
cat <<EOF >/opt/cap-captcha_data/.env
46+
NODE_ENV=production
47+
SERVER_PORT=3000
48+
DATA_DIR=/opt/cap-captcha_data
49+
VALKEY_URL=redis://127.0.0.1:6379
50+
ADMIN_KEY='${var_admin_key}'
51+
EOF
52+
chmod 600 /opt/cap-captcha_data/.env
53+
msg_ok "Configured Cap"
54+
55+
msg_info "Creating Service"
56+
cat <<EOF >/etc/systemd/system/cap-captcha.service
57+
[Unit]
58+
Description=Cap CAPTCHA Server
59+
After=network.target valkey-server.service
60+
Requires=valkey-server.service
61+
62+
[Service]
63+
Type=simple
64+
WorkingDirectory=/opt/cap-captcha/capd
65+
EnvironmentFile=/opt/cap-captcha_data/.env
66+
ExecStart=/usr/bin/bun run src/index.js
67+
Restart=on-failure
68+
RestartSec=5
69+
70+
[Install]
71+
WantedBy=multi-user.target
72+
EOF
73+
systemctl enable -q --now cap-captcha
74+
msg_ok "Created Service"
75+
76+
motd_ssh
77+
customize
78+
cleanup_lxc

‎json/cap-captcha.json‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "Cap",
3+
"slug": "cap-captcha",
4+
"categories": [
5+
6
6+
],
7+
"date_created": "2026-11-13",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://trycap.dev/guide/capd/",
13+
"website": "https://trycap.dev/",
14+
"repository": "https://github.com/tiagozip/cap",
15+
"architectures": [
16+
"amd64",
17+
"arm64"
18+
],
19+
"platforms": ["pve"],
20+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/cap-captcha.webp",
21+
"description": "Cap is a lightweight, privacy-friendly CAPTCHA alternative to reCAPTCHA and hCaptcha that uses proof-of-work instead of puzzles or tracking. This is its self-hosted server (capd): a dashboard to manage site keys, the challenge endpoints the widget talks to, and a siteverify API your backend uses to check tokens.",
22+
"install_methods": [
23+
{
24+
"type": "default",
25+
"script": "ct/cap-captcha.sh",
26+
"config_path": "/opt/cap-captcha_data/.env",
27+
"resources": {
28+
"cpu": 2,
29+
"ram": 2048,
30+
"hdd": 4,
31+
"os": "Debian",
32+
"version": "13"
33+
}
34+
}
35+
],
36+
"default_credentials": {
37+
"username": null,
38+
"password": null
39+
},
40+
"notes": [
41+
{
42+
"text": "Sign in to the dashboard with the admin key (ADMIN_KEY in /opt/cap-captcha_data/.env).",
43+
"type": "info"
44+
},
45+
{
46+
"text": "Stored site key secrets are encrypted with the admin key. After changing ADMIN_KEY, reset each site key's secret.",
47+
"type": "warning"
48+
}
49+
],
50+
"app_vars": [
51+
{
52+
"name": "var_admin_key",
53+
"label": "Admin Key",
54+
"type": "password",
55+
"secret": true,
56+
"help": "Dashboard password, at least 12 characters; generated when left empty"
57+
}
58+
]
59+
}

0 commit comments

Comments
 (0)