2024-02-03 11:05:10 +00:00
|
|
|
package context
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2024-02-03 14:18:37 +00:00
|
|
|
"git.polynom.me/rio/internal/gitea"
|
2024-02-03 11:05:10 +00:00
|
|
|
"git.polynom.me/rio/internal/metrics"
|
2024-02-03 14:18:37 +00:00
|
|
|
"github.com/patrickmn/go-cache"
|
2024-02-03 11:05:10 +00:00
|
|
|
)
|
|
|
|
|
2024-02-03 14:18:37 +00:00
|
|
|
type CacheContext struct {
|
|
|
|
// Cache for general repository information
|
|
|
|
RepositoryInformationCache cache.Cache
|
|
|
|
}
|
|
|
|
|
2024-02-03 11:05:10 +00:00
|
|
|
type GlobalContext struct {
|
|
|
|
DefaultCSP string
|
|
|
|
PagesDomain string
|
2024-02-03 14:18:37 +00:00
|
|
|
Gitea *gitea.GiteaClient
|
2024-02-03 11:05:10 +00:00
|
|
|
MetricConfig *metrics.LokiMetricConfig
|
2024-02-03 14:18:37 +00:00
|
|
|
Cache *CacheContext
|
2024-02-03 11:05:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Context struct {
|
|
|
|
Username string
|
|
|
|
Reponame string
|
|
|
|
Domain string
|
|
|
|
Path string
|
|
|
|
|
|
|
|
// HTTP Stuff
|
|
|
|
Referrer string
|
|
|
|
UserAgent string
|
|
|
|
Writer http.ResponseWriter
|
|
|
|
|
|
|
|
// Pointer to the global context
|
|
|
|
Global *GlobalContext
|
|
|
|
}
|