{"id":30186278,"url":"https://github.com/jsrep/cloudflare-turnstile-goat","last_synced_at":"2025-08-12T14:11:00.063Z","repository":{"id":308370643,"uuid":"1032309319","full_name":"JSREP/Cloudflare-Turnstile-Goat","owner":"JSREP","description":"Cloudflare Turnstile的在线例子","archived":false,"fork":false,"pushed_at":"2025-08-05T14:39:26.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-05T16:19:38.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JSREP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-05T06:02:04.000Z","updated_at":"2025-08-05T14:38:48.000Z","dependencies_parsed_at":"2025-08-05T16:34:19.577Z","dependency_job_id":null,"html_url":"https://github.com/JSREP/Cloudflare-Turnstile-Goat","commit_stats":null,"previous_names":["jsrep/cloudflare-turnstile-goat"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/JSREP/Cloudflare-Turnstile-Goat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSREP%2FCloudflare-Turnstile-Goat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSREP%2FCloudflare-Turnstile-Goat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSREP%2FCloudflare-Turnstile-Goat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSREP%2FCloudflare-Turnstile-Goat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JSREP","download_url":"https://codeload.github.com/JSREP/Cloudflare-Turnstile-Goat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSREP%2FCloudflare-Turnstile-Goat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270073680,"owners_count":24522393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T14:10:57.570Z","updated_at":"2025-08-12T14:11:00.057Z","avatar_url":"https://github.com/JSREP.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔐 Cloudflare Turnstile Goat\n\n[![Live Demo](https://img.shields.io/badge/🌐_Live_Demo-https://cloudflare--turnstile.jsrei.org/-blue?style=for-the-badge)](https://cloudflare-turnstile.jsrei.org/)\n[![Docker Hub](https://img.shields.io/badge/🐳_Docker_Hub-jsreidockerhub/cloudflare--turnstile--goat-blue?style=for-the-badge)](https://hub.docker.com/r/jsreidockerhub/cloudflare-turnstile-goat)\n[![License](https://img.shields.io/badge/📄_License-MIT-green?style=for-the-badge)](LICENSE)\n\n\u003e **🚀 [Try the Live Demo](https://cloudflare-turnstile.jsrei.org/)** - Experience Cloudflare Turnstile CAPTCHA integration in action!\n\nA comprehensive demonstration application showcasing **Cloudflare Turnstile CAPTCHA** integration with a complete web stack.\n\n## 🌟 Project Overview\n\nThis project is a complete Cloudflare Turnstile verification demonstration application featuring:\n- **Frontend**: Pure vanilla HTML/CSS/JavaScript implementation\n- **Backend**: Python Flask API with robust validation\n- **Features**: Complete Turnstile verification workflow with interactive debug interface\n\n## ✨ Key Features\n\n- 🛡️ **Security Protection**: Effectively prevents bot attacks and brute force attempts\n- 🎯 **User Experience**: No image clicking required - one-click verification completion\n- 🔧 **Easy Integration**: Simple API interface, integrate with just a few lines of code\n- 📊 **Real-time Monitoring**: Detailed verification logs and status monitoring\n- 🐳 **Docker Ready**: Containerized application for easy deployment\n- 🌍 **Multi-Architecture**: Supports AMD64, ARM64, and more platforms\n\n## 🏗️ Project Structure\n\n```\nCloudflare-Turnstile-Goat/\n├── backend/                 # Python Flask backend\n│   ├── app.py              # Main application file\n│   ├── config.py           # Configuration file\n│   ├── requirements.txt    # Python dependencies\n│   ├── .env                # Environment variables\n│   └── utils/\n│       └── turnstile.py    # Turnstile verification utilities\n├── frontend/               # Frontend static files\n│   ├── index.html          # Main page\n│   ├── login.html          # Login page\n│   ├── css/                # Stylesheets\n│   │   ├── main.css        # Main styles\n│   │   ├── login.css       # Login page styles\n│   │   └── components.css  # Component styles\n│   └── js/                 # JavaScript files\n│       ├── main.js         # Main script\n│       └── login.js        # Login page script\n├── Dockerfile              # Docker configuration\n├── docker-compose.yml      # Docker Compose setup\n└── README.md               # Project documentation\n```\n\n## 🚀 Quick Start\n\n### Option 1: Docker (Recommended)\n\n```bash\n# Pull and run the container\ndocker run -p 59623:59623 jsreidockerhub/cloudflare-turnstile-goat:latest\n\n# Or with custom environment variables\ndocker run -p 59623:59623 \\\n  -e TURNSTILE_SITE_KEY=your_site_key \\\n  -e TURNSTILE_SECRET_KEY=your_secret_key \\\n  jsreidockerhub/cloudflare-turnstile-goat:latest\n```\n\n### Option 2: Local Development\n\n#### 1. Prerequisites\n\n- Python 3.11+\n- Modern browser (ES6+ support)\n\n#### 2. Install Dependencies\n\n```bash\n# Navigate to backend directory\ncd backend\n\n# Install Python dependencies\npip install -r requirements.txt\n```\n\n#### 3. Configure Environment Variables\n\nCopy the environment template:\n```bash\ncp .env.example .env\n```\n\nEdit the `.env` file with your Turnstile keys:\n```env\n# Cloudflare Turnstile Configuration\nTURNSTILE_SITE_KEY=your_site_key\nTURNSTILE_SECRET_KEY=your_secret_key\n```\n\n\u003e **Note**: The project uses Cloudflare's test keys by default, suitable for development and demonstration. Replace with real keys for production.\n\n#### 4. Start the Application\n\n```bash\n# Start the backend service\ncd backend\npython app.py\n```\n\nAfter startup, visit:\n- **Main Page**: http://127.0.0.1:59623/\n- **Login Page**: http://127.0.0.1:59623/login.html\n\n## 📖 Usage Guide\n\n### Demo Credentials\n\n- **Username**: `admin`\n- **Password**: `password`\n\n### Verification Workflow\n\n1. Visit the login page\n2. Enter username and password\n3. Complete Turnstile CAPTCHA verification\n4. Click the login button\n5. View verification results and debug information\n\n## 🔌 API Endpoints\n\n### Get Configuration\n```http\nGET /api/config\n```\nReturns the Turnstile site key and configuration.\n\n### Verify Turnstile Token\n```http\nPOST /api/verify\nContent-Type: application/json\n\n{\n  \"token\": \"turnstile_token\"\n}\n```\n\n### User Login\n```http\nPOST /api/login\nContent-Type: application/json\n\n{\n  \"username\": \"admin\",\n  \"password\": \"password\",\n  \"token\": \"turnstile_token\"\n}\n```\n\n## ⚙️ Turnstile Configuration\n\n### Getting Your Keys\n\n1. Visit the [Cloudflare Dashboard](https://dash.cloudflare.com/)\n2. Select your domain\n3. Navigate to \"Security\" \u003e \"Turnstile\"\n4. Create a new site key\n5. Copy the Site Key and Secret Key\n\n### Test Keys\n\nThe project uses the following test keys by default:\n- **Site Key**: `1x00000000000000000000AA`\n- **Secret Key**: `1x0000000000000000000000000000000AA`\n\nThese keys are for development and testing only and will always return successful results.\n\n## 🛠️ Development Guide\n\n### Frontend Architecture\n\n- **HTML**: Semantic structure following web standards\n- **CSS**: Modular styles following the four UI design principles\n- **JavaScript**: ES6+ syntax with modular design\n\n### Backend Architecture\n\n- **Flask**: Lightweight web framework\n- **Modular Design**: Separated configuration and utility classes\n- **Error Handling**: Comprehensive exception handling mechanisms\n- **Logging**: Detailed operation logs\n\n### UI Design Principles\n\n1. **Proximity**: Related elements close together, unrelated elements separated\n2. **Alignment**: All elements properly aligned, left, center, or right\n3. **Repetition**: Consistent styles, unified colors and fonts\n4. **Contrast**: Important content stands out with size and color differences\n\n## 🔒 Security Considerations\n\n- ✅ Server-side Turnstile token verification\n- ✅ User IP address validation\n- ✅ Request timeout handling\n- ✅ Error message sanitization\n- ✅ CORS security configuration\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n1. **Turnstile Widget Not Displaying**\n   - Check network connection\n   - Verify Site Key configuration\n   - Check browser console for errors\n\n2. **Verification Failures**\n   - Check Secret Key configuration\n   - Ensure server time is correct\n   - Review backend logs\n\n3. **CORS Errors**\n   - Check CORS_ORIGINS configuration\n   - Ensure request domain is in the allowlist\n\n### Debug Mode\n\nEnable debug mode for detailed logs:\n```env\nFLASK_DEBUG=true\n```\n\n## 🏗️ Supported Architectures\n\nThe Docker image supports multiple architectures:\n- `linux/amd64` (Intel/AMD 64-bit)\n- `linux/arm64` (ARM 64-bit - Apple M1/M2, AWS Graviton, etc.)\n- `linux/arm/v7` (ARM 32-bit - Raspberry Pi 4, etc.)\n- `linux/arm/v6` (ARM 32-bit - Raspberry Pi Zero, etc.)\n- `linux/ppc64le` (PowerPC 64-bit Little Endian - IBM Power systems)\n- `linux/s390x` (IBM Z - IBM mainframe architecture)\n\n## 📚 What You'll Learn\n\n- How to integrate Cloudflare Turnstile CAPTCHA\n- Backend API validation techniques\n- Frontend CAPTCHA handling\n- Security best practices for CAPTCHA implementation\n- Docker containerization for web applications\n\n## 📄 License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit Issues and Pull Requests.\n\n## 📞 Contact\n\nIf you have any questions, please contact us through GitHub Issues.\n\n---\n\n**[🌐 Try the Live Demo](https://cloudflare-turnstile.jsrei.org/)** | **[📖 中文文档](README_CN.md)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsrep%2Fcloudflare-turnstile-goat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsrep%2Fcloudflare-turnstile-goat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsrep%2Fcloudflare-turnstile-goat/lists"}