34 lines
570 B
Go
Raw Normal View History

2016-11-20 10:26:11 +00:00
package main
import (
2017-05-29 22:07:05 +00:00
"strings"
2016-11-20 10:26:11 +00:00
2016-11-22 16:37:20 +00:00
"github.com/aerogo/aero"
2016-11-20 10:26:11 +00:00
)
2017-10-02 00:09:05 +00:00
// rewrite will rewrite certain routes
func rewrite(ctx *aero.RewriteContext) {
2017-10-01 22:31:44 +00:00
requestURI := ctx.URI()
// User profiles
if strings.HasPrefix(requestURI, "/+") {
newURI := "/user/"
userName := requestURI[2:]
ctx.SetURI(newURI + userName)
return
}
if strings.HasPrefix(requestURI, "/_/+") {
newURI := "/_/user/"
userName := requestURI[4:]
ctx.SetURI(newURI + userName)
return
}
// Analytics
if requestURI == "/dark-flame-master" {
ctx.SetURI("/api/new/analytics")
return
}
2016-11-20 10:26:11 +00:00
}