2019-10-07 16:19:01 +00:00
|
|
|
package httpd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2021-01-25 20:31:33 +00:00
|
|
|
const (
|
2021-05-06 19:35:43 +00:00
|
|
|
page400Title = "Bad request"
|
|
|
|
page403Title = "Forbidden"
|
|
|
|
page404Title = "Not found"
|
|
|
|
page404Body = "The page you are looking for does not exist."
|
|
|
|
page500Title = "Internal Server Error"
|
|
|
|
page500Body = "The server is unable to fulfill your request."
|
|
|
|
webDateTimeFormat = "2006-01-02 15:04:05" // YYYY-MM-DD HH:MM:SS
|
|
|
|
redactedSecret = "[**redacted**]"
|
|
|
|
csrfFormToken = "_form_token"
|
|
|
|
csrfHeaderToken = "X-CSRF-TOKEN"
|
2021-01-25 20:31:33 +00:00
|
|
|
)
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
type loginPage struct {
|
|
|
|
CurrentURL string
|
|
|
|
Version string
|
|
|
|
Error string
|
2021-02-03 07:55:28 +00:00
|
|
|
CSRFToken string
|
2021-04-09 20:02:48 +00:00
|
|
|
StaticURL string
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
|
2019-12-30 17:37:50 +00:00
|
|
|
func getSliceFromDelimitedValues(values, delimiter string) []string {
|
|
|
|
result := []string{}
|
|
|
|
for _, v := range strings.Split(values, delimiter) {
|
|
|
|
cleaned := strings.TrimSpace(v)
|
2021-01-25 20:31:33 +00:00
|
|
|
if cleaned != "" {
|
2019-12-30 17:37:50 +00:00
|
|
|
result = append(result, cleaned)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|