Skip to content

Commit 37a8b4b

Browse files
upgrade caddy to 2.10.x
1 parent 45631ad commit 37a8b4b

File tree

7 files changed

+567
-518
lines changed

7 files changed

+567
-518
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM docker.io/library/caddy:2.8-builder-alpine as builder
1+
FROM docker.io/library/caddy:2.10-builder-alpine as builder
22
RUN mkdir -p /usr/local/src
33
COPY go.mod go.sum caddyfile.go /usr/local/src/
44
COPY pages /usr/local/src/pages
55
WORKDIR /usr/local/src
66
RUN ls && xcaddy build \
77
--with github.com/d7z-project/caddy-gitea-pages=./
8-
FROM docker.io/library/caddy:2.8
8+
FROM docker.io/library/caddy:2.10
99
COPY --from=builder /usr/local/src/caddy /usr/bin/caddy

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
VERSION := 0.0.2
1+
VERSION := 0.0.3
22

33
dev:
4-
@xcaddy run v2.8.4 -c Caddyfile.local
4+
@xcaddy run v2.10.0 -c Caddyfile.local
55

66
fmt:
77
@go fmt

README.en.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Gitea Pages
2+
3+
English|[中文](README.md)
4+
5+
> Gitea Pages implementation inspired by Github Pages
6+
> This project is currently in maintenance mode. You may also check out my other project: [d7z-project/gitea-pages](https://github.com/d7z-project/gitea-pages)
7+
8+
## Installation Guide
9+
10+
The `xcaddy` tool is required for this step. Use the following command to generate the Caddy executable.
11+
If `xcaddy` is not installed, download it from [caddyserver/xcaddy](https://github.com/caddyserver/xcaddy/releases) first.
12+
Additionally, ensure Golang 1.24 is installed.
13+
14+
```bash
15+
xcaddy build v2.10.0 --with github.com/d7z-project/caddy-gitea-pages
16+
# List current modules
17+
./caddy list-modules | grep gitea
18+
```
19+
20+
This project also provides Docker images for `linux/amd64` and `linux/arm64`:
21+
22+
```bash
23+
docker pull ghcr.io/d7z-project/caddy-gitea-pages:nightly
24+
```
25+
26+
For configuration details, refer to the `docker.io/library/caddy` image.
27+
28+
## Configuration Guide
29+
30+
After installing Caddy, add the following configuration to your `Caddyfile`:
31+
32+
```conf
33+
{
34+
order gitea before file_server
35+
}
36+
37+
:80
38+
gitea {
39+
# Gitea server address
40+
server https://gitea.com
41+
# Gitea Token
42+
token please-replace-it
43+
# Default domain, similar to Github's github.io
44+
domain example.com
45+
}
46+
```
47+
48+
The token requires the following permissions:
49+
- `organization:read`
50+
- `repository:read`
51+
- `user:read`
52+
53+
For more detailed configurations, see [Caddyfile](./Caddyfile).
54+
55+
## Usage Instructions
56+
57+
The repository `https://gitea.com/owner/repo.git` corresponds to `owner.example.com/repo` in the example configuration.
58+
59+
To access domains configured via `CNAME`, you must first visit the repository's `<owner>.example.com/<repo>` URL. This step only needs to be performed once.
60+
61+
**Note**: The repository must have a `gh-pages` branch containing an `index.html` file for access. If issues persist after configuration, restart Caddy to clear the cache.
62+
63+
### Fallback Strategy
64+
- Appends `index.html` automatically when the URL ends with `/`.
65+
- If a file is not found and `404.html` exists, it will be served with a 404 status code.
66+
- For repositories tagged with `routes-history` or `routes-hash`, the fallback uses `index.html` with a 200 status code by default.
67+
68+
## TODO
69+
- [x] Support CNAME custom paths (HTTP mode only, no ACME handling)
70+
- [x] Support content caching
71+
- [ ] Optimize concurrency model and race condition handling
72+
- [ ] Support HTTP Range for resumable downloads
73+
- [ ] Support OAuth2 login for private page access
74+
75+
## Acknowledgments
76+
This project references [42wim/caddy-gitea](https://github.com/42wim/caddy-gitea).
77+
78+
## LICENSE
79+
This project is licensed under [Apache-2.0](./LICENSE).

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Gitea Pages
22

3-
[English (Google TR)](./README_en.md) | 中文
3+
[English](./README.en.md)|中文
44

55
> 参照 Github Pages 实现的 Gitea Pages
6+
> 当前项目处于维护模式,你也可以看看我的另一个项目 [d7z-project/gitea-pages](https://github.com/d7z-project/gitea-pages)
67
78
## 安装说明
89

910
此处需要用到 `xcaddy` 工具,使用如下命令生成 Caddy 执行文件,
1011
如果 `xcaddy` 不存在,需先前往 [caddyserver/xcaddy](https://github.com/caddyserver/xcaddy/releases) 安装 `xcaddy`,
11-
同时安装好 Golang 1.22
12+
同时安装好 Golang 1.24
1213

1314
```bash
14-
xcaddy build v2.8.4 --with github.com/d7z-project/caddy-gitea-pages
15+
xcaddy build v2.10.0 --with github.com/d7z-project/caddy-gitea-pages
1516
# 列出当前模块
1617
./caddy list-modules | grep gitea
1718
```

README_en.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

go.mod

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,130 @@
11
module github.com/d7z-project/caddy-gitea-pages
22

3-
go 1.22.4
4-
toolchain go1.24.1
3+
go 1.24
54

65
require (
7-
code.gitea.io/sdk/gitea v0.18.0
8-
github.com/Masterminds/sprig/v3 v3.2.3
9-
github.com/caddyserver/caddy/v2 v2.8.4
6+
code.gitea.io/sdk/gitea v0.21.0
7+
github.com/Masterminds/sprig/v3 v3.3.0
8+
github.com/caddyserver/caddy/v2 v2.10.0
109
github.com/orcaman/concurrent-map/v2 v2.0.1
1110
)
1211

1312
require (
14-
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9
13+
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b
1514
github.com/patrickmn/go-cache v2.1.0+incompatible
1615
github.com/pkg/errors v0.9.1
1716
go.uber.org/zap v1.27.0
1817
)
1918

2019
require (
20+
cel.dev/expr v0.24.0 // indirect
21+
dario.cat/mergo v1.0.2 // indirect
2122
filippo.io/edwards25519 v1.1.0 // indirect
23+
github.com/42wim/httpsig v1.2.3 // indirect
2224
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
25+
github.com/KimMachineGun/automemlimit v0.7.2 // indirect
2326
github.com/Masterminds/goutils v1.1.1 // indirect
24-
github.com/Masterminds/semver/v3 v3.2.1 // indirect
27+
github.com/Masterminds/semver/v3 v3.3.1 // indirect
2528
github.com/Microsoft/go-winio v0.6.2 // indirect
2629
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
2730
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect
2831
github.com/beorn7/perks v1.0.1 // indirect
29-
github.com/caddyserver/certmagic v0.21.3 // indirect
32+
github.com/caddyserver/certmagic v0.23.0 // indirect
3033
github.com/caddyserver/zerossl v0.1.3 // indirect
34+
github.com/ccoveille/go-safecast v1.6.1 // indirect
3135
github.com/cespare/xxhash v1.1.0 // indirect
3236
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3337
github.com/chzyer/readline v1.5.1 // indirect
34-
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
38+
github.com/cloudflare/circl v1.6.1 // indirect
39+
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
40+
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
3541
github.com/davidmz/go-pageant v1.0.2 // indirect
3642
github.com/dgraph-io/badger v1.6.2 // indirect
3743
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
38-
github.com/dgraph-io/ristretto v0.1.1 // indirect
39-
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
44+
github.com/dgraph-io/ristretto v0.2.0 // indirect
45+
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect
4046
github.com/dustin/go-humanize v1.0.1 // indirect
47+
github.com/francoispqt/gojay v1.2.13 // indirect
4148
github.com/go-fed/httpsig v1.1.0 // indirect
4249
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
43-
github.com/go-kit/kit v0.13.0 // indirect
44-
github.com/go-kit/log v0.2.1 // indirect
45-
github.com/go-logfmt/logfmt v0.6.0 // indirect
46-
github.com/go-sql-driver/mysql v1.8.1 // indirect
50+
github.com/go-jose/go-jose/v4 v4.1.0 // indirect
51+
github.com/go-sql-driver/mysql v1.9.2 // indirect
4752
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
48-
github.com/golang/glog v1.2.4 // indirect
4953
github.com/golang/protobuf v1.5.4 // indirect
50-
github.com/golang/snappy v0.0.4 // indirect
51-
github.com/google/cel-go v0.20.1 // indirect
52-
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect
54+
github.com/golang/snappy v1.0.0 // indirect
55+
github.com/google/cel-go v0.25.0 // indirect
56+
github.com/google/pprof v0.0.0-20250602020802-c6617b811d0e // indirect
5357
github.com/google/uuid v1.6.0 // indirect
5458
github.com/hashicorp/go-version v1.7.0 // indirect
55-
github.com/huandu/xstrings v1.4.0 // indirect
56-
github.com/imdario/mergo v0.3.16 // indirect
59+
github.com/huandu/xstrings v1.5.0 // indirect
5760
github.com/inconshreveable/mousetrap v1.1.0 // indirect
58-
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
59-
github.com/jackc/pgconn v1.14.3 // indirect
60-
github.com/jackc/pgio v1.0.0 // indirect
6161
github.com/jackc/pgpassfile v1.0.0 // indirect
62-
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
63-
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
64-
github.com/jackc/pgtype v1.14.3 // indirect
65-
github.com/jackc/pgx/v4 v4.18.3 // indirect
66-
github.com/klauspost/compress v1.17.8 // indirect
67-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
68-
github.com/libdns/libdns v0.2.2 // indirect
62+
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
63+
github.com/jackc/pgx/v5 v5.7.5 // indirect
64+
github.com/jackc/puddle/v2 v2.2.2 // indirect
65+
github.com/klauspost/compress v1.18.0 // indirect
66+
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
67+
github.com/libdns/libdns v1.1.0 // indirect
6968
github.com/manifoldco/promptui v0.9.0 // indirect
70-
github.com/mattn/go-colorable v0.1.13 // indirect
69+
github.com/mattn/go-colorable v0.1.14 // indirect
7170
github.com/mattn/go-isatty v0.0.20 // indirect
7271
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
73-
github.com/mholt/acmez/v2 v2.0.1 // indirect
74-
github.com/miekg/dns v1.1.59 // indirect
72+
github.com/mholt/acmez/v3 v3.1.2 // indirect
73+
github.com/miekg/dns v1.1.66 // indirect
7574
github.com/mitchellh/copystructure v1.2.0 // indirect
7675
github.com/mitchellh/go-ps v1.0.0 // indirect
7776
github.com/mitchellh/reflectwalk v1.0.2 // indirect
78-
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
79-
github.com/prometheus/client_golang v1.19.1 // indirect
80-
github.com/prometheus/client_model v0.6.1 // indirect
81-
github.com/prometheus/common v0.53.0 // indirect
82-
github.com/prometheus/procfs v0.15.0 // indirect
77+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
78+
github.com/onsi/ginkgo/v2 v2.23.4 // indirect
79+
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
80+
github.com/prometheus/client_golang v1.22.0 // indirect
81+
github.com/prometheus/client_model v0.6.2 // indirect
82+
github.com/prometheus/common v0.64.0 // indirect
83+
github.com/prometheus/procfs v0.16.1 // indirect
8384
github.com/quic-go/qpack v0.5.1 // indirect
84-
github.com/quic-go/quic-go v0.48.2 // indirect
85-
github.com/rs/xid v1.5.0 // indirect
85+
github.com/quic-go/quic-go v0.52.0 // indirect
86+
github.com/rs/xid v1.6.0 // indirect
8687
github.com/russross/blackfriday/v2 v2.1.0 // indirect
8788
github.com/shopspring/decimal v1.4.0 // indirect
8889
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
89-
github.com/slackhq/nebula v1.9.1 // indirect
90-
github.com/smallstep/certificates v0.26.1 // indirect
91-
github.com/smallstep/nosql v0.6.1 // indirect
92-
github.com/smallstep/pkcs7 v0.0.0-20240411202544-a82ada2bab6b // indirect
93-
github.com/smallstep/scep v0.0.0-20240214080410-892e41795b99 // indirect
90+
github.com/slackhq/nebula v1.9.5 // indirect
91+
github.com/smallstep/certificates v0.28.3 // indirect
92+
github.com/smallstep/cli-utils v0.12.1 // indirect
93+
github.com/smallstep/linkedca v0.23.0 // indirect
94+
github.com/smallstep/nosql v0.7.0 // indirect
95+
github.com/smallstep/pkcs7 v0.2.1 // indirect
96+
github.com/smallstep/scep v0.0.0-20250318231241-a25cabb69492 // indirect
9497
github.com/smallstep/truststore v0.13.0 // indirect
95-
github.com/spf13/cast v1.6.0 // indirect
96-
github.com/spf13/cobra v1.8.0 // indirect
97-
github.com/spf13/pflag v1.0.5 // indirect
98+
github.com/spf13/cast v1.9.2 // indirect
99+
github.com/spf13/cobra v1.9.1 // indirect
100+
github.com/spf13/pflag v1.0.6 // indirect
98101
github.com/stoewer/go-strcase v1.3.0 // indirect
99-
github.com/tailscale/tscert v0.0.0-20240517230440-bbccfbf48933 // indirect
100-
github.com/urfave/cli v1.22.15 // indirect
101-
github.com/zeebo/blake3 v0.2.3 // indirect
102-
go.etcd.io/bbolt v1.3.10 // indirect
103-
go.step.sm/cli-utils v0.9.0 // indirect
104-
go.step.sm/crypto v0.46.0 // indirect
105-
go.step.sm/linkedca v0.20.1 // indirect
106-
go.uber.org/automaxprocs v1.5.3 // indirect
107-
go.uber.org/mock v0.4.0 // indirect
102+
github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53 // indirect
103+
github.com/urfave/cli v1.22.16 // indirect
104+
github.com/zeebo/blake3 v0.2.4 // indirect
105+
go.etcd.io/bbolt v1.4.0 // indirect
106+
go.step.sm/crypto v0.66.0 // indirect
107+
go.uber.org/automaxprocs v1.6.0 // indirect
108+
go.uber.org/mock v0.5.2 // indirect
108109
go.uber.org/multierr v1.11.0 // indirect
109-
go.uber.org/zap/exp v0.2.0 // indirect
110-
golang.org/x/crypto v0.36.0 // indirect
111-
golang.org/x/crypto/x509roots/fallback v0.0.0-20240529182030-349231f7e4e4 // indirect
112-
golang.org/x/exp v0.0.0-20240529005216-23cca8864a10 // indirect
113-
golang.org/x/mod v0.17.0 // indirect
114-
golang.org/x/net v0.38.0 // indirect
115-
golang.org/x/sync v0.12.0 // indirect
116-
golang.org/x/sys v0.31.0 // indirect
117-
golang.org/x/term v0.30.0 // indirect
118-
golang.org/x/text v0.23.0 // indirect
119-
golang.org/x/time v0.5.0 // indirect
120-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
121-
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
122-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
123-
google.golang.org/grpc v1.64.1 // indirect
124-
google.golang.org/protobuf v1.34.1 // indirect
110+
go.uber.org/zap/exp v0.3.0 // indirect
111+
golang.org/x/crypto v0.38.0 // indirect
112+
golang.org/x/crypto/x509roots/fallback v0.0.0-20250531095911-4f9f0ca9fcfb // indirect
113+
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
114+
golang.org/x/mod v0.24.0 // indirect
115+
golang.org/x/net v0.40.0 // indirect
116+
golang.org/x/oauth2 v0.30.0 // indirect
117+
golang.org/x/sync v0.14.0 // indirect
118+
golang.org/x/sys v0.33.0 // indirect
119+
golang.org/x/term v0.32.0 // indirect
120+
golang.org/x/text v0.25.0 // indirect
121+
golang.org/x/time v0.11.0 // indirect
122+
golang.org/x/tools v0.33.0 // indirect
123+
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
124+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
125+
google.golang.org/grpc v1.72.2 // indirect
126+
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
127+
google.golang.org/protobuf v1.36.6 // indirect
125128
gopkg.in/yaml.v3 v3.0.1 // indirect
126129
howett.net/plist v1.0.1 // indirect
127130
)

0 commit comments

Comments
 (0)