GoBlog/app.go

104 lines
2.4 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"
apc "github.com/go-ap/client"
"github.com/go-fed/httpsig"
"github.com/hacdias/indieauth/v3"
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"
)
type goBlog struct {
// ActivityPub
apPrivateKey *rsa.PrivateKey
2022-04-21 16:18:39 +00:00
apPubKeyBytes []byte
apSigner httpsig.Signer
apSignMutex sync.Mutex
apHttpClients map[string]*apc.C
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
// Microformats
mfInit sync.Once
mfCache *ristretto.Cache
// Minify
min minify.Minifier
// Plugins
pluginHost *plugins.PluginHost
2022-11-27 14:06:43 +00:00
// Profile image
profileImageHashString string
profileImageHashGroup singleflight.Group
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
// Tor
torAddress string
torHostname string
}