GoBlog/app.go

100 lines
2.2 KiB
Go
Raw Normal View History

package main
import (
"crypto/rsa"
"net/http"
"sync"
shutdowner "git.jlel.se/jlelse/go-shutdowner"
ts "git.jlel.se/jlelse/template-strings"
2022-04-17 05:27:17 +00:00
"github.com/dgraph-io/ristretto"
2021-06-19 06:37:16 +00:00
ct "github.com/elnormous/contenttype"
"github.com/go-fed/httpsig"
"github.com/hacdias/indieauth/v2"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/yuin/goldmark"
"go.goblog.app/app/pkgs/minify"
"go.goblog.app/app/pkgs/plugins"
"golang.org/x/crypto/acme/autocert"
"golang.org/x/sync/singleflight"
2021-10-13 07:01:54 +00:00
"tailscale.com/tsnet"
)
type goBlog struct {
// ActivityPub
apPrivateKey *rsa.PrivateKey
2022-04-21 16:18:39 +00:00
apPubKeyBytes []byte
apPostSigner httpsig.Signer
apPostSignMutex sync.Mutex
webfingerResources map[string]*configBlog
webfingerAccts map[string]string
2021-06-19 06:37:16 +00:00
// ActivityStreams
asCheckMediaTypes []ct.MediaType
// Assets
assetFileNames map[string]string
assetFiles map[string]*assetFile
// Autocert
autocertManager *autocert.Manager
autocertInit sync.Once
// Blogroll
blogrollCacheGroup singleflight.Group
// Blogstats
blogStatsCacheGroup singleflight.Group
// Cache
cache *cache
// Config
cfg *config
// Database
db *database
2021-06-19 06:37:16 +00:00
// Errors
errorCheckMediaTypes []ct.MediaType
2022-02-22 18:47:12 +00:00
// Geo
photonMutex sync.Mutex
// Hooks
pPostHooks []postHookFunc
pUpdateHooks []postHookFunc
pDeleteHooks []postHookFunc
pUndeleteHooks []postHookFunc
hourlyHooks []hourlyHookFunc
2021-06-19 06:37:16 +00:00
// HTTP Client
httpClient *http.Client
// HTTP Routers
2021-07-17 07:33:44 +00:00
d http.Handler
2022-01-24 08:43:06 +00:00
// IndexNow
2022-02-25 15:29:42 +00:00
inKey []byte
inLoad sync.Once
2021-11-23 14:23:01 +00:00
// IndieAuth
ias *indieauth.Server
// Logs
logf *rotatelogs.RotateLogs
// Markdown
2021-08-04 21:26:38 +00:00
md, absoluteMd, titleMd goldmark.Markdown
2021-06-20 13:18:02 +00:00
// Media
compressorsInit sync.Once
compressors []mediaCompression
mediaStorageInit sync.Once
mediaStorage mediaStorage
// Minify
min minify.Minifier
// Plugins
pluginHost *plugins.PluginHost
2022-04-17 05:27:17 +00:00
// Reactions
reactionsInit sync.Once
reactionsCache *ristretto.Cache
reactionsSfg singleflight.Group
// Regex Redirects
regexRedirects []*regexRedirect
// Sessions
loginSessions, captchaSessions *dbSessionStore
// Shutdown
shutdown shutdowner.Shutdowner
// Template strings
ts *ts.TemplateStrings
2021-10-13 07:01:54 +00:00
// Tailscale
tsinit sync.Once
tss *tsnet.Server
// Tor
torAddress string
torHostname string
}