diff options
| author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-03-27 19:12:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-27 19:12:44 +0200 |
| commit | 47efdd4f84cc9a29738fe16d631eb33ee716db61 (patch) | |
| tree | af7514fac2d55c7a2885025d6e858b8a2cfa3b55 /src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | |
| parent | e202e4adf979073921455083f5e737bc4fcf5f14 (diff) | |
| download | notenoughupdates-47efdd4f84cc9a29738fe16d631eb33ee716db61.tar.gz notenoughupdates-47efdd4f84cc9a29738fe16d631eb33ee716db61.tar.bz2 notenoughupdates-47efdd4f84cc9a29738fe16d631eb33ee716db61.zip | |
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.
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 12 |
1 files changed, 7 insertions, 5 deletions
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) { |
