mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-26 05:24:09 +01:00
Add auth support to socsk proxy
This commit is contained in:
@@ -39,6 +39,8 @@ class SettingsMutation {
|
||||
updateSetting(settings.socksProxyEnabled, serverConfig.socksProxyEnabled)
|
||||
updateSetting(settings.socksProxyHost, serverConfig.socksProxyHost)
|
||||
updateSetting(settings.socksProxyPort, serverConfig.socksProxyPort)
|
||||
updateSetting(settings.socksProxyUsername, serverConfig.socksProxyUsername)
|
||||
updateSetting(settings.socksProxyPassword, serverConfig.socksProxyPassword)
|
||||
|
||||
// webUI
|
||||
updateSetting(settings.webUIFlavor?.uiName, serverConfig.webUIFlavor)
|
||||
|
||||
@@ -23,6 +23,8 @@ interface Settings : Node {
|
||||
val socksProxyEnabled: Boolean?
|
||||
val socksProxyHost: String?
|
||||
val socksProxyPort: String?
|
||||
val socksProxyUsername: String?
|
||||
val socksProxyPassword: String?
|
||||
|
||||
// webUI
|
||||
// requires restart (found no way to mutate (serve + "unserve") served files during runtime), exclude for now
|
||||
@@ -94,6 +96,8 @@ data class PartialSettingsType(
|
||||
override val socksProxyEnabled: Boolean?,
|
||||
override val socksProxyHost: String?,
|
||||
override val socksProxyPort: String?,
|
||||
override val socksProxyUsername: String?,
|
||||
override val socksProxyPassword: String?,
|
||||
// webUI
|
||||
override val webUIFlavor: WebUIFlavor?,
|
||||
override val initialOpenInBrowserEnabled: Boolean?,
|
||||
@@ -152,6 +156,8 @@ class SettingsType(
|
||||
override val socksProxyEnabled: Boolean,
|
||||
override val socksProxyHost: String,
|
||||
override val socksProxyPort: String,
|
||||
override val socksProxyUsername: String,
|
||||
override val socksProxyPassword: String,
|
||||
// webUI
|
||||
override val webUIFlavor: WebUIFlavor,
|
||||
override val initialOpenInBrowserEnabled: Boolean,
|
||||
@@ -209,6 +215,8 @@ class SettingsType(
|
||||
config.socksProxyEnabled.value,
|
||||
config.socksProxyHost.value,
|
||||
config.socksProxyPort.value,
|
||||
config.socksProxyUsername.value,
|
||||
config.socksProxyPassword.value,
|
||||
// webUI
|
||||
WebUIFlavor.from(config.webUIFlavor.value),
|
||||
config.initialOpenInBrowserEnabled.value,
|
||||
|
||||
@@ -82,6 +82,8 @@ class ServerConfig(getConfig: () -> Config, val moduleName: String = SERVER_CONF
|
||||
val socksProxyEnabled: MutableStateFlow<Boolean> by OverrideConfigValue(BooleanConfigAdapter)
|
||||
val socksProxyHost: MutableStateFlow<String> by OverrideConfigValue(StringConfigAdapter)
|
||||
val socksProxyPort: MutableStateFlow<String> by OverrideConfigValue(StringConfigAdapter)
|
||||
val socksProxyUsername: MutableStateFlow<String> by OverrideConfigValue(StringConfigAdapter)
|
||||
val socksProxyPassword: MutableStateFlow<String> by OverrideConfigValue(StringConfigAdapter)
|
||||
|
||||
// webUI
|
||||
val webUIEnabled: MutableStateFlow<Boolean> by OverrideConfigValue(BooleanConfigAdapter)
|
||||
|
||||
@@ -236,14 +236,25 @@ fun applicationSetup() {
|
||||
serverConfig.socksProxyEnabled,
|
||||
serverConfig.socksProxyHost,
|
||||
serverConfig.socksProxyPort,
|
||||
) { proxyEnabled, proxyHost, proxyPort ->
|
||||
Triple(proxyEnabled, proxyHost, proxyPort)
|
||||
serverConfig.socksProxyUsername,
|
||||
serverConfig.socksProxyPassword,
|
||||
) { proxyEnabled, proxyHost, proxyPort, proxyUsername, proxyPassword ->
|
||||
data class DataClassForDestruction(
|
||||
val proxyEnabled: Boolean,
|
||||
val proxyHost: String,
|
||||
val proxyPort: String,
|
||||
val proxyUsername: String,
|
||||
val proxyPassword: String,
|
||||
)
|
||||
DataClassForDestruction(proxyEnabled, proxyHost, proxyPort, proxyUsername, proxyPassword)
|
||||
},
|
||||
{ (proxyEnabled, proxyHost, proxyPort) ->
|
||||
{ (proxyEnabled, proxyHost, proxyPort, proxyUsername, proxyPassword) ->
|
||||
logger.info("Socks Proxy changed - enabled= $proxyEnabled, proxy= $proxyHost:$proxyPort")
|
||||
if (proxyEnabled) {
|
||||
System.getProperties()["socksProxyHost"] = proxyHost
|
||||
System.getProperties()["socksProxyPort"] = proxyPort
|
||||
System.getProperties()["java.net.socks.username"] = proxyUsername
|
||||
System.getProperties()["java.net.socks.password"] = proxyPassword
|
||||
} else {
|
||||
System.getProperties()["socksProxyHost"] = ""
|
||||
System.getProperties()["socksProxyPort"] = ""
|
||||
|
||||
@@ -6,6 +6,8 @@ server.port = 4567
|
||||
server.socksProxyEnabled = false
|
||||
server.socksProxyHost = ""
|
||||
server.socksProxyPort = ""
|
||||
server.socksProxyUsername = ""
|
||||
server.socksProxyPassword = ""
|
||||
|
||||
# webUI
|
||||
server.webUIEnabled = true
|
||||
|
||||
@@ -6,6 +6,8 @@ server.port = 4567
|
||||
server.socksProxyEnabled = false
|
||||
server.socksProxyHost = ""
|
||||
server.socksProxyPort = ""
|
||||
server.socksProxyUsername = ""
|
||||
server.socksProxyPassword = ""
|
||||
|
||||
# downloader
|
||||
server.downloadAsCbz = false
|
||||
|
||||
Reference in New Issue
Block a user