mirror of https://github.com/statping/statping
				
				
				
			BASE_PATH
							parent
							
								
									479763f186
								
							
						
					
					
						commit
						217a45425d
					
				|  | @ -49,8 +49,8 @@ func loginHandler(w http.ResponseWriter, r *http.Request) { | |||
| 		session.Values["user_id"] = user.Id | ||||
| 		session.Values["admin"] = user.Admin.Bool | ||||
| 		session.Save(r, w) | ||||
| 		log.Infoln(fmt.Sprintf("User %v logged in from IP %v", user.Username, r.RemoteAddr)) | ||||
| 		http.Redirect(w, r, "/dashboard", http.StatusSeeOther) | ||||
| 		utils.Log.Infoln(fmt.Sprintf("User %v logged in from IP %v", user.Username, r.RemoteAddr)) | ||||
| 		http.Redirect(w, r, basePath+"dashboard", http.StatusSeeOther) | ||||
| 	} else { | ||||
| 		err := core.ErrorResponse{Error: "Incorrect login information submitted, try again."} | ||||
| 		ExecuteResponse(w, r, "login.gohtml", err, nil) | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ import ( | |||
| 	"html/template" | ||||
| 	"net/http" | ||||
| 	"os" | ||||
| 	"path" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
|  | @ -51,10 +52,6 @@ var ( | |||
| func RunHTTPServer(ip string, port int) error { | ||||
| 	host := fmt.Sprintf("%v:%v", ip, port) | ||||
| 
 | ||||
| 	if os.Getenv("BASE_PATH") != "" { | ||||
| 		basePath = "/" + os.Getenv("BASE_PATH") | ||||
| 	} | ||||
| 
 | ||||
| 	key := utils.FileExists(utils.Directory + "/server.key") | ||||
| 	cert := utils.FileExists(utils.Directory + "/server.crt") | ||||
| 
 | ||||
|  | @ -220,7 +217,7 @@ func loadTemplate(w http.ResponseWriter, r *http.Request) (*template.Template, e | |||
| // ExecuteResponse will render a HTTP response for the front end user
 | ||||
| func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data interface{}, redirect interface{}) { | ||||
| 	if url, ok := redirect.(string); ok { | ||||
| 		http.Redirect(w, r, basePath+url, http.StatusSeeOther) | ||||
| 		http.Redirect(w, r, path.Join(basePath, url), http.StatusSeeOther) | ||||
| 		return | ||||
| 	} | ||||
| 	if usingSSL { | ||||
|  |  | |||
|  | @ -45,27 +45,31 @@ func Router() *mux.Router { | |||
| 		authPass = os.Getenv("AUTH_PASSWORD") | ||||
| 		r.Use(basicAuthHandler) | ||||
| 	} | ||||
| 	if basePath != "/" { | ||||
| 		r = r.PathPrefix(basePath).Subrouter() | ||||
| 
 | ||||
| 	if os.Getenv("BASE_PATH") != "" { | ||||
| 		basePath = "/" + os.Getenv("BASE_PATH") + "/" | ||||
| 		r = r.PathPrefix("/" + os.Getenv("BASE_PATH")).Subrouter() | ||||
| 		r.Handle("", http.HandlerFunc(indexHandler)) | ||||
| 	} else { | ||||
| 		r.Handle("/", http.HandlerFunc(indexHandler)) | ||||
| 	} | ||||
| 
 | ||||
| 	r.Use(sendLog) | ||||
| 	r.Handle("/", http.HandlerFunc(indexHandler)) | ||||
| 	if source.UsingAssets(dir) { | ||||
| 		indexHandler := http.FileServer(http.Dir(dir + "/assets/")) | ||||
| 		r.PathPrefix("/css/").Handler(http.StripPrefix(basePath+"/css/", http.FileServer(http.Dir(dir+"/assets/css")))) | ||||
| 		r.PathPrefix("/font/").Handler(http.StripPrefix(basePath+"/font/", http.FileServer(http.Dir(dir+"/assets/font")))) | ||||
| 		r.PathPrefix("/js/").Handler(http.StripPrefix(basePath+"/js/", http.FileServer(http.Dir(dir+"/assets/js")))) | ||||
| 		r.PathPrefix("/robots.txt").Handler(indexHandler) | ||||
| 		r.PathPrefix("/favicon.ico").Handler(indexHandler) | ||||
| 		r.PathPrefix("/banner.png").Handler(indexHandler) | ||||
| 		r.PathPrefix("/css/").Handler(http.StripPrefix(basePath+"css/", http.FileServer(http.Dir(dir+"/assets/css")))) | ||||
| 		r.PathPrefix("/font/").Handler(http.StripPrefix(basePath+"font/", http.FileServer(http.Dir(dir+"/assets/font")))) | ||||
| 		r.PathPrefix("/js/").Handler(http.StripPrefix(basePath+"js/", http.FileServer(http.Dir(dir+"/assets/js")))) | ||||
| 		r.PathPrefix("/robots.txt").Handler(http.StripPrefix(basePath, indexHandler)) | ||||
| 		r.PathPrefix("/favicon.ico").Handler(http.StripPrefix(basePath, indexHandler)) | ||||
| 		r.PathPrefix("/banner.png").Handler(http.StripPrefix(basePath, indexHandler)) | ||||
| 	} else { | ||||
| 		r.PathPrefix("/css/").Handler(http.StripPrefix(basePath+"/css/", http.FileServer(source.CssBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/font/").Handler(http.StripPrefix(basePath+"/font/", http.FileServer(source.FontBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/js/").Handler(http.StripPrefix(basePath+"/js/", http.FileServer(source.JsBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/robots.txt").Handler(http.FileServer(source.TmplBox.HTTPBox())) | ||||
| 		r.PathPrefix("/favicon.ico").Handler(http.FileServer(source.TmplBox.HTTPBox())) | ||||
| 		r.PathPrefix("/banner.png").Handler(http.FileServer(source.TmplBox.HTTPBox())) | ||||
| 		r.PathPrefix("/css/").Handler(http.StripPrefix(basePath+"css/", http.FileServer(source.CssBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/font/").Handler(http.StripPrefix(basePath+"font/", http.FileServer(source.FontBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/js/").Handler(http.StripPrefix(basePath+"js/", http.FileServer(source.JsBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/robots.txt").Handler(http.StripPrefix(basePath, http.FileServer(source.TmplBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/favicon.ico").Handler(http.StripPrefix(basePath, http.FileServer(source.TmplBox.HTTPBox()))) | ||||
| 		r.PathPrefix("/banner.png").Handler(http.StripPrefix(basePath, http.FileServer(source.TmplBox.HTTPBox()))) | ||||
| 	} | ||||
| 	r.Handle("/charts.js", http.HandlerFunc(renderServiceChartsHandler)) | ||||
| 	r.Handle("/setup", http.HandlerFunc(setupHandler)).Methods("GET") | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ $('.toggle-service').on('click',function(e) { | |||
| 	let d = confirm("Do you want to "+(eval(online) ? "stop" : "start")+" checking this service?"); | ||||
| 	if (d) { | ||||
| 		$.ajax({ | ||||
| 			url: "/api/services/" + serviceId + "/running", | ||||
| 			url: "api/services/" + serviceId + "/running", | ||||
| 			type: 'POST', | ||||
| 			success: function (data) { | ||||
| 				if (online === "true") { | ||||
|  | @ -166,7 +166,7 @@ function UTCTime() { | |||
| } | ||||
| 
 | ||||
| function ChartLatency(service, start=0, end=9999999999, group="hour", retry=true) { | ||||
|     let url = "/api/services/" + service + "/data?start=" + start + "&end=" + end + "&group=" + group; | ||||
|     let url = "api/services/" + service + "/data?start=" + start + "&end=" + end + "&group=" + group; | ||||
|     return new Promise(resolve => { | ||||
|         $.ajax({ | ||||
|             url: url, | ||||
|  | @ -182,7 +182,7 @@ function ChartLatency(service, start=0, end=9999999999, group="hour", retry=true | |||
| function ChartHeatmap(service) { | ||||
|     return new Promise(resolve => { | ||||
|         $.ajax({ | ||||
|             url: "/api/services/" + service + "/heatmap", | ||||
|             url: "api/services/" + service + "/heatmap", | ||||
|             type: 'GET', | ||||
|             success: function (data) { | ||||
|                 resolve(data); | ||||
|  | @ -202,7 +202,7 @@ function FailureAnnotations(chart, service, start=0, end=9999999999, group="hour | |||
|     }; | ||||
|     var dataArr = []; | ||||
|     $.ajax({ | ||||
|         url: "/api/services/"+service+"/failures?start="+start+"&end="+end+"&group="+group, | ||||
|         url: "api/services/"+service+"/failures?start="+start+"&end="+end+"&group="+group, | ||||
|         type: 'GET', | ||||
|         success: function(data) { | ||||
|             data.forEach(function (d) { | ||||
|  | @ -227,7 +227,7 @@ $('input[type=checkbox]').on('change', function() { | |||
| 
 | ||||
| function PingAjaxChart(chart, service, start=0, end=9999999999, group="hour") { | ||||
|   $.ajax({ | ||||
|     url: "/api/services/"+service+"/ping?start="+start+"&end="+end+"&group="+group, | ||||
|     url: "api/services/"+service+"/ping?start="+start+"&end="+end+"&group="+group, | ||||
|     type: 'GET', | ||||
|     success: function(data) { | ||||
|       chart.data.labels.pop(); | ||||
|  | @ -349,8 +349,8 @@ function CreateService(output) { | |||
|                 <td class="d-none d-md-table-cell">${data.online}<span class="badge badge-success">ONLINE</span></td> | ||||
|                 <td class="text-right"> | ||||
|                     <div class="btn-group"> | ||||
|                         <a href="/service/${data.id}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> View</a> | ||||
|                         <a href="/api/services/${data.id}" class="ajax_delete btn btn-danger confirm-btn" data-method="DELETE" data-obj="service_${data.id}" data-id="${data.id}"><i class="fas fa-times"></i></a> | ||||
|                         <a href="service/${data.id}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> View</a> | ||||
|                         <a href="api/services/${data.id}" class="ajax_delete btn btn-danger confirm-btn" data-method="DELETE" data-obj="service_${data.id}" data-id="${data.id}"><i class="fas fa-times"></i></a> | ||||
|                     </div> | ||||
|                 </td> | ||||
|             </tr>`; | ||||
|  | @ -365,8 +365,8 @@ function CreateUser(output) { | |||
|                 <td>${form.username}</td> | ||||
|                 <td class="text-right"> | ||||
|                     <div class="btn-group"> | ||||
|                         <a href="/user/${data.id}" class="btn btn-outline-secondary"><i class="fas fa-user-edit"></i> Edit</a> | ||||
|                         <a href="/api/users/${data.id}" class="ajax_delete btn btn-danger confirm-btn" data-method="DELETE" data-obj="user_${data.id}" data-id="${data.id}"><i class="fas fa-times"></i></a> | ||||
|                         <a href="user/${data.id}" class="btn btn-outline-secondary"><i class="fas fa-user-edit"></i> Edit</a> | ||||
|                         <a href="api/users/${data.id}" class="ajax_delete btn btn-danger confirm-btn" data-method="DELETE" data-obj="user_${data.id}" data-id="${data.id}"><i class="fas fa-times"></i></a> | ||||
|                     </div> | ||||
|                 </td> | ||||
|             </tr>`; | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ | |||
|             {{ range Services }} | ||||
|                 <div class="col-12 card mb-3" style="min-height: 260px"> | ||||
|                     <div class="card-body"> | ||||
|                         <h5 class="card-title"><a href="/service/{{.Id}}">{{.Name}}</a> {{if .Online}}<span class="badge float-right badge-success">ONLINE</span>{{else}}<span class="badge float-right badge-danger">OFFLINE</span>{{end}}</h5> | ||||
|                         <h5 class="card-title"><a href="service/{{.Id}}">{{.Name}}</a> {{if .Online}}<span class="badge float-right badge-success">ONLINE</span>{{else}}<span class="badge float-right badge-danger">OFFLINE</span>{{end}}</h5> | ||||
|                         <div class="row"> | ||||
|                             <div class="col-md-3 col-sm-6"> | ||||
|                                 <div id="spark_service_{{.Id}}_1"></div> | ||||
|  | @ -46,7 +46,7 @@ | |||
|                     <div class="jumbotron jumbotron-fluid"> | ||||
|                         <div class="text-center"> | ||||
|                             <h1 class="display-4">No Services!</h1> | ||||
|                             <a class="lead">You don't have any websites or applications being monitored by your Statping server. <p><a href="/service/create" class="btn btn-secondary mt-3">Add Service</a></p></p> | ||||
|                             <a class="lead">You don't have any websites or applications being monitored by your Statping server. <p><a href="service/create" class="btn btn-secondary mt-3">Add Service</a></p></p> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 {{end}} | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| {{ if CoreApp.Footer.String }} | ||||
|     {{ safe CoreApp.Footer.String }} | ||||
| {{ else }} | ||||
|     <a href="https://github.com/hunterlong/statping" target="_blank">Statping {{VERSION}} made with <i class="text-danger fas fa-heart"></i></a> | <a href="/dashboard">Dashboard</a> | ||||
|     <a href="https://github.com/hunterlong/statping" target="_blank">Statping {{VERSION}} made with <i class="text-danger fas fa-heart"></i></a> | <a href="dashboard">Dashboard</a> | ||||
| {{ end }} | ||||
| </div> | ||||
| {{ end }} | ||||
|  |  | |||
|  | @ -159,7 +159,7 @@ | |||
|         </div> | ||||
|         {{if ne .Id 0}} | ||||
|         <div class="col-6"> | ||||
|             <a href="/service/{{ .Id }}/delete_failures" data-method="GET" data-redirect="/service/{{ .Id }}" class="btn btn-danger btn-block confirm-btn">Delete All Failures</a> | ||||
|             <a href="service/{{ .Id }}/delete_failures" data-method="GET" data-redirect="/service/{{ .Id }}" class="btn btn-danger btn-block confirm-btn">Delete All Failures</a> | ||||
|         </div> | ||||
|         {{end}} | ||||
|     </div> | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|     <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}}"> | ||||
|     <base href="{{BasePath}}/"> | ||||
|     <base href="{{BasePath}}"> | ||||
| {{if USE_CDN}} | ||||
|     <link rel="shortcut icon" type="image/x-icon" href="https://assets.statping.com/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"> | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| {{end}} | ||||
|     <div class="col-12 bg-white p-4"> | ||||
|         <div class="col-12 col-md-8 offset-md-2 mb-4 mt-3"> | ||||
|             <img class="col-12 mt-5 mt-md-0" src="/banner.png"> | ||||
|             <img class="col-12 mt-5 mt-md-0" src="banner.png"> | ||||
|         </div> | ||||
|         <h3>Index</h3> | ||||
|     {{ safe . }} | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ | |||
| {{ if not .Services }} | ||||
|     <div class="alert alert-danger" role="alert"> | ||||
|         <h4 class="alert-heading">No Services to Monitor!</h4> | ||||
|         <p>Your Statping Status Page is working correctly, but you don't have any services to monitor. Go to the <a href="/dashboard">Dashboard</a> and add a website to begin really using your status page!</p> | ||||
|         <p>Your Statping Status Page is working correctly, but you don't have any services to monitor. Go to the <a href="dashboard">Dashboard</a> and add a website to begin really using your status page!</p> | ||||
|         <hr> | ||||
|         <p class="mb-0">If this is a bug, please make an issue in the Statping Github Repo. <a href="https://github.com/hunterlong/statping" class="btn btn-sm btn-outline-danger float-right">Statping Github Repo</a></p> | ||||
|     </div> | ||||
|  | @ -59,7 +59,7 @@ | |||
|         <div class="card"> | ||||
|             <div class="card-body"> | ||||
|                 <div class="col-12"> | ||||
|                     <h4 class="mt-3"><a href="/service/{{ServiceLink .}}"{{if not .Online}} class="text-danger"{{end}}>{{ .Name }}</a> | ||||
|                     <h4 class="mt-3"><a href="service/{{ServiceLink .}}"{{if not .Online}} class="text-danger"{{end}}>{{ .Name }}</a> | ||||
|                     {{if .Online}} | ||||
|                         <span class="badge bg-success float-right">ONLINE</span> | ||||
|                     {{ else }} | ||||
|  | @ -93,7 +93,7 @@ | |||
|                     <span class="d-none d-md-inline">{{.SmallText}}</span> | ||||
|                 </div> | ||||
|                 <div class="col-sm-12 col-md-2"> | ||||
|                     <a href="/service/{{ServiceLink .}}" class="btn {{if .Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right dyn-dark btn-block">View Service</a> | ||||
|                     <a href="service/{{ServiceLink .}}" class="btn {{if .Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right dyn-dark btn-block">View Service</a> | ||||
|                 </div> | ||||
|             </div> | ||||
| 
 | ||||
|  | @ -104,5 +104,5 @@ | |||
| </div> | ||||
| {{end}} | ||||
| {{define "extra_scripts"}} | ||||
| <script src="/charts.js"></script> | ||||
| <script src="charts.js"></script> | ||||
| {{end}} | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ | |||
|             type: "POST", | ||||
|             data: sendData, | ||||
|             success: function (data) { | ||||
|                 var box = `<div class="alert alert-success" role="alert">Service '${data.output.name}' Added <a href="/service/${data.output.id}" class="badge badge-secondary mt-1 float-right">View</a></div>`; | ||||
|                 var box = `<div class="alert alert-success" role="alert">Service '${data.output.name}' Added <a href="service/${data.output.id}" class="badge badge-secondary mt-1 float-right">View</a></div>`; | ||||
|                 $("#imported_area").append(box); | ||||
|             } | ||||
|           }); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| <div class="container col-md-7 col-sm-12 mt-md-5 bg-light"> | ||||
|     <div class="col-10 offset-1 col-md-8 offset-md-2 mt-md-2"> | ||||
|         <div class="col-12 col-md-8 offset-md-2 mb-4"> | ||||
|             <img class="col-12 mt-5 mt-md-0" src="/banner.png"> | ||||
|             <img class="col-12 mt-5 mt-md-0" src="banner.png"> | ||||
|         </div> | ||||
|     {{ if .Error }} | ||||
|         <div class="alert alert-danger" role="alert"> | ||||
|  |  | |||
|  | @ -9,11 +9,11 @@ | |||
| </div> | ||||
| {{end}} | ||||
| {{define "extra_css"}} | ||||
| <link rel="stylesheet" href="/css/flatpickr.min.css"> | ||||
| <link rel="stylesheet" href="css/flatpickr.min.css"> | ||||
| {{end}} | ||||
| {{define "extra_scripts"}} | ||||
| <script src="/js/flatpickr.js"></script> | ||||
| <script src="/js/rangePlugin.js"></script> | ||||
| <script src="js/flatpickr.js"></script> | ||||
| <script src="js/rangePlugin.js"></script> | ||||
| <script> | ||||
| $(document).ready(function() { | ||||
|     $("#start_on").flatpickr({ | ||||
|  | @ -24,4 +24,4 @@ $(document).ready(function() { | |||
|     }); | ||||
| }); | ||||
| </script> | ||||
| {{end}} | ||||
| {{end}} | ||||
|  |  | |||
|  | @ -18,12 +18,12 @@ | |||
|             {{range .}} | ||||
|                 <tr id="message_{{.Id}}"> | ||||
|                     <td>{{.Title}}</td> | ||||
|                     <td class="d-none d-md-table-cell">{{if .Service}}<a href="/service/{{.Service.Id}}">{{.Service.Name}}</a>{{end}}</td> | ||||
|                     <td class="d-none d-md-table-cell">{{if .Service}}<a href="service/{{.Service.Id}}">{{.Service.Name}}</a>{{end}}</td> | ||||
|                     <td class="d-none d-md-table-cell">{{ToString .StartOn}}</td> | ||||
|                     <td class="text-right"> | ||||
|                         {{if Auth}}<div class="btn-group"> | ||||
|                             <a href="/message/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-exclamation-triangle"></i> Edit</a> | ||||
|                             <a href="/api/messages/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="message_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a> | ||||
|                             <a href="message/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-exclamation-triangle"></i> Edit</a> | ||||
|                             <a href="api/messages/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="message_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a> | ||||
|                         </div>{{end}} | ||||
|                     </td> | ||||
|                 </tr> | ||||
|  | @ -41,11 +41,11 @@ | |||
| </div> | ||||
| {{end}} | ||||
| {{define "extra_css"}} | ||||
| <link rel="stylesheet" href="/css/flatpickr.min.css"> | ||||
| <link rel="stylesheet" href="css/flatpickr.min.css"> | ||||
| {{end}} | ||||
| {{define "extra_scripts"}} | ||||
| <script src="/js/flatpickr.js"></script> | ||||
| <script src="/js/rangePlugin.js"></script> | ||||
| <script src="js/flatpickr.js"></script> | ||||
| <script src="js/rangePlugin.js"></script> | ||||
| <script> | ||||
| $(document).ready(function() { | ||||
|     $("#start_on").flatpickr({ | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| {{define "nav"}} | ||||
|     {{$isAdmin := Auth}} | ||||
| <nav class="navbar navbar-expand-lg navbar-light bg-light"> | ||||
|     <a class="navbar-brand" href="#">Statping</a> | ||||
|     <a class="navbar-brand" href="">Statping</a> | ||||
|     <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> | ||||
|         <span class="navbar-toggler-icon"></span> | ||||
|     </button> | ||||
|  |  | |||
|  | @ -5,10 +5,10 @@ | |||
| <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script> | ||||
| <script src="https://assets.statping.com/main.js"></script> | ||||
| {{ else }} | ||||
| <script src="{{BasePath}}/js/jquery-3.3.1.min.js"></script> | ||||
| <script src="{{BasePath}}/js/bootstrap.min.js"></script> | ||||
| <script src="{{BasePath}}/js/apexcharts.min.js"></script> | ||||
| <script src="{{BasePath}}/js/main.js"></script> | ||||
| <script src="js/jquery-3.3.1.min.js"></script> | ||||
| <script src="js/bootstrap.min.js"></script> | ||||
| <script src="js/apexcharts.min.js"></script> | ||||
| <script src="js/main.js"></script> | ||||
| {{end}} | ||||
| {{block "extra_scripts" .}} {{end}} | ||||
| {{end}} | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ | |||
|             <span class="mt-3 mb-3 text-white d-md-none btn bg-danger d-block d-md-none">OFFLINE</span> | ||||
|         {{end}} | ||||
| 
 | ||||
|         <h4 class="mt-2"><a href="/">{{CoreApp.Name}}</a> - {{ $s.Name }} | ||||
|         <h4 class="mt-2"><a href="">{{CoreApp.Name}}</a> - {{ $s.Name }} | ||||
|         {{if $s.Online }} | ||||
|             <span class="badge bg-success float-right d-none d-md-block">ONLINE</span> | ||||
|         {{ else }} | ||||
|  | @ -168,7 +168,7 @@ | |||
|                         {{ if lt $ch.Expected 0}}{{Duration $ch.Expected}} ago{{else}}in {{Duration $ch.Expected}}{{end}} | ||||
|                         {{end}} | ||||
|                         </td> | ||||
|                         <td><a href="/api/checkin/{{$ch.ApiKey}}" data-method="DELETE" data-obj="checkin_{{$ch.Id}}" data-id="{{$ch.Id}}" class="ajax_delete btn btn-sm btn-danger">Delete</a></td> | ||||
|                         <td><a href="api/checkin/{{$ch.ApiKey}}" data-method="DELETE" data-obj="checkin_{{$ch.Id}}" data-id="{{$ch.Id}}" class="ajax_delete btn btn-sm btn-danger">Delete</a></td> | ||||
|                     </tr> | ||||
|                     {{end}} | ||||
|                     </tbody> | ||||
|  | @ -231,12 +231,12 @@ | |||
| </div> | ||||
| {{end}} | ||||
| {{define "extra_css"}} | ||||
| <link rel="stylesheet" href="/css/flatpickr.min.css"> | ||||
| <link rel="stylesheet" href="css/flatpickr.min.css"> | ||||
| {{end}} | ||||
| {{define "extra_scripts"}} | ||||
| {{$s := .Service}} | ||||
| <script src="/js/flatpickr.js"></script> | ||||
| <script src="/js/rangePlugin.js"></script> | ||||
| <script src="js/flatpickr.js"></script> | ||||
| <script src="js/rangePlugin.js"></script> | ||||
| <script> | ||||
| 
 | ||||
| let options = { | ||||
|  |  | |||
|  | @ -8,13 +8,13 @@ | |||
|             <div class="jumbotron jumbotron-fluid"> | ||||
|                 <div class="text-center"> | ||||
|                     <h1 class="display-4">No Services!</h1> | ||||
|                     <a class="lead">You don't have any websites or applications being monitored by your Statping server. <p><a href="/service/create" class="btn btn-secondary mt-3">Add Service</a></p></p> | ||||
|                     <a class="lead">You don't have any websites or applications being monitored by your Statping server. <p><a href="service/create" class="btn btn-secondary mt-3">Add Service</a></p></p> | ||||
|                 </div> | ||||
|             </div> | ||||
|         {{end}} | ||||
| 
 | ||||
|         {{if ne (len .Services) 0}} | ||||
|         <h1 class="text-black-50">Services <a href="/service/create" class="btn btn-outline-success mt-1 float-right"> | ||||
|         <h1 class="text-black-50">Services <a href="service/create" class="btn btn-outline-success mt-1 float-right"> | ||||
|                 <i class="fas fa-plus"></i> Create</a> | ||||
|         </h1> | ||||
|         <table class="table"> | ||||
|  | @ -38,8 +38,8 @@ | |||
|                 <td class="d-none d-md-table-cell">{{if ne .GroupId 0}}<span class="badge badge-secondary">{{(Group .GroupId).Name}}</span>{{end}}</td> | ||||
|                 <td class="text-right"> | ||||
|                     <div class="btn-group"> | ||||
|                         <a href="/service/{{ServiceLink .}}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> View</a> | ||||
|                         {{if Auth}}<a href="/api/services/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="service_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}} | ||||
|                         <a href="service/{{ServiceLink .}}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> View</a> | ||||
|                         {{if Auth}}<a href="api/services/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="service_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}} | ||||
|                     </div> | ||||
|                 </td> | ||||
|             </tr> | ||||
|  | @ -69,8 +69,8 @@ | |||
|                         <td>{{if .Public.Bool}}<span class="badge badge-primary">PUBLIC</span>{{else}}<span class="badge badge-secondary">PRIVATE</span>{{end}}</td> | ||||
|                         <td class="text-right"> | ||||
|                             <div class="btn-group"> | ||||
|                                 <a href="/group/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> Edit</a> | ||||
|                                 {{if Auth}}<a href="/api/groups/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="group_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}} | ||||
|                                 <a href="group/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-chart-area"></i> Edit</a> | ||||
|                                 {{if Auth}}<a href="api/groups/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="group_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>{{end}} | ||||
|                             </div> | ||||
|                         </td> | ||||
|                     </tr> | ||||
|  | @ -90,7 +90,7 @@ | |||
| {{if USE_CDN}} | ||||
| <script src="https://assets.statping.com/sortable.min.js"></script> | ||||
| {{ else }} | ||||
| <script src="/js/sortable.min.js"></script> | ||||
| <script src="js/sortable.min.js"></script> | ||||
| {{end}} | ||||
| <script> | ||||
|     // drag and drop sorting for Services
 | ||||
|  |  | |||
|  | @ -126,7 +126,7 @@ | |||
|                                 <div class="col-sm-9"> | ||||
|                                     <input type="text" class="form-control select-input" value="{{ .ApiSecret }}" id="api_secret" readonly> | ||||
|                                     <small class="form-text text-muted">API Secret is used for read, create, update and delete routes</small> | ||||
|                                     <small class="form-text text-muted">You can <a class="confirm_btn" data-msg="Are you sure you want to reset the API keys?" href="/api/renew">Regenerate API Keys</a> if you need to.</small> | ||||
|                                     <small class="form-text text-muted">You can <a class="confirm_btn" data-msg="Are you sure you want to reset the API keys?" href="api/renew">Regenerate API Keys</a> if you need to.</small> | ||||
|                                 </div> | ||||
|                             </div> | ||||
| 
 | ||||
|  | @ -137,7 +137,7 @@ | |||
| 
 | ||||
|                         <div class="card mt-2"> | ||||
|                             <div class="card-body"> | ||||
|                                 <form action="/settings/bulk_import" method="POST" enctype="multipart/form-data" class="form-inline"> | ||||
|                                 <form action="settings/bulk_import" method="POST" enctype="multipart/form-data" class="form-inline"> | ||||
|                                     <div class="form-group col-10"> | ||||
|                                         <input type="file" name="file" class="form-control-file" accept=".csv"> | ||||
|                                     </div> | ||||
|  | @ -156,7 +156,7 @@ | |||
|                                     <img class="rounded text-center" width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ QrAuth }}"> | ||||
|                                 </div> | ||||
|                                 <a class="btn btn-sm btn-primary" href={{safeURL QrAuth}}>Open in Statping App</a> | ||||
|                                 <a href="/settings/export" class="btn btn-sm btn-secondary">Export Settings</a> | ||||
|                                 <a href="settings/export" class="btn btn-sm btn-secondary">Export Settings</a> | ||||
|                             </div> | ||||
|                             </div> | ||||
|                         {{end}} | ||||
|  | @ -165,7 +165,7 @@ | |||
|                     <div class="tab-pane" id="v-pills-notifications" role="tabpanel" aria-labelledby="v-pills-notifications-tab"> | ||||
|                         <h3>Notifications</h3> | ||||
| 
 | ||||
|                         <form method="POST" action="/settings"> | ||||
|                         <form method="POST" action="settings"> | ||||
| 
 | ||||
|                             <div class="form-group"> | ||||
|                                 <div class="col-12"> | ||||
|  | @ -192,7 +192,7 @@ | |||
|                         <div class="jumbotron jumbotron-fluid"> | ||||
|                             <div class="text-center col-12"> | ||||
|                                 <h1 class="display-5">Enable Local Assets</h1> | ||||
|                                 <span class="lead">Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.<p><a href="/settings/build" class="btn btn-primary mt-3"{{if USE_CDN}} disabled{{end}}>Enable Local Assets</a></p></span> | ||||
|                                 <span class="lead">Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.<p><a href="settings/build" class="btn btn-primary mt-3"{{if USE_CDN}} disabled{{end}}>Enable Local Assets</a></p></span> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     {{ else }} | ||||
|  | @ -220,7 +220,7 @@ | |||
|                                 </div> | ||||
|                             </div> | ||||
|                             <button type="submit" class="btn btn-primary btn-block mt-2">Save Style</button> | ||||
|                             <a href="/settings/delete_assets" class="btn btn-danger btn-block confirm-btn">Delete All Assets</a> | ||||
|                             <a href="settings/delete_assets" class="btn btn-danger btn-block confirm-btn">Delete All Assets</a> | ||||
|                         </form> | ||||
|                     {{end}} | ||||
|                     </div> | ||||
|  | @ -245,7 +245,7 @@ | |||
|                             {{end}} | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                         <a href="/api/clear_cache" class="btn btn-danger btn-block">Clear Cache</a> | ||||
|                         <a href="api/clear_cache" class="btn btn-danger btn-block">Clear Cache</a> | ||||
|                     </div> | ||||
|                 {{ range .Notifications }} | ||||
|                 {{$n := .Select}} | ||||
|  | @ -282,7 +282,7 @@ | |||
|                             <div class="card-body"> | ||||
|                                 <h5 class="card-title">{{ .Name }}</h5> | ||||
|                                 <p class="card-text">{{ .Description }}</p> | ||||
|                                 <a href="/plugins/download/{{ .Name }}" class="card-link">Add</a> | ||||
|                                 <a href="plugins/download/{{ .Name }}" class="card-link">Add</a> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     {{ end }} | ||||
|  | @ -290,7 +290,7 @@ | |||
| 
 | ||||
| 
 | ||||
|                     <div class="tab-pane fade" id="v-pills-backups" role="tabpanel" aria-labelledby="v-pills-backups-tab"> | ||||
|                         <a href="/backups/create" class="btn btn-primary btn-block">Backup Database</a> | ||||
|                         <a href="backups/create" class="btn btn-primary btn-block">Backup Database</a> | ||||
|                     </div> | ||||
| 
 | ||||
|                 {{ range .Plugins }} | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| {{define "content"}} | ||||
| <div class="container col-md-7 col-sm-12 mt-md-5 bg-light"> | ||||
|     <div class="col-6 offset-3 mt-2 mb-5"> | ||||
|         <img width="100%" src="/banner.png"> | ||||
|         <img width="100%" src="banner.png"> | ||||
|     </div> | ||||
|     <div class="col-12"> | ||||
|     {{ if .Error }} | ||||
|  | @ -92,5 +92,5 @@ | |||
| </div> | ||||
| {{end}} | ||||
| {{define "extra_scripts"}} | ||||
| <script src="/js/setup.js"></script> | ||||
| <script src="js/setup.js"></script> | ||||
| {{end}} | ||||
|  |  | |||
|  | @ -8,9 +8,9 @@ | |||
|     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> | ||||
|     <link rel="stylesheet" href="https://assets.statping.com/base.css"> | ||||
| {{ else }} | ||||
|     <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> | ||||
|     <link rel="stylesheet" href="/css/bootstrap.min.css"> | ||||
|     <link rel="stylesheet" href="/css/base.css"> | ||||
|     <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> | ||||
|     <link rel="stylesheet" href="css/bootstrap.min.css"> | ||||
|     <link rel="stylesheet" href="css/base.css"> | ||||
| {{end}} | ||||
| 
 | ||||
|     <title>{{.Name}} Status</title> | ||||
|  | @ -46,7 +46,7 @@ | |||
|             <div class="card"> | ||||
|                 <div class="card-body"> | ||||
|                     <div class="col-12"> | ||||
|                         <h4 class="mt-3"><a href="/service/{{.Id}}"{{if not .Online}} class="text-danger"{{end}}>{{ .Name }}</a> | ||||
|                         <h4 class="mt-3"><a href="service/{{.Id}}"{{if not .Online}} class="text-danger"{{end}}>{{ .Name }}</a> | ||||
|                         {{if .Online}} | ||||
|                             <span class="badge bg-success float-right">ONLINE</span> | ||||
|                         {{ else }} | ||||
|  | @ -94,7 +94,7 @@ | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script> | ||||
| <script src="https://assets.statping.com/main.js"></script> | ||||
| 
 | ||||
| <script src="/charts.js"></script> | ||||
| <script src="charts.js"></script> | ||||
| 
 | ||||
| </body> | ||||
| </html> | ||||
| </html> | ||||
|  |  | |||
|  | @ -17,8 +17,8 @@ | |||
|                 <td>{{.Username}}</td> | ||||
|                 <td class="text-right"> | ||||
|                     {{if Auth}}<div class="btn-group"> | ||||
|                         <a href="/user/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-user-edit"></i> Edit</a> | ||||
|                         <a href="/api/users/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="user_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a> | ||||
|                         <a href="user/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-user-edit"></i> Edit</a> | ||||
|                         <a href="api/users/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="user_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a> | ||||
|                     </div>{{end}} | ||||
|                 </td> | ||||
|             </tr> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Hunter Long
						Hunter Long