This commit is contained in:
Adrian Siekierka 2025-04-06 13:25:30 +02:00
parent 7fecb0732c
commit d1599ab8b6
5 changed files with 12 additions and 13 deletions

View File

@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.4.1614-1.7.10
oc.version=1.8.7-snapshot
oc.version=1.8.8-snapshot
ae2.version=rv2-stable-10
bc.version=7.1.24

View File

@ -1,17 +1,7 @@
## Fixes/improvements
* [#3703] Fix potential packet memory leak.
* [#3729] Fix potential crash when opening the manual.
* Added a configuration option for network packet TTL. (Timothé GRISOT)
* Improved mod load times on certain platforms. (charagarland)
* Updated Chinese translation. (HfSr)
* Updated Unifont to 16.0.02.
## OpenOS fixes/improvements
* [#3714] Fix an OpenOS 1.8.0 regression causing event.pullFiltered() to effectively ignore filter timeouts.
* [#3727] Fix an exception handler bug in process.lua, uncovered by fixing recursive xpcall() handling in 1.8.4.
* [#3769] Add default user agent configuration option; change OpenComputers' default user agent to "opencomputers/$version".
## List of contributors
asie, charagarland, DragDen, HfSr, Timothé GRISOT
asie

View File

@ -1001,6 +1001,11 @@ opencomputers {
"allow default"
]
# The default user agent used by HTTP calls made by the internet card.
# The string "$version" will be replaced with the version of the copy of
# OpenComputers used.
httpUserAgent: "opencomputers/$version"
# The time in seconds to wait for a response to a request before timing
# out and returning an error message. If this is zero (the default) the
# request will never time out.

View File

@ -500,6 +500,9 @@ class Settings(val config: Config) {
def internetAccessAllowed(): Boolean = {
internetAccessConfigured() && !internetFilteringRulesInvalid()
}
// >= 1.8.8
val httpUserAgent = config.getString("internet.httpUserAgent")
}
object Settings {

View File

@ -515,6 +515,7 @@ object InternetCard {
http.setDoInput(true)
http.setDoOutput(post.isDefined)
http.setRequestMethod(if (method.isDefined) method.get else if (post.isDefined) "POST" else "GET")
http.setRequestProperty("User-Agent", Settings.get.httpUserAgent.replace("$version", OpenComputers.Version))
headers.foreach(Function.tupled(http.setRequestProperty))
if (post.isDefined) {
http.setReadTimeout(Settings.get.httpTimeout)