{"id":22272653,"url":"https://github.com/ling-drag0n/cloudpaste","last_synced_at":"2025-05-15T06:08:23.829Z","repository":{"id":264245699,"uuid":"892815339","full_name":"ling-drag0n/CloudPaste-old","owner":"ling-drag0n","description":"新版已重构！详细查看README。基于 Cloudflare Workers 的在线剪贴板和文件分享服务，支持 Markdown、阅后即焚、文本/文件分享、密码保护等功能","archived":false,"fork":false,"pushed_at":"2025-04-04T20:31:42.000Z","size":1190,"stargazers_count":533,"open_issues_count":4,"forks_count":311,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-15T06:07:40.055Z","etag":null,"topics":["cloudflare","cloudflare-workers","cloudpaste","kv-storage","markdown","r2-storage","workers"],"latest_commit_sha":null,"homepage":"https://copy.vw50.ggff.net/share/paste/example","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ling-drag0n.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}},"created_at":"2024-11-22T20:44:35.000Z","updated_at":"2025-05-15T04:23:28.000Z","dependencies_parsed_at":"2024-12-23T21:21:01.730Z","dependency_job_id":"9b47811e-763f-4eb2-b679-1c51b420d6a3","html_url":"https://github.com/ling-drag0n/CloudPaste-old","commit_stats":null,"previous_names":["ling-drag0n/cloudpaste","ling-drag0n/cloudpaste-old"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ling-drag0n%2FCloudPaste-old","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ling-drag0n%2FCloudPaste-old/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ling-drag0n%2FCloudPaste-old/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ling-drag0n%2FCloudPaste-old/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ling-drag0n","download_url":"https://codeload.github.com/ling-drag0n/CloudPaste-old/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283350,"owners_count":22045141,"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","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":["cloudflare","cloudflare-workers","cloudpaste","kv-storage","markdown","r2-storage","workers"],"created_at":"2024-12-03T13:07:57.246Z","updated_at":"2025-05-15T06:08:18.815Z","avatar_url":"https://github.com/ling-drag0n.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudPaste - Online Clipboard 📋\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg width=\"100\" height=\"100\" src=\"https://img.icons8.com/dusk/100/paste.png\" alt=\"paste\"/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  English | \u003ca href=\"./README.zh.md\"\u003e中文\u003c/a\u003e\n\u003c/div\u003e\n\n![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-Workers-orange?style=flat-square\u0026logo=cloudflare)\n![Vue.js](https://img.shields.io/badge/Vue.js-3.x-green?style=flat-square\u0026logo=vue.js)\n![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)\n\nAn online clipboard and file sharing service based on Cloudflare Workers. Supports Markdown, password protection, file uploads, and more.\n\n👉Refactored version: https://github.com/ling-drag0n/CloudPaste\n\n\u003cdetails\u003e\n    \u003csummary\u003eOld version deployment tutorial, click to expand!\u003c/summary\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image1.png\" width=\"400\"/\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image2.png\" width=\"400\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image3.png\" width=\"400\"/\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image4.png\" width=\"400\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image5.png\" width=\"400\"/\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"./image/image6.png\" width=\"400\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## ✨ Features\n\n### 📝 Text Sharing\n\n- Supports plain text and Markdown styles\n- Real-time Markdown preview with synchronized scrolling\n- Resizable editor with bidirectional stretching\n- Password protection\n- Optional expiration time\n- Custom link suffix (available for single file uploads only)\n- Access count limit settings\n- Text sharing supports export to PDF, Word documents, and PNG images\n- Auto-save draft feature\n  - Automatically saves before browser closes\n  - Recoverable on next visit\n  - Automatically clears after successful submission\n\n### 📁 File Sharing\n\n- Drag and drop upload support\n- Multiple file uploads\n- Configurable file size limits and total storage limits\n- Password protection\n- Optional expiration time\n- Real-time upload progress display\n- File preview functionality\n- Upload speed display\n- Upload cancellation support\n- Custom link suffix (available for single file uploads only)\n- QR code sharing and direct link sharing\n- Download count limit settings\n\n### 🔐 Access Control\n\n- Storage space usage monitoring\n- Password Protection\n  - Password settings for text and file sharing\n  - Administrators can modify or remove passwords at any time\n  - Encrypted password storage\n- Text Content Control\n  - Only administrators can edit shared text content\n  - Regular users can only view\n  - Support for modifying expiration time\n  - Support for modifying access count limits\n- Upload Control\n  - Administrators can enable/disable text upload functionality\n  - Administrators can enable/disable file upload functionality\n  - Prevention of malicious resource consumption\n\n### 🛡️ Security Features\n\n- Encrypted password storage\n- Access permission control\n- CORS security configuration\n- Upload limit protection\n- Automatic expiration cleanup\n  - Regular checks for expired content\n  - Automatic deletion of expired shares\n  - Storage space release\n  - Cleanup check triggered by access\n\n### 🎨 Interface Optimization\n\n- Full resolution responsive layout\n- Optimized mobile adaptation\n- Beautiful scrollbar styles\n- Smooth animation transitions\n- File upload progress animation\n- Copy success notification animation\n- Error notification animation effects\n- Drag and drop upload visual feedback\n- Dark theme support (with minor imperfections)\n\n## 🚀 Deployment (Automatic)\n\n### 1. GitHub Actions Deployment (Optional)\n\n1. **Fork this Repository**\n\n   - Click the Fork button in the top right\n   - Wait for repository cloning to complete\n\n2. **Set GitHub Secrets**\n   In your GitHub repository, go to Settings -\u003e Secrets and variables -\u003e Actions -\u003e New Repository secrets, and add the following secrets:\n\n   - `CF_API_TOKEN`: Cloudflare API token\n\n     - Visit [Cloudflare Dashboard](https://dash.cloudflare.com/profile/api-tokens)\n     - Create new API token - select \"Edit Cloudflare Workers\"\n\n   - `CF_ACCOUNT_ID`: Cloudflare account ID\n\n     - Found on the right side of your Cloudflare dashboard\n\n   - `ADMIN_USERNAME`: Administrator username\n\n     - Set your admin account\n\n   - `ADMIN_PASSWORD`: Administrator password\n     - Set your admin password\n\n3. **Run Workflow**\n\n### 2. One-Click Deployment\n\nAfter deployment, there's no password by default. You need to set up variables and secrets in the corresponding worker under Cloudflare:\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/ling-drag0n/CloudPaste)\n\n## 🚀 Deployment (Manual)\n\n### 1. Prerequisites\n\n1. Register for a [Cloudflare](https://dash.cloudflare.com) account\n2. Access the Cloudflare console\n\n### 2. Create Storage Resources\n\n1. Create KV Namespace\n\n   - Name: `PASTE_STORE`\n   - Used for storing text content\n\n2. Create KV Namespace\n\n   - Name: `UPLOAD_STATUS`\n   - Used for storing upload functionality switch status\n\n3. Create R2 Bucket\n   - Name: `cloudpaste-files`\n   - Used for storing uploaded files\n\n### 3. Create Worker\n\n1. Create a new Worker script\n\n2. Configure environment variables:\n\n   ```env\n   ADMIN_USERNAME=your-admin-username\n   ADMIN_PASSWORD=your-admin-password\n   ```\n\n3. Bind storage:\n\n   - KV bindings:\n\n     ```toml\n     # Text storage\n     Variable name: PASTE_STORE\n     Select created KV namespace\n\n     # Upload status control\n     Variable name: UPLOAD_STATUS\n     Select created KV namespace\n     ```\n\n   - R2 binding:\n     ```toml\n     Variable name: FILE_STORE\n     Select created R2 bucket\n     ```\n\n4. KV Namespace Description:\n\n   - `PASTE_STORE`: For storing text share content and metadata\n   - `UPLOAD_STATUS`: For storing and controlling upload functionality switches\n     - `textUpload`: Controls text upload functionality\n     - `fileUpload`: Controls file upload functionality\n   - `FILE_STORE`: For storing uploaded files\n\n5. Example Configuration (wrangler.toml):\n\n   ```toml\n   [[kv_namespaces]]\n   binding = \"PASTE_STORE\"\n   id = \"your-KV-namespace-ID\"\n\n   [[kv_namespaces]]\n   binding = \"UPLOAD_STATUS\"\n   id = \"your-KV-namespace-ID\"\n\n   [[r2_buckets]]\n   bucket_name = \"cloudpaste-files\"\n   binding = \"FILE_STORE\"\n   ```\n\n### 4. Deploy Code\n\n1. Copy the complete code from `worker.js`\n2. Paste it into the Worker editor\n3. Save and deploy\n\n## 🔧 Code Structure\n\n### Main Components\n\n1. `worker.js`\n\n   - Main Worker code\n   - Contains route handling and API implementation\n\n2. Utility Functions\n\n   - `generateId`: Generate random ID\n   - `hashPassword`: Password encryption\n   - `verifyPassword`: Password verification\n   - `calculateExpiryTime`: Calculate expiration time\n   - `isExpired`: Check if expired\n\n3. Frontend Components\n   - Vue 3 application\n   - Markdown rendering\n   - Code highlighting\n   - File upload interface\n\n### 📡 API Endpoints\n\n1. Text Related\n\n   ```http\n   POST /api/paste     # Create text share\n   GET  /api/paste/:id # Get text content\n   ```\n\n2. File Related\n\n   ```http\n   POST /api/file      # Upload file\n   GET  /api/file/:id  # Get file information\n   GET  /api/file/:id?download=true # Download file\n   GET  /download/:id  # Direct file download\n   ```\n\n3. Admin Related\n   ```http\n   POST   /api/admin/login                    # Admin login\n   GET    /api/admin/shares                   # Get share list\n   GET    /api/admin/storage                  # Get storage space usage\n   DELETE /api/admin/paste/:id                # Delete text share\n   DELETE /api/admin/file/:id                 # Delete file share\n   PUT    /api/admin/paste/:id/content        # Update text content\n   PUT    /api/admin/paste/:id/password       # Modify text share password\n   PUT    /api/admin/file/:id/password        # Modify file share password\n   GET    /api/admin/upload-status            # Get upload status\n   PUT    /api/admin/upload-status            # Update upload status\n   PUT    /api/admin/file/:id/settings        # Modify file share settings\n   ```\n\n## 🔄 Automation Features\n\n### Expired Content Cleanup\n\n- Automatic detection of expired content\n- Scheduled cleanup of expired files and text\n- Storage space release\n- Automatic cleanup triggered every hour\n\n## ⚠️ Usage Limitations\n\n- Maximum file size: 98MB (modifiable)\n- Supported expiration times: 1 hour, 1 day, 7 days, 30 days, never expires\n- Concurrent requests limited by Worker\n- Free R2 total storage space: 10GB (modifiable)\n- Share access count limits:\n  - Text shares can set maximum view count\n  - File shares can set maximum download count\n  - Custom count settings, 0 means unlimited\n  - Automatic deletion when limit is reached\n- Custom link limitations:\n  - Only supports letters, numbers, hyphens, and underscores\n  - Only available for single file uploads\n- Storage space warnings:\n  - Warning at 70% usage\n  - Danger alert at 90% usage\n  - Upload disabled when storage is full\n\n## 📝 Notes\n\n1. Ensure correct environment variable configuration\n\n2. Regular storage usage checks\n\n   - Monitor storage space through admin panel\n   - Pay attention to storage space usage warnings\n   - Timely cleanup of unnecessary content\n\n3. Monitor error logs\n\n4. Mind Worker usage quotas\n\n5. For direct link downloads on server file transfer\n\n   ```bash\n   # Direct download\n   curl -O https://your-domain/download/fileId\n\n   # Download with password\n   curl -H \"X-Password: your-password\" -O https://your-domain/download/fileId\n   ```\n\n## 🛠️ Built With\n\n- Cloudflare Workers\n- Cloudflare KV\n- Cloudflare R2\n- Vue 3\n- Marked (Markdown rendering)\n- Highlight.js (code highlighting)\n\n## 📱 Browser Support\n\n- Chrome (recommended)\n- Firefox\n- Safari\n- Edge\n- Mobile browsers\n\n## 📄 License\n\nMIT License\n\n## 🔗 Related Links\n\n- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)\n- [Vue 3 Documentation](https://v3.vuejs.org/)\n- [Marked Documentation](https://marked.js.org/)\n\n\u003c/details\u003e\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=ling-drag0n/CloudPaste\u0026type=Date)](https://star-history.com/#ling-drag0n/CloudPaste\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fling-drag0n%2Fcloudpaste","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fling-drag0n%2Fcloudpaste","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fling-drag0n%2Fcloudpaste/lists"}