chore: Format

This commit is contained in:
PapaTutuWawa 2024-01-01 00:38:39 +01:00
parent 1154eff9ae
commit 85bd71cff3
7 changed files with 97 additions and 100 deletions

View File

@ -5,8 +5,8 @@ import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"encoding/json"
"encoding/base64"
"encoding/json"
"io/ioutil"
"github.com/go-acme/lego/v4/acme"
@ -61,7 +61,6 @@ func ClientFromFile(storage, acmeServer string) (*lego.Client, error) {
contacts = append(contacts, v.(string))
}
registration := registration.Resource{
URI: reg["uri"].(string),
Body: acme.Account{

View File

@ -74,7 +74,7 @@ type CertificateWrapper struct {
func (c *CertificateWrapper) GetPrivateKey() *rsa.PrivateKey {
data, _ := base64.StdEncoding.DecodeString(c.PrivateKeyEncoded)
pk, _ := certcrypto.ParsePEMPrivateKey(data);
pk, _ := certcrypto.ParsePEMPrivateKey(data)
return pk.(*rsa.PrivateKey)
}
@ -160,7 +160,7 @@ func fallbackCert(pagesDomain string) (*CertificateWrapper, error) {
return nil, err
}
notAfter := time.Now().Add(time.Hour*24*7);
notAfter := time.Now().Add(time.Hour * 24 * 7)
cert := x509.Certificate{
SerialNumber: big.NewInt(1),
Subject: pkix.Name{

View File

@ -2,18 +2,18 @@ package main
import (
"crypto/tls"
"os"
"errors"
"fmt"
"net"
"net/http"
"os"
"strings"
"time"
"code.gitea.io/sdk/gitea"
"github.com/urfave/cli/v2"
"github.com/go-acme/lego/v4/challenge/http01"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
const (
@ -35,7 +35,6 @@ func handleSubdomain(domain string, cname string, path, giteaUrl string, giteaCl
cname,
path,
giteaClient,
)
if err != nil {
log.Errorf("Failed to get repo: %s", err)

View File

@ -14,7 +14,6 @@ var (
pathCache = cache.New(1*time.Hour, 1*time.Hour)
)
type PageCacheEntry struct {
Repository *gitea.Repository
Path string
@ -113,9 +112,9 @@ func RepoFromPath(username, host, cname, path string, giteaClient *gitea.Client)
repoLookup,
)
reponame = repoLookup
} else if (cname != "") {
} else if cname != "" {
// Allow naming the repository "example.org" (But give the TXT record preference)
reponame = cname;
reponame = cname
}
log.Debugf("Trying repository %s/%s", username, reponame)