{"id":29014242,"url":"https://github.com/djkcyl/rifs","last_synced_at":"2025-09-21T22:55:47.079Z","repository":{"id":301141863,"uuid":"1004855846","full_name":"djkcyl/rifs","owner":"djkcyl","description":"🦀 基于 Rust 构建的现代化高性能图床服务，支持实时转换、智能缓存和多种现代图片格式","archived":false,"fork":false,"pushed_at":"2025-07-01T09:24:26.000Z","size":205,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T22:48:31.637Z","etag":null,"topics":["image","image-processing","imagebed","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djkcyl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-19T09:32:29.000Z","updated_at":"2025-07-02T16:21:16.000Z","dependencies_parsed_at":"2025-06-25T11:42:14.566Z","dependency_job_id":null,"html_url":"https://github.com/djkcyl/rifs","commit_stats":null,"previous_names":["djkcyl/rifs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/djkcyl/rifs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djkcyl%2Frifs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djkcyl%2Frifs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djkcyl%2Frifs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djkcyl%2Frifs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djkcyl","download_url":"https://codeload.github.com/djkcyl/rifs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djkcyl%2Frifs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276318988,"owners_count":25621651,"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-09-21T02:00:07.055Z","response_time":72,"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":["image","image-processing","imagebed","rust"],"created_at":"2025-06-25T20:13:03.322Z","updated_at":"2025-09-21T22:55:47.055Z","avatar_url":"https://github.com/djkcyl.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RIFS - Rust图床服务\n\n\u003cdiv align=\"center\"\u003e\n\n![RIFS Logo](https://img.shields.io/badge/RIFS-Rust%20Image%20File%20Server-blue?style=for-the-badge\u0026logo=rust)\n\n\u003cp\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Rust-1.85+-orange.svg?style=flat-square\" alt=\"Rust Version\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\" alt=\"License\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Status-Production%20Ready-green.svg?style=flat-square\" alt=\"Status\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg?style=flat-square\" alt=\"Platform\"\u003e\n\u003c/p\u003e\n\n**🚀 高性能 Rust 图床服务 • 支持实时转换和智能缓存**\n\n\u003c/div\u003e\n\n---\n\n## ⚠️ 重要声明\n\n\u003cdiv align=\"center\"\u003e\n\n**🤖 本项目完全由 AI (Claude) 生成和编写 🤖**\n\n**此项目包括所有代码、文档、配置文件等均为人工智能自动生成**  \n**请在使用前仔细检查和测试，AI生成的代码可能存在潜在问题**  \n**不建议直接用于生产环境，需要经过充分的测试和验证**\n\n\u003c/div\u003e\n\n---\n\n## ✨ 特性\n\n- **高性能** - Rust编写，内存安全，高并发处理\n- **多格式支持** - 支持JPEG、PNG、GIF、WebP、AVIF、ICO 6种主流图片格式\n- **实时转换** - 通过URL参数进行图片尺寸、格式、质量转换\n- **智能缓存** - 自动缓存转换结果，支持LRU清理策略\n- **去重存储** - SHA256哈希去重，避免重复存储\n- **管理面板** - 内置Web管理界面，支持缓存管理和系统监控\n\n## 🏗️ 系统架构\n\n```mermaid\nflowchart TD\n    %% 客户端\n    Client[\"🌍 HTTP客户端\u003cbr/\u003eWeb/Mobile/API\"]\n    \n    %% 接入层\n    Nginx[\"🔄 Nginx反向代理\u003cbr/\u003e负载均衡·SSL·缓存\"]\n    Server[\"🦀 RIFS服务器\u003cbr/\u003eRust + Axum框架\"]\n    \n    %% Web框架层\n    Middleware[\"🛡️ 中间件层\u003cbr/\u003eCORS·日志·限流·认证\"]\n    Router[\"🚦 路由层\u003cbr/\u003eRESTful API路由\"]\n    \n    %% 处理器层 - 分开排列避免重叠\n    ImageH[\"🖼️ ImageHandler\u003cbr/\u003e图片上传·访问·转换\"]\n    CacheH[\"⚡ CacheHandler\u003cbr/\u003e缓存管理·清理·统计\"]\n    HealthH[\"💚 HealthHandler\u003cbr/\u003e健康检查·系统监控\"]\n    StaticH[\"📁 StaticHandler\u003cbr/\u003e静态资源·管理面板\"]\n    \n    %% 服务层 - 分层排列\n    ImageS[\"📸 ImageService\u003cbr/\u003e图片业务逻辑\"]\n    TransformS[\"🔄 TransformService\u003cbr/\u003e格式转换·尺寸调整\"]\n    CacheS[\"🧠 CacheService\u003cbr/\u003e智能缓存策略\"]\n    \n    %% 工具层\n    Utils[\"🛠️ FormatUtils\u003cbr/\u003e格式检测·验证\"]\n    Transform[\"⚙️ StaticTransform\u003cbr/\u003e图像处理引擎\"]\n    \n    %% 仓储层\n    ImageRepo[\"📊 ImageRepository\u003cbr/\u003e图片元数据管理\"]\n    CacheRepo[\"🗃️ CacheRepository\u003cbr/\u003e缓存索引管理\"]\n    BaseRepo[\"🏛️ BaseRepository\u003cbr/\u003e通用数据访问\"]\n    \n    %% 数据存储\n    SQLite[(\"🗃️ SQLite\u003cbr/\u003e默认轻量级数据库\")]\n    PostgreSQL[(\"🐘 PostgreSQL\u003cbr/\u003e高性能生产数据库\")]\n    MySQL[(\"🐬 MySQL\u003cbr/\u003e兼容性数据库\")]\n    \n    %% 文件存储\n    Uploads[\"📤 原图存储\u003cbr/\u003euploads/目录\u003cbr/\u003eSHA256分层\"]\n    Cache[\"⚡ 缓存存储\u003cbr/\u003ecache/目录\u003cbr/\u003e转换结果\"]\n    \n    %% 状态管理\n    AppState[\"🌟 AppState\u003cbr/\u003e全局状态管理器\"]\n    DBPool[\"🏊 DatabasePool\u003cbr/\u003e数据库连接池\"]\n    Config[\"⚙️ AppConfig\u003cbr/\u003e配置热加载管理\"]\n    \n    %% 垂直主流程 - 避免交叉\n    Client --\u003e Nginx\n    Nginx --\u003e Server\n    Server --\u003e Middleware\n    Middleware --\u003e Router\n    \n    %% 路由到处理器 - 分散连接\n    Router --\u003e ImageH\n    Router --\u003e CacheH\n    Router --\u003e HealthH\n    Router --\u003e StaticH\n    \n    %% 处理器到服务层 - 明确分工\n    ImageH --\u003e ImageS\n    ImageH --\u003e TransformS\n    CacheH --\u003e CacheS\n    \n    %% 服务层到工具层 - 水平连接\n    ImageS --\u003e Utils\n    TransformS --\u003e Transform\n    \n    %% 服务层到仓储层 - 直接对应\n    ImageS --\u003e ImageRepo\n    CacheS --\u003e CacheRepo\n    \n    %% 仓储继承关系\n    ImageRepo --\u003e BaseRepo\n    CacheRepo --\u003e BaseRepo\n    \n    %% 数据存储连接 - 分开避免重叠\n    BaseRepo --\u003e SQLite\n    BaseRepo --\u003e PostgreSQL\n    BaseRepo --\u003e MySQL\n    \n    %% 文件存储连接 - 独立路径\n    ImageS -.-\u003e Uploads\n    CacheS -.-\u003e Cache\n    \n    %% 状态管理连接 - 侧边路径\n    AppState --\u003e DBPool\n    AppState --\u003e Config\n    DBPool -.-\u003e BaseRepo\n    \n    %% 样式定义 - 增强可读性\n    style Client fill:#e3f2fd,stroke:#1976d2,stroke-width:3px\n    style Nginx fill:#f1f8e9,stroke:#689f38,stroke-width:2px\n    style Server fill:#fce4ec,stroke:#c2185b,stroke-width:3px\n    \n    style Middleware fill:#fff3e0,stroke:#f57c00,stroke-width:2px\n    style Router fill:#fff3e0,stroke:#f57c00,stroke-width:2px\n    \n    style ImageH fill:#e8f5e8,stroke:#388e3c,stroke-width:2px\n    style CacheH fill:#e8f5e8,stroke:#388e3c,stroke-width:2px\n    style HealthH fill:#e8f5e8,stroke:#388e3c,stroke-width:2px\n    style StaticH fill:#e8f5e8,stroke:#388e3c,stroke-width:2px\n    \n    style ImageS fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px\n    style TransformS fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px\n    style CacheS fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px\n    \n    style Utils fill:#e1f5fe,stroke:#0277bd,stroke-width:2px\n    style Transform fill:#e1f5fe,stroke:#0277bd,stroke-width:2px\n    \n    style ImageRepo fill:#e0f2f1,stroke:#00695c,stroke-width:2px\n    style CacheRepo fill:#e0f2f1,stroke:#00695c,stroke-width:2px\n    style BaseRepo fill:#e0f2f1,stroke:#00695c,stroke-width:3px\n    \n    style SQLite fill:#fff8e1,stroke:#f9a825,stroke-width:2px\n    style PostgreSQL fill:#fff8e1,stroke:#f9a825,stroke-width:2px\n    style MySQL fill:#fff8e1,stroke:#f9a825,stroke-width:2px\n    \n    style Uploads fill:#fafafa,stroke:#424242,stroke-width:2px\n    style Cache fill:#fafafa,stroke:#424242,stroke-width:2px\n    \n    style AppState fill:#e8eaf6,stroke:#3f51b5,stroke-width:3px\n    style DBPool fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px\n    style Config fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px\n```\n\n## 🚀 快速开始\n\n### 本地运行\n\n```bash\n# 克隆项目\ngit clone https://github.com/djkcyl/rifs.git\ncd rifs\n\n# 运行\ncargo run --release\n```\n\n### Docker 运行\n\n```bash\ndocker run --rm --pull always -d \\\n  -p 3000:3000 \\\n  -v ./uploads:/app/uploads \\\n  -v ./cache:/app/cache \\\n  -v ./data:/app/data \\\n  -v ./config.toml:/app/config.toml \\\n  djkcyl/rifs:latest\n```\n\n## 📖 使用示例\n\n### 上传图片\n\n```bash\ncurl -F \"file=@image.jpg\" http://localhost:3000/upload\n```\n\n### 图片访问\n\n```bash\n# 原图\nhttp://localhost:3000/images/a1b2c3d4...\n\n# 转换 - 宽度800px\nhttp://localhost:3000/images/a1b2c3d4...@w800\n\n# 复杂转换 - 尺寸+格式+质量\nhttp://localhost:3000/images/a1b2c3d4...@w800_h600_jpeg_q90\n```\n\n### 转换参数\n\n| 参数 | 说明 | 示例 |\n|------|------|------|\n| `w{数字}` | 最大宽度 | `w800` |\n| `h{数字}` | 最大高度 | `h600` |\n| `{格式}` | 目标格式 | `jpeg`, `png`, `webp`, `avif`, `ico` |\n| `q{数字}` | 质量1-100 | `q90` |\n| `na[w/b/#hex]` | 去透明+背景色 | `naw`(白), `nab`(黑), `na#ff0000` |\n\n## ⚙️ 配置\n\n首次运行时会自动创建 `config.toml` 配置文件，包含所有配置项的详细说明。修改配置后重启服务即可生效。\n\n也可以通过环境变量覆盖配置，格式为 `RIFS_` 前缀，如：\n```bash\nexport RIFS_SERVER_PORT=8080\n```\n\n## 📊 管理面板\n\n- **API文档**: http://localhost:3000/\n- **缓存管理**: http://localhost:3000/cache/management\n\n## 🖼️ 支持格式\n\n| 格式 | 扩展名 | 读取 | 写入 | URL转换 | 质量控制 |\n|------|--------|------|------|---------|----------|\n| **JPEG** | .jpg, .jpeg | ✅ | ✅ | ✅ | ✅ |\n| **PNG** | .png | ✅ | ✅ | ✅ | ✅ |\n| **GIF** | .gif | ✅ | ✅ | ✅ | ❌ |\n| **WebP** | .webp | ✅ | ✅ | ✅ | ✅ |\n| **AVIF** | .avif | ✅ | ✅ | ✅ | ❌ |\n| **ICO** | .ico | ✅ | ✅ | ✅ | ❌ |\n\n### 转换能力说明\n\n- ✅ **完全支持**: 可读取、写入、URL参数转换\n- ❌ **仅存储**: 支持上传存储原图，不支持参数转换\n- **动画处理**: GIF/WebP动画转换时自动提取第一帧\n- **质量控制**: JPEG、PNG、WebP支持质量参数优化\n- **智能压缩**: PNG根据质量参数智能选择压缩级别和滤波器\n\n---\n\n\u003cdiv align=\"center\"\u003e\nMade with ❤️ and 🦀\n\u003c/div\u003e ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjkcyl%2Frifs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjkcyl%2Frifs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjkcyl%2Frifs/lists"}