Graphical overhaul.
Remove all legacy pixeldrain pages, handlers and assets. Remove old theming engine. Make logo responsive to the accent colour. Lots of other stuff.
This commit is contained in:
@@ -5,11 +5,12 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"fornaxian.tech/pixeldrain_api_client/pixelapi"
|
||||
"fornaxian.tech/nova_server/api"
|
||||
)
|
||||
|
||||
const defaultThemeColour = "#220735"
|
||||
const defaultThemeColour = "#49dfa0"
|
||||
const defaultHost = "https://nova.storage"
|
||||
const siteDescription = "Cost-effective cloud storage and content delivery"
|
||||
|
||||
type ogData struct {
|
||||
MetaPropRules []ogProp
|
||||
@@ -78,6 +79,22 @@ func generateOGData(name, filetype, pageurl, fileurl, thumbnailurl, themecolour
|
||||
return og
|
||||
}
|
||||
|
||||
// siteOGData describes the site itself, for link previews of pages which are
|
||||
// not a shared file
|
||||
func siteOGData(r *http.Request) (og ogData) {
|
||||
var addr = getRequestAddress(r)
|
||||
og.addProp("og:type", "website")
|
||||
og.addProp("og:site_name", "Nova.storage")
|
||||
og.addProp("og:title", "Nova.storage")
|
||||
og.addProp("og:description", siteDescription)
|
||||
og.addProp("og:url", addr+r.URL.Path)
|
||||
og.addProp("og:image", addr+"/res/img/nova_512.png")
|
||||
og.addName("description", siteDescription)
|
||||
og.addName("theme-color", defaultThemeColour)
|
||||
og.addName("twitter:card", "summary")
|
||||
return og
|
||||
}
|
||||
|
||||
func getRequestAddress(r *http.Request) (addr string) {
|
||||
if r.Host == "" {
|
||||
return defaultHost
|
||||
@@ -87,7 +104,7 @@ func getRequestAddress(r *http.Request) (addr string) {
|
||||
return "https://" + r.Host
|
||||
}
|
||||
}
|
||||
func (wc *WebController) metadataFromFilesystem(r *http.Request, f pixelapi.FilesystemPath) (og ogData) {
|
||||
func (wc *WebController) metadataFromFilesystem(r *http.Request, f api.FilesystemPath) (og ogData) {
|
||||
var addr = getRequestAddress(r)
|
||||
var base = &f.Path[f.BaseIndex]
|
||||
|
||||
@@ -102,8 +119,8 @@ func (wc *WebController) metadataFromFilesystem(r *http.Request, f pixelapi.File
|
||||
var colour = defaultThemeColour
|
||||
for _, node := range f.Path {
|
||||
if node.Properties["branding_enabled"] == "true" &&
|
||||
node.Properties["brand_highlight_color"] != "" {
|
||||
colour = node.Properties["brand_highlight_color"]
|
||||
node.Properties["brand_accent_color"] != "" {
|
||||
colour = node.Properties["brand_accent_color"]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user