|
@@ -8,6 +8,7 @@ import (
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -15,17 +16,28 @@ func loggingRequest(tag string, r *http.Request) {
|
|
|
fmt.Printf("%s --- %s\n", time.Now(), tag)
|
|
|
}
|
|
|
|
|
|
-func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
- loggingRequest("indexHandler", r)
|
|
|
- host := "http://" + r.Host
|
|
|
+
|
|
|
+func createIndexHandler(reverseHost string) func(http.ResponseWriter, *http.Request) {
|
|
|
+ return func(w http.ResponseWriter, r *http.Request) {
|
|
|
+ loggingRequest("indexHandler", r)
|
|
|
|
|
|
- w.Header().Set("content-type", "text/html; charset=utf-8")
|
|
|
- w.WriteHeader(200)
|
|
|
- html := `<h1>Hello,This is a Jrebel & JetBrains License Server!</h1>
|
|
|
+ var host string
|
|
|
+ if len(reverseHost) > 0 {
|
|
|
+ host = reverseHost
|
|
|
+ } else {
|
|
|
+ host = "http://" + r.Host + r.RequestURI
|
|
|
+ }
|
|
|
+
|
|
|
+ host = strings.TrimSuffix(host, "/")
|
|
|
+
|
|
|
+ w.Header().Set("content-type", "text/html; charset=utf-8")
|
|
|
+ w.WriteHeader(200)
|
|
|
+ html := `<h1>Hello,This is a Jrebel & JetBrains License Server!</h1>
|
|
|
<p>License Server started at %s
|
|
|
<p>JRebel 7.1 and earlier version Activation address was: <span style='color:red'>%s/{tokenname}</span>, with any email."
|
|
|
<p>JRebel 2018.1 and later version Activation address was: %s/{guid}(eg:<span style='color:red'> %s/%s </span>), with any email.`
|
|
|
- _, _ = fmt.Fprintf(w, html, host, host, host, host, newUUIDV4String())
|
|
|
+ _, _ = fmt.Fprintf(w, html, host, host, host, host, newUUIDV4String())
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func jrebelLeasesHandler(w http.ResponseWriter, r *http.Request) {
|