Return help message for / request on HTTP service
This commit is contained in:
parent
cddd3ca173
commit
ea53e6b467
|
@ -58,7 +58,23 @@ func (h *slashFix) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func handleHTTPServerRequest(w http.ResponseWriter, r *http.Request) {
|
||||
var message string
|
||||
urlForBrowsh, _ := url.PathUnescape(strings.TrimPrefix(r.URL.Path, "/"))
|
||||
if strings.TrimSpace(urlForBrowsh) == "" {
|
||||
if (strings.Contains(r.Host, "text.")) {
|
||||
message = "Welcome to the Browsh plain text client.\n" +
|
||||
"You can use it by appending URLs like this;\n" +
|
||||
"http://html.brow.sh/https://www.brow.sh"
|
||||
} else {
|
||||
message = "<html>" +
|
||||
"Welcome to the Browsh HTML web client.<br />" +
|
||||
"Type a URL after 'html.brow.sh' in your URL bar, eg;<br />" +
|
||||
"<a href=\"http://html.brow.sh/https://www.brow.sh\">http://html.brow.sh/https://www.brow.sh</a><br />" +
|
||||
"</html>"
|
||||
}
|
||||
io.WriteString(w, message)
|
||||
return
|
||||
}
|
||||
rawTextRequestID := pseudoUUID()
|
||||
mode := getRawTextMode(r)
|
||||
sendMessageToWebExtension(
|
||||
|
|
Loading…
Reference in a new issue