Update: replace gin codebase to fiber

This commit is contained in:
VnPower 2023-06-12 11:28:50 +07:00
parent fc37e277a6
commit 6c42f6b6b9
Signed by: vnpower
GPG key ID: 881DE3DEB966106C
8 changed files with 288 additions and 285 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
.vercel
*.map
config.yml
tmp/
.air.toml

19
go.mod
View file

@ -8,7 +8,9 @@ require (
)
require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cbroglie/mustache v1.4.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
@ -19,16 +21,33 @@ require (
github.com/go-playground/validator/v10 v10.14.1 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gofiber/fiber/v2 v2.46.0 // indirect
github.com/gofiber/template v1.8.2 // indirect
github.com/gofiber/template/html/v2 v2.0.4 // indirect
github.com/gofiber/template/mustache/v2 v2.0.4 // indirect
github.com/gofiber/utils v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jellydator/ttlcache/v2 v2.11.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
github.com/tinylib/msgp v1.1.8 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.47.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect

64
go.sum
View file

@ -1,6 +1,10 @@
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/cbroglie/mustache v1.4.0 h1:Azg0dVhxTml5me+7PsZ7WPrQq1Gkf3WApcHMjMprYoU=
github.com/cbroglie/mustache v1.4.0/go.mod h1:SS1FTIghy0sjse4DUVGV1k/40B1qE1XkD9DtDsHo9iM=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@ -43,6 +47,16 @@ github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gofiber/fiber/v2 v2.46.0 h1:wkkWotblsGVlLjXj2dpgKQAYHtXumsK/HyFugQM68Ns=
github.com/gofiber/fiber/v2 v2.46.0/go.mod h1:DNl0/c37WLe0g92U6lx1VMQuxGUQY5V7EIaVoEsUffc=
github.com/gofiber/template v1.8.2 h1:PIv9s/7Uq6m+Fm2MDNd20pAFFKt5wWs7ZBd8iV9pWwk=
github.com/gofiber/template v1.8.2/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
github.com/gofiber/template/html/v2 v2.0.4 h1:exZDo23hrYRqxoX4vPkJj31yxXTmlFEu2aHd+XmJmLM=
github.com/gofiber/template/html/v2 v2.0.4/go.mod h1:RCF14eLeQDCSUPp0IGc2wbSSDv6yt+V54XB/+Unz+LM=
github.com/gofiber/template/mustache/v2 v2.0.4 h1:n6Un05JZVeSjQgjYN5aiG/hvBVErc/CCPW3SzyzJo/U=
github.com/gofiber/template/mustache/v2 v2.0.4/go.mod h1:U75y7n5F3OJu8P5dUn1m9dX8RU6Jf/uvIORAVAQpYOc=
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
@ -60,6 +74,8 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jellydator/ttlcache/v2 v2.11.1 h1:AZGME43Eh2Vv3giG6GeqeLeFXxwxn1/qHItqWZl6U64=
@ -67,6 +83,10 @@ github.com/jellydator/ttlcache/v2 v2.11.1/go.mod h1:RtE5Snf0/57e+2cLWFYWCCsLas2H
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
@ -78,9 +98,14 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -103,8 +128,18 @@ github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4=
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@ -118,13 +153,23 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw=
github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c=
github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
@ -133,6 +178,7 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@ -140,13 +186,18 @@ golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -154,6 +205,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -169,16 +221,25 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@ -186,8 +247,11 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -7,140 +7,140 @@ import (
"regexp"
"strconv"
"strings"
"github.com/gofiber/template/html/v2"
)
func GetTemplateFunctions() template.FuncMap {
return template.FuncMap{
"inc": func(n int) int {
// For rankings to increment a number by 1
return n + 1
},
"add": func(a int, b int) int {
return a + b
},
func GetTemplateFunctions(engine *html.Engine) {
engine.AddFunc("inc", func(n int) int {
// For rankings to increment a number by 1
return n + 1
})
engine.AddFunc("add", func(a int, b int) int {
return a + b
})
"dec": func(n int) int {
return n - 1
},
engine.AddFunc("dec", func(n int) int {
return n - 1
})
"toInt": func(s string) int {
n, _ := strconv.Atoi(s)
return n
},
engine.AddFunc("toInt", func(s string) int {
n, _ := strconv.Atoi(s)
return n
})
"proxyImage": func(url string) string {
if strings.Contains(url, "s.pximg.net") {
// This subdomain didn't get proxied
return url
}
engine.AddFunc("proxyImage", func(url string) string {
if strings.Contains(url, "s.pximg.net") {
// This subdomain didn't get proxied
return url
}
regex := regexp.MustCompile(`.*?pximg\.net`)
proxy := "https://" + configs.ProxyServer
regex := regexp.MustCompile(`.*?pximg\.net`)
proxy := "https://" + configs.ProxyServer
return regex.ReplaceAllString(url, proxy)
},
"parseEmojis": func(s string) template.HTML {
regex := regexp.MustCompile(`\(([^)]+)\)`)
return regex.ReplaceAllString(url, proxy)
})
engine.AddFunc("parseEmojis", func(s string) template.HTML {
regex := regexp.MustCompile(`\(([^)]+)\)`)
parsedString := regex.ReplaceAllStringFunc(s, func(s string) string {
s = s[1 : len(s)-1] // Get the string inside
var id string
parsedString := regex.ReplaceAllStringFunc(s, func(s string) string {
s = s[1 : len(s)-1] // Get the string inside
var id string
switch s {
case "normal":
id = "101"
case "surprise":
id = "102"
case "serious":
id = "103"
case "heaven":
id = "104"
case "happy":
id = "105"
case "excited":
id = "106"
case "sing":
id = "107"
case "cry":
id = "108"
case "normal2":
id = "201"
case "shame2":
id = "202"
case "love2":
id = "203"
case "interesting2":
id = "204"
case "blush2":
id = "205"
case "fire2":
id = "206"
case "angry2":
id = "207"
case "shine2":
id = "208"
case "panic2":
id = "209"
case "normal3":
id = "301"
case "satisfaction3":
id = "302"
case "surprise3":
id = "303"
case "smile3":
id = "304"
case "shock3":
id = "305"
case "gaze3":
id = "306"
case "wink3":
id = "307"
case "happy3":
id = "308"
case "excited3":
id = "309"
case "love3":
id = "310"
case "normal4":
id = "401"
case "surprise4":
id = "402"
case "serious4":
id = "403"
case "love4":
id = "404"
case "shine4":
id = "405"
case "sweat4":
id = "406"
case "shame4":
id = "407"
case "sleep4":
id = "408"
case "heart":
id = "501"
case "teardrop":
id = "502"
case "star":
id = "503"
}
return fmt.Sprintf(`<img src="https://s.pximg.net/common/images/emoji/%s.png" alt="(%s)" class="emoji" />`, id, s)
})
return template.HTML(parsedString)
},
"isEmpty": func(s string) bool {
return len(s) < 1
},
"isEmphasize": func(s string) bool {
switch s {
case
"R-18",
"R-18G":
return true
case "normal":
id = "101"
case "surprise":
id = "102"
case "serious":
id = "103"
case "heaven":
id = "104"
case "happy":
id = "105"
case "excited":
id = "106"
case "sing":
id = "107"
case "cry":
id = "108"
case "normal2":
id = "201"
case "shame2":
id = "202"
case "love2":
id = "203"
case "interesting2":
id = "204"
case "blush2":
id = "205"
case "fire2":
id = "206"
case "angry2":
id = "207"
case "shine2":
id = "208"
case "panic2":
id = "209"
case "normal3":
id = "301"
case "satisfaction3":
id = "302"
case "surprise3":
id = "303"
case "smile3":
id = "304"
case "shock3":
id = "305"
case "gaze3":
id = "306"
case "wink3":
id = "307"
case "happy3":
id = "308"
case "excited3":
id = "309"
case "love3":
id = "310"
case "normal4":
id = "401"
case "surprise4":
id = "402"
case "serious4":
id = "403"
case "love4":
id = "404"
case "shine4":
id = "405"
case "sweat4":
id = "406"
case "shame4":
id = "407"
case "sleep4":
id = "408"
case "heart":
id = "501"
case "teardrop":
id = "502"
case "star":
id = "503"
}
return false
},
}
return fmt.Sprintf(`<img src="https://s.pximg.net/common/images/emoji/%s.png" alt="(%s)" class="emoji" />`, id, s)
})
return template.HTML(parsedString)
})
engine.AddFunc("isEmpty", func(s string) bool {
return len(s) < 1
})
engine.AddFunc("isEmphasize", func(s string) bool {
switch s {
case
"R-18",
"R-18G":
return true
}
return false
})
}

23
main.go
View file

@ -5,27 +5,30 @@ import (
"pixivfe/handler"
"pixivfe/views"
"github.com/gin-gonic/gin"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)
func setupRouter() *gin.Engine {
server := gin.Default()
func setupRouter() *fiber.App {
// HTML templates, automatically loaded
engine := html.New("./template", ".html")
server.SetFuncMap(handler.GetTemplateFunctions())
handler.GetTemplateFunctions(engine)
server := fiber.New(fiber.Config{
Views: engine,
})
// Static files
server.StaticFile("/favicon.ico", "./template/favicon.ico")
server.Static("/favicon.ico", "./template/favicon.ico")
server.Static("css/", "./template/css")
server.Static("assets/", "./template/assets")
// HTML templates, automatically loaded
server.LoadHTMLGlob("template/*.html")
// Routes/Views
views.SetupRoutes(server)
// Disable trusted proxies since we do not use any for now
server.SetTrustedProxies(nil)
// server.SetTrustedProxies(nil)
return server
}
@ -39,5 +42,5 @@ func main() {
r := setupRouter()
r.Run(":" + configs.Port)
r.Listen(":" + configs.Port)
}

View file

@ -1,4 +1,4 @@
{{ template "header.html" .Title}}
{{ template "header" .Title}}
<div class="container">
<h2>{{ .Title }}</h2>
@ -122,4 +122,4 @@
</div>
</div>
{{ template "footer.html" }}
{{ template "footer" }}

View file

@ -1,4 +1,4 @@
{{ template "header.html" }}
{{ template "header" }}
<div
class="container"
style="
@ -19,4 +19,4 @@
if you are using the official instance :D</small
>
</div>
{{ template "footer.html" }}
{{ template "footer" }}

View file

@ -1,6 +1,7 @@
package views
import (
"errors"
"math"
"net/http"
"pixivfe/configs"
@ -8,30 +9,20 @@ import (
"strconv"
"time"
cache "github.com/chenyahui/gin-cache"
"github.com/chenyahui/gin-cache/persist"
"github.com/gin-gonic/gin"
"github.com/gofiber/fiber/v2"
)
var PC *handler.PixivClient
func artwork_page(c *gin.Context) {
id := c.Param("id")
func artwork_page(c *fiber.Ctx) error {
id := c.Params("id")
if _, err := strconv.Atoi(id); err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "Bad request",
"Error": "Invalid artwork ID",
})
return
return errors.New("Bad id")
}
illust, err := PC.GetArtworkByID(id)
if err != nil {
c.HTML(http.StatusInternalServerError, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
related, _ := PC.GetRelatedArtworks(id)
@ -39,13 +30,10 @@ func artwork_page(c *gin.Context) {
artist_info, err := PC.GetUserInformation(illust.UserID, 1)
if err != nil {
c.HTML(http.StatusInternalServerError, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return err
}
c.HTML(http.StatusOK, "artwork.html", gin.H{
return c.Render("artwork", fiber.Map{
"Illust": illust,
"Related": related,
"Artist": artist_info,
@ -54,82 +42,54 @@ func artwork_page(c *gin.Context) {
})
}
func index_page(c *gin.Context) {
func index_page(c *fiber.Ctx) error {
// recommended, _ := handler.GetRecommendedIllust(c)
// ranking, _ := handler.GetRankingIllust(c, "day")
// spotlight := handler.GetSpotlightArticle(c)
// newest, _ := handler.GetNewestIllust(c)
// c.HTML(http.StatusOK, "index.html", gin.H{
// return c.Render(http.StatusOK, "index.html", fiber.Map{
// "Recommended": recommended,
// "Rankings": ranking,
// "Spotlights": spotlight,
// "Newest": newest,
// })
c.HTML(http.StatusOK, "temp.html", gin.H{})
return c.Render("temp", fiber.Map{})
}
func user_page(c *gin.Context) {
id := c.Param("id")
func user_page(c *fiber.Ctx) error {
id := c.Params("id")
if _, err := strconv.Atoi(id); err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "Bad request",
"Error": "Invalid user ID",
})
return
}
page, ok := c.GetQuery("page")
if !ok {
page = "1"
return err
}
page := c.Query("page", "1")
pageInt, _ := strconv.Atoi(page)
user, err := PC.GetUserInformation(id, pageInt)
if err != nil {
c.HTML(http.StatusInternalServerError, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
worksCount, _ := PC.GetUserArtworksCount(id)
pageLimit := math.Ceil(float64(worksCount)/30.0) + 1.0
c.HTML(http.StatusOK, "user.html", gin.H{"Title": user.Name, "User": user, "PageLimit": int(pageLimit), "Page": pageInt})
return c.Render("user", fiber.Map{"Title": user.Name, "User": user, "PageLimit": int(pageLimit), "Page": pageInt})
}
func ranking_page(c *gin.Context) {
mode, ok := c.GetQuery("mode")
func ranking_page(c *fiber.Ctx) error {
mode := c.Query("mode", "daily")
if !ok {
mode = "daily"
}
content := c.Query("content", "all")
content, ok := c.GetQuery("content")
if !ok {
content = "all"
}
page, ok := c.GetQuery("page")
if !ok {
page = "1"
}
page := c.Query("page", "1")
pageInt, _ := strconv.Atoi(page)
response, err := PC.GetRanking(mode, content, page)
if err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
c.HTML(http.StatusOK, "rank.html", gin.H{
return c.Render("rank", fiber.Map{
"Title": "Ranking",
"Items": response.Artworks,
"Mode": mode,
@ -137,75 +97,40 @@ func ranking_page(c *gin.Context) {
"Page": pageInt})
}
func newest_artworks_page(c *gin.Context) {
worktype, ok := c.GetQuery("type")
func newest_artworks_page(c *fiber.Ctx) error {
worktype := c.Query("type", "illust")
if !ok {
worktype = "illust"
}
r18, ok := c.GetQuery("r18")
if !ok {
r18 = "false"
}
r18 := c.Query("r18", "false")
works, err := PC.GetNewestArtworks(worktype, r18)
if err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
c.HTML(http.StatusOK, "newest.html", gin.H{
return c.Render("newest", fiber.Map{
"Items": works,
"Title": "Newest works",
})
}
func search_page(c *gin.Context) {
name := c.Param("name")
func search_page(c *fiber.Ctx) error {
name := c.Params("name")
page, ok := c.GetQuery("page")
page := c.Query("page", "1")
if !ok {
page = "1"
}
order := c.Query("order", "date_d")
order, ok := c.GetQuery("order")
mode := c.Query("mode", "safe")
if !ok {
order = "date_d"
}
mode, ok := c.GetQuery("mode")
if !ok {
mode = "safe"
}
category, ok := c.GetQuery("category")
if !ok {
category = "artworks"
}
category := c.Query("category", "artworks")
tag, err := PC.GetTagData(name)
if err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
result, _ := PC.GetSearch(category, name, order, mode, page)
result, err := PC.GetSearch(category, name, order, mode, page)
if err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
queries := map[string]string{
@ -214,40 +139,32 @@ func search_page(c *gin.Context) {
"Mode": mode,
"Category": category,
}
c.HTML(http.StatusOK, "tag.html", gin.H{"Title": "Results for " + tag.Name, "Tag": tag, "Data": result, "Queries": queries})
return c.Render("tag", fiber.Map{"Title": "Results for " + tag.Name, "Tag": tag, "Data": result, "Queries": queries})
}
func search(c *gin.Context) {
name := c.PostForm("name")
func search(c *fiber.Ctx) error {
name := c.FormValue("name")
c.Redirect(http.StatusFound, "/tags/"+name)
return c.Redirect("/tags/"+name, http.StatusFound)
}
func discovery_page(c *gin.Context) {
mode, ok := c.GetQuery("mode")
if !ok {
mode = "safe"
}
func discovery_page(c *fiber.Ctx) error {
mode := c.Query("mode", "safe")
artworks, err := PC.GetDiscoveryArtwork(mode, 300)
if err != nil {
c.HTML(http.StatusBadRequest, "error.html", gin.H{
"Title": "An error occured",
"Error": err,
})
return
return err
}
c.HTML(http.StatusOK, "discovery.html", gin.H{"Title": "Discovery", "Artworks": artworks})
return c.Render("discovery", fiber.Map{"Title": "Discovery", "Artworks": artworks})
}
func not_found_page(c *gin.Context) {
c.HTML(http.StatusNotFound, "error.html", gin.H{
"Title": "Not found",
"Error": "Route " + c.Request.URL.Path + " not found.",
})
}
// func not_found_page(c *fiber.Ctx) {
// return c.Render(http.StatusNotFound, "error.html", fiber.Map{
// "Title": "Not found",
// "Error": "Route " + c.Request.URL.Path + " not found.",
// })
// }
func NewPixivClient(timeout int) *handler.PixivClient {
transport := &http.Transport{Proxy: http.ProxyFromEnvironment}
@ -266,22 +183,20 @@ func NewPixivClient(timeout int) *handler.PixivClient {
return pc
}
func SetupRoutes(r *gin.Engine) {
func SetupRoutes(r *fiber.App) {
PC = NewPixivClient(5000)
PC.SetSessionID(configs.Token)
PC.SetUserAgent(configs.UserAgent)
store := persist.NewMemoryStore(1 * time.Minute)
r.GET("/", index_page)
r.GET("artworks/:id", cache.CacheByRequestURI(store, 6*time.Hour), artwork_page)
r.GET("users/:id", cache.CacheByRequestURI(store, 6*time.Hour), user_page)
r.GET("newest", newest_artworks_page)
r.GET("ranking", cache.CacheByRequestURI(store, 6*time.Hour), ranking_page)
r.GET("tags/:name", cache.CacheByRequestURI(store, 1*time.Hour), search_page)
r.GET("discovery", discovery_page)
r.POST("tags", search)
r.Get("/", index_page)
r.Get("artworks/:id", artwork_page)
r.Get("users/:id", user_page)
r.Get("newest", newest_artworks_page)
r.Get("ranking", ranking_page)
r.Get("tags/:name", search_page)
r.Get("discovery", discovery_page)
r.Post("tags", search)
// 404 page
r.NoRoute(not_found_page)
// r.NoRoute(not_found_page)
}