Skip to content

Commit

Permalink
Merge branch 'main' into modifiers-predict-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
midgleyc committed Jun 1, 2022
2 parents c10385b + e557e7e commit 8c59380
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/data/content-types.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Don't recognise any content types
14 changes: 14 additions & 0 deletions src/net/sourceforge/kolmafia/KoLmafia.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.math.BigInteger;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -111,6 +112,7 @@
import net.sourceforge.kolmafia.swingui.listener.LicenseDisplayListener;
import net.sourceforge.kolmafia.swingui.panel.GenericPanel;
import net.sourceforge.kolmafia.textui.AshRuntime;
import net.sourceforge.kolmafia.utilities.FileUtilities;
import net.sourceforge.kolmafia.utilities.LockableListFactory;
import net.sourceforge.kolmafia.utilities.LogStream;
import net.sourceforge.kolmafia.utilities.StringUtilities;
Expand All @@ -130,13 +132,25 @@ public abstract class KoLmafia {
System.setProperty("com.apple.mrj.application.live-resize", "true");
System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
System.setProperty("java.net.preferIPv4Stack", "true");
// override content types to avoid a Rhino problem
// see https://github.com/mozilla/rhino/issues/1232
ensureContentTypes();

if (SwinglessUIUtils.isSwingAvailable()) {
JEditorPane.registerEditorKitForContentType("text/html", RequestEditorKit.class.getName());
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
}

private static void ensureContentTypes() {
var contentTypesFile = KoLConstants.DATA_LOCATION.toPath().resolve("content-types.properties");
if (!Files.exists(contentTypesFile)) {
FileUtilities.loadLibrary(
KoLConstants.DATA_LOCATION, KoLConstants.DATA_DIRECTORY, "content-types.properties");
}
System.setProperty("content.types.user.table", contentTypesFile.toString());
}

public static String currentIterationString = "";
public static boolean tookChoice = false;
public static boolean redoSkippedAdventures = true;
Expand Down
1 change: 1 addition & 0 deletions test/root/expected/content-type-encoding.js.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Our Daily Candles™ order form
1 change: 1 addition & 0 deletions test/root/scripts/content-type-encoding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports.main = function() { var k = require("kolmafia"); k.print(k.Item.get("Our Daily Candles™ order form")) }

0 comments on commit 8c59380

Please sign in to comment.