{"id":13486531,"url":"https://github.com/xtyxtyx/sorry","last_synced_at":"2025-05-14T11:12:26.434Z","repository":{"id":37336109,"uuid":"122743998","full_name":"xtyxtyx/sorry","owner":"xtyxtyx","description":"在线制作`sorry 为所欲为`的gif","archived":false,"fork":false,"pushed_at":"2023-04-11T12:44:58.000Z","size":23702,"stargazers_count":6467,"open_issues_count":19,"forks_count":787,"subscribers_count":153,"default_branch":"master","last_synced_at":"2025-05-10T13:59:02.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sorry.xuty.cc/","language":"CSS","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/xtyxtyx.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}},"created_at":"2018-02-24T13:44:26.000Z","updated_at":"2025-05-07T07:36:56.000Z","dependencies_parsed_at":"2022-07-12T12:05:00.059Z","dependency_job_id":"6f399ba5-6ef4-44d7-8c15-9073fda80cb4","html_url":"https://github.com/xtyxtyx/sorry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtyxtyx%2Fsorry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtyxtyx%2Fsorry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtyxtyx%2Fsorry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtyxtyx%2Fsorry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtyxtyx","download_url":"https://codeload.github.com/xtyxtyx/sorry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129525,"owners_count":22019628,"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":[],"created_at":"2024-07-31T18:00:47.933Z","updated_at":"2025-05-14T11:12:21.420Z","avatar_url":"https://github.com/xtyxtyx.png","language":"CSS","funding_links":[],"categories":["CSS","好玩项目","Code"],"sub_categories":["沙雕项目","library/repositories"],"readme":"\n![图片](https://raw.githubusercontent.com/xtyxtyx/sorry/master/media/1.gif)\n\n[V2EX](https://www.v2ex.com/t/431802)\n\n## 微信小程序试用\n小程序在 2019 年因为「内容安全」被下线了，2023.4 刚申诉上线，大家可以扫码试用一下。\n\n![图片](https://github.com/xtyxtyx/sorry/blob/master/media/gh_b404536005f9_258.jpg)\n\n\n## 常用特效代码\n出现在句子中的特效代码会对其后的字符产生影响\n```\n咕咕{\\i1}{\\fs40}咕咕咕{\\r}咕\n```\n![示例](https://raw.githubusercontent.com/xtyxtyx/sorry/master/media/2.png)\n```\n\\n 折行\n\\h 空格\n\n{\\i1} 斜体\n{\\i0} 取消斜体\n\n{\\b1} 粗体\n{\\b0} 取消粗体\n\n{\\u1} 下划线\n{\\u0} 取消下划线\n\n{\\fs60} 调整字号\n\n{\\fad(100,200)} 100ms淡入，200ms淡出\n\n{\\r} 重置所有特效\n```\n## 源代码库\n\n```\n├── Gemfile\n├── Gemfile.lock\n├── LICENSE\n├── public                  # 静态文件目录\n├── views                   # 主页目录\n├── templates               # 模板目录\n├── README.md\n├── site_config.yml         # 站点配置文件\n├── src                     # 这里就是源代码\n└── temp                    # 把临时文件安放在这里\n```\n另有\n- [python版](https://github.com/East196/sorrypy)，由@East196编写\n- [java版](https://github.com/li24361/sorryJava)，由@li24361编写\n- [nodejs版](https://github.com/q809198545/node-sorry)，由@q809198545编写\n- [C# ASP.NET版](https://github.com/shuangrain/SorryNet)，由@shuangrain编写\n- [微信小程序](https://github.com/CoXier/iemoji-wechat)，由@CoXier编写\n- [微信小程序](https://github.com/trumanwong/remix-mini-program)，由@trumanwong编写\n- [nodejs版(使用Drawtext filter渲染)](https://github.com/SnailDev/SnailDev.GifMaker)，由@SnailDev编写\n- [网页版(使用Canvas渲染)](https://coding.net/u/hhhhhg/p/wjzGif-JavaScript/git)，由@hhhhhg编写\n- [PHP版](https://github.com/PrintNow/php-sorry-gif)，由@PrintNow编写\n- [Golang版](https://github.com/Hentioe/sorry-generator)，由@Hentioe编写\n- [AlfredWork版](https://github.com/BlackDragonF/AlfredWorkflows)，由@BlackDragonF编写\n- [nodejs版(使用koa2)](https://github.com/wadejs/sorry-template)，由@wadejs编写\n- [VuePress版](https://github.com/fritx/SorryPress)，由@fritx编写\n- [网页版](https://github.com/WincerChan/Meme-generator)，由@WincerChan编写\n\n## API\n\n制作GIF：\n```\nPOST https://sorry.xuty.tk/api/\u003ctemplate_name\u003e/make\n{\n    \"0\": \"好啊\",\n    \"1\": \"...\",\n    ...\n}\n\n# 返回GIF下载地址\n-\u003e 200 /cache/c2f4069ed207dc38e0f2d9359a2fa6b7.gif\n\n# 或服务器忙\n-\u003e 503\n```\n目前支持的template_name有：\n```\n- sorry\n- wangjingze\n- jinkela        # 金坷垃\n- marmot         # 土拨鼠\n- dagong         # 窃格瓦拉\n- diandongche    # 窃格瓦拉偷电动车\n```\n\n## 部署指南\n\n### 使用Docker\n```\ndocker build -t sorry ./app\ndocker run --rm -it -p 4567:4567 sorry\n```\n\n### docker-compose 一键启动\n```\ndocker-compose up\n```\n\n### 手工部署\n首先，机器上得安装好ruby :gem:\n\n接下来：\n```bash\ncd ./app\n\n# 安装bundler\ngem install bundler\n\n# [可选] 使用国内镜像\ngem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/\n\n# [可选] Linux服务器一般需要安装中文字体\napt install ttf-wqy-microhei \n\n# 安装编译依赖\napt install ruby-dev build-essential\n\n# 安装ffmpeg\napt install ffmpeg\n\n# 安装依赖\nbundle install\n\n# 运行\nruby src/sorry.rb\n\n# 生产环境\nAPP_ENV=production ruby src/sorry.rb\n\n```\n\n#### [可选] 使用PM2监控\u0026自动重启\n\n```\nnpm install pm2 -g\n\npm2 start process.yml --env production\n\n# [可选] 非root用户使用80端口\nsudo apt-get install authbind\nsudo touch /etc/authbind/byport/80\nsudo chown %user% /etc/authbind/byport/80\nsudo chmod 755 /etc/authbind/byport/80\n\nalias pm2='authbind --deep pm2'\nauthbind --deep pm2 update\n\n# [可选] 定时重启服务\ncrontab -e\n10   22  *   *   *     pm2 start sorry       \n```\n\n### 定时清除缓存\n```\ncrontab -e\n\n# 在每小时的第10分钟 清除700分钟以前的gif\n\n10  *  *   *   *     find /root/sorry/public/cache -name '*.gif' -mmin +700  -exec rm {} \\;       \n```\n\n## 添加GIF模板\n向网站中添加模板需要加入以下文件\n\n```\ntemplates/\u003ctemplate_name\u003e/template.mp4  # 视频模板\ntemplates/\u003ctemplate_name\u003e/template.ass  # 字幕模板\npublic/\u003ctemplate_name\u003e/example.png   # 展示图片\nviews/\u003ctemplate_name\u003e.erb    # 模板主页\n```\n\n其中`index.erb` 参考其他模板主页，增减`\u003cinput\u003e`的数量即可\n\n然后发个Pull request\n\n如果你不熟悉aegisub的使用，也可以只提供视频模板。如果你是github用户，可以发个issue， 也可以[发送邮件](mailto:xty50337@hotmail.com)\n\n## 制作字幕模板template.ass\n首先使用aegisub为模板视频创建字幕，保存为template.ass（aegisub教程可以看这个 https://tieba.baidu.com/p/1360405931 ）\n![图片](https://raw.githubusercontent.com/xtyxtyx/sorry/master/media/3.png)\n\n然后把文本替换成模板字符串 \u003c%= sentences[n] %\u003e\n![图片](https://raw.githubusercontent.com/xtyxtyx/sorry/master/media/4.png)\n\n## TODO\n\n- [ ] 重新设计主页\n- [ ] 重新设计404页面\n- [ ] 把gif的渲染弄成队列，提高响应速度\n- [x] 定时删除缓存，不然有多少硬盘空间也不够用\n- [ ] 写个脚本，自动配置新的gif\n- [ ] 写测试\n\n## 服务器\n\n- [Cloudcone](https://app.cloudcone.com/?ref=940) sorry.xuty.tk部署在Cloudcone上\n- [Vultr 最低2.5$/月](https://www.vultr.com/?ref=7019614)\n- [DigitalOcean 注册送10美金](https://m.do.co/c/67a58d6cf3da)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtyxtyx%2Fsorry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtyxtyx%2Fsorry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtyxtyx%2Fsorry/lists"}