all repos — nirvash @ 1d743646c591832497f1bf897545cd154f67279a

modular CMS using the quartzgun library

add favicon and put NAVIGATION first in page list
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQT/foVVmI9pK13hPWFohAcXSWbK8wUCZfaC3QAKCRBohAcXSWbK
85n3AP9+KtyY8JoiJbIO2j/wKp1truZG6MjfncoFjTR5yHu80wEArKcu+5oeHmVi
vDzAdIGvb5pU8CCvBom/8BbSlQ5/SwQ=
=4oub
-----END PGP SIGNATURE-----
commit

1d743646c591832497f1bf897545cd154f67279a

parent

e4ae62ad7b35eb5c0065ee470908e643b064eec2

5 files changed, 14 insertions(+), 5 deletions(-)

jump to
M LICENSELICENSE

@@ -1,4 +1,4 @@

-Copyright 2022 Derek Stevens <nilix@nilfm.cc> +Copyright 2024 Iris LIghtshard <nilix@nilfm.cc> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
M archetype/eureka.goarchetype/eureka.go

@@ -77,9 +77,10 @@ panic(err.Error())

} pages := map[string]string{} + pages["meta.nav.htm"] = "NAVIGATION" for _, file := range files { filename := file.Name() - if strings.HasSuffix(filename, ".htm") { + if strings.HasSuffix(filename, ".htm") && filename != "meta.nav.htm" { pages[filename] = strings.Replace( strings.TrimSuffix(filename, ".htm"), "_", " ", -1) }

@@ -195,7 +196,7 @@ }

func (self *EurekaAdapter) CreatePage(slug, title, content string) error { // eureka creates titles from slugs, so we transform the title into the slug - slug = strings.ReplaceAll(title, " ", "_") + ".htm" + slug = strings.ToLower(strings.ReplaceAll(title, " ", "_")) + ".htm" path := filepath.Join(self.Root, "inc", slug) if strings.Contains(slug, "../") || strings.Contains(slug, "..\\") {

@@ -217,7 +218,7 @@ }

func (self *EurekaAdapter) SavePage(oldSlug, newSlug, title, content string) error { // eureka creates titles from slugs, so we transform the title into the slug - newSlug = strings.ReplaceAll(title, " ", "_") + ".htm" + newSlug = strings.ToLower(strings.ReplaceAll(title, " ", "_")) + ".htm" if strings.Contains(newSlug, "../") || strings.Contains(newSlug, "..\\") || strings.Contains(oldSlug, "../") || strings.Contains(oldSlug, "..\\") {
M templates/cms_list.htmltemplates/cms_list.html

@@ -11,7 +11,14 @@

<div class="page-list"> <ul> {{ range $slug, $title := $pages }} + {{ if eq $title "NAVIGATION" }} <li><a href="/edit/{{$slug}}">{{$title}}</a></li> + {{ end }} + {{ end }} + {{ range $slug, $title := $pages }} + {{ if ne $title "NAVIGATION" }} + <li><a href="/edit/{{$slug}}">{{$title}}</a></li> + {{ end }} {{ end }} </ul> </div>
M templates/header.htmltemplates/header.html

@@ -6,6 +6,7 @@ <meta charset='utf-8'>

<meta name='description' content='Nirvash CMS'/> <meta name='viewport' content='width=device-width,initial-scale=1'> <link rel='stylesheet' type='text/css' href='/static/style.css'> + <link rel='shortcut icon' href='/static/favicon.png'> <title>Nirvash &mdash; CMS</title> </head> <body>

@@ -20,4 +21,4 @@ <li><a href="/deploy">Deployment</a></li>

<li><a href="/logout">Logout</a></li> </ul> </nav> -{{end}}+{{end}}