assets fix - meta tags

pull/94/head v0.79.2
Hunter Long 2018-11-05 23:15:55 -08:00
parent b2fdaa5c14
commit 3fc1ea39cf
17 changed files with 63 additions and 136 deletions

View File

@ -1,7 +1,10 @@
.git
.github
.idea
logs
*.log
build
assets
source/rice-box.go
.env
.DS_Store

View File

@ -1,4 +1,4 @@
VERSION=0.79.1
VERSION=0.79.2
BINARY_NAME=statup
GOPATH:=$(GOPATH)
GOCMD=go

View File

@ -1,3 +1,10 @@
statup:
container_name: statup
image: hunterlong/statup
restart: always
ports:
- 8080:8080
postgres:
container_name: postgres
image: postgres
@ -20,13 +27,3 @@ mysql:
MYSQL_DATABASE: root
MYSQL_USER: root
MYSQL_PASSWORD: password123
mssql:
container_name: mssql
image: microsoft/mssql-server-linux
restart: always
ports:
- 1433:1433
environment:
SA_PASSWORD: PaSsW0rD123
ACCEPT_EULA: "Y"

View File

@ -105,6 +105,9 @@ var handlerFuncs = func(w http.ResponseWriter, r *http.Request) template.FuncMap
"Services": func() []types.ServiceInterface {
return core.CoreApp.Services
},
"len": func(g []types.ServiceInterface) int {
return len(g)
},
"USE_CDN": func() bool {
return core.CoreApp.UseCdn
},

View File

@ -38,17 +38,17 @@ func Router() *mux.Router {
r.Handle("/", cached("120s", "text/html", http.HandlerFunc(indexHandler)))
if source.UsingAssets(dir) {
indexHandler := http.FileServer(http.Dir(dir + "/assets/"))
r.PathPrefix("/css/").Handler(http.StripPrefix("/font/", http.FileServer(http.Dir(dir+"/assets/font"))))
r.PathPrefix("/font/").Handler(http.StripPrefix("/css/", http.FileServer(http.Dir(dir+"/assets/css"))))
r.PathPrefix("/css/").Handler(http.StripPrefix("/css/", http.FileServer(http.Dir(dir+"/assets/css"))))
r.PathPrefix("/font/").Handler(http.StripPrefix("/font/", http.FileServer(http.Dir(dir+"/assets/font"))))
r.PathPrefix("/robots.txt").Handler(indexHandler)
r.PathPrefix("/favicon.ico").Handler(indexHandler)
r.PathPrefix("/statup.png").Handler(indexHandler)
} else {
r.PathPrefix("/css/").Handler(http.StripPrefix("/css/", http.FileServer(source.CssBox.HTTPBox())))
r.PathPrefix("/font/").Handler(http.StripPrefix("/font/", http.FileServer(source.FontBox.HTTPBox())))
r.PathPrefix("/robots.txt").Handler(http.FileServer(source.TmplBox.HTTPBox()))
r.PathPrefix("/favicon.ico").Handler(http.FileServer(source.TmplBox.HTTPBox()))
r.PathPrefix("/statup.png").Handler(http.FileServer(source.TmplBox.HTTPBox()))
r.PathPrefix("/font/").Handler(http.StripPrefix("/font/", http.FileServer(source.FontBox.HTTPBox())))
}
r.PathPrefix("/js/").Handler(http.StripPrefix("/js/", http.FileServer(source.JsBox.HTTPBox())))
r.Handle("/charts.js", http.HandlerFunc(renderServiceChartsHandler))

View File

@ -103,7 +103,7 @@ func saveAssetsHandler(w http.ResponseWriter, r *http.Request) {
err = source.CompileSASS(dir)
if err != nil {
source.CopyToPublic(source.CssBox, dir+"/assets/css", "base.css")
utils.Log(2, "Default 'base.css' was insert because SASS did not work.")
utils.Log(3, "Default 'base.css' was inserted because SASS did not work.")
}
resetRouter()
executeResponse(w, r, "settings.html", core.CoreApp, "/settings")

View File

@ -31,15 +31,15 @@ type mobilePush struct {
var mobile = &mobilePush{&notifier.Notification{
Method: "mobile",
Title: "Mobile Notifications",
Description: "Receive push notifications on your mobile device using the Statup App.",
Description: "Receive push notifications on your Android or iPhone devices using the Statup App. You can scan the Authentication QR Code found in Settings to get the mobile app setup in seconds.",
Author: "Hunter Long",
AuthorUrl: "https://github.com/hunterlong",
Delay: time.Duration(5 * time.Second),
Icon: "fas fa-mobile-alt",
Form: []notifier.NotificationForm{{
Type: "text",
Title: "Mobile Identifiers",
Placeholder: "A list of your mobile push notification ids",
Title: "Device Identifiers",
Placeholder: "A list of your mobile device push notification ID's.",
DbField: "var1",
}}},
}

View File

@ -1,36 +1,4 @@
@charset "UTF-8";
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Index Page */
/* Status Container */
/* Button Colors */
@ -618,22 +586,6 @@ HTML, BODY {
box-shadow: none;
border-radius: 3px; }
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@media (max-width: 767px) {
HTML, BODY {
background-color: #fcfcfc; }

View File

@ -1,20 +1,3 @@
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@import 'variables';

View File

@ -1,20 +1,3 @@
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@media (max-width: 767px) {
HTML,BODY {

View File

@ -1,20 +1,3 @@
/*!
* Statup
* Copyright (C) 2018. Hunter Long and the project contributors
* Written by Hunter Long <info@socialeck.com> and the project contributors
*
* https://github.com/hunterlong/statup
*
* The licenses for most software and other practical works are designed
* to take away your freedom to share and change the works. By contrast,
* the GNU General Public License is intended to guarantee your freedom to
* share and change all versions of a program--to make sure it remains free
* software for all its users.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Index Page */
$background-color: #fcfcfc;
$max-width: 860px;

View File

@ -131,7 +131,7 @@ func UsingAssets(folder string) bool {
// SaveAsset will save an asset to the '/assets/' folder.
func SaveAsset(data []byte, folder, file string) error {
utils.Log(1, fmt.Sprintf("Saving %v/%v into assets folder", folder, file))
utils.Log(1, fmt.Sprintf("Saving %v/assets/%v into assets folder", folder, file))
err := ioutil.WriteFile(folder+"/assets/"+file, data, 0744)
if err != nil {
utils.Log(3, fmt.Sprintf("Failed to save %v/%v, %v", folder, file, err))
@ -157,23 +157,19 @@ func CreateAllAssets(folder string) error {
MakePublicFolder(folder + "/assets/js")
MakePublicFolder(folder + "/assets/css")
MakePublicFolder(folder + "/assets/scss")
MakePublicFolder(folder + "/assets/font")
utils.Log(1, "Inserting scss, css, and javascript files into assets folder")
CopyToPublic(ScssBox, folder+"/assets/scss", "base.scss")
CopyToPublic(ScssBox, folder+"/assets/scss", "variables.scss")
CopyToPublic(ScssBox, folder+"/assets/scss", "mobile.scss")
CopyToPublic(ScssBox, folder+"/assets/scss", "pikaday.scss")
CopyToPublic(CssBox, folder+"/assets/css", "bootstrap.min.css")
CopyToPublic(CssBox, folder+"/assets/css", "base.css")
//CopyToPublic(JsBox, folder+"/assets/js", "bootstrap.min.js")
//CopyToPublic(JsBox, folder+"/assets/js", "Chart.bundle.min.js")
//CopyToPublic(JsBox, folder+"/assets/js", "jquery-3.3.1.min.js")
//CopyToPublic(JsBox, folder+"/assets/js", "sortable.min.js")
//CopyToPublic(JsBox, folder+"/assets/js", "main.js")
//CopyToPublic(JsBox, folder+"/assets/js", "setup.js")
CopyAllToPublic(FontBox, "font")
CopyAllToPublic(ScssBox, "scss")
CopyAllToPublic(CssBox, "css")
CopyAllToPublic(JsBox, "js")
CopyToPublic(FontBox, folder+"/assets/font", "all.css")
CopyToPublic(TmplBox, folder+"/assets", "robots.txt")
CopyToPublic(TmplBox, folder+"/assets", "statup.png")
CopyToPublic(TmplBox, folder+"/assets", "favicon.ico")
utils.Log(1, "Compiling CSS from SCSS style...")
err := utils.Log(1, "Statup assets have been inserted")
err := CompileSASS(utils.Directory)
utils.Log(1, "Statup assets have been inserted")
return err
}
@ -188,6 +184,27 @@ func DeleteAllAssets(folder string) error {
return err
}
func CopyAllToPublic(box *rice.Box, folder string) error {
err := box.Walk("/", func(path string, info os.FileInfo, err error) error {
if info.Name() == "" {
return nil
}
if info.IsDir() {
folder := fmt.Sprintf("%v/assets/%v/%v", utils.Directory, folder, info.Name())
MakePublicFolder(folder)
return nil
}
file, err := box.Bytes(path)
if err != nil {
return nil
}
filePath := fmt.Sprintf("%v%v", folder, path)
SaveAsset(file, utils.Directory, filePath)
return nil
})
return err
}
// CopyToPublic will create a file from a rice Box to the '/assets' directory
func CopyToPublic(box *rice.Box, folder, file string) error {
assetFolder := fmt.Sprintf("%v/%v", folder, file)

View File

@ -1,7 +1,9 @@
{{ define "head"}}
<head>
<meta charset="utf-8">
<title>{{block "title" .}} {{end}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
<meta name="description" content="{{block "description" .}}{{end}}">
{{if USE_CDN}}
<link rel="shortcut icon" type="image/x-icon" href="https://assets.statup.io/favicon.ico">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
@ -14,6 +16,5 @@
<link rel="stylesheet" href="/font/all.css">
{{end}}
{{block "extra_css" .}} {{end}}
<title>{{block "title" .}} {{end}}</title>
</head>
{{end}}

View File

@ -1,4 +1,5 @@
{{define "title"}}{{CoreApp.Name}} Status{{end}}
{{define "description"}}{{CoreApp.Name}} is currently monitoring {{len CoreApp.Services}} services with 0 of them offline. {{CoreApp.Name}} is using Statup to monitor applications.{{end}}
{{define "content"}}
<div class="container col-md-7 col-sm-12 mt-2 sm-container">
<h1 class="col-12 text-center mb-4 mt-sm-3 header-title">{{.Name}}</h1>

View File

@ -1,7 +1,7 @@
{{define "title"}}{{.Service.Name}} Status{{end}}
{{define "description"}}{{$s := .Service}}{{if $s.Online }}{{.Service.Name}} is currently online and responding within {{$s.AvgTime}} milliseconds with {{$s.TotalUptime}}% total uptime on {{$s.Domain}}.{{else}}{{.Service.Name}} is currently offline on {{$s.Domain}}. Notify the admin to let them know their service is offline.{{end}}{{end}}
{{ define "content" }}
{{$s := .Service}}
<div class="container col-md-7 col-sm-12 mt-md-5 bg-light">
{{if Auth}}

View File

@ -17,7 +17,7 @@
{{end}}
</div>
</div>
<div class="col-md-8 col-sm-12">
<div class="col-md-9 col-sm-12">
{{if Error}}
<div class="alert alert-danger" role="alert">{{Error}}</div>
{{end}}
@ -109,12 +109,15 @@
<input type="text" class="form-control select-input" value="{{ .ApiSecret }}" id="api_secret" readonly>
<small class="form-text text-muted">You can <a href="/api/renew">Regenerate API Keys</a> if you need to.</small>
</div>
<img width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=http://statup://setup?domain={{ .Domain }}&api={{ .ApiKey }}&secret={{ .ApiSecret }}&choe=UTF-8">
</div>
<div class="row">
<a href="/settings/export" class="btn btn-sm btn-secondary float-right">Export Settings</a>
<a href="#" class="btn btn-sm btn-secondary float-right ml-1">Authentication QR Code</a>
</div>
<div class="row align-content-center">
<img class="rounded text-center" width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=statup://setup?domain={{ .Domain }}&api={{ .ApiKey }}&secret={{ .ApiSecret }}&choe=UTF-8">
</div>
</form>

View File

@ -1,4 +1,5 @@
{{define "title"}}Statup | Setup{{end}}
{{define "description"}}Setup your Statup instance to monitor your websites and servers using MySQL, Postgres or SQLite.{{end}}
{{define "content"}}
<div class="container col-md-7 col-sm-12 mt-md-5 bg-light">
<div class="col-4 offset-4 mt-2 mb-5"><img width="100%" src="/statup.png"></div>