mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-10-17 08:24:32 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8beded7b41 | ||
|
91060dcd54 | ||
|
e06ee21f3b |
@@ -255,8 +255,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!indexFileSource.hashIsEqual(indexHash)) {
|
if (!indexFileSource.hashIsEqual(indexHash)) {
|
||||||
// TODO: throw exception
|
ui.handleExceptionAndExit(RuntimeException("Your index hash is invalid! Please run packwiz refresh on the pack again"))
|
||||||
println("I was meant to put an error message here but I'll do that later")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (stateHandler.cancelButton) {
|
if (stateHandler.cancelButton) {
|
||||||
|
@@ -4,6 +4,7 @@ import link.infra.packwiz.installer.metadata.SpaceSafeURI
|
|||||||
import link.infra.packwiz.installer.request.IRequestHandler
|
import link.infra.packwiz.installer.request.IRequestHandler
|
||||||
import okio.Source
|
import okio.Source
|
||||||
import okio.source
|
import okio.source
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
|
||||||
open class RequestHandlerHTTP : IRequestHandler {
|
open class RequestHandlerHTTP : IRequestHandler {
|
||||||
override fun matchesHandler(loc: SpaceSafeURI): Boolean {
|
override fun matchesHandler(loc: SpaceSafeURI): Boolean {
|
||||||
@@ -12,14 +13,17 @@ open class RequestHandlerHTTP : IRequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getFileSource(loc: SpaceSafeURI): Source? {
|
override fun getFileSource(loc: SpaceSafeURI): Source? {
|
||||||
val conn = loc.toURL().openConnection()
|
val conn = loc.toURL().openConnection() as HttpURLConnection
|
||||||
// TODO: when do we send specific headers??? should there be a way to signal this?
|
// TODO: when do we send specific headers??? should there be a way to signal this?
|
||||||
// github *sometimes* requires it, sometimes not!
|
conn.addRequestProperty("Accept", "application/octet-stream")
|
||||||
//conn.addRequestProperty("Accept", "application/octet-stream");
|
// TODO: include version?
|
||||||
|
conn.addRequestProperty("User-Agent", "packwiz-installer")
|
||||||
|
|
||||||
conn.apply {
|
conn.apply {
|
||||||
// 30 second read timeout
|
// 30 second read timeout
|
||||||
readTimeout = 30 * 1000
|
readTimeout = 30 * 1000
|
||||||
|
requestMethod = "GET"
|
||||||
}
|
}
|
||||||
return conn.getInputStream().source()
|
return conn.inputStream.source()
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -180,9 +180,16 @@ class InstallWindow : IUserInterface {
|
|||||||
override fun showOptions(options: List<IOptionDetails>): Future<Boolean> {
|
override fun showOptions(options: List<IOptionDetails>): Future<Boolean> {
|
||||||
val future = CompletableFuture<Boolean>()
|
val future = CompletableFuture<Boolean>()
|
||||||
EventQueue.invokeLater {
|
EventQueue.invokeLater {
|
||||||
OptionsSelectWindow(options, future, frmPackwizlauncher).apply {
|
if (options.isEmpty()) {
|
||||||
defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE
|
JOptionPane.showMessageDialog(null,
|
||||||
isVisible = true
|
"This modpack has no optional mods!",
|
||||||
|
"Optional mods", JOptionPane.INFORMATION_MESSAGE)
|
||||||
|
future.complete(false)
|
||||||
|
} else {
|
||||||
|
OptionsSelectWindow(options, future, frmPackwizlauncher).apply {
|
||||||
|
defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE
|
||||||
|
isVisible = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return future
|
return future
|
||||||
@@ -201,7 +208,7 @@ class InstallWindow : IUserInterface {
|
|||||||
|
|
||||||
override fun disableOptionsButton() {
|
override fun disableOptionsButton() {
|
||||||
btnOptions.apply {
|
btnOptions.apply {
|
||||||
text = "Optional mods..."
|
text = "No optional mods"
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user