mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 15:32:22 +08:00

* rename /mtfe route to /femt to match project name * set correct navTree JSON property name * call GetWebAssets in the request handler to prevent stale assets during development * Call /bootdata and render grafana * set nonce on script * write csp header in index handler * write report-only csp as well * debug stuff * more debug logging * move importing app into a seperate, async-loaded module * Clean up comments * make /femt redirect to / in the frontend * remove console.log * remove stale commented code * call __grafana_load_failed if bootstrap fails * comment for __grafana_boot_data_promise * remove console.log * remove blank newline * codeowners
74 lines
3.0 KiB
Go
74 lines
3.0 KiB
Go
package dtos
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"github.com/grafana/grafana/pkg/services/navtree"
|
|
)
|
|
|
|
type IndexViewData struct {
|
|
User *CurrentUser `json:"user"`
|
|
Settings *FrontendSettingsDTO `json:"settings"`
|
|
AppUrl string `json:"-"`
|
|
AppSubUrl string `json:"-"`
|
|
GoogleAnalyticsId string `json:"-"`
|
|
GoogleAnalytics4Id string `json:"-"`
|
|
GoogleAnalytics4SendManualPageViews bool `json:"-"`
|
|
GoogleTagManagerId string `json:"-"`
|
|
NavTree *navtree.NavTreeRoot `json:"navTree"`
|
|
BuildVersion string `json:"-"`
|
|
BuildCommit string `json:"-"`
|
|
ThemeType string `json:"-"`
|
|
NewGrafanaVersionExists bool `json:"-"`
|
|
NewGrafanaVersion string `json:"-"`
|
|
AppName string `json:"-"`
|
|
AppNameBodyClass string `json:"-"`
|
|
FavIcon template.URL `json:"-"`
|
|
AppleTouchIcon template.URL `json:"-"`
|
|
AppTitle string `json:"-"`
|
|
LoadingLogo template.URL `json:"-"`
|
|
CSPContent string `json:"-"`
|
|
CSPEnabled bool `json:"-"`
|
|
IsDevelopmentEnv bool `json:"-"`
|
|
// Nonce is a cryptographic identifier for use with Content Security Policy.
|
|
Nonce string `json:"-"`
|
|
NewsFeedEnabled bool `json:"-"`
|
|
Assets *EntryPointAssets `json:"assets"` // Includes CDN info
|
|
}
|
|
|
|
type EntryPointAssets struct {
|
|
ContentDeliveryURL string `json:"cdn,omitempty"`
|
|
JSFiles []EntryPointAsset `json:"jsFiles"`
|
|
CSSFiles []EntryPointAsset `json:"cssFiles"`
|
|
Dark string `json:"dark"`
|
|
Light string `json:"light"`
|
|
Swagger []EntryPointAsset `json:"swagger"`
|
|
SwaggerCSSFiles []EntryPointAsset `json:"swaggerCssFiles"`
|
|
}
|
|
|
|
type EntryPointAsset struct {
|
|
FilePath string `json:"filePath"`
|
|
Integrity string `json:"integrity"`
|
|
}
|
|
|
|
func (a *EntryPointAssets) SetContentDeliveryURL(prefix string) {
|
|
if prefix == "" {
|
|
return
|
|
}
|
|
a.ContentDeliveryURL = prefix
|
|
a.Dark = prefix + a.Dark
|
|
a.Light = prefix + a.Light
|
|
for i, p := range a.JSFiles {
|
|
a.JSFiles[i].FilePath = prefix + p.FilePath
|
|
}
|
|
for i, p := range a.CSSFiles {
|
|
a.CSSFiles[i].FilePath = prefix + p.FilePath
|
|
}
|
|
for i, p := range a.Swagger {
|
|
a.Swagger[i].FilePath = prefix + p.FilePath
|
|
}
|
|
for i, p := range a.SwaggerCSSFiles {
|
|
a.SwaggerCSSFiles[i].FilePath = prefix + p.FilePath
|
|
}
|
|
}
|