Require access to Still via method
This commit adds a safeguard to accessing the still from a specific component by requiring access via the component.GetStill method.
This commit is contained in:
parent
81fa84c244
commit
8235ea9105
63 changed files with 288 additions and 197 deletions
|
|
@ -32,7 +32,7 @@ func (api *API) Routes() component.Routes {
|
|||
|
||||
func (a *API) HandleRoute(ctx context.Context, path string) (http.Handler, error) {
|
||||
return &api.Handler[string]{
|
||||
Config: a.Config,
|
||||
Config: component.GetStill(a).Config,
|
||||
Auth: a.dependencies.Auth,
|
||||
|
||||
Methods: []string{"GET"},
|
||||
|
|
|
|||
|
|
@ -85,15 +85,17 @@ func (resolver *Resolver) HandleRoute(ctx context.Context, route string) (http.H
|
|||
Data: map[string]string{},
|
||||
}
|
||||
|
||||
config := component.GetStill(resolver).Config
|
||||
|
||||
// handle the default domain name!
|
||||
domainName := resolver.Config.HTTP.PrimaryDomain
|
||||
domainName := config.HTTP.PrimaryDomain
|
||||
if domainName != "" {
|
||||
fallback.Data[fmt.Sprintf("^https?://(.*)\\.%s", regexp.QuoteMeta(domainName))] = fmt.Sprintf("https://$1.%s", domainName)
|
||||
logger.Info().Str("name", domainName).Msg("registering default domain")
|
||||
}
|
||||
|
||||
// handle the extra domains!
|
||||
for _, domain := range resolver.Config.HTTP.ExtraDomains {
|
||||
for _, domain := range config.HTTP.ExtraDomains {
|
||||
fallback.Data[fmt.Sprintf("^https?://(.*)\\.%s", regexp.QuoteMeta(domain))] = fmt.Sprintf("https://$1.%s", domainName)
|
||||
logger.Info().Str("name", domainName).Msg("registering legacy domain")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue