Fully rename Pixeldrain to Nova
This commit is contained in:
@@ -47,7 +47,7 @@ func (wc *WebController) serveDirectory(w http.ResponseWriter, r *http.Request,
|
||||
return
|
||||
}
|
||||
|
||||
td.Title = fmt.Sprintf("%s ~ pixeldrain", node.Path[node.BaseIndex].Name)
|
||||
td.Title = fmt.Sprintf("%s ~ Nova", node.Path[node.BaseIndex].Name)
|
||||
td.Other = node
|
||||
td.OGData = wc.metadataFromFilesystem(r, node)
|
||||
err = wc.templates.Run(w, r, "wrap", td)
|
||||
|
||||
@@ -82,19 +82,19 @@ func userStyle(style string, hue int) template.CSS {
|
||||
def = hackerStyle
|
||||
hue = -1 // Does not support custom hues
|
||||
case "canta":
|
||||
def = cantaPixeldrainStyle
|
||||
def = cantaNovaStyle
|
||||
case "skeuos":
|
||||
def = skeuosPixeldrainStyle
|
||||
def = skeuosNovaStyle
|
||||
case "sweet":
|
||||
def = sweetPixeldrainStyle
|
||||
def = sweetNovaStyle
|
||||
case "adwaita_dark":
|
||||
def = adwaitaDarkStyle
|
||||
case "adwaita_light":
|
||||
def = adwaitaLightStyle
|
||||
case "pixeldrain98":
|
||||
def = pixeldrain98Style
|
||||
case "pixeldrain98_dark":
|
||||
def = pixeldrain98StyleDark
|
||||
case "nova98":
|
||||
def = nova98Style
|
||||
case "nova98_dark":
|
||||
def = nova98StyleDark
|
||||
}
|
||||
|
||||
if hue >= 0 && hue <= 360 {
|
||||
@@ -370,7 +370,7 @@ var hackerStyle = styleSheet{
|
||||
CardColor: HSL{120, .4, .05},
|
||||
}
|
||||
|
||||
var cantaPixeldrainStyle = styleSheet{
|
||||
var cantaNovaStyle = styleSheet{
|
||||
Input: HSL{167, .06, .30}, // hsl(167, 6%, 30%)
|
||||
InputHover: HSL{167, .06, .35}, // hsl(167, 6%, 30%)
|
||||
InputText: HSL{0, 0, 1},
|
||||
@@ -385,7 +385,7 @@ var cantaPixeldrainStyle = styleSheet{
|
||||
CardColor: HSL{170, .05, .26},
|
||||
}
|
||||
|
||||
var skeuosPixeldrainStyle = styleSheet{
|
||||
var skeuosNovaStyle = styleSheet{
|
||||
Input: HSL{226, .15, .23}, //hsl(226, 15%, 23%)
|
||||
InputHover: HSL{226, .15, .28},
|
||||
InputText: HSL{60, .06, .93},
|
||||
@@ -452,7 +452,7 @@ var nordLightStyle = styleSheet{
|
||||
CardColor: nord5,
|
||||
}
|
||||
|
||||
var sweetPixeldrainStyle = styleSheet{
|
||||
var sweetNovaStyle = styleSheet{
|
||||
Input: HSL{229, .25, .18}, // hsl(229, 25%, 14%)
|
||||
InputHover: HSL{229, .25, .23}, // hsl(229, 25%, 14%)
|
||||
InputText: HSL{223, .13, .79},
|
||||
@@ -610,7 +610,7 @@ hr,
|
||||
}
|
||||
`
|
||||
|
||||
var pixeldrain98Style = styleSheet{
|
||||
var nova98Style = styleSheet{
|
||||
Input: RGB{190, 190, 190},
|
||||
InputHover: RGB{220, 220, 220},
|
||||
InputText: RGB{0, 0, 0},
|
||||
@@ -629,7 +629,7 @@ var pixeldrain98Style = styleSheet{
|
||||
StyleOverrides: override98,
|
||||
}
|
||||
|
||||
var pixeldrain98StyleDark = styleSheet{
|
||||
var nova98StyleDark = styleSheet{
|
||||
Input: HSL{0, 0, .25},
|
||||
InputHover: HSL{0, 0, .30},
|
||||
InputText: RGB{255, 255, 255},
|
||||
|
||||
54
webcontroller/sveltekit.go
Normal file
54
webcontroller/sveltekit.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package webcontroller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"fornaxian.tech/log"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
// New initializes a new WebController by registering all the request handlers
|
||||
// and parsing all templates in the resource directory
|
||||
func serveSK(r *httprouter.Router) (err error) {
|
||||
// r.ServeFiles("/_app/*filepath", http.Dir(assetsPath+"/_app"))
|
||||
// r.ServeFiles("/style/*filepath", http.Dir(assetsPath+"/style"))
|
||||
|
||||
readdir, err := os.ReadDir(assetsPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, entry := range readdir {
|
||||
if entry.Type().IsRegular() {
|
||||
serveFile(r, "/"+entry.Name(), assetsPath+"/"+entry.Name())
|
||||
} else if entry.IsDir() {
|
||||
r.ServeFiles("/"+entry.Name()+"/*filepath", http.Dir(assetsPath+"/"+entry.Name()))
|
||||
}
|
||||
}
|
||||
|
||||
r.NotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("Running fallback handler for %s", r.URL.Path)
|
||||
http.ServeFile(w, r, assetsPath+"/fallback.html")
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
const assetsPath = "/home/wim/Workspace/svelte/fnx_sk/build"
|
||||
|
||||
func serveFile(r *httprouter.Router, path, file string) {
|
||||
var handler = func(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
p httprouter.Params,
|
||||
) {
|
||||
http.ServeFile(w, r, assetsPath+"/"+file)
|
||||
}
|
||||
|
||||
r.GET(path, handler)
|
||||
r.HEAD(path, handler)
|
||||
r.OPTIONS(path, handler)
|
||||
r.POST(path, handler)
|
||||
r.PUT(path, handler)
|
||||
r.PATCH(path, handler)
|
||||
r.DELETE(path, handler)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func (wc *WebController) newTemplateData(w http.ResponseWriter, r *http.Request)
|
||||
Value: "",
|
||||
Path: "/",
|
||||
Expires: time.Unix(0, 0),
|
||||
Domain: ".pixeldrain.com",
|
||||
Domain: ".nova.storage",
|
||||
})
|
||||
}
|
||||
return t
|
||||
|
||||
@@ -118,7 +118,6 @@ func New(r *httprouter.Router, prefix string, conf Config) (wc *WebController) {
|
||||
}
|
||||
|
||||
r.NotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Info("running wrap handler")
|
||||
wc.serveTemplate("wrap", handlerOpts{})(w, r, nil)
|
||||
})
|
||||
|
||||
@@ -134,15 +133,6 @@ func New(r *httprouter.Router, prefix string, conf Config) (wc *WebController) {
|
||||
{GET, "api" /* */, wc.serveMarkdown("api.md", handlerOpts{})},
|
||||
{GET, "d/*path" /* */, wc.serveDirectory},
|
||||
{GET, "widgets" /* */, wc.serveTemplate("widgets", handlerOpts{})},
|
||||
{GET, "about" /* */, wc.serveMarkdown("about.md", handlerOpts{})},
|
||||
{GET, "hosting" /* */, wc.serveMarkdown("hosting.md", handlerOpts{})},
|
||||
{GET, "acknowledgements" /**/, wc.serveMarkdown("acknowledgements.md", handlerOpts{})},
|
||||
{GET, "business" /* */, wc.serveMarkdown("business.md", handlerOpts{})},
|
||||
{GET, "limits" /* */, wc.serveMarkdown("limits.md", handlerOpts{})},
|
||||
{GET, "abuse" /* */, wc.serveMarkdown("abuse.md", handlerOpts{})},
|
||||
{GET, "filesystem" /* */, wc.serveMarkdown("filesystem.md", handlerOpts{})},
|
||||
{GET, "100_gigabit_ethernet", wc.serveMarkdown("100_gigabit_ethernet.md", handlerOpts{NoExec: true})},
|
||||
{GET, "apps" /* */, wc.serveTemplate("apps", handlerOpts{})},
|
||||
{GET, "status" /* */, wc.serveTemplate("status", handlerOpts{})},
|
||||
{GET, "theme.css", wc.themeHandler},
|
||||
} {
|
||||
@@ -287,5 +277,5 @@ func (wc *WebController) getAPIKey(r *http.Request) (key string, err error) {
|
||||
return cookie.Value, nil
|
||||
}
|
||||
}
|
||||
return "", errors.New("not a valid pixeldrain authentication cookie")
|
||||
return "", errors.New("not a valid Nova authentication cookie")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user