Commit graph

194 commits

Author SHA1 Message Date
be92f30e64 Update gitea sdk to e23e8aa3004f (#257)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #257 Reviewed-by: crapStone <codeberg@crapstone.dev> Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de>
2023-11-15 10:27:27 +00:00
a8272f0ce9 Don't send server version to client (#254)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
closes #247 Reviewed-on: #254 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: crapStone <crapstone01@gmail.com> Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 01:49:29 +00:00
b6103c6a1b Chore: Fix env var description (#251)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #251 Reviewed-by: crapStone <crapstone01@gmail.com> Co-authored-by: thepaperpilot <thepaperpilot@noreply.codeberg.org> Co-committed-by: thepaperpilot <thepaperpilot@noreply.codeberg.org>
2023-09-17 16:45:20 +00:00
ff3cd1ba35 Fix CI pipeline (replace "pipeline" with "steps")
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-27 11:37:17 +02:00
56d3e291c4 Security Fix: clean paths correctly to avoid circumvention of BlacklistedPaths 2023-08-27 10:13:15 +02:00
d720d25e42 Use http.NoBody as per linter (#231)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #231 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2023-07-17 19:44:58 +00:00
7f318f89a6 Fix escaped error message (#230)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- This specific message will [already be generated](974229681f/html/error.go (L44)) when `http.StatusMisdirectedRequest` is set as status with [an empty message](974229681f/html/error.go (L25-L28)). - Resolves #228 Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: #230 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2023-07-16 22:34:46 +00:00
974229681f Initial redirects implementation (#148)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Adds basic support for `_redirects` files. It supports a subset of what IPFS supports: https://docs.ipfs.tech/how-to/websites-on-ipfs/redirects-and-custom-404s/ Example: ``` /redirect https://example.com/ 301 /another-redirect /page 301 /302 https://example.com/ 302 /app/* /index.html 200 /articles/* /posts/:splat 301 ``` 301 redirect: https://video-prize-ranch.localhost.mock.directory:4430/redirect SPA rewrite: https://video-prize-ranch.localhost.mock.directory:4430/app/path/path Catch-all with splat: https://video-prize-ranch.localhost.mock.directory:4430/articles/path/path Closes #46 Co-authored-by: video-prize-ranch <cb.8a3w5@simplelogin.co> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #148 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: video-prize-ranch <video-prize-ranch@noreply.codeberg.org> Co-committed-by: video-prize-ranch <video-prize-ranch@noreply.codeberg.org>
2023-03-30 21:36:31 +00:00
970c13cf5c
Readme.md: use matrix.org for room alias
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-03-21 02:32:25 +01:00
98d7a771be
Readme.md: add link to chat & main repo
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-03-21 01:53:07 +01:00
c40dddf471 Fix certificate renewal (#209)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
A database bug in xorm.go prevents the pages-server from saving a renewed certificate for a domain that already has one in the database. Co-authored-by: crystal <crystal@noreply.codeberg.org> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #209 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Crystal <crystal@noreply.codeberg.org> Co-committed-by: Crystal <crystal@noreply.codeberg.org>
2023-03-20 22:57:26 +00:00
26d59b71f0 Fix typo in integration test log (#210)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
I forgot to update the name of this function in the CI log so it looks like it's running the same test twice even though it's not. Co-authored-by: crystal <crystal@noreply.codeberg.org> Reviewed-on: #210 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Crystal <crystal@noreply.codeberg.org> Co-committed-by: Crystal <crystal@noreply.codeberg.org>
2023-03-20 22:52:42 +00:00
c9050e5722 Handle Relative Symlinks (#205)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
enhance #114 Reviewed-on: #205
2023-03-11 05:07:17 +00:00
42d5802b9b Allow to define default branches (#125)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This try to address #115 Co-authored-by: Simon Vieille <simon@deblan.fr> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #125 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: deblan <deblan@noreply.codeberg.org> Co-committed-by: deblan <deblan@noreply.codeberg.org>
2023-02-14 03:03:00 +00:00
0adac9a5b1 fix http -> https redirect and add integration tests for it (#184)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
and more logging Reviewed-on: #184
2023-02-14 02:23:28 +00:00
42b3f8d1b7 use mockery for mock code generation (#185)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
close #181 Reviewed-on: #185
2023-02-13 23:13:30 +00:00
9a3d1c36dc Document more flags & make http port customizable (#183)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Reviewed-on: #183
2023-02-13 20:14:45 +00:00
46316f9e2f Fix raw domain for branches with custom domains and index.html (#159)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix #156 fix #157 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #159 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: crystal <crystal@noreply.codeberg.org> Co-committed-by: crystal <crystal@noreply.codeberg.org>
2023-02-11 03:12:42 +00:00
08d4e70cfd
Update Readme to point out new Architecture
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-02-11 03:39:38 +01:00
5753f7136d Move acmeClient creation into own file & struct (#179)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
get rid of gobal vars and make make functions with less args :) tldr: collect funcs and create a own ACME client to manage that stuff Reviewed-on: #179
2023-02-11 02:29:08 +00:00
fd643d15f0 Drop: pogreb support (#175)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
followup of #173 close #95 Reviewed-on: #175
2023-02-11 02:04:57 +00:00
272c7ca76f Fix xorm regressions by handle wildcard certs correctly (#177)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
close #176 Reviewed-on: #177
2023-02-11 01:26:21 +00:00
d8d119b0b3 Fix Cache Bug (#178)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
error io.EOF is gracefully end of file read. so we don't need to cancel cache saving Reviewed-on: #178
2023-02-11 00:31:56 +00:00
1b6ea4b6e1
use same version var on cli app as header
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-02-10 04:33:28 +01:00
7b35a192bf Add cert store option based on sqlite3, mysql & postgres (#173)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Deprecate **pogreb**! close #169 Reviewed-on: #173
2023-02-10 03:00:14 +00:00
7fce7cf68b Added Whitespace Trimming TXT DNS Records (#152)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Solves Codeberg/Community#823 and #143 Co-authored-by: foehammer127 <foehammer127@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #152 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: foehammer <foehammer@noreply.codeberg.org> Co-committed-by: foehammer <foehammer@noreply.codeberg.org>
2023-02-10 01:44:44 +00:00
8b1f497bc4 Allow to use certificate even if domain validation fails (#160)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Currently if the canonical domain validations fails(either for legitimate reasons or for bug reasons like the request to Gitea/Forgejo failing) it will use main domain certificate, which in the case for custom domains will warrant a security error as the certificate isn't issued to the custom domain. - This patch handles this situation more gracefully and instead only disallow obtaining a certificate if the domain validation fails, so in the case that a certificate still exists it can still be used even if the canonical domain validation fails. There's a small side effect, legitimate users that remove domains from `.domain` will still be able to use the removed domain(as long as the DNS records exists) as long as the certificate currently hold by pages-server isn't expired. - Given the increased usage in custom domains that are resulting in errors, I think it ways more than the side effect. - In order to future-proof against future slowdowns of instances, add a retry mechanism to the domain validation function, such that it's more likely to succeed even if the instance is not responding. - Refactor the code a bit and add some comments. Co-authored-by: Gusted <postmaster@gusted.xyz> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #160 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2023-02-10 01:38:15 +00:00
2c2087953d Add Integration test for custom domain redirect to another custom domain (#172)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
address #155 Reviewed-on: #172
2023-02-09 17:30:06 +00:00
513e79832a Use correct log level for CheckCanonicalDomain (#162)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
- Currently any error generated by requesting the `.domains` file of a repository would be logged under the info log level, which isn't the correct log level when we exclude the not found error. - Use warn log level if the error isn't the not found error. Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: #162 Reviewed-by: Otto <otto@codeberg.org>
2023-01-22 18:52:21 +00:00
bd538abd37 Fix wrong redirect on custom domain with path (#154)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
closes #153 Co-authored-by: crapStone <crapstone01@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #154 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: crapStone <crapstone@noreply.codeberg.org> Co-committed-by: crapStone <crapstone@noreply.codeberg.org>
2023-01-11 00:00:37 +00:00
c286b3b1d0 Added TokenBucket to limit the rate of validation failures (#151)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added new TockenBucket named `acmeClientFailLimit` to avoid being banned because of the [Failed validation limit](https://letsencrypt.org/docs/failed-validation-limit/) of Let's Encrypt. The behaviour is similar to the other limiters blocking the `obtainCert` func ensuring rate under limit. Co-authored-by: fsologureng <sologuren@estudiohum.cl> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #151 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Felipe Leopoldo Sologuren Gutiérrez <fsologureng@noreply.codeberg.org> Co-committed-by: Felipe Leopoldo Sologuren Gutiérrez <fsologureng@noreply.codeberg.org>
2023-01-04 05:26:14 +00:00
f7fad2a5ae Integration Tests use https://codeberg.org/cb_pages_tests
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2023-01-04 06:08:06 +01:00
98d198d419 Safely get certificate's leaf (#150)
- It's not guaranteed that `tls.X509KeyPair` will set `c.Leaf`. - This patch fixes this by using a wrapper that parses the leaf certificate(in bytes) if `c.Leaf` wasn't set. - Resolves #149 Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: #150 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2023-01-04 04:51:27 +00:00
9d769aeee7 Fix error page generation (#145)
Co-authored-by: crapStone <crapstone01@gmail.com> Reviewed-on: #145 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: crapStone <crapstone@noreply.codeberg.org> Co-committed-by: crapStone <crapstone@noreply.codeberg.org>
2022-12-04 21:24:58 +00:00
dcf03fc078 Fix error page (#144)
Co-authored-by: crapStone <crapstone01@gmail.com> Reviewed-on: #144 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: crapStone <crapstone@noreply.codeberg.org> Co-committed-by: crapStone <crapstone@noreply.codeberg.org>
2022-12-02 15:25:25 +00:00
5e72753e91
ci: "docker-tag" use tags 2022-11-22 22:30:53 +01:00
caeb1a4acb Return a 404 if there is no repository (#141)
If no repository is found the user expects a 404 status code instead of a dependency failed status code (as it was before). Signed-off-by: Jan Klippel <c0d3b3rg@kl1pp3l.de> Fixes: Codeberg/Community#809 Co-authored-by: Jan Klippel <c0d3b3rg@kl1pp3l.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: #141 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: jklippel <jklippel@noreply.codeberg.org> Co-committed-by: jklippel <jklippel@noreply.codeberg.org>
2022-11-22 21:26:10 +00:00
f2f943c0d8 Remove unnecessary conversion (#139)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Remove unnecessary type conversion. - Enforce via CI Co-authored-by: Gusted <williamzijl7@hotmail.com> Reviewed-on: #139 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2022-11-15 16:15:11 +01:00
3c61a39864 Enable http/2 support (#137)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
As per [the documentation](https://pkg.go.dev/net/http#Serve), it doesn't enable HTTP2 by-default, unless we enable it via the `NextProtos` option. Co-authored-by: Gusted <williamzijl7@hotmail.com> Reviewed-on: #137 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2022-11-12 22:25:20 +01:00
4565481643
refactor: finish use default const for defaultPagesBranch and defaultPagesRepo
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-12 21:16:11 +01:00
c827a28dd8
defaultPagesBranch
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-11-12 21:13:13 +01:00
aa90356f0a
use a const for defaultPagesRepo
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-12 21:10:16 +01:00
b6d0a04b21
refactor: rm not needed type conversion
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-12 21:04:34 +01:00
6c63b66ce4 Refactor split long functions (#135)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
we have big functions that handle all stuff ... we should split this into smaler chuncks so we could test them seperate and make clear cuts in what happens where Reviewed-on: #135
2022-11-12 20:43:44 +01:00
b9966487f6 switch to std http implementation instead of fasthttp (#106)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
close #100 close #109 close #113 close #28 close #63 Reviewed-on: #106
2022-11-12 20:37:20 +01:00
69eabb248a
CI publish next only on default branch
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-12 00:23:45 +01:00
8e67d28c4f
Add editorconfig, fix files and lint via ci
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-11 23:51:45 +01:00
91b54bef29
add newline
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-07 23:09:41 +01:00
bf9a08e1fd Fatal on ACME Client creation failure (#133)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- For production(*cough* Codeberg *cough*), it's important to not use mock certs. So fail right from the start if this is the case and not try to "handle it gracefully", as it would break production. - Resolves #131 CC @6543 Co-authored-by: Gusted <williamzijl7@hotmail.com> Reviewed-on: #133 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2022-11-07 16:27:37 +01:00
b9e9f14209 use codeberg.org/6543/docker-images/golang_just
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Signed-off-by: 6543 <6543@obermui.de>
2022-10-10 23:27:33 +02:00