0
0
mirror of https://github.com/rls-moe/nyx synced 2024-09-28 16:03:47 +02:00
nyx/http/admin/rice-box.go

56 lines
14 KiB
Go
Raw Normal View History

2017-03-15 14:33:27 +01:00
package admin
import (
"github.com/GeertJohan/go.rice/embedded"
"time"
)
func init() {
// define files
file2 := &embedded.EmbeddedFile{
Filename: `index.html`,
FileModTime: time.Unix(1489315188, 0),
Content: string("<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{.Config.Site.Title}} Admin Login</title>\n <link rel=\"stylesheet\" href=\"/@/style.css\">\n <link rel=\"stylesheet\" href=\"/@/custom.css\">\n <link rel=\"stylesheet\" href=\"/@/admin.css\">\n</head>\n<body>\n <div class=\"admin login\">\n <form action=\"/admin/login.sh\" method=\"POST\">\n <input\n type=\"hidden\"\n name=\"csrf_token\"\n value=\"{{ .CSRFToken }}\" />\n <div class=\"admin form row\">\n <input\n class=\"admin form input\"\n type=\"text\"\n name=\"id\"\n placeholder=\"admin id\"\n minlength=\"3\"/>\n </div>\n <div class=\"admin form row\">\n <input\n class=\"admin form input\"\n type=\"password\"\n name=\"pass\"\n placeholder=\"password\"\n minlength=\"3\"/>\n </div>\n <div class=\"admin form row\">\n <input class=\"admin form input halfsize\" type=\"submit\" value=\"Login\"/>\n <input class=\"admin form input halfsize\" type=\"reset\" value=\"Reset\"/>\n </div>\n </form>\n </div>\n</body>\n</html>"),
}
file3 := &embedded.EmbeddedFile{
Filename: `panel.html`,
FileModTime: time.Unix(1489566364, 0),
Content: string("<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{.Config.Site.Title}} Admin Panel</title>\n <link rel=\"stylesheet\" href=\"/@/style.css\">\n <link rel=\"stylesheet\" href=\"/@/custom.css\">\n <link rel=\"stylesheet\" href=\"/@/admin.css\">\n</head>\n<body>\n<div class=\"welcome\">\n Welcome {{.Admin.Id}}<br>\n <form class=\"form logout\" method=\"POST\" action=\"/admin/logout.sh\">\n <input\n type=\"hidden\"\n name=\"csrf_token\"\n value=\"{{ .CSRFToken }}\" />\n <input type=\"submit\" value=\"Logout\" />\n </form>\n</div>\n<br clear=\"left\" /><hr />\n<div class=\"postarea\">\n <form action=\"/admin/new_board.sh\" method=\"POST\">\n <table>\n <tbody>\n <tr>\n <td class=\"postblock\">\n Action\n </td>\n <td>\n New Board\n <input\n type=\"hidden\"\n name=\"csrf_token\"\n value=\"{{ .CSRFToken }}\" />\n </td>\n </tr>\n <tr>\n <td class=\"postblock\">\n Short Name\n </td>\n <td>\n <input type=\"text\" placeholder=\"shortname\" name=\"shortname\"/>\n </td>\n </tr>\n <tr>\n <td class=\"postblock\">\n Long Name\n </td>\n <td>\n <input type=\"text\" placeholder=\"longname\" name=\"longname\"/>\n </td>\n </tr>\n <tr>\n <td class=\"postblock\"></td>\n <td>\n <input type=\"submit\" value=\"Create Board\" />\n <input type=\"reset\" value=\"Reset\" />\n </td>\n </tr>\n </tbody>\n </table>\n </form>\n</div>\n<br clear=\"left\" /><hr />\n<div class=\"postarea\">\n <form action=\"/admin/new_admin.sh\" method=\"POST\">\n <table>\n <tbody>\n <tr>\n <td class=\"postblock\">\n Action\n </td>\n <td>\n New Administrator\n <input\n type=\"hidden\"\n name=\"csrf_token\"\n value=\"{{ .CSRFToken }}\" />\n </td>\n </tr>\n <tr>\n <td class=\"postblock\">\n ID\n </td>\n <td>\n <input type=\"text\"\n minlength=\"4\"\n maxlength=\"255\"\n name=\"adminid\"\n required />\n </td>\n </tr>\n <tr>\n <td class=\"postblock\">\n Password\n </td>\n <td>\n <input type=\"password\"\n minlength=\"12\"\n maxlength=\"255\"\n name=\"adminpass\"\n required />\n </td>\n </tr>\n <tr>\n <td class=\"postblock\"></td>\n <td>\n <input type=\"submit\" value=\"Create Admin ID\" />\n <input type=\"reset\" value=\"Reset\" />\n </td>\n </tr>\n </tbody>\n </table>\n </form>\n</div>\n<br clear=\"left\" /><hr />\n<div class=\"postarea\">\n <form action=\"/admin/del_admin.sh\" method=\"POST\">\n <table>\n <tbody>\n <tr>\n <td class=\"postblock\">\n Action\n </td>\n <td>\n
}
file4 := &embedded.EmbeddedFile{
Filename: `status.html`,
FileModTime: time.Unix(1489525499, 0),
Content: string("<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{.Config.Site.Title}} Status</title>\n <link rel=\"stylesheet\" href=\"/@/style.css\">\n <link rel=\"stylesheet\" href=\"/@/custom.css\">\n <link rel=\"stylesheet\" href=\"/@/admin.css\">\n</head>\n<body>\n<div class=\"banner logo\">\n<h2>Runtime Statistics</h2>\n</div>\n<br/>\n<br/>\n<div class=\"postarea\">\n <form id=\"postform1\" action=\"/admin/new_board.sh\" method=\"POST\">\n <table>\n <tbody>\n <tr><td class=\"postblock\">\n Start Time\n </td><td>\n {{.Uptime.human}}\n </td></tr>\n <tr><td class=\"postblock\">\n Uptime (Precise)\n </td><td>\n {{ .Uptime.hours | printf \"%.4f\"}} hours<br/>\n {{ .Uptime.seconds | printf \"%.4f\"}} seconds\n </td></tr>\n <tr><td class=\"postblock\">\n Num. CPU\n </td><td>\n {{.GC.numcpu}}\n </td></tr>\n <tr><td class=\"postblock\">\n Num. GoRoutines\n </td><td>\n {{.GC.numgor}}\n </td></tr>\n <tr><td class=\"postblock\">\n Go Version<br/>\n Arch/OS/Compiler\n </td><td>\n {{.GC.version}}<br/>\n {{.GC.arch}} / {{.GC.os}} / {{.GC.compiler}}\n </td></tr>\n <tr><td class=\"postblock\">\n Current Allocs\n </td><td>\n {{.GC.memory.alloc}}\n </td></tr>\n <tr><td class=\"postblock\">\n Cumulative Allocs\n </td><td>\n {{.GC.memory.calloc}}\n </td></tr>\n <tr><td class=\"postblock\">\n Used Sys Memory\n </td><td>\n {{.GC.memory.sysmem}}\n </td></tr>\n <tr><td class=\"postblock\">\n Pointer Lookups\n </td><td>\n {{.GC.memory.lookups}}\n </td></tr>\n <tr><td class=\"postblock\">\n MAllocs\n </td><td>\n {{.GC.memory.mallocs}}\n </td></tr>\n <tr><td class=\"postblock\">\n MFrees\n </td><td>\n {{.GC.memory.frees}}\n </td></tr>\n <tr><td class=\"postblock\">\n Live Objects\n </td><td>\n {{.GC.memory.liveobj}}\n </td></tr>\n <tr><td class=\"postblock\">\n Heap Allocated\n </td><td>\n {{.GC.memory.heapalloc}}\n </td></tr>\n <tr><td class=\"postblock\">\n Heap Released\n </td><td>\n {{.GC.memory.heaprelease}}\n </td></tr>\n <tr><td class=\"postblock\">\n GC Metadata\n </td><td>\n {{.GC.memory.gcmeta}}\n </td></tr>\n <tr><td class=\"postblock\">\n GC Pause\n </td><td>\n {{.GC.memory.pause}}\n </td></tr>\n <tr><td class=\"postblock\">\n GC Invokations\n </td><td>\n {{.GC.memory.gctimes}}\n </td></tr>\n <tr><td class=\"postblock\">\n GC Forced\n </td><td>\n {{.GC.memory.fgctimes}}\n </td></tr>\n <tr><td class=\"postblock\">\n GC CPU Usage\n </td><td>\n {{.GC.memory.cpufrac}}\n </td></tr>\n </tbody>\n </table>\n </form>\n</div>\n<br clear=\"left\" /><hr />\n</body>\n</html>"),
}
// define dirs
dir1 := &embedded.EmbeddedDir{
Filename: ``,
DirModTime: time.Unix(1489566364, 0),
ChildFiles: []*embedded.EmbeddedFile{
file2, // index.html
file3, // panel.html
file4, // status.html
},
}
// link ChildDirs
dir1.ChildDirs = []*embedded.EmbeddedDir{}
// register embeddedBox
2017-03-15 14:39:57 +01:00
embedded.RegisterEmbeddedBox(`admin_res/`, &embedded.EmbeddedBox{
Name: `admin_res/`,
2017-03-15 14:33:27 +01:00
Time: time.Unix(1489566364, 0),
Dirs: map[string]*embedded.EmbeddedDir{
"": dir1,
},
Files: map[string]*embedded.EmbeddedFile{
"index.html": file2,
"panel.html": file3,
"status.html": file4,
},
})
}