From 321da54f88156a135f3637ae0a1dd4f134d1a938 Mon Sep 17 00:00:00 2001 From: dragon Date: Fri, 9 May 2025 15:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3=E5=92=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 +++++++++++++++++------------------ README_zh.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ config.yaml | 7 +++++++ 3 files changed, 81 insertions(+), 20 deletions(-) create mode 100644 README_zh.md diff --git a/README.md b/README.md index 57362bb..3f98901 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,55 @@ # gitea-pages -> 新一代 Gitea Pages,替换之前的 caddy-gitea-proxy +> Next-generation Gitea Pages, replacing the previous caddy-gitea-proxy -**此项目是 Dragon's Zone HomeLab 的一部分** +**This project is part of Dragon's Zone HomeLab** -本项目的侧重于功能实现,并未考虑任何性能优化,亦未考虑大规模部署的情况,由此带来的任何问题与项目无关。 +This project focuses on functional implementation and does not consider any performance optimizations or large-scale deployment scenarios. Any issues arising from this are not related to the project. -注意,项目在最近加入了自定义渲染器功能,可能导致严重的安全和性能问题,如出现相关问题请反馈。 +**Note**: The project recently added custom renderers and reverse proxy functionality, which may lead to serious security and performance issues. If not needed, it can be turned off in the settings. ## Get Started -安装 `go1.23` 或更高版本,同时安装 `Make` 工具 ,然后执行如下命令: +Install `go1.24` or later, along with the `Make` tool, and then execute the following command: ```bash make gitea-pages ``` -之后可使用如下命令启动 +After that, you can start it using the following command: ```bash ./gitea-pages -conf config.yaml ``` -具体配置可查看 [`config.yaml`](./config.yaml)。 - +For specific configurations, check [`config.yaml`](./config.yaml). ### Page Config -在项目的默认分支创建 `.pages.yaml`,填入如下内容 +Create `.pages.yaml` in the project's default branch and fill in the following content: ```yaml -v-route: true # 虚拟路由 +v-route: true # Virtual routing alias: # CNAME - "example.com" - "example2.com" -renders: # 渲染器 +templates: # Renderer gotemplate: '**/*.tmpl,**/index.html' proxy: /api: https://github.com/api ignore: .git/**,.pages.yaml - ``` ## TODO -- [x] 内容缓存 -- [x] CNAME 自定义域名 -- [x] 模板渲染 -- [x] 反向代理请求 -- [ ] OAuth2 授权访问私有页面 -- [ ] ~~http01 自动签发证书~~: 交由 Caddy 完成 -- [ ] ~~Web 钩子触发更新~~: 对实时性需求不大 +- [x] Content caching +- [x] CNAME custom domains +- [x] Template rendering +- [x] Reverse proxy requests +- [ ] OAuth2 authorized access to private pages +- [ ] ~~http01 auto-certificate issuance~~: Handled by Caddy +- [ ] ~~Webhook-triggered updates~~: Not a high priority for real-time needs ## LICENSE -此项目使用 [Apache-2.0](./LICENSE) \ No newline at end of file +This project is licensed under [Apache-2.0](./LICENSE) \ No newline at end of file diff --git a/README_zh.md b/README_zh.md new file mode 100644 index 0000000..38ac6cd --- /dev/null +++ b/README_zh.md @@ -0,0 +1,56 @@ +# gitea-pages + +> 新一代 Gitea Pages,替换之前的 `caddy-gitea-proxy` + +**此项目是 Dragon's Zone HomeLab 的一部分** + +本项目的侧重于功能实现,并未考虑任何性能优化,亦未考虑大规模部署的情况,由此带来的任何问题与项目无关。 + +**注意**:项目在最近加入了自定义渲染器和反向代理功能,可能导致严重的安全和性能问题,如不需要可在设置中关闭。 + +## Get Started + +安装 `go1.24` 或更高版本,同时安装 `Make` 工具 ,然后执行如下命令: + +```bash +make gitea-pages +``` + +之后可使用如下命令启动 + +```bash +./gitea-pages -conf config.yaml +``` + +具体配置可查看 [`config.yaml`](./config.yaml)。 + + +### Page Config + +在项目的默认分支创建 `.pages.yaml`,填入如下内容 + +```yaml +v-route: true # 虚拟路由 +alias: # CNAME + - "example.com" + - "example2.com" +templates: # 渲染器 + gotemplate: '**/*.tmpl,**/index.html' +proxy: + /api: https://github.com/api +ignore: .git/**,.pages.yaml +``` + +## TODO + +- [x] 内容缓存 +- [x] CNAME 自定义域名 +- [x] 模板渲染 +- [x] 反向代理请求 +- [ ] OAuth2 授权访问私有页面 +- [ ] ~~http01 自动签发证书~~: 交由 Caddy 完成 +- [ ] ~~Web 钩子触发更新~~: 对实时性需求不大 + +## LICENSE + +此项目使用 [Apache-2.0](./LICENSE) \ No newline at end of file diff --git a/config.yaml b/config.yaml index 3f57d62..46a1f79 100644 --- a/config.yaml +++ b/config.yaml @@ -23,3 +23,10 @@ page: 404: /path/to/html.gotmpl # 默认 500 页面模板 500: /path/to/html.gotmpl + +# 渲染器配置 +render: + enable: false +# 反向代理配置 +proxy: + enable: false \ No newline at end of file