Bug - Not A Bug Relay browser doesn't load images inside relay/ dir

philmasterplus

Active member
  • KoLmafia revision: r20662
My relay override UI script uses some custom images. Currently, my directory layout looks like this:
Code:
kolmafia.jar
relay/
  relay_100familiars.js    My relay script (executed by KoLmafia, works fine)
  100familiars/
    style.css              CSS for the relay UI (loads fine)
    100familiars.js        JS for the relay UI (loads fine)
    images/
      sort_asc.png         Image for the relay UI (not loading)
      sort_desc.png        Image for the relay UI (not loading)

In the relay browser, my relay script can load CSS and JS files like this:
HTML:
<script src="/100familiars/100familiars.js"></script>
<link rel="stylesheet" href="/100familiars/style.css" />

However, the images fail to load:
HTML:
<img src="/100familiars/images/sort_asc.png" /><!-- image fails to load -->

I tried moving the images to other directories, and it seems that images only work if they are placed inside the images/ directory under the KoLmafia root.
Code:
kolmafia.jar
images/
  100familiars/
    sort_asc.png           Accessible via /images/100familiars/sort_asc.png
    sort_desc.png          Accessible via /images/100familiars/sort_desc.png

This is problematic, however, because the cache clear command deletes all files under images/. (I learned this from this post and verified it myself).

I tested all other directories allowed under the current SVN spec: ccs/, data/, planting/, relay/, scripts/. However, it appears that only images/ allows custom images.

So I am stuck between:
  • Placing my images under images/, and telling my users never to run cache clear
  • ...or not using images at all
 
Last edited:

philmasterplus

Active member
Update: History tells me that the status quo is as it should be.
Images are cached only in /images or a subdirectory.

It's fine with me if there is one designated directory for relay overrides to store images in which we will not look at on a "cache clear", however that is done. images/relay seems fine.
It is safe to clear everything in /images, since if KoLmafia is asked to serve something there, it will copy it from it's built-in images if it is not there - except for custom images added by scripts, like chit. I believe that /images is the only built-in os-independant way for a relay script to put in a link to a local file into a page.

I like /images/relayimages/whatever as a "safe" directory of relay script images that KoLmafia will not clear by itself, when I add "cache clear" or whatever.

...and the cache clear command was implemented in r12657.

TL;DR: I can put my custom images under images/relayimages/ and it will be completely safe from cache clear.
 
Top