Made full use of Service* constants in util.
This commit is contained in:
parent
f9dabbc6f9
commit
2667ec93ce
@ -42,9 +42,9 @@ func (h *Handlers) Index(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *Handlers) Privacy(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
web.Privacy("/ Privacy statements",
|
||||
util.GetServiceByHost(r.Host, "radio"),
|
||||
util.GetServiceByHost(r.Host, "files"),
|
||||
util.GetServiceByHost(r.Host, "upload"), w)
|
||||
util.GetServiceByHost(r.Host, util.ServiceRadio),
|
||||
util.GetServiceByHost(r.Host, util.ServiceRadio),
|
||||
util.GetServiceByHost(r.Host, util.ServiceUpload), w)
|
||||
}
|
||||
|
||||
func (h *Handlers) Stuff(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -56,10 +56,10 @@ func (p *Post) PostURL(host string, rss bool) string {
|
||||
return strings.Replace(p.URL, p.URL[:lastColon+2],
|
||||
util.GetServiceByHost(host, service), 1)
|
||||
} else if rss && p.URL[0] == '/' {
|
||||
return util.GetServiceByHost(host, "") + p.URL
|
||||
return util.GetServiceByHost(host, util.ServiceHome) + p.URL
|
||||
}
|
||||
} else if p.URL == "" && rss {
|
||||
return util.GetServiceByHost(host, "") + "/mindflow#" + p.PostID()
|
||||
return util.GetServiceByHost(host, util.ServiceHome) + "/mindflow#" + p.PostID()
|
||||
}
|
||||
return p.URL
|
||||
}
|
||||
|
@ -19,52 +19,52 @@ const (
|
||||
func GetServiceByHost(host, service string) string {
|
||||
if strings.HasSuffix(host, "i2p") {
|
||||
switch service {
|
||||
case "radio":
|
||||
case ServiceRadio:
|
||||
return "http://radio.arav.i2p"
|
||||
case "files":
|
||||
case ServiceFiles:
|
||||
return "http://files.arav.i2p"
|
||||
case "upload":
|
||||
case ServiceUpload:
|
||||
return "http://upload.arav.i2p"
|
||||
case "git":
|
||||
case ServiceGit:
|
||||
return "http://git.arav.i2p"
|
||||
default:
|
||||
return "http://arav.i2p"
|
||||
}
|
||||
} else if strings.HasPrefix(host, "[300") {
|
||||
switch service {
|
||||
case "radio":
|
||||
case ServiceRadio:
|
||||
return "http://[300:a98d:d6d0:8a08::e]"
|
||||
case "files":
|
||||
case ServiceFiles:
|
||||
return "http://[300:a98d:d6d0:8a08::d]"
|
||||
case "upload":
|
||||
case ServiceUpload:
|
||||
return "http://[300:a98d:d6d0:8a08::c]"
|
||||
case "git":
|
||||
case ServiceGit:
|
||||
return "http://[300:a98d:d6d0:8a08::b]"
|
||||
default:
|
||||
return "http://[300:a98d:d6d0:8a08::f]"
|
||||
}
|
||||
} else if strings.HasSuffix(host, "onion") {
|
||||
switch service {
|
||||
case "radio":
|
||||
case ServiceRadio:
|
||||
return "http://wsmkgnmhmzqm7kyzv7jnzzafvgm7xlmlfvzhgorpapd5or2arnhuktqd.onion"
|
||||
case "files":
|
||||
case ServiceFiles:
|
||||
return "http://qf5e43nlhvnrutmikuvbdfj3cmtthokpbaxtkm6mjlslttzvtgm4fxid.onion"
|
||||
case "upload":
|
||||
case ServiceUpload:
|
||||
return "http://4usftbmjpfexkr2x5xbp5ukmygpmg4fgrnx2wbifsexqctooz5hmviyd.onion"
|
||||
case "git":
|
||||
case ServiceGit:
|
||||
return "http://qqitm7qlsbbubwmjos4cqzmvkqidg34rfnbyhuydhalep33fbvh22xyd.onion"
|
||||
default:
|
||||
return "http://moq7aejnf4xk5k2bkaltli3ftkhusy2mbrd3pj23nrca343ku2mgk4yd.onion"
|
||||
}
|
||||
} else {
|
||||
switch service {
|
||||
case "radio":
|
||||
case ServiceRadio:
|
||||
return "https://radio.arav.su"
|
||||
case "files":
|
||||
case ServiceFiles:
|
||||
return "https://files.arav.su"
|
||||
case "upload":
|
||||
case ServiceUpload:
|
||||
return "https://upload.arav.su"
|
||||
case "git":
|
||||
case ServiceGit:
|
||||
return "https://git.arav.su"
|
||||
default:
|
||||
return "https://arav.su"
|
||||
|
Loading…
Reference in New Issue
Block a user