|
| 1 | +# pastebin-ipfs |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +<img width="200px" src="./docs/images/ipfs-archivists.svg" /> |
| 8 | + |
| 9 | +<small>_(IPFS Archivists)_</small> |
| 10 | + |
| 11 | +*仍处于开发阶段,欢迎提交 Pull Request。* |
| 12 | + |
| 13 | +基于 IPFS 的 Pastebin,由 _去中心化网络_ 和 _边缘网络_ 安全驱动。 |
| 14 | + |
| 15 | +类似于 [gist](https://gist.github.com/),但不需要登陆账号。 |
| 16 | +[Ubuntu Pastebin](https://paste.ubuntu.com/) 的替代品。 |
| 17 | + |
| 18 | +[paste.shoujo.io](https://paste.shoujo.io) |
| 19 | + |
| 20 | +<table> |
| 21 | + <td><img width="500px" src="./docs/images/index.png" /></td> |
| 22 | + <td><img width="500px" src="./docs/images/view.png" /></td> |
| 23 | +</table> |
| 24 | + |
| 25 | +## 特性 |
| 26 | + |
| 27 | +<!-- - [Gallery](https://paste.shoujo.io/gallery) shows *Public* snippets --> |
| 28 | +- 数据由 [IPFS](https://ipfs.io/) 去中心化储存 |
| 29 | +- *AES-GCM* 加密 |
| 30 | +- 开发 API(OpenAPI v3,跨域 CORS `*`) |
| 31 | +- 文件上传(仅限 API) |
| 32 | +- CDN 缓存(或 [IPFS 网关](https://cloudflare-ipfs.com)) |
| 33 | +- [Prismjs](https://github.com/PrismJS/prism) 语法高亮 |
| 34 | +- 无过期时间(受限于 IPFS) |
| 35 | + |
| 36 | +## 使用 |
| 37 | + |
| 38 | +### 网页(Web) |
| 39 | + |
| 40 | +Web 版提供近期发布[画册看板(未实现)](https://paste.shoujo.io/gallery)、操作文件的可视化面板。 |
| 41 | + |
| 42 | +访问 [Web 页面](https://paste.shoujo.io)。 |
| 43 | + |
| 44 | +### API |
| 45 | + |
| 46 | +**API 文档**: [*OpenAPI v3 - Swagger UI*](https://mayocream.github.io/pastebin-ipfs/api/) |
| 47 | + |
| 48 | +Pastebin 限制每个用户的请求速率为 20 QPS。 |
| 49 | + |
| 50 | +### 终端(Terminal) |
| 51 | + |
| 52 | +创建 Snippet: |
| 53 | + |
| 54 | +```bash |
| 55 | +$ curl -T doc.md https://paste.shoujo.io/api/v0/ # remember to have a slash '/' at the end |
| 56 | +# or |
| 57 | +$ curl -X POST https://paste.shoujo.io/api/v0/ -d 'いつか君に伝えたいと思っていた気持ちは' |
| 58 | +# or |
| 59 | +$ curl -X PUT https://paste.shoujo.io/api/v0//lyrics.txt -d 'Stars fall, birds sleep' |
| 60 | +``` |
| 61 | + |
| 62 | +获取 Snippet: |
| 63 | + |
| 64 | +```bash |
| 65 | +curl https://paste.shoujo.io/api/v0/QmTnhJH8azDsudkxgp8wNLEN5Zq86NAE6DAkzwGBDpaQ6Z/plain.txt |
| 66 | +``` |
| 67 | + |
| 68 | +## 私有化部署(Self-Hosted) |
| 69 | + |
| 70 | +### Kubernetes |
| 71 | + |
| 72 | +使用 [Helm](https://helm.sh/) 部署 pastebin-ipfs. |
| 73 | + |
| 74 | +```bash |
| 75 | +git clone https://github.com/mayocream/pastebin-ipfs |
| 76 | +cd pastebin-ipfs/helm |
| 77 | +helm install pastebin-ipfs . |
| 78 | +``` |
| 79 | + |
| 80 | +参阅 [values.yaml](./helm/values.yaml) 了解详细参数。 |
| 81 | + |
| 82 | +### Docker Compose |
| 83 | + |
| 84 | +编辑 [deploy/docker/docker-compose.yml](https://github.com/mayocream/pastebin-ipfs/blob/main/deploy/docker/docker-compose.yml) 文件. |
| 85 | + |
| 86 | +```bash |
| 87 | +docker-compose up -d |
| 88 | +``` |
| 89 | + |
| 90 | +### Docker |
| 91 | + |
| 92 | +你必须先在主机上运行 ipfs-daemon。 |
| 93 | + |
| 94 | +IPFS 运行示例: [docker-compose.yml](https://github.com/mayocream/pastebin-ipfs/blob/main/docker-compose.yml). |
| 95 | + |
| 96 | +```bash |
| 97 | +docker run -p 8080:3939 pastebin-ipfs:latest |
| 98 | +``` |
| 99 | + |
| 100 | +## 开发 |
| 101 | + |
| 102 | +```bash |
| 103 | +make run # start ipfs daemon at http://127.0.0.1:5001 |
| 104 | + # run pastebin API at http://127.0.0.1:3939 |
| 105 | +make web-live # run Webpage |
| 106 | +``` |
| 107 | + |
| 108 | +## 反馈 |
| 109 | + |
| 110 | +欢迎通过 Github Issue 提交建议和反馈,不限制语言。🧐 |
| 111 | + |
| 112 | +## Todo |
| 113 | + |
| 114 | +- [ ] replace ipfs daemon with [ipfs-lite](github.com/hsanjuan/ipfs-lite). |
| 115 | + |
| 116 | +## 致谢 |
| 117 | + |
| 118 | +- [Web Crypto Encryption and Decryption Example](https://github.com/bradyjoslin/webcrypto-example) |
| 119 | + |
| 120 | +## LICENSE |
| 121 | + |
| 122 | +MIT |
0 commit comments