Re-add support for nice outfit image URLs

We removed this earlier in 7205455ccb, but now it's time to re-add it!
This commit is contained in:
Emi Matchu 2021-11-12 19:53:34 -08:00
parent d37d958a36
commit 30d582a9c4
2 changed files with 12 additions and 8 deletions

View file

@ -2,6 +2,18 @@ module.exports = {
env: { env: {
PUBLIC_URL: "", PUBLIC_URL: "",
}, },
async rewrites() {
return [
{
source: "/outfits/:id/:size(150|300|600).png",
destination: "/api/outfitImage?size=:size&id=:id",
},
{
source: "/outfits/:id/v/:updatedAt/:size(150|300|600).png",
destination: "/api/outfitImage?size=:size&id=:id&updatedAt=:updatedAt",
},
];
},
async redirects() { async redirects() {
return [ return [
{ {

View file

@ -1,13 +1,5 @@
{ {
"routes": [ "routes": [
{
"src": "/outfits/(?<id>[^/]+)/(?<size>150|300|600)\\.png",
"dest": "/api/outfitImage.js?size=$size&id=$id"
},
{
"src": "/outfits/(?<id>[^/]+)/v/(?<updatedAt>[^/]+)/(?<size>150|300|600)\\.png",
"dest": "/api/outfitImage.js?size=$size&id=$id&updatedAt=$updatedAt"
},
{ {
"handle": "filesystem" "handle": "filesystem"
}, },