chore: Format
This commit is contained in:
parent
1154eff9ae
commit
85bd71cff3
@ -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{
|
||||
|
4
acme.go
4
acme.go
@ -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{
|
||||
|
5
main.go
5
main.go
@ -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)
|
||||
|
5
repo.go
5
repo.go
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user