mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-28 23:52:12 +00:00
disable /link rewrite. fixes #101
This commit is contained in:
parent
1169457eaf
commit
9d40d02ea7
|
@ -156,7 +156,7 @@ var funcMap = template.FuncMap{
|
||||||
if host != "." {
|
if host != "." {
|
||||||
body = RegReplace(body, `href="/`, `href="./`)
|
body = RegReplace(body, `href="/`, `href="./`)
|
||||||
}
|
}
|
||||||
body = RegReplace(body, `href="(https:\/\/[a-zA-Z0-9\.\-]+\/(c|u|comment|post)\/[^#\?]*?)"`, `href="/`+host+`/link?url=$1"`)
|
//body = RegReplace(body, `href="(https:\/\/[a-zA-Z0-9\.\-]+\/(c|u|comment|post)\/[^#\?]*?)"`, `href="/`+host+`/link?url=$1"`)
|
||||||
body = RegReplace(body, `::: ?spoiler (.*?)\n([\S\s]*?):::`, "<details><summary>$1</summary>$2</details>")
|
body = RegReplace(body, `::: ?spoiler (.*?)\n([\S\s]*?):::`, "<details><summary>$1</summary>$2</details>")
|
||||||
return template.HTML(body)
|
return template.HTML(body)
|
||||||
},
|
},
|
||||||
|
@ -1490,6 +1490,12 @@ func UserOp(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
http.Redirect(w, r, r.URL.String(), 301)
|
http.Redirect(w, r, r.URL.String(), 301)
|
||||||
}
|
}
|
||||||
func GetLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
func GetLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
ref, _ := url.Parse(r.Referer())
|
||||||
|
if r.Host != ref.Host {
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
w.Write([]byte("Invalid Referer"))
|
||||||
|
return
|
||||||
|
}
|
||||||
var dest *url.URL
|
var dest *url.URL
|
||||||
m, _ := url.ParseQuery(r.URL.RawQuery)
|
m, _ := url.ParseQuery(r.URL.RawQuery)
|
||||||
if len(m["url"]) > 0 {
|
if len(m["url"]) > 0 {
|
||||||
|
|
Loading…
Reference in a new issue