update readme

This commit is contained in:
Ronmi Ren 2025-01-13 15:45:42 +08:00
commit 8905b5e3d1

View file

@ -2,7 +2,7 @@ A simple static page service for Forgejo/Gitea.
### Repo setup ### Repo setup
Everything in branch `static-pages` (if you have not changed it by assigning `-b` flag) will be served as-is. Everything in branch `static-pages` (if you have not changed it by assigning `--branch` flag) will be served as-is.
There are two mode you can use: serve mode and webhook mode. There are two mode you can use: serve mode and webhook mode.
@ -10,8 +10,6 @@ There are two mode you can use: serve mode and webhook mode.
Serve mode starts an HTTP server listens on specified port. When you visit `http://ip:port/user/repo/path/to/file`, it ask forgejo server for `path/to/file` in branch `static-pages` of repository `user/repo` via api, then forward the response to client. Serve mode starts an HTTP server listens on specified port. When you visit `http://ip:port/user/repo/path/to/file`, it ask forgejo server for `path/to/file` in branch `static-pages` of repository `user/repo` via api, then forward the response to client.
In other words, anything you push to branch `static-pages` will be provided as-is.
This mode is good for simple setup, like, you have small number of viewers, or you use other powerful cache/proceting service like Cloudflare. This mode is good for simple setup, like, you have small number of viewers, or you use other powerful cache/proceting service like Cloudflare.
### Webhook mode ### Webhook mode
@ -23,9 +21,9 @@ To serve downloaded pages, you'll have to use a web server like Nginx.
### Example ### Example
``` ```
forgejo-pages serve -k my-secret-token -s https://git.example.com -a :8080 -b static-pages forgejo-pages serve --token my-secret-token --server https://git.example.com --bind :8080 --branch static-pages
forgejo-pages listen -u myuser -k my-secret-token -s https://git.example.com -a :8080 -b static-pages -d ./data forgejo-pages listen --user myuser --token my-secret-token --server https://git.example.com --bind :8080 --branch static-pages --dir ./data
``` ```
Flags can be assigned through environmental variables like `PAGES_BIND`, `PAGES_BRANCH`, or config file Flags can be assigned through environmental variables like `PAGES_BIND`, `PAGES_BRANCH`, or config file
@ -63,12 +61,12 @@ server {
### Will it support SSL for security? ### Will it support SSL for security?
No, just use reverse proxy. You might also need LetsEncrypt or Cloudflare to apply for a free SSL certificate. No, use reverse proxy or webhook mode. You might also need LetsEncrypt or Cloudflare to apply for a free SSL certificate. If you need all-in-one solution, take a look at https://codeberg.org/Codeberg/pages-server/
### Will it support caching ### Will it support caching
No. It does provide very basic cache (etag, last-modified and related HTTP headers) as it just forward request to your git server. If your need more, use reverse proxy. No. Serve mode does provide very basic cache (etag, last-modified and related HTTP headers) as it just forward request to your git server. If your need more, use reverse proxy or webhook mode. If you need all-in-one solution, take a look at https://codeberg.org/Codeberg/pages-server/
# License # License
MPLv2 MPLv2. There is a copy of source at https://github.com/Ronmi/forgejo-pages