|
1 | 1 | # Pastebin-worker |
2 | 2 |
|
3 | | -This is a pastebin that can be deployed on Cloudflare workers. Try it on [shz.al](https://shz.al). |
| 3 | +This is a pastebin that can be deployed on Cloudflare workers. Try it on [shz.al](https://shz.al). |
4 | 4 |
|
5 | | -**Philosophy**: effortless deployment, friendly CLI usage, rich functionality. |
| 5 | +**Philosophy**: effortless deployment, friendly CLI usage, rich functionality. |
6 | 6 |
|
7 | 7 | **Features**: |
8 | 8 |
|
9 | 9 | 1. Share your paste with as short as 4 characters |
10 | 10 | 2. Customize the paste URL |
11 | | -4. **Update** and **delete** your paste as you want |
12 | | -5. **Expire** your paste after a period of time |
13 | | -6. **Syntax highlighting** powered by PrismJS |
14 | | -7. Display **markdown** file as HTML |
15 | | -8. Used as a URL shortener |
16 | | -9. Customize returned mimetype |
| 11 | +3. **Update** and **delete** your paste as you want |
| 12 | +4. **Expire** your paste after a period of time |
| 13 | +5. **Syntax highlighting** powered by PrismJS |
| 14 | +6. Display **markdown** file as HTML |
| 15 | +7. Used as a URL shortener |
| 16 | +8. Customize returned mimetype |
17 | 17 |
|
18 | 18 | ## Usage |
19 | 19 |
|
20 | | -1. You can post, update, delete your paste directly on the website (such as [shz.al](https://shz.al)). |
| 20 | +1. You can post, update, delete your paste directly on the website (such as [shz.al](https://shz.al)). |
21 | 21 |
|
22 | | -2. It also provides a convenient HTTP API to use. See [API reference](doc/api.md) for details. You can easily call API via command line (using `curl` or similar tools). |
| 22 | +2. It also provides a convenient HTTP API to use. See [API reference](doc/api.md) for details. You can easily call API via command line (using `curl` or similar tools). |
23 | 23 |
|
24 | 24 | 3. [pb](/scripts) is a bash script to make it easier to use on command line. |
25 | 25 |
|
26 | 26 | ## Limitations |
27 | 27 |
|
28 | | -1. If deployed on Cloudflare Worker free-tier plan, the service allows at most 100,000 reads and 1000 writes, 1000 deletes per day. |
29 | | -2. Due to the size limit of Cloudflare KV storage, the size of each paste is bounded under 25 MB. |
| 28 | +1. If deployed on Cloudflare Worker free-tier plan, the service allows at most 100,000 reads and 1000 writes, 1000 deletes per day. |
| 29 | +2. Due to the size limit of Cloudflare KV storage, the size of each paste is bounded under 25 MB. |
30 | 30 |
|
31 | 31 | ## Deploy |
32 | 32 |
|
33 | | -You are free to deploy the pastebin on your own domain if you host your domain on Cloudflare. |
| 33 | +You are free to deploy the pastebin on your own domain if you host your domain on Cloudflare. |
34 | 34 |
|
35 | 35 | 1. Install `node` and `yarn`. |
36 | 36 |
|
@@ -82,34 +82,41 @@ $ curl -u admin1:this-is-passwd-1 -Fc=@/path/to/file example-pb.com |
82 | 82 | ``` |
83 | 83 |
|
84 | 84 | ## Administration |
| 85 | + |
85 | 86 | Delete a paste: |
| 87 | + |
86 | 88 | ```console |
87 | 89 | $ yarn delete-paste <name-of-paste> |
88 | 90 | ``` |
89 | 91 |
|
90 | 92 | List pastes: |
| 93 | + |
91 | 94 | ```console |
92 | 95 | $ yarn -s wrangler kv:key list --binding PB > kv_list.json |
93 | 96 | ``` |
94 | 97 |
|
95 | 98 | ## Development |
96 | 99 |
|
97 | 100 | Run a local simulator: |
| 101 | + |
98 | 102 | ```console |
99 | 103 | $ yarn dev |
100 | 104 | ``` |
101 | 105 |
|
102 | 106 | Run tests: |
| 107 | + |
103 | 108 | ```console |
104 | 109 | $ yarn test |
105 | 110 | ``` |
106 | 111 |
|
107 | 112 | Run typing check: |
| 113 | + |
108 | 114 | ```console |
109 | 115 | $ yarn tsc --noEmit |
110 | 116 | ``` |
111 | 117 |
|
112 | 118 | Run tests with coverage report: |
| 119 | + |
113 | 120 | ```console |
114 | 121 | $ yarn coverage |
115 | 122 | ``` |
0 commit comments