1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2024-12-20 10:31:18 +00:00

Add a pre-filled home page as welcome

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-08-07 08:28:15 +02:00
parent bbba71a9c3
commit 87f7c52b5b
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 71 additions and 3 deletions

View file

@ -2,6 +2,7 @@
// sources:
// frontend/app.js
// frontend/index.html
// home.md
package main
@ -16256,6 +16257,57 @@ func bindataFrontendIndexhtml() (*asset, error) {
return a, nil
}
var _bindataHomemd = []byte(
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x92\x3f\x6f\xdb\x3c\x10\xc6\x77\x7f\x8a\x0b\xde\x21\x6f\x80\x46\xde" +
"\x33\xb6\x43\x6b\xa0\x29\x3a\x04\x08\x0a\x23\x03\x25\x3e\x12\xaf\xa2\x79\x2e\x79\xb4\xe2\x7e\xfa\xe2\x28\x3b\x6d" +
"\xa7\x2e\x06\x2c\x1e\x7f\x7c\xfe\xdc\x7f\xf4\x49\x0e\xd8\x6c\x9e\x11\x07\x39\x80\x54\xe8\x2c\x35\x53\xc2\x42\xcf" +
"\x3c\xf3\xcd\x66\xf3\x4d\xea\xed\x09\x54\xea\x30\xa0\x94\xb1\xc6\x78\xa6\xa2\x2e\x2b\x3c\x69\x00\x15\x19\x75\x71" +
"\x19\xe4\x92\x27\x24\x45\xbe\x1c\x8c\x59\x92\x22\xf9\x8e\xbe\xc8\x62\x58\x1a\x5c\x22\x78\x56\xc2\x09\xf9\xac\x81" +
"\xd3\x74\x43\x8f\xee\xdc\x63\x25\xd2\xc2\x1a\x48\x03\x17\x3a\xba\x09\x0f\xb4\x53\xe2\xb2\xbe\xd2\xce\xed\x2b\x2d" +
"\x81\x87\x40\x0b\xc7\x48\x3d\xe8\xc4\x85\x4d\x8a\xab\x2a\x07\xa7\x3c\x38\x13\x28\x69\x3d\xe0\x34\xb5\xeb\xe6\xa5" +
"\xd1\xa5\x2a\xb9\x44\x9e\x33\x06\xa5\xc8\x69\x36\xcf\x2e\x9d\xa9\xd4\xfe\xde\xf8\x1d\x3d\x05\xd0\xd0\xb4\xab\xc9" +
"\xbe\xcd\xa0\x02\x18\x2a\xf3\x14\x94\x92\x2c\x26\x2b\x89\x52\x51\x31\xbb\x7d\x55\x92\x64\xc1\x20\x9f\xe0\x69\x09" +
"\x48\xf6\x6e\xc6\x3a\x78\x9d\xdb\xef\x2d\xee\x97\x97\x66\xa4\xdb\x6c\x9e\x6d\xce\x12\x31\xf8\x35\xa1\x5a\x40\xfb" +
"\x47\x97\x67\x2f\x4b\x7a\xf9\x3f\xa8\x1e\xcb\xc3\x76\x8b\xd4\x2d\x3c\xf3\x11\x9e\x5d\x27\x79\xda\xda\xbf\xed\x75" +
"\xee\xce\x6c\x14\x3d\x47\xac\x05\x5e\xf4\x97\x8e\x76\x63\x23\x5b\x43\xa3\x3b\x70\x64\x97\xd7\x9c\xb9\xb9\xa3\x12" +
"\xa4\x46\x4f\x23\x5b\x7d\x6f\xbd\x90\x2b\x6f\xd7\x6a\xb1\x46\x65\xbd\x25\x09\x84\xd7\x01\x47\x65\x49\x0f\xb4\x4b" +
"\x85\x3d\xd6\xce\x5a\xc8\x57\x17\x2d\x5a\xcb\x75\xbf\xff\xea\x26\xf3\x5c\x8b\x71\xbd\xd4\x3e\x82\xfa\xec\x86\x19" +
"\xa6\xef\x29\x48\xc1\x5a\xe7\xdf\x1d\x4e\x50\xca\x58\x32\xab\x22\x11\x27\x15\xfb\x41\x4e\x2e\x36\x7a\xb9\x6c\x42" +
"\x70\xb6\x9e\xd1\xaa\x89\x67\xf2\x3c\x8e\xc8\x56\x5d\x14\xe7\xed\xc5\x1e\xc1\x9d\xd8\x42\xd1\x60\x0b\xf8\xfa\x27" +
"\xa3\xa3\xf7\xb5\xed\x63\xa2\x21\xc3\x5d\x16\xe6\x4d\xd1\x22\x79\xa6\xef\xb5\xa8\xe5\x63\x8d\xed\x12\x0d\xae\xb4" +
"\x90\x09\xaf\x47\x64\x46\x1a\x40\x9a\x9b\xad\x77\xab\x98\x11\x4e\x6b\x06\x65\xfc\xa8\x28\x5a\x48\x32\x8d\x80\xef" +
"\xdd\x70\xa1\xb5\xe5\x6c\x9b\xb9\xdf\x95\x52\x71\xff\xd4\xf2\xc8\xbf\xeb\x9e\x58\x43\xed\xbb\x41\x0e\xdb\xcf\xf5" +
"\x27\x8f\xc8\x6b\xe1\x6c\xe3\xe5\xce\x36\xfc\x63\x1b\x31\xb8\xba\x19\xe4\x28\x8a\xcc\xe4\x2e\xdc\x0f\xe2\xf1\x4f" +
"\xdc\x5d\xb7\xf9\x15\x00\x00\xff\xff\x89\xe1\x8e\x06\x03\x04\x00\x00")
func bindataHomemdBytes() ([]byte, error) {
return bindataRead(
_bindataHomemd,
"home.md",
)
}
func bindataHomemd() (*asset, error) {
bytes, err := bindataHomemdBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{
name: "home.md",
size: 1027,
md5checksum: "90c96a95496c346cb0c694c0f029bc06",
mode: os.FileMode(420),
modTime: time.Unix(1, 0),
}
a := &asset{bytes: bytes, info: info}
return a, nil
}
//
// Asset loads and returns the asset for the given name.
@ -16322,6 +16374,7 @@ func AssetNames() []string {
var _bindata = map[string]func() (*asset, error){
"frontend/app.js": bindataFrontendAppjs,
"frontend/index.html": bindataFrontendIndexhtml,
"home.md": bindataHomemd,
}
//
@ -16380,6 +16433,7 @@ var _bintree = &bintree{Func: nil, Children: map[string]*bintree{
"app.js": {Func: bindataFrontendAppjs, Children: map[string]*bintree{}},
"index.html": {Func: bindataFrontendIndexhtml, Children: map[string]*bintree{}},
}},
"home.md": {Func: bindataHomemd, Children: map[string]*bintree{}},
}}
// RestoreAsset restores an asset under the given directory

9
home.md Normal file
View file

@ -0,0 +1,9 @@
# Home
Welcome to your new Wiki!
You've successfully started the software and entered the frontend. Now you can edit everything! Maybe start with this page: It is the start page which will be visited automatically on visiting the Wiki without an direct link to any sub-page. The content you're seeing right now is not stored but only served when there is no stored [[Home]] page.
When editing you can use [Markdown](https://en.wikipedia.org/wiki/Markdown) to style your contents. If you are familiar with it you should find everything as you are used to with one exception: Inside this Wiki you can link any [[Page]] using double brackets. Those will automatically get rewritten into internal links which have slightly different loading behaviour than external links. But even creating those will work just fine.
In case you experience trouble, have feature requests or feedback just visit the [Issue-Tracker](https://github.com/Luzifer/wiki/issues) on Github or take a look at the [Code](https://github.com/Luzifer/wiki).

11
main.go
View file

@ -1,6 +1,6 @@
package main
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go -modtime 1 -md5checksum ./frontend/...
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go -modtime 1 -md5checksum ./frontend/... home.md
import (
"bytes"
@ -104,8 +104,13 @@ func handlePageRead(w http.ResponseWriter, r *http.Request) {
// All okay, render follows
case errFileNotFound:
http.Error(w, "Page not yet exists", http.StatusNotFound)
return
if sanitizeFilename(vars["page"]) != "home.md" {
http.Error(w, "Page not yet exists", http.StatusNotFound)
return
}
// Deliver initial "Home" page
file = &storedFile{Content: string(MustAsset("home.md"))}
default:
http.Error(w, err.Error(), http.StatusInternalServerError)