Bug - Fixed Snojo images disappeared by mafia in disguise delimit path

Veracity

Developer
Staff member
I will comment that your DEBUG log doesn't show anything useful; you are in the Relay Browser, KoL sends back images in the response and, we assume, KoLmafia simply sends down the page, at which point it is up to the browser to display the page.

Perhaps you are trying to say that KomafiaL is modifying the page and removing images before sending down the page.

There is no code in KoLmafia which does that. Relay scripts can do that. I don't see that you are running one.
I see that the script is asking for various "powerpixel" images. I think that is due to Javascipt; there is a "powerpixel" ocrs variable there.

Turn on the "Extra Debugging" setting which says "Logged decorated responses in debug log" and we can compare what KoL sends to KoLmafia with what KoLmafia sends to the browser.

Since, as I said, KoLmafia has no code which modifies the monster images, I suspect there will be no difference, which will make this an issue with your browser.
 

taltamir

Member
Perhaps you are trying to say that KomafiaL is modifying the page and removing images before sending down the page.
That is what I was trying to say.

In disguise delimit, while wearing powerful glove (I initially did not realize it was the cause. but it is. without powerful glove disguise delimit snojo looks normal), kol images of the snojo training snowman become very warped.

when they become warped in base kol then mafia does not send them to relay browser.

Here is a debug log with extra logging
View attachment DEBUG_20200617.txt

Disguise Delimit + powerful glove in base kol looks like:
https://imgur.com/HMHVR5L


In mafia looks like
https://imgur.com/NoSFXQq
 
Last edited:

Veracity

Developer
Staff member
Your log shows KoLmafia sending down every image that the browser requested.
powerPixels is the OCRS style added by the powerful glove.
It is generated, in Javascript, by scripts/ocrs.20200128.js
That requests 7 extra files to be loaded:

Code:
Requesting: http://www.kingdomofloathing.com/undefined
0 request properties
Server returned response code 404 (Not Found)

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p1.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p1.png
15 header fields

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p2.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p2.png
15 header fields

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p3.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p3.png
15 header fields

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p4.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p4.png
15 header fields
 
Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p5.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p5.png
15 header fields

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p6.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p6.png
15 header fields

Requesting: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p7.png
0 request properties
Retrieved: http://www.kingdomofloathing.com/iii/otherimages/powerpixels/p7.png
15 header fields
Notice that the browser is also requesting "undefined". I suspect that indicates a javascript error.

But, contrary to your assertion that "KoLmafia is not sending down the images", I think it is sending every image that the browser requests.
I did not see the browser asking for any of the snowman part images.

I will try visiting the snowman with a powerful glove equipped sometime today.
I will also check the "verbosely log communiztion between the browser and KoLmafia" log setting.
 

Veracity

Developer
Staff member
The snowman images disappear in vanilla KoL on Chrome on my mac if I am wearing a Powerful Glove:

Screen Shot 2020-06-17 at 4.29.55 AM.png
There are errors on the Javascript console:

Screen Shot 2020-06-17 at 4.30.14 AM.png
Not seeing any difference between vanilla KoL and the Relay Browser for this on my computer.
There are definitely bugs in ocrs.20200128.js
 

Veracity

Developer
Staff member
By the way - I noticed that KoL was sending down png images with the "Access-Control-Allow-Origin: *" header, but we were not sending it to the Browser, since we were generating a pseudo response, since we were sending via our Image Cache. It's up to the Javascript whether it needs that and, apparently, the new powerPixels code omits the specification that DOESN'T require it.

Revision 20193 sets that header in pseudo-responses.
This eliminates some of the Javascript errors I was getting (not shown in previous message, since I was already testing this change.)
However it otherwise doesn't change anything for me, since the blank Snowman image still happens, both in the Relay Browser, and in vanilla KoL.
 

xKiv

Active member
I am seeing a glove-modified snowman image in vanilla kol in firefox 77.0.1 on windows. It disappears in chrome 83 on the same system.

It's up to the Javascript whether it needs that

My understanding is that it is up to the *browser* whether it will use this. If the browser (wants and) doesn't see access-control-allow-origin that allows use of the response then the javascript will only see an error.
Implementation of this of course varies/varied over browsers, their versions, and possibly tweaked config options.
It might also be affected by some addons (for example: if code on http://a.b.c/ requests data from https://a.b.c/ then it will normally require the header; but if I have an addon like "https everywhere", then the code itself was loaded from https://a.b.c/ and therefore is same-origin with the data ; this specific example should be irrelevant in the case of KoL).

Being in mafia could be relevant for requests that are not passed through mafia (because then the page/javascript origin is http://127.0.0.1:600080/ and that's not the same origin as https://s3.amazonaws.com/) ... if kol (AWS?) didn't return "access-control-allow-origin: *".

chrome - request
Code:
GET /images.kingdomofloathing.com/otherimages/combatsnowman/spookyresistor.png HTTP/1.1
Origin: https://www.kingdomofloathing.com
Referer: https://www.kingdomofloathing.com/fight.php?ireallymeanit=1592429089
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36

chrome - respones
Code:
HTTP/1.1 200 OK
x-amz-id-2: 8Zk66xlauhwaS08N6jrlZj92+7rX/VvDZHzm+QSf2U/umXyavGDmzcbbbAiiECxw9fYOtRFbSCA=
x-amz-request-id: 2993A3900445BBF4
Date: Wed, 17 Jun 2020 21:24:52 GMT
Last-Modified: Mon, 28 Mar 2016 19:27:27 GMT
ETag: "c269c8148aa6768db764cbfb3098ea4c"
x-amz-meta-s3cmd-attrs: uid:1003/gname:asym_images/uname:jick/gid:1000/mode:33204/mtime:1449795938/atime:1458843343/md5:c269c8148aa6768db764cbfb3098ea4c/ctime:1449796359
Cache-Control: public,max-age=31536000
Accept-Ranges: bytes
Content-Type: image/png
Content-Length: 2097
Server: AmazonS3

firefox - request
Code:
GET /images.kingdomofloathing.com/otherimages/combatsnowman/spookyresistor.png HTTP/1.1
Host: s3.amazonaws.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Accept: image/webp,*/*
Accept-Language: en-US,en;q=0.7,cs;q=0.3
Accept-Encoding: gzip, deflate, br
Origin: https://www.kingdomofloathing.com
Connection: keep-alive
Referer: https://www.kingdomofloathing.com/fight.php?ireallymeanit=1592429295

firefox - response
Code:
HTTP/1.1 200 OK
x-amz-id-2: UnkT1YOGQ5ZQsEQGnh7idOwSSlgoVeCcoOx3RBGs+FPsdrX3kKIXVyNPiUTGixrR/mPSfDRfVCE=
x-amz-request-id: B4A6F35C361F2EB5
Date: Wed, 17 Jun 2020 21:28:19 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
Access-Control-Expose-Headers: Access-Control-Allow-Origin
Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
Last-Modified: Mon, 28 Mar 2016 19:27:27 GMT
ETag: "c269c8148aa6768db764cbfb3098ea4c"
x-amz-meta-s3cmd-attrs: uid:1003/gname:asym_images/uname:jick/gid:1000/mode:33204/mtime:1449795938/atime:1458843343/md5:c269c8148aa6768db764cbfb3098ea4c/ctime:1449796359
Cache-Control: public,max-age=31536000
Accept-Ranges: bytes
Content-Type: image/png
Content-Length: 2097
Server: AmazonS3


firefox sends more request headers (host, accept, accept-language, accept-encoding, connection) and different user-agent.
firefox receives more response headers (access-control-allow-origin, access-control-allow-methods, access-control-expose-headers, vary).

I don't think we can fix this mafia-side, unless we force those access control headers on everything?
Anyway, looks like something that should be fixed by KoL, AWS, or chrome. I am guessing chrome.
 

taltamir

Member
To clarify. the 2 comparison images I posted earlier were both from latest version firefox. Showing the difference between mafia and base kol on the same browser.

Tested today with 20194 and it is still not showing when going through mafia and showing when going directly to kol. same as the prior posted pictures
firefox v77.0.1 64bit
 
Last edited:

Veracity

Developer
Staff member
Well, I have found an actual problem - which I can fix.

Our RelayAgent modifies strings it finds in KoL html to point to "/images", which goes through our local image cache, backed by KoL, if it is not present.

Code:
	private final static Pattern IMAGE_PATTERN = Pattern.compile( "(" + KoLmafia.AMAZON_IMAGE_SERVER +
								      "|" + KoLmafia.KOL_IMAGE_SERVER +
								      "|" + "/iii" +
								      "|" + "//images.kingdomofloathing.com" +
								      "|" + "http://pics.communityofloathing.com/albums" +
								      ")" + RelayAgent.NOCACHE_IMAGES );
Notice that sometimes KoL uses "/iii" as a shortcut to "images.kingdomofloathing.com".

But KoL-provided Javascript also uses this shortcut when downloading imges - and we were not recognizing that.

In particular, the "powerPixels" support did that.

Revision 20195 treats browser requests for "/iii/...stuff" to be a request for an image, which is handled by our image cache.

With this, here is a screen shot of the Snowman in my Chrome Relay Browser.

Screen Shot 2020-06-17 at 6.41.17 PM.png
I find that image to be all but useless - but you can look at the hover text over each segment.

I cannot explain why Chrome was not showing this to me logged in natively before, but I think this fixes your issue.
 

Veracity

Developer
Staff member
And I took my Powerful Glove to fight a random other monster, and, good grief. Now, for the first time, I see why people were complaining about how it messes up monster images. I wore my Powerful Glove all through Plumber and Low-Key runs, collecting pixels and bypassing the 8-bit realm, but all that I saw was weird eyes on all the monsters. Now I see that it crudifies the rest of the image, as well.

I wonder if I could put in a feature to remove that modifier from supplied ocrs arrays when decorating fight.php in the Relay Browser. I could make a list of "modifiers to add" (drippy, rainbow, ...) and a list of "modifiers to remove" (powerPixel)
 
Top