mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-11-07 13:04:32 +01:00
Significant rewrite to use 4koma, OkHttp, PackwizPath; fixing several issues
Github release plugin, Kotlin, Okio and OkHttp updated Toml4j removed and replaced with 4koma - improves null safety, immutability, TOML compliance kotlin-result removed (I don't think it was used anyway) SpaceSafeURI replaced with PackwizPath which handles special characters much better (fixes #5) Fixed directory traversal issues Hashing system rewritten for better type safety and cleaner code Download mode changed to use an enum Request system completely rewritten; now uses OkHttp for HTTP requests (fixes #36, fixes #5) Added request interceptor which retries requests (fixes #4) Removed: support for extracting packs from zip files (and Github zipballs) Cleaner exceptions; more improvements pending (in particular showing request failure causes) Improved speed of cancelling in-progress downloads Better support for installing from local files (no file: URI required; though it is still supported) Various code cleanup changes
This commit is contained in:
@@ -41,6 +41,16 @@ interface IUserInterface {
|
||||
|
||||
var optionsButtonPressed: Boolean
|
||||
var cancelButtonPressed: Boolean
|
||||
var cancelCallback: (() -> Unit)?
|
||||
|
||||
var firstInstall: Boolean
|
||||
|
||||
}
|
||||
|
||||
inline fun <T> IUserInterface.wrap(message: String, inner: () -> T): T {
|
||||
return try {
|
||||
inner.invoke()
|
||||
} catch (e: Exception) {
|
||||
showErrorAndExit(message, e)
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,12 @@ import kotlin.system.exitProcess
|
||||
class CLIHandler : IUserInterface {
|
||||
@Volatile
|
||||
override var optionsButtonPressed = false
|
||||
// TODO: treat ctrl+c as cancel?
|
||||
@Volatile
|
||||
override var cancelButtonPressed = false
|
||||
@Volatile
|
||||
override var cancelCallback: (() -> Unit)? = null
|
||||
@Volatile
|
||||
override var firstInstall = false
|
||||
|
||||
override var title: String = ""
|
||||
|
||||
@@ -28,7 +28,10 @@ class GUIHandler : IUserInterface {
|
||||
set(value) {
|
||||
optionalSelectedLatch.countDown()
|
||||
field = value
|
||||
cancelCallback?.invoke()
|
||||
}
|
||||
@Volatile
|
||||
override var cancelCallback: (() -> Unit)? = null
|
||||
var okButtonPressed = false
|
||||
set(value) {
|
||||
optionalSelectedLatch.countDown()
|
||||
|
||||
Reference in New Issue
Block a user