From 47efdd4f84cc9a29738fe16d631eb33ee716db61 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 27 Mar 2022 19:12:44 +0200 Subject: New wiki in wiki renderer (#97) * partly working and pushing cuz jani * way better rendering stuff but still not perfect * finish most of wiki renderer for new wiki * JANI MY FRIEND PLEASE TEST * Windows time :sad: * fix wiki renderer * Some things I forgor * changelog * Better corrupted file handling in graph and added check for crash that I have no idea how it happened. --- .../io/github/moulberry/notenoughupdates/NEUManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index df31834f..abe0bdcf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -23,6 +23,7 @@ import org.apache.commons.io.FileUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; +import javax.net.ssl.HttpsURLConnection; import javax.swing.JDialog; import javax.swing.JOptionPane; import java.io.*; @@ -1032,11 +1033,12 @@ public class NEUManager { } catch (IOException e) { return null; } - try ( - BufferedInputStream inStream = new BufferedInputStream(new URL( - url + "?action=raw&templates=expand").openStream()); - FileOutputStream fileOutputStream = new FileOutputStream(f) - ) { + try { + HttpsURLConnection con = (HttpsURLConnection) new URL(url + "?action=raw&templates=expand").openConnection(); + con.setRequestMethod("GET"); + con.setRequestProperty("User-Agent", "NotEnoughUpdates"); + BufferedInputStream inStream = new BufferedInputStream(con.getInputStream()); + FileOutputStream fileOutputStream = new FileOutputStream(f); byte[] dataBuffer = new byte[1024]; int bytesRead; while ((bytesRead = inStream.read(dataBuffer, 0, 1024)) != -1) { -- cgit