Rename config options to use underscores

Makes more sense for the INI.
This commit is contained in:
Cadence Ember 2022-09-04 13:38:30 +12:00
parent a2ec8bb923
commit cc138a07aa
Signed by: cadence
GPG Key ID: BC1C2C61CF521B17
4 changed files with 15 additions and 14 deletions

View File

@ -26,7 +26,7 @@
`(html `(html
(head (head
(meta (@ (name "viewport") (content "width=device-width, initial-scale=1"))) (meta (@ (name "viewport") (content "width=device-width, initial-scale=1")))
(title ,(format "~a | ~a" title (config-get 'application-name))) (title ,(format "~a | ~a" title (config-get 'application_name)))
(style ":root { --theme-page-background-color: #dfdfe0 }") ; fallback in case styles don't load fast enough (style ":root { --theme-page-background-color: #dfdfe0 }") ; fallback in case styles don't load fast enough
,@(map (λ (url) ,@(map (λ (url)
`(link (@ (rel "stylesheet") (type "text/css") (href ,url)))) `(link (@ (rel "stylesheet") (type "text/css") (href ,url))))
@ -53,22 +53,22 @@
(img (@ (class "my-logo") (src "/static/breezewiki.svg")))) (img (@ (class "my-logo") (src "/static/breezewiki.svg"))))
(p (p
(a (@ (href "https://gitdab.com/cadence/breezewiki")) (a (@ (href "https://gitdab.com/cadence/breezewiki"))
,(format "~a source code" (config-get 'application-name)))) ,(format "~a source code" (config-get 'application_name))))
(p (p
(a (@ (href "https://lists.sr.ht/~cadence/breezewiki-discuss")) (a (@ (href "https://lists.sr.ht/~cadence/breezewiki-discuss"))
"Discussions / Bug reports / Feature requests")) "Discussions / Bug reports / Feature requests"))
,(if (config-get 'instance-is-official) ,(if (config-get 'instance_is_official)
`(p ,(format "This instance is run by the ~a developer, " (config-get 'application-name)) `(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact")) (a (@ (href "https://cadence.moe/contact"))
"Cadence.")) "Cadence."))
`(p `(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application-name))))) ,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name)))))
(div (div
(p "This page displays proxied content from " (p "This page displays proxied content from "
(a (@ (href ,source-url) (rel "noreferrer")) ,source-url) (a (@ (href ,source-url) (rel "noreferrer")) ,source-url)
". Text content is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), " ". Text content is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.") (a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files may have different copying restrictions.") " Media files may have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application-name)))))))))))) (p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))))))))))
(module+ test (module+ test
(check-not-false (xexp->html (generate-wiki-page "" "test" "test" '(template))))) (check-not-false (xexp->html (generate-wiki-page "" "test" "test" '(template)))))

View File

@ -16,10 +16,11 @@
(hash-ref config key)) (hash-ref config key))
(define default-config (define default-config
'((port . "10416") '((application_name . "BreezeWiki")
(canonical_origin . "")
(debug . "false") (debug . "false")
(instance-is-official . "false") ; please don't turn this on, or you will make me very upset (instance_is_official . "false") ; please don't turn this on, or you will make me very upset
(application-name . "BreezeWiki"))) (port . "10416")))
(define config (define config
(make-hasheq (make-hasheq

View File

@ -59,7 +59,7 @@
(define data (easy:response-json dest-res)) (define data (easy:response-json dest-res))
(define body (generate-results-page dest-url wikiname prefixed-category data)) (define body (generate-results-page dest-url wikiname prefixed-category data))
(when (config-get 'debug) (when (config-true? 'debug)
; used for its side effects ; used for its side effects
; convert to string with error checking, error will be raised if xexp is invalid ; convert to string with error checking, error will be raised if xexp is invalid
(xexp->html body)) (xexp->html body))

View File

@ -56,20 +56,20 @@
(footer (@ (class "custom-footer")) (footer (@ (class "custom-footer"))
(div (@ (class "internal-footer")) (div (@ (class "internal-footer"))
(img (@ (class "my-logo") (src "/static/breezewiki.svg"))) (img (@ (class "my-logo") (src "/static/breezewiki.svg")))
,(if (config-get 'instance-is-official) ,(if (config-get 'instance_is_official)
`(div `(div
(p ,(format "This instance is run by the ~a developer, " (config-get 'application-name)) (p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact")) (a (@ (href "https://cadence.moe/contact"))
"Cadence.")) "Cadence."))
(p "Hosting generously provided by " (p "Hosting generously provided by "
(a (@ (href "http://alphamethyl.barr0w.net/")) (a (@ (href "http://alphamethyl.barr0w.net/"))
"alphamethyl."))) "alphamethyl.")))
`(p `(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application-name)))) ,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name))))
(p "Text content on wikis run by Fandom is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), " (p "Text content on wikis run by Fandom is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.") (a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files and official Fandom documents have different copying restrictions.") " Media files and official Fandom documents have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application-name))))))))))) (p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name)))))))))))
(module+ test (module+ test
(check-not-false (xexp->html body))) (check-not-false (xexp->html body)))