diff --git a/glide.lock b/glide.lock new file mode 100644 index 00000000..a37bb9c1 --- /dev/null +++ b/glide.lock @@ -0,0 +1,72 @@ +hash: 7aa42ec83fe541ba9f37553bf02de80f1740bd4cb24262079f50e73ea499bf90 +updated: 2016-11-23T01:36:19.423267559+09:00 +imports: +- name: github.com/aerogo/aero + version: 2f422704cd49cfe0d31390002ee4764e5e0f71a3 +- name: github.com/aerospike/aerospike-client-go + version: 43beaedd687afef4bc62fdb128408611a5ed6ee5 + subpackages: + - internal/lua + - internal/lua/resources + - logger + - pkg/bcrypt + - pkg/ripemd160 + - types + - types/atomic + - types/particle_type + - types/rand + - utils/buffer +- name: github.com/animenotifier/arn + version: 3face13fce44c878d587cfd36fae0225a21f98f4 +- name: github.com/buaazp/fasthttprouter + version: 5396e5b544db47fab9bce89929cd4c05df3b3de0 +- name: github.com/cloudfoundry/gosigar + version: c32d31af94b0e9d3b2877e49c1a581ad5a793343 +- name: github.com/dustin/go-humanize + version: bd88f87ad3a420f7bcf05e90566fd1ceb351fa7f +- name: github.com/fatih/color + version: dea9d3a26a087187530244679c1cfb3a42937794 +- name: github.com/klauspost/compress + version: e3b7981a12dd3cab49afa1d3a50e715846f23732 + subpackages: + - flate + - gzip + - zlib +- name: github.com/klauspost/cpuid + version: 09cded8978dc9e80714c4d85b0322337b0a1e5e0 +- name: github.com/klauspost/crc32 + version: cb6bfca970f6908083f26f39a79009d608efd5cd +- name: github.com/mattn/go-colorable + version: d228849504861217f796da67fae4f6e347643f15 +- name: github.com/mattn/go-isatty + version: 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8 +- name: github.com/microcosm-cc/bluemonday + version: f77f16ffc87a6a58814e64ae72d55f9c41374e6d +- name: github.com/OneOfOne/xxhash + version: 8e3f99d9489277dae933ed6f2daae376a6c7b011 +- name: github.com/patrickmn/go-cache + version: 1881a9bccb818787f68c52bfba648c6cf34c34fa +- name: github.com/russross/blackfriday + version: 0b647d0506a698cca42caca173e55559b12a69f2 +- name: github.com/shurcooL/sanitized_anchor_name + version: 1dba4b3954bc059efc3991ec364f9f9a35f597d2 +- name: github.com/valyala/fasthttp + version: d42167fd04f636e20b005e9934159e95454233c7 + subpackages: + - fasthttputil +- name: github.com/yuin/gopher-lua + version: d0d5dd3565a9f3c86ff5bc42a0b1cc9e5bfcf55e + subpackages: + - ast + - parse + - pm +- name: golang.org/x/net + version: 4971afdc2f162e82d185353533d3cf16188a9f4e + subpackages: + - html + - html/atom +- name: golang.org/x/sys + version: b699b7032584f0953262cb2788a0ca19bb494703 + subpackages: + - unix +testImports: [] diff --git a/glide.yaml b/glide.yaml new file mode 100644 index 00000000..95bc06ab --- /dev/null +++ b/glide.yaml @@ -0,0 +1,6 @@ +package: github.com/animenotifier/notify.moe +import: +- package: github.com/aerogo/aero +- package: github.com/animenotifier/arn +- package: github.com/valyala/fasthttp + version: ^20160617.0.0 diff --git a/rewrite.go b/rewrite.go index 7b2f13f6..0e9d018c 100644 --- a/rewrite.go +++ b/rewrite.go @@ -3,7 +3,7 @@ package main import ( "bytes" - "github.com/valyala/fasthttp" + "github.com/aerogo/aero" ) func init() { @@ -11,19 +11,19 @@ func init() { plusRouteAjax := []byte("/_/+") // This will rewrite /+UserName requests to /user/UserName - app.Rewrite(func(ctx *fasthttp.RequestCtx) { - requestURI := ctx.RequestURI() + app.Rewrite(func(ctx *aero.RewriteContext) { + requestURI := ctx.URIBytes() if bytes.HasPrefix(requestURI, plusRoute) { newURI := []byte("/user/") userName := requestURI[2:] newURI = append(newURI, userName...) - ctx.Request.SetRequestURIBytes(newURI) + ctx.SetURIBytes(newURI) } else if bytes.HasPrefix(requestURI, plusRouteAjax) { newURI := []byte("/_/user/") userName := requestURI[4:] newURI = append(newURI, userName...) - ctx.Request.SetRequestURIBytes(newURI) + ctx.SetURIBytes(newURI) } }) }