The 2020 Next.js rewrite, now being merged into impress!
Matchu
49d3b3685d
I think the issue with the Spring Topiary Garden Background is that EaselJS is trying to do intermediate canvas reads in order to apply computed filters, but loading from our asset proxy counts as tainted data. Here's the traceback I got in Chrome for it: ``` Error building movie clips DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. at a.b._applyFilters (https://code.createjs.com/1.0.0/easeljs.min.js:15:12029) at a.b._drawToCache (https://code.createjs.com/1.0.0/easeljs.min.js:15:11806) at a.b.update (https://code.createjs.com/1.0.0/easeljs.min.js:15:8638) at a.b.define (https://code.createjs.com/1.0.0/easeljs.min.js:15:8148) at lib.Flowerfront.b.cache (https://code.createjs.com/1.0.0/easeljs.min.js:13:3361) at new lib.Bg (https://images.neopets-asset-proxy.openneo.net/cp/items/data/000/000/441/441520_f4a43d48bf/441520HTML5.js:4266:16) at new lib._441520HTML5 (https://images.neopets-asset-proxy.openneo.net/cp/items/data/000/000/441/441520_f4a43d48bf/441520HTML5.js:5291:18) at x (https://impress-2020.openneo.net/static/js/11.3a356cfe.chunk.js:1:12286) at https://impress-2020.openneo.net/static/js/11.3a356cfe.chunk.js:1:17768 at Array.map (<anonymous>) ``` To try to fix this, I've updated our Fastly config to version 8, which should accept CORS requests from https://impress-2020.openneo.net. And here, I've updated the movie clip assets to be requested CORS-style, so that the Origin header will actually be set. It's hard to test this without just, pushing it to prod. I've confirmed in isolation that setting the `Origin` header in the request yields the expected `Access-Control-Allow-Origin` response header, and that the `Vary` header is set correctly too. But, end-to-end, I don't really have great mockability here—maybe with a good proxy setup I could do it? But nah, let's just push and find out! |
||
---|---|---|
.storybook | ||
.vscode | ||
api | ||
public | ||
scripts | ||
src | ||
.gitignore | ||
config-overrides.js | ||
dev-todos.txt | ||
package.json | ||
README.md | ||
yarn.lock |
Dress to Impress 2020
This is a rewrite of the Neopets customization app, Dress to Impress!
It's a React app, built with create-react-app
, running on Vercel, JAMstack-style.
The motivating goals of the rewrite are:
- Mobile friendly, to match Neopets's move to mobile.
- Simple modern tech, to be more maintainable over time and decrease hosting costs.
If you want to contribute, please reach out to Matchu! This repository is almost shareable, but the main limitation is that we currently run even our development server against the production database, and those credentials are private. But we can change that if there's interest!
Architecture sketch
First, there's the core app, in this repository.
- React app: Runs on Vercel's CDN. Code in
src/app
. - API functions: Run on Vercel's Serverless Functions. Code in
api
andsrc/server
.
Then, there's our various data storage components.
- MySQL database: Runs on our Linode VPS, colocated with the old app.
- Amazon S3: Stores PNGs of pet/item appearance layers, converted from the Neopets SWFs. (Once Neopets releases HTML5-compatible assets for all their items, we can hopefully remove this!)
Finally, there's our third-party integrations.
- Auth0: For authentication. Data imported from our old OpenNeo ID auth database.
- Honeycomb: For observability & performance insights on the backend.
- Discord: For logging Support users' actions to a private Discord server.
- Neopets: We load pet data from them! And plenty of assets!
Notable old components not currently included in Impress 2020:
- Elasticsearch: Used for lightning-fast item search queries. So far, we're finding the MySQL queries to be fast enough in practice. Might consider using some kind of fulltext query engine if that doesn't scale with more users!
- Resque: Used to schedule background tasks for modeling and outfit thumbnails.
- Outfit thumbnail generation: Used for outfit thumbnails in the app. I'm wondering if there's a way to get away with not doing this, like just rendering the layers... but I suppose if we want a good social share experience, then we'll probably want this. Maybe we can generate them on the fly as API requests, instead of adding a data storage component?
- Memcache: Used to cache common HTML and JSON snippets. Not yet needing anything similar in Impress 2020!
- The entire old Rails app! No references to it in here, aside from some temporary URL links to features that aren't implemented here yet.