Revision 16841 fixes the Monster Manuel regexp for monster image to accept any of the following:
src=http://images.kingdomofloathing.com/...
src=/images/...
src=https://s3.amazonaws.com/images.kingdomofloathing.com/...
Note that the aws image is fetched with https. I assume by rewriting, you are referring to methods like these:
FileUtilities.java:
Code:
private static final String localImageName( final String filename )
{
if ( filename == null || filename.equals( "" ) )
{
return null;
}
String localname = filename.substring( filename.indexOf( "/", "http://".length() ) + 1 );
if ( localname.startsWith( "albums/" ) )
{
localname = localname.substring( 7 );
}
return localname;
}
That takes a KoL url and extracts the path. Notice that it assumes http:
RelayRequest.java:
Code:
private static String localImagePath( final String filename )
{
return filename.endsWith( "favicon.ico" ) ?
"http://www.kingdomofloathing.com/favicon.ico" :
filename.startsWith( "images" ) ?
"http://images.kingdomofloathing.com" + filename.substring( 6 ) :
filename;
}
This converts one of our "rewritten" URLs to go back to the old image server.
RelayRequest.java:
Code:
public static final void overrideImages( final StringBuffer buffer )
{
if ( !Preferences.getBoolean( "relayOverridesImages" ) )
{
return;
}
for ( String filename : IMAGES )
{
String find = "http://images.kingdomofloathing.com/" + filename;
String replace = "/images/" + filename;
StringUtilities.globalStringReplace( buffer, find, replace );
}
}
Only detects old image server.
I see that lost added this to KoLmafia.java:
Code:
// Currently this setting is only meaningful when logging in to the
// dev server. More code changes will possibly be needed later
public static boolean useAmazonImages = false;
I'm adding the following:
Code:
public String imageServerPath()
{
return KoLmafia.useAmazonImages ?
"https://s3.amazonaws.com/images.kingdomofloathing.com/" :
"http://images.kingdomofloathing.com/";
}
and using at as seems appropriate.
That won't solve the various regexps to work on either, but the change I made to MonsterManuelManager should work with either.