1
0
Fork 0
forked from OpenNeo/impress
Commit graph

57 commits

Author SHA1 Message Date
dc44b4dbb3 Oops, fix bug with saving outfits of pets loaded from Neopets.com
Okay right, the wardrobe-2020 app treats `state` as a bit of an
override thing, and `pose` is the main canonical field for how a pet
looks. We were missing a few pieces here:

1. After loading a pet, we weren't including the `pose` field in the
   initial query string for the wardrobe URL, but we _were_ including
   the `state` field, so the outfit would get set up with a conflicting
   pet state ID vs pose.
2. When saving an outfit, we weren't taking the `state` field into
   account at all. This could cause the saved outfit to not quite match
   how it actually looked in-app, because the default pet state for
   that species/color/pose trio could be different; and regardless, the
   outfit state would come back with `appearanceId` set to `null`,
   which wouldn't match the local outfit state, which would trigger an
   infinite loop.

Here, we complete the round-trip of the `state` field, from pet loading
to outfit saving to the outfit data that comes back after saving!
2024-02-08 09:51:31 -08:00
ba45de583f Oops, don't update body_id when there's an alt style! 2024-01-24 06:12:35 -08:00
e511bdc5e2 Oops right, it's okay to work with an alt style we've already seen! 2024-01-24 04:01:34 -08:00
4e5023288e Track contributions of Alt Styles 2024-01-24 03:54:43 -08:00
5004142dfb Add alt style support to modeling
Nothing to show them yet, but I think this works for loading it all in
the first place?

Still needs contributions tho!
2024-01-24 03:25:23 -08:00
4888a9dcbe Oops, remove stray viewer_data reader from Pet
This is left over from a previous plan I had, before moving
`fetch_viewer_data` to a class method.
2024-01-24 01:00:53 -08:00
b0e7f2ccd5 Move lib/rocketamf -> lib/rocketamf_extensions, to fix reload issues
Something in the Rails loader doesn't like that I have both a gem and
a lib folder named `RocketAMF`, I think? It'll often work for the first
pet load request, then on subsequent ones say `Envelope` is not
defined, I'm guessing because it scrapped the gem's module in favor of
mine?

Idk, let's just simplify all this by making our own module. I feel like
this old lib could use an overhaul and simplification anyway, but this
will do for now!
2024-01-24 00:59:11 -08:00
0406a32444 Disable loading alt style pets specifically 2024-01-24 00:54:30 -08:00
c33f1cb767 Extract Pet.fetch_viewer_data to a class method
This will make it easy to look up pet data from Neopets without messing
around with how the Pet model handles it!
2024-01-24 00:51:20 -08:00
c76e8cd2a9 Allow admin users to load pets
Also allows the new rake task we're building to load, too!
2024-01-24 00:42:35 -08:00
b1eca2f3a5 Disable modeling while we fix Alt Styles rollout bugs 2024-01-24 00:19:28 -08:00
44d9f98313 Increase pet loading timeout 2024-01-23 22:10:42 -08:00
94d15f005d Delete a couple unused accessors
At least, I think they are!
2023-11-11 15:42:08 -08:00
3a963c7d25 Fix old .scoped -> .all Rails upgrade bug
Ahh, I guess I missed these, I think they're maybe not actually used in
the app is why? cuz they're all default values that are overridden at
the actual call sites. But I ran into it when running `Pet.load` in the
console, and yeah let's just fix 'em up!
2023-11-09 21:35:42 -08:00
d8b0bf3174 Skip item translations when modeling
Okay, this is a process that idk if it's even been working for a while anyway, I don't think Neopets translates item names anymore?

And it's crashing when I try to model stuff now, so like. yeah ok I'm fine with just skipping this, it's a shame to lose out on potential data going forward but *I think there just isn't data to get anyway*
2023-10-23 19:05:10 -07:00
cbad00f32d Fix AMFPHP requests
Okay, right, if we're just using www.neopets.com (like we are for now), it fails on http://www.neopets.com because it triggers a redirect that we don't follow.

So here I 1) change the default to HTTPS, and 2) add HTTPS support to our little RocketAMF lib
2023-10-23 19:05:09 -07:00
1e690d9f6c Fix old find_or_initialize_by methods
I missed this in the Rails upgrades, oops!
2023-10-23 19:05:09 -07:00
d97c32b5da Upgrade to Rails 5.2.8.1
Some important little upgrades but mostly straightforward!

Note that there's still a known issue where item searches crash, I was hoping that this was a bug in Rails 4.2 that would be fixed on upgading to 5, but nope, oh well!

Also uhh I just got a bit silly and didn't actually mean to go all the way to 5.2 in one go, I had meant to start at 5.0… but tbh the 5.1 and 5.2 changes seem small, and this seems to be working, so. Yeah ok let's roll!
2023-10-23 19:05:05 -07:00
a15cbeb307 Remove pet state labeling & Neopets gem
This labeling technique hasn't worked in a long time bc it requires being logged in. These days we just manually label them with the 2020 support tools I think!

Clearing out the Neopets gem should help us manage some gem dep conflicts in the 4.2 upgrade too (I think the nokogiri one gets tricky?)
2023-10-23 19:05:05 -07:00
Matchu
a29e016555 Update to new scope syntax
Ohh ok, without this change all of our `scope`s were just immediately evaluating the argument and fetching _all_ such matching records immediately, instead of waiting to actually be called. This led to bugs like `pet_type.as_json` returning ALL pet states in the whole db, because the `PetState.emotion_order` scope was being treated as a single predefined query, rather than a query fragment to merge into the current context.

This also explains what happened in 724ed83: that's why things before the scope in the query were being ignored.
2023-10-23 19:05:03 -07:00
Emi Dunn-Rankin
568a3645de
Use secret NEOPETS_URL_ORIGIN to bypass HTTPS
Oops, neopets.com finally stopped accepting `http://` connections, so our AMFPHP requests stopped working! And our current dependencies make it hard to make modern HTTPS requests :(

Instead, we're doing this quick-fix: we have a connection who knows the internal address for the Neopets origin server behind their CDN, which *does* still accept `http://` requests!

So, when `NEOPETS_URL_ORIGIN` is specified in the secret `.env` file (not committed to the repository), we'll use it instead of `http://www.neopets.com`. However, we still have that in the code as a fallback, just to be a bit less surprising to some theoretical future dev so they can see the real error message, and to self-document a bit of what that value is semantically doing! (The documentation angle is more of why it's there, rather than an actual expectation that any actual person in the future will run the code and get the fallback.)
2022-08-02 20:46:47 -07:00
Matchu
c5c587fab1 stop crashing when trying to translate item names 2015-07-27 13:23:46 -04:00
7c6e607612 basic neopia api integration 2014-01-10 16:25:02 -05:00
082119afe1 fix some mall spider bugs, including not having all the attributes it needed for search indexing 2013-07-09 21:00:36 -07:00
9bd49aa85d first step in repairing mall spider 2013-07-09 20:01:55 -07:00
6cad85cec1 iron out some rails 3.1 compatibility issues 2013-03-05 15:41:55 -06:00
f547a75c40 ruby 2.0.0 compatibility... hopefully. 2013-02-25 01:14:45 -05:00
2cc688f7ff bump up pet load timeout 2013-01-28 17:52:10 -06:00
f59fa92aa1 oops, dont include duplicate items in wardrobe after translating 2013-01-28 17:02:33 -06:00
eab14e31fd waaay speed up Pet#translate_items
A few key changes:
  * Don't reload the whole pet 8 times!! Sooo many bad things
    happen, including redundant lookups of everything else and
    too many item saves and reindexes. Instead, fetch the item
    data, apply it to the items, and then save the items (once
    each!)
  * Updated my branch of globalize3 to be even better at avoiding
    redundant queries when saving. Woo.
  * Last realization: wrapping all the item saves in a single
    transaction works wonders. COMMIT seems to have high overhead,
    so doing only one took it from 50ms * 10 or whatever to 60ms.
    Good stuff.
2013-01-28 15:18:11 -06:00
482b1a155d ugh, fine, save the pets sequentially 2013-01-28 03:02:20 -06:00
a39110884d cut down on pets#load queries 2013-01-28 02:10:25 -06:00
6c3ff09f5d make en-MEEP translatable - because sorting by translations doesnt work well with fallbacks 2013-01-27 20:43:08 -06:00
573e8a6459 use I18n.with_locale wherever possible, since it catches errors properly
In particular, pet#load was handling locale-switching itself, but wasn't
switching back to original locale on error. We could've used a rescue
block, but, when I18n.with_locale is so cool, may as well use it fully.
2013-01-25 15:09:56 -06:00
dd30fbe0d7 move from with_translations to includes(:translations), since we dont usually care about requiring 2013-01-24 18:26:00 -06:00
c9ae7155b1 locale metadata, including hidden locales for item loading and selection 2013-01-24 18:24:34 -06:00
ef2423e87f globalize3 for items 2013-01-24 18:24:34 -06:00
29ed401238 load pet by locale, prepare needed translations 2013-01-24 18:24:34 -06:00
7dfc6d81a2 add timeout to pet load 2012-08-11 18:47:25 -04:00
c2c6a800f2 track pet state gender/mood 2012-05-23 20:00:38 -04:00
ec3088fdec ensure that pet state is saved before trying to save its assets 2012-01-13 15:56:31 -06:00
cc23f7435b automatically rezone bio 2011-10-31 16:22:24 -05:00
4e919aca04 ree compatibility 2011-05-31 10:36:32 -04:00
3d05bbeeed instead of crashing in mall spider when pet not found, delete pet and find a new one 2011-05-21 22:32:01 -04:00
8ff6c5ad9c pet state order fix, and maybe some contribution fixes 2011-02-22 17:54:20 -05:00
2a7fea11e6 handle timeout errors for pet data, swfs, pet images 2011-02-19 22:49:13 -05:00
3d29f7784f asset spider, yaaay 2010-11-27 18:41:06 -05:00
8e6a34b69c fix contributions for pet states and items
dependent contributables would only count as contributed if their parent
was being contributed for the first time, too. the trick was to delay
actually *assigning* them to their parents until the very, very end
2010-11-15 17:56:16 -05:00
7db0beec75 points for bulk pet adding 2010-11-06 19:07:15 -04:00
d10ab2615f actually contributing things, yay 2010-11-06 18:08:45 -04:00