From 26d59b71f049d459b663ec885156bfb8b89aa0c9 Mon Sep 17 00:00:00 2001
From: Crystal <crystal@noreply.codeberg.org>
Date: Mon, 20 Mar 2023 22:52:42 +0000
Subject: [PATCH 1/4] Fix typo in integration test log (#210)

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: https://codeberg.org/Codeberg/pages-server/pulls/210
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Crystal <crystal@noreply.codeberg.org>
Co-committed-by: Crystal <crystal@noreply.codeberg.org>
---
 integration/get_test.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/integration/get_test.go b/integration/get_test.go
index c0a3a47..9d97390 100644
--- a/integration/get_test.go
+++ b/integration/get_test.go
@@ -124,7 +124,7 @@ func TestRawCustomDomain(t *testing.T) {
 }
 
 func TestRawIndex(t *testing.T) {
-	log.Println("=== TestRawCustomDomain ===")
+	log.Println("=== TestRawIndex ===")
 	// test raw domain response for index.html
 	resp, err := getTestHTTPSClient().Get("https://raw.localhost.mock.directory:4430/cb_pages_tests/raw-test/@branch-test/index.html") // need cb_pages_tests fork
 	assert.NoError(t, err)

From c40dddf471277260ee3ca95c5701cf723c1e24cb Mon Sep 17 00:00:00 2001
From: Crystal <crystal@noreply.codeberg.org>
Date: Mon, 20 Mar 2023 22:57:26 +0000
Subject: [PATCH 2/4] Fix certificate renewal (#209)

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: https://codeberg.org/Codeberg/pages-server/pulls/209
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Crystal <crystal@noreply.codeberg.org>
Co-committed-by: Crystal <crystal@noreply.codeberg.org>
---
 server/database/xorm.go      | 2 +-
 server/database/xorm_test.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/database/xorm.go b/server/database/xorm.go
index fb1dc17..217b6d1 100644
--- a/server/database/xorm.go
+++ b/server/database/xorm.go
@@ -64,7 +64,7 @@ func (x xDB) Put(domain string, cert *certificate.Resource) error {
 	}
 	defer sess.Close()
 
-	if exist, _ := sess.ID(c.Domain).Exist(); exist {
+	if exist, _ := sess.ID(c.Domain).Exist(new(Cert)); exist {
 		if _, err := sess.ID(c.Domain).Update(c); err != nil {
 			return err
 		}
diff --git a/server/database/xorm_test.go b/server/database/xorm_test.go
index 9c032ee..50d8a7f 100644
--- a/server/database/xorm_test.go
+++ b/server/database/xorm_test.go
@@ -37,7 +37,7 @@ func TestSanitizeWildcardCerts(t *testing.T) {
 	}))
 
 	// update existing cert
-	assert.Error(t, certDB.Put(".wildcard.de", &certificate.Resource{
+	assert.NoError(t, certDB.Put(".wildcard.de", &certificate.Resource{
 		Domain:      "*.wildcard.de",
 		Certificate: localhost_mock_directory_certificate,
 	}))

From 98d7a771be9783a333a3f9abd8d6e08d1ad4a46f Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Tue, 21 Mar 2023 01:53:07 +0100
Subject: [PATCH 3/4] Readme.md: add link to chat & main repo

---
 README.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/README.md b/README.md
index 5707d65..7e1b2c5 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,11 @@
 # Codeberg Pages
 
+[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue)](https://opensource.org/license/eupl-1-2/)
+[![status-badge](https://ci.codeberg.org/api/badges/Codeberg/pages-server/status.svg)](https://ci.codeberg.org/Codeberg/pages-server)
+<a href="https://matrix.to/#/#gitea-pages-server:obermui.de" title="Join the Matrix room at https://matrix.to/#/#gitea-pages-server:obermui.de">
+  <img src="https://img.shields.io/matrix/gitea-pages-server:obermui.de?label=matrix">
+</a>
+
 Gitea lacks the ability to host static pages from Git.
 The Codeberg Pages Server addresses this lack by implementing a standalone service
 that connects to Gitea via API.
@@ -8,6 +14,9 @@ It is suitable to be deployed by other Gitea instances, too, to offer static pag
 **End user documentation** can mainly be found at the [Wiki](https://codeberg.org/Codeberg/pages-server/wiki/Overview)
 and the [Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/).
 
+
+<a href="https://codeberg.org/Codeberg/pages-server"> <img src="https://codeberg.org/Codeberg/GetItOnCodeberg/raw/branch/main/get-it-on-blue-on-white.svg" alt="Get It On Codeberg" width="250"/> <a/>
+
 ## Quickstart
 
 This is the new Codeberg Pages server, a solution for serving static pages from Gitea repositories.
@@ -29,6 +38,10 @@ record that points to your repo (just like the CNAME record):
 
 Certificates are generated, updated and cleaned up automatically via Let's Encrypt through a TLS challenge.
 
+## Chat for admins & devs
+
+[matrix: #gitea-pages-server:obermui.de](https://matrix.to/#/#gitea-pages-server:obermui.de)
+
 ## Deployment
 
 **Warning: Some Caveats Apply**  

From 970c13cf5c006dfa1011ba9e6721baafa3f1ad55 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Tue, 21 Mar 2023 02:32:25 +0100
Subject: [PATCH 4/4] Readme.md: use matrix.org for room alias

---
 README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 7e1b2c5..b694e29 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
 
 [![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue)](https://opensource.org/license/eupl-1-2/)
 [![status-badge](https://ci.codeberg.org/api/badges/Codeberg/pages-server/status.svg)](https://ci.codeberg.org/Codeberg/pages-server)
-<a href="https://matrix.to/#/#gitea-pages-server:obermui.de" title="Join the Matrix room at https://matrix.to/#/#gitea-pages-server:obermui.de">
-  <img src="https://img.shields.io/matrix/gitea-pages-server:obermui.de?label=matrix">
+<a href="https://matrix.to/#/#gitea-pages-server:matrix.org" title="Join the Matrix room at https://matrix.to/#/#gitea-pages-server:matrix.org">
+  <img src="https://img.shields.io/matrix/gitea-pages-server:matrix.org?label=matrix">
 </a>
 
 Gitea lacks the ability to host static pages from Git.
@@ -40,7 +40,7 @@ Certificates are generated, updated and cleaned up automatically via Let's Encry
 
 ## Chat for admins & devs
 
-[matrix: #gitea-pages-server:obermui.de](https://matrix.to/#/#gitea-pages-server:obermui.de)
+[matrix: #gitea-pages-server:matrix.org](https://matrix.to/#/#gitea-pages-server:matrix.org)
 
 ## Deployment