Bug - Waiting for Info Golden gun profile image issue

QVamp

Member
Apparently when you use the golden gun, it changes your profile image to gold. However, it does this by encoding the entire image in the data "data:image/png;base64"

In mafia, the image shows up as a broken image.

The properties of the gun aren't recorded yet (I was trying to do this very thing), so I'm not sure if it is time-sensitive. But you might be able to see the issue by pulling up QVamp's profile. I'm using no more turns tonight, so if it is turn based, it should stay that way.
 

QVamp

Member
sorry, I realized I didn't specify... the <img src=""> attribute is the data:image.

And to help more, Mafia ultimately says:

<img crossorigin="Anonymous" src="/iii/otherimages/ed_av1.gif" width="60" height="100" border="0">

... I have no idea where this src comes from.
 

lostcalpolydude

Developer
Staff member
My brief bit of time looking at this a while ago leads me to believe this falls somewhere in Not a (mafia) Bug or Won't Fix. Maybe someone else will see a straightforward fix though.
 

Bale

Minion
Not a mafia bug? How so? I have noticed that this bug does not happen when I use native KoL, so it seems likely that mafia is failing to handle a KoL feature.
 

heeheehee

Developer
Staff member
The /iii/ prefix is also present in KoL. I imagine the issue is that we're not treating that as an image URL, so we're not caching it.
 

heeheehee

Developer
Staff member
This report is not quite correct.

HTML snippet from the profile page:
PHP:
<table><tr><td><script language="javascript" src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/ocrs.20151224.js"></script><link rel="stylesheet" href="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/ocrs.css" /><div class='gold' style='position: relative'><img  src="/iii/otherimages/jarlsberg_avatar.gif" width=60 height=100 border=0></div></td>

This is implemented by piggybacking off the OCRS image manipulation javascript. I would surmise that modifying the images regex to include /iii as a possible prefix is the simplest fix.
 

heeheehee

Developer
Staff member
Yes, that's because it looks to be expired (or something). I used a golden gun on my multi, sleepyone (#1964444), so you can see it there for now.

Secondary wrinkle I noticed (after adding "/iii" to the regex in RelayAgent.java) is that KoL modified ocrs.20151224.js without bumping the version number; we're over-aggressively caching, unfortunately. I removed the cached copy, restarted Mafia, and it displays as expected.
 

Veracity

Developer
Staff member
However, I had a multi buy a golden gun and use it on himself, so now I can experiment.
 

Veracity

Developer
Staff member
Secondary wrinkle I noticed (after adding "/iii" to the regex in RelayAgent.java) is that KoL modified ocrs.20151224.js without bumping the version number; we're over-aggressively caching, unfortunately. I removed the cached copy, restarted Mafia, and it displays as expected.
KoL modified it? Did it, at lease, update the modified date?
 

heeheehee

Developer
Staff member
KoL modified it? Did it, at lease, update the modified date?

Yes.

HTTP/1.1 200 OK
x-amz-id-2: eCR+aieWt5M85wjvgn+gxyrn2GnZxpqDg4jXbA0wYzGfRt5nND/AAXqd/8JLyxlltaFHMK2/RLk=
x-amz-request-id: 7E31DC208E91A5F5
Date: Sat, 05 Aug 2017 15:48:45 GMT
Last-Modified: Wed, 31 May 2017 23:03:41 GMT
ETag: "367351b4f75a1da82e51ea8b79fea94f"
x-amz-meta-s3cmd-attrs: uid:0/gname:asym_images/uname:root/gid:1000/mode:33204/mtime:1205288282/atime:1458845490/md5:45a04502549033f59a7820a3066bcc5c/ctime:1381342807
Cache-Control: public,max-age=31536000
Accept-Ranges: bytes
Content-Type: text/javascript
Content-Length: 11527
Server: AmazonS3
 

Veracity

Developer
Staff member
I added /iii as a valid image prefix and it works.

Regarding caching, we are willing to cache anything from an image directory - unless it is in the "excludes" list and serve it back to the Browser. We will only check the modification date if the Browser specifically says If-Modified-Since. Interesting that the Browser apparently doesn't cache .js files.

I suppose we could, ourself, ask KoL for an If-Modified-Since download for anything we have cached (or perhaps only for .js files?) and update our cache if KoL has a newer version. That would guard against KoL making a stealth update of a versioned file, as it did this time, which unambiguously seems to be an Operational bug on KoL's part, but we cannot for KoL devs to necessarily do the right thing.
 

Veracity

Developer
Staff member
Revision 18171 adds /iii as a valid image directory. Gold images work for me.

Asking KoL for an If-Not-Modified download for any (.js) file we already have cached would be a bigger project.

An easier - but, perhaps less successful - "solution" would be to report the KoL bug to KoL and have CDM update the version number of the ocrs Javascript file.
 

heeheehee

Developer
Staff member
Oh, my browser (Chromium... 61, masquerading as 55 for some strange reason) does cache js files (the server specified an expiry of 1 year); I was simply forcing it to ignore its cache via developer console.

I wonder if it's not sending the If-Not-Modified headers because the max age of the resource is set to 1 year.
 
Top