@striae-org/striae 7.0.1 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +8 -14
- package/functions/api/_shared/lists-client.ts +39 -0
- package/functions/api/_shared/registration-allowlist.ts +5 -4
- package/functions/api/auth/can-register.ts +7 -2
- package/functions/api/pdf/[[path]].ts +4 -1
- package/functions/api/user/[[path]].ts +11 -5
- package/package.json +14 -11
- package/scripts/delete-account.mjs +350 -0
- package/scripts/deploy-all.sh +3 -3
- package/scripts/deploy-config/modules/prompt.sh +43 -7
- package/scripts/deploy-config/modules/scaffolding.sh +19 -0
- package/scripts/deploy-config/modules/validation.sh +3 -0
- package/scripts/deploy-config.sh +0 -33
- package/scripts/deploy-pages-secrets.sh +1 -10
- package/scripts/deploy-worker-secrets.sh +19 -1
- package/scripts/install-workers.sh +4 -3
- package/scripts/update-markdown-versions.cjs +1 -0
- package/workers/audit-worker/package.json +2 -2
- package/workers/audit-worker/wrangler.jsonc.example +1 -1
- package/workers/data-worker/package.json +2 -2
- package/workers/data-worker/wrangler.jsonc.example +1 -1
- package/workers/image-worker/package.json +2 -2
- package/workers/image-worker/wrangler.jsonc.example +1 -1
- package/workers/lists-worker/package.json +13 -0
- package/workers/lists-worker/src/lists-worker.ts +97 -0
- package/workers/lists-worker/src/types.ts +4 -0
- package/workers/lists-worker/wrangler.jsonc.example +23 -0
- package/workers/pdf-worker/package.json +2 -2
- package/workers/pdf-worker/wrangler.jsonc.example +1 -1
- package/workers/user-worker/package.json +2 -2
- package/workers/user-worker/wrangler.jsonc.example +1 -1
- package/wrangler.toml.example +6 -2
- package/app/config-example/members.emails +0 -11
- package/app/config-example/primershear.emails +0 -6
- package/scripts/deploy-members-emails.sh +0 -102
- package/scripts/deploy-primershear-emails.sh +0 -101
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# ============================================
|
|
4
|
-
# MEMBERS EMAIL LIST DEPLOYMENT SCRIPT
|
|
5
|
-
# ============================================
|
|
6
|
-
# Reads app/config/members.emails, updates REGISTRATION_EMAILS in .env,
|
|
7
|
-
# then deploys that secret directly to Cloudflare Pages (production).
|
|
8
|
-
|
|
9
|
-
set -e
|
|
10
|
-
set -o pipefail
|
|
11
|
-
|
|
12
|
-
RED='\033[0;31m'
|
|
13
|
-
GREEN='\033[0;32m'
|
|
14
|
-
YELLOW='\033[1;33m'
|
|
15
|
-
BLUE='\033[0;34m'
|
|
16
|
-
NC='\033[0m'
|
|
17
|
-
|
|
18
|
-
echo -e "${BLUE}👥 Members Email List Deployment${NC}"
|
|
19
|
-
echo "=================================="
|
|
20
|
-
|
|
21
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
22
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
23
|
-
cd "$PROJECT_ROOT"
|
|
24
|
-
|
|
25
|
-
trap 'echo -e "\n${RED}❌ deploy-members-emails.sh failed near line ${LINENO}${NC}"' ERR
|
|
26
|
-
|
|
27
|
-
# ── Read emails file ──────────────────────────────────────────────────────────
|
|
28
|
-
|
|
29
|
-
EMAILS_FILE="$PROJECT_ROOT/app/config/members.emails"
|
|
30
|
-
|
|
31
|
-
if [ ! -f "$EMAILS_FILE" ]; then
|
|
32
|
-
echo -e "${RED}❌ members.emails not found at: $EMAILS_FILE${NC}"
|
|
33
|
-
echo -e "${YELLOW} Create it with one email address or @domain.com wildcard per line.${NC}"
|
|
34
|
-
echo -e "${YELLOW} See app/config-example/members.emails for the format.${NC}"
|
|
35
|
-
exit 1
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Strip comment lines and blank lines, then join with commas
|
|
39
|
-
# Use || true to avoid failure if paste gets no input (handles empty file gracefully)
|
|
40
|
-
REGISTRATION_EMAILS=$(grep -v '^[[:space:]]*#' "$EMAILS_FILE" | grep -v '^[[:space:]]*$' | paste -sd ',' - || true)
|
|
41
|
-
|
|
42
|
-
if [ -z "$REGISTRATION_EMAILS" ]; then
|
|
43
|
-
echo -e "${YELLOW}⚠️ members.emails contains no active entries.${NC}"
|
|
44
|
-
echo -e "${YELLOW} The secret will be set to an empty string, disabling the gateway (open registration).${NC}"
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
ENTRY_COUNT=$(echo "$REGISTRATION_EMAILS" | tr ',' '\n' | grep -c '[^[:space:]]' || true)
|
|
48
|
-
echo -e "${GREEN}✅ Loaded $ENTRY_COUNT entry(ies) from app/config/members.emails${NC}"
|
|
49
|
-
|
|
50
|
-
# ── Update .env ───────────────────────────────────────────────────────────────
|
|
51
|
-
|
|
52
|
-
ENV_FILE="$PROJECT_ROOT/.env"
|
|
53
|
-
|
|
54
|
-
if [ ! -f "$ENV_FILE" ]; then
|
|
55
|
-
echo -e "${RED}❌ .env not found. Run deploy-config first.${NC}"
|
|
56
|
-
exit 1
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
# Replace the REGISTRATION_EMAILS= line in .env (handles both empty and populated values)
|
|
60
|
-
if grep -q '^REGISTRATION_EMAILS=' "$ENV_FILE"; then
|
|
61
|
-
# Use a temp file to avoid sed -i portability issues across macOS/Linux
|
|
62
|
-
local_tmp=$(mktemp)
|
|
63
|
-
sed "s|^REGISTRATION_EMAILS=.*|REGISTRATION_EMAILS=${REGISTRATION_EMAILS}|" "$ENV_FILE" > "$local_tmp"
|
|
64
|
-
mv "$local_tmp" "$ENV_FILE"
|
|
65
|
-
echo -e "${GREEN}✅ Updated REGISTRATION_EMAILS in .env${NC}"
|
|
66
|
-
else
|
|
67
|
-
echo "" >> "$ENV_FILE"
|
|
68
|
-
echo "REGISTRATION_EMAILS=${REGISTRATION_EMAILS}" >> "$ENV_FILE"
|
|
69
|
-
echo -e "${GREEN}✅ Appended REGISTRATION_EMAILS to .env${NC}"
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# ── Deploy to Cloudflare Pages ────────────────────────────────────────────────
|
|
73
|
-
|
|
74
|
-
if ! command -v wrangler > /dev/null 2>&1; then
|
|
75
|
-
echo -e "${RED}❌ wrangler is not installed or not in PATH${NC}"
|
|
76
|
-
exit 1
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
source "$ENV_FILE"
|
|
80
|
-
|
|
81
|
-
PAGES_PROJECT_NAME=$(echo "$PAGES_PROJECT_NAME" | tr -d '\r')
|
|
82
|
-
if [ -z "$PAGES_PROJECT_NAME" ]; then
|
|
83
|
-
echo -e "${RED}❌ PAGES_PROJECT_NAME is missing from .env${NC}"
|
|
84
|
-
exit 1
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
echo -e "${YELLOW} Setting REGISTRATION_EMAILS for production...${NC}"
|
|
88
|
-
printf '%s' "$REGISTRATION_EMAILS" | wrangler pages secret put REGISTRATION_EMAILS \
|
|
89
|
-
--project-name "$PAGES_PROJECT_NAME"
|
|
90
|
-
|
|
91
|
-
echo -e "${GREEN}✅ REGISTRATION_EMAILS deployed to production${NC}"
|
|
92
|
-
|
|
93
|
-
# Deploy Pages so the new secret takes effect immediately
|
|
94
|
-
echo -e "\n${YELLOW}🚀 Building and deploying Pages to activate new secret...${NC}"
|
|
95
|
-
|
|
96
|
-
if ! npm run deploy-pages; then
|
|
97
|
-
echo -e "${RED}❌ Pages deployment failed${NC}"
|
|
98
|
-
exit 1
|
|
99
|
-
fi
|
|
100
|
-
echo -e "${GREEN}✅ Pages deployment complete${NC}"
|
|
101
|
-
|
|
102
|
-
echo -e "\n${GREEN}🎉 Members email list deployment complete!${NC}"
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# ============================================
|
|
4
|
-
# PRIMERSHEAR EMAIL LIST DEPLOYMENT SCRIPT
|
|
5
|
-
# ============================================
|
|
6
|
-
# Reads app/config/primershear.emails, updates PRIMERSHEAR_EMAILS in .env,
|
|
7
|
-
# then deploys that secret directly to Cloudflare Pages (production).
|
|
8
|
-
|
|
9
|
-
set -e
|
|
10
|
-
set -o pipefail
|
|
11
|
-
|
|
12
|
-
RED='\033[0;31m'
|
|
13
|
-
GREEN='\033[0;32m'
|
|
14
|
-
YELLOW='\033[1;33m'
|
|
15
|
-
BLUE='\033[0;34m'
|
|
16
|
-
NC='\033[0m'
|
|
17
|
-
|
|
18
|
-
echo -e "${BLUE}📧 PrimerShear Email List Deployment${NC}"
|
|
19
|
-
echo "======================================"
|
|
20
|
-
|
|
21
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
22
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
23
|
-
cd "$PROJECT_ROOT"
|
|
24
|
-
|
|
25
|
-
trap 'echo -e "\n${RED}❌ deploy-primershear-emails.sh failed near line ${LINENO}${NC}"' ERR
|
|
26
|
-
|
|
27
|
-
# ── Read emails file ──────────────────────────────────────────────────────────
|
|
28
|
-
|
|
29
|
-
EMAILS_FILE="$PROJECT_ROOT/app/config/primershear.emails"
|
|
30
|
-
|
|
31
|
-
if [ ! -f "$EMAILS_FILE" ]; then
|
|
32
|
-
echo -e "${RED}❌ primershear.emails not found at: $EMAILS_FILE${NC}"
|
|
33
|
-
echo -e "${YELLOW} Create it with one email address per line.${NC}"
|
|
34
|
-
exit 1
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
# Strip comment lines and blank lines, then join with commas
|
|
38
|
-
# Use || true to avoid failure if paste gets no input (handles empty file gracefully)
|
|
39
|
-
PRIMERSHEAR_EMAILS=$(grep -v '^[[:space:]]*#' "$EMAILS_FILE" | grep -v '^[[:space:]]*$' | paste -sd ',' - || true)
|
|
40
|
-
|
|
41
|
-
if [ -z "$PRIMERSHEAR_EMAILS" ]; then
|
|
42
|
-
echo -e "${YELLOW}⚠️ primershear.emails contains no active email addresses.${NC}"
|
|
43
|
-
echo -e "${YELLOW} The secret will be set to an empty string, disabling the feature.${NC}"
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
EMAIL_COUNT=$(echo "$PRIMERSHEAR_EMAILS" | tr ',' '\n' | grep -c '[^[:space:]]' || true)
|
|
47
|
-
echo -e "${GREEN}✅ Loaded $EMAIL_COUNT email address(es) from app/config/primershear.emails${NC}"
|
|
48
|
-
|
|
49
|
-
# ── Update .env ───────────────────────────────────────────────────────────────
|
|
50
|
-
|
|
51
|
-
ENV_FILE="$PROJECT_ROOT/.env"
|
|
52
|
-
|
|
53
|
-
if [ ! -f "$ENV_FILE" ]; then
|
|
54
|
-
echo -e "${RED}❌ .env not found. Run deploy-config first.${NC}"
|
|
55
|
-
exit 1
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
# Replace the PRIMERSHEAR_EMAILS= line in .env (handles both empty and populated values)
|
|
59
|
-
if grep -q '^PRIMERSHEAR_EMAILS=' "$ENV_FILE"; then
|
|
60
|
-
# Use a temp file to avoid sed -i portability issues across macOS/Linux
|
|
61
|
-
local_tmp=$(mktemp)
|
|
62
|
-
sed "s|^PRIMERSHEAR_EMAILS=.*|PRIMERSHEAR_EMAILS=${PRIMERSHEAR_EMAILS}|" "$ENV_FILE" > "$local_tmp"
|
|
63
|
-
mv "$local_tmp" "$ENV_FILE"
|
|
64
|
-
echo -e "${GREEN}✅ Updated PRIMERSHEAR_EMAILS in .env${NC}"
|
|
65
|
-
else
|
|
66
|
-
echo "" >> "$ENV_FILE"
|
|
67
|
-
echo "PRIMERSHEAR_EMAILS=${PRIMERSHEAR_EMAILS}" >> "$ENV_FILE"
|
|
68
|
-
echo -e "${GREEN}✅ Appended PRIMERSHEAR_EMAILS to .env${NC}"
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# ── Deploy to Cloudflare Pages ────────────────────────────────────────────────
|
|
72
|
-
|
|
73
|
-
if ! command -v wrangler > /dev/null 2>&1; then
|
|
74
|
-
echo -e "${RED}❌ wrangler is not installed or not in PATH${NC}"
|
|
75
|
-
exit 1
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
source "$ENV_FILE"
|
|
79
|
-
|
|
80
|
-
PAGES_PROJECT_NAME=$(echo "$PAGES_PROJECT_NAME" | tr -d '\r')
|
|
81
|
-
if [ -z "$PAGES_PROJECT_NAME" ]; then
|
|
82
|
-
echo -e "${RED}❌ PAGES_PROJECT_NAME is missing from .env${NC}"
|
|
83
|
-
exit 1
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
echo -e "${YELLOW} Setting PRIMERSHEAR_EMAILS for production...${NC}"
|
|
87
|
-
printf '%s' "$PRIMERSHEAR_EMAILS" | wrangler pages secret put PRIMERSHEAR_EMAILS \
|
|
88
|
-
--project-name "$PAGES_PROJECT_NAME"
|
|
89
|
-
|
|
90
|
-
echo -e "${GREEN}✅ PRIMERSHEAR_EMAILS deployed to production${NC}"
|
|
91
|
-
|
|
92
|
-
# Deploy Pages so the new secret takes effect immediately
|
|
93
|
-
echo -e "\n${YELLOW}🚀 Building and deploying Pages to activate new secret...${NC}"
|
|
94
|
-
|
|
95
|
-
if ! npm run deploy-pages; then
|
|
96
|
-
echo -e "${RED}❌ Pages deployment failed${NC}"
|
|
97
|
-
exit 1
|
|
98
|
-
fi
|
|
99
|
-
echo -e "${GREEN}✅ Pages deployment complete${NC}"
|
|
100
|
-
|
|
101
|
-
echo -e "\n${GREEN}🎉 PrimerShear email list deployment complete!${NC}"
|