Skip to content

Commit

Permalink
Add wrapper to git
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherp committed Mar 25, 2024
1 parent f2136a1 commit 3dfe770
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions core/src/main/resources/changelog.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 10 additions & 3 deletions other/gowrapper/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -125,21 +126,27 @@ 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 {
if _, err := os.Stat(filepath.Join(basePath, "core.exe")); err == nil {
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")
}
Expand Down
4 changes: 2 additions & 2 deletions other/gowrapper/console/console.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"theotherp/base"
"theotherp/base"
)

func main() {
base.Entrypoint(false, false)
base.Entrypoint(false, true)
}
4 changes: 2 additions & 2 deletions releases/windows-release/include/NZBHydra2 Console.exe
Git LFS file not shown
4 changes: 2 additions & 2 deletions releases/windows-release/include/NZBHydra2.exe
Git LFS file not shown

0 comments on commit 3dfe770

Please sign in to comment.