Files
erisus-void-packages/srcpkgs/goanime/patches/disable-self-update.patch
T
2026-11-29 10:28:59 +01:00

98 lines
4.2 KiB
Diff

--- a/internal/handlers/request_flow_test.go
+++ b/internal/handlers/request_flow_test.go
@@ -1,19 +1,15 @@
package handlers
import (
- "encoding/json"
"errors"
"image"
"image/png"
- "net/http"
- "net/http/httptest"
"os"
"path/filepath"
"runtime"
"testing"
"github.com/alvarorichard/Goanime/v2/internal/models"
- "github.com/alvarorichard/Goanime/v2/internal/updater"
"github.com/alvarorichard/Goanime/v2/internal/upscaler"
"github.com/alvarorichard/Goanime/v2/internal/util"
"github.com/ktr0731/go-fuzzyfinder"
@@ -326,24 +322,11 @@ func TestHandlePlaybackMode_SymbolPin(t *testing.T) {
// --- HandleUpdateRequest ---
-func TestHandleUpdateRequest_DoesNotPanic(t *testing.T) {
- if runtime.GOOS == "windows" {
- // HandleUpdateRequest → updater.CheckAndPromptUpdate may open the huh
- // confirm form when GitHub has a newer release. The form blocks on TTY
- // on Windows CI. Skip there.
- t.Skip("huh form blocks on Windows CI without TTY")
- }
- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
- _ = json.NewEncoder(w).Encode(updater.GitHubRelease{TagName: "v0.0.0"})
- }))
- t.Cleanup(srv.Close)
- // Cannot override updater.releaseAPIURL from outside its package; just
- // ensure the wrapper doesn't panic and either succeeds or returns wrapped
- // error from the underlying network call.
+func TestHandleUpdateRequest_Disabled(t *testing.T) {
err := HandleUpdateRequest()
- if err != nil {
- assert.Contains(t, err.Error(), "update failed")
- }
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "self-updating is disabled")
+ assert.Contains(t, err.Error(), "package manager")
}
// --- HandleUpscaleRequest, handleImageUpscale, handleVideoUpscale ---
diff --git a/internal/handlers/update.go b/internal/handlers/update.go
index 6b24f0b..7e52f10 100644
--- a/internal/handlers/update.go
+++ b/internal/handlers/update.go
@@ -2,18 +2,9 @@ package handlers
import (
"fmt"
-
- "github.com/alvarorichard/Goanime/v2/internal/updater"
- "github.com/alvarorichard/Goanime/v2/internal/util"
)
// HandleUpdateRequest processes update requests
func HandleUpdateRequest() error {
- // Initialize logger for update process
- util.InitLogger()
- util.Info("Checking for updates...")
- if updateErr := updater.CheckAndPromptUpdate(); updateErr != nil {
- return fmt.Errorf("update failed: %w", updateErr)
- }
- return nil
+ return fmt.Errorf("self-updating is disabled in this package; update GoAnime with your package manager")
}
diff --git a/internal/util/help.go b/internal/util/help.go
index 7961bfb..1b34428 100644
--- a/internal/util/help.go
+++ b/internal/util/help.go
@@ -107,7 +107,7 @@ func ShowBeautifulHelp() {
addOption(&helpContent, "--perf", "Enable performance profiling - shows timing metrics for all operations.")
addOption(&helpContent, "--help / -h", "Display this beautiful help message with detailed usage information.")
addOption(&helpContent, "--version", "Show version information and build details.")
- addOption(&helpContent, "--update", "Check for updates and update automatically to the latest version.")
+ addOption(&helpContent, "--update", "Self-updating is disabled; use your package manager to update GoAnime.")
addOption(&helpContent, "-d", "Download mode - download specific episodes for offline viewing.")
addOption(&helpContent, "-r", "Range download mode - download multiple episodes (use with -d or -dm).")
addOption(&helpContent, "-a", "Download ALL episodes/seasons. Use with -d (anime) or -dm (TV/series/dorama).")
@@ -168,7 +168,7 @@ func ShowBeautifulHelp() {
addExample(&helpContent, "goanime", "Start interactive mode")
addExample(&helpContent, "goanime \"attack on titan\"", "Search directly for Attack on Titan")
addExample(&helpContent, "goanime --debug \"naruto\"", "Search with debug information")
- addExample(&helpContent, "goanime --update", "Check for updates and update automatically")
+ addExample(&helpContent, "goanime --update", "Show package-manager update guidance")
addExample(&helpContent, "goanime --version", "Show version information")
addExample(&helpContent, "goanime -d \"one piece\" 1", "Download episode 1 of One Piece")
addExample(&helpContent, "goanime -d -r \"naruto\" 1-5", "Download episodes 1-5 of Naruto")