From 3dfe770b6ae17f816528defa383c212d729659b3 Mon Sep 17 00:00:00 2001 From: TheOtherP Date: Mon, 25 Mar 2024 21:11:19 +0100 Subject: [PATCH] Add wrapper to git --- core/src/main/resources/changelog.yaml | 2 ++ other/gowrapper/base/base.go | 13 ++++++++++--- other/gowrapper/console/console.go | 4 ++-- .../windows-release/include/NZBHydra2 Console.exe | 4 ++-- releases/windows-release/include/NZBHydra2.exe | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/core/src/main/resources/changelog.yaml b/core/src/main/resources/changelog.yaml index e8366c329..f62869fd3 100644 --- a/core/src/main/resources/changelog.yaml +++ b/core/src/main/resources/changelog.yaml @@ -1,6 +1,8 @@ #@formatter:off - version: "v5.4.0" changes: + - type: "feature" + text: "I've completely rewritten the wrapper for windows. It's not a packaged python script anymore but an actually compiled binary. This has a couple of benefits: No more false positives from virus scanners (VirusTotal shows 5/72). No more temporary files not being cleaned up after a crash. The files are (a bit) smaller.\nI don't plan to compile the wrapper for anything but windows as it makes more sense and is easier to run the python wrapper instead." - type: "fix" text: "IPs or usernames were not shown in the history. See #932" final: true diff --git a/other/gowrapper/base/base.go b/other/gowrapper/base/base.go index 1ea1469bd..8dd3e63c3 100644 --- a/other/gowrapper/base/base.go +++ b/other/gowrapper/base/base.go @@ -33,6 +33,7 @@ var doStart bool var mainProcess *exec.Cmd var terminatedByWrapper = false var restarted = false +var releaseType ReleaseType = "" var lastRestart = time.Now() var internalApiKey = randstr.Hex(20) var hideWindow = false @@ -125,10 +126,14 @@ func getJavaVersion(javaExecutable string) int { } func determineReleaseType() ReleaseType { + if releaseType != "" { + return releaseType + } forcedReleaseType := os.Getenv("NZBHYDRA_FORCE_GENERIC") if forcedReleaseType != "" { Logf(logrus.InfoLevel, "Release type %s forced by environment variable", forcedReleaseType) - return ReleaseType(forcedReleaseType) + releaseType = ReleaseType(forcedReleaseType) + return releaseType } basePath := getBasePath() if _, err := os.Stat(filepath.Join(basePath, "lib")); err == nil { @@ -136,10 +141,12 @@ func determineReleaseType() ReleaseType { Fatal("lib folder and core found. Either delete the executable to use the generic release type (using java and ignoring the executable) or delete the lib folder to use the executable and not require java") } Logf(logrus.InfoLevel, "Release type GENERIC detected") - return GENERIC + releaseType = GENERIC + return releaseType } else if _, err := os.Stat(filepath.Join(basePath, "core.exe")); err == nil { Logf(logrus.InfoLevel, "Release type NATIVE detected") - return NATIVE + releaseType = NATIVE + return releaseType } else { Fatal("Unable to determine the release type. Neither lib folder nor core found") } diff --git a/other/gowrapper/console/console.go b/other/gowrapper/console/console.go index c925986a3..3e2732c4e 100644 --- a/other/gowrapper/console/console.go +++ b/other/gowrapper/console/console.go @@ -1,9 +1,9 @@ package main import ( - "theotherp/base" + "theotherp/base" ) func main() { - base.Entrypoint(false, false) + base.Entrypoint(false, true) } diff --git a/releases/windows-release/include/NZBHydra2 Console.exe b/releases/windows-release/include/NZBHydra2 Console.exe index 43b59917a..8cd049809 100644 --- a/releases/windows-release/include/NZBHydra2 Console.exe +++ b/releases/windows-release/include/NZBHydra2 Console.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbe80ae901a21c6cbaa34219e46eed9325b9ab33d5075879d12852dc6fd83ce5 -size 6807282 +oid sha256:84da467d610c37b2817c858901c7a16d10c327fd71f62026007df45e5127c5e9 +size 3461632 diff --git a/releases/windows-release/include/NZBHydra2.exe b/releases/windows-release/include/NZBHydra2.exe index 43ac166ce..806114af7 100644 --- a/releases/windows-release/include/NZBHydra2.exe +++ b/releases/windows-release/include/NZBHydra2.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c648390b3aae1977280d46cf486972290e316a13f81fb0677537619810546818 -size 9280104 +oid sha256:a40f39a1b624c150fb47c362099ebda2d0706723f2fa71ada2ede7eb281e0182 +size 5474816