Philipp Heckel 3 лет назад
Родитель
Сommit
7d473488de
10 измененных файлов с 37 добавлено и 10 удалено
  1. 13 0
      .goreleaser.yml
  2. 4 0
      cmd/access_linux.go
  3. 0 0
      cmd/access_linux_test.go
  4. 3 10
      cmd/app.go
  5. 4 0
      cmd/publish.go
  6. 4 0
      cmd/serve_linux.go
  7. 0 0
      cmd/serve_linux_test.go
  8. 4 0
      cmd/subscribe.go
  9. 5 0
      cmd/user_linux.go
  10. 0 0
      cmd/user_linux_test.go

+ 13 - 0
.goreleaser.yml

@@ -57,6 +57,19 @@ builds:
     goarch: [arm64]
     # No "upx", since it causes random core dumps, see
     # https://github.com/binwiederhier/ntfy/issues/191#issuecomment-1083406546
+  -
+    id: ntfy_windows_amd64
+    binary: ntfy
+    env:
+      - CGO_ENABLED=0 # explicitly disable, since we don't need go-sqlite3
+    tags: []
+    ldflags:
+      - "-X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
+    goos: [windows]
+    goarch: [amd64]
+    hooks:
+      post:
+        - upx "{{ .Path }}" # apt install upx
 nfpms:
   -
     package_name: ntfy

+ 4 - 0
cmd/access.go → cmd/access_linux.go

@@ -8,6 +8,10 @@ import (
 	"heckel.io/ntfy/util"
 )
 
+func init() {
+	commands = append(commands, cmdAccess)
+}
+
 const (
 	userEveryone = "everyone"
 )

+ 0 - 0
cmd/access_test.go → cmd/access_linux_test.go


+ 3 - 10
cmd/app.go

@@ -19,6 +19,8 @@ const (
 	categoryServer = "Server commands"
 )
 
+var commands = make([]*cli.Command, 0)
+
 // New creates a new CLI application
 func New() *cli.App {
 	return &cli.App{
@@ -30,16 +32,7 @@ func New() *cli.App {
 		Reader:                 os.Stdin,
 		Writer:                 os.Stdout,
 		ErrWriter:              os.Stderr,
-		Commands: []*cli.Command{
-			// Server commands
-			cmdServe,
-			cmdUser,
-			cmdAccess,
-
-			// Client commands
-			cmdPublish,
-			cmdSubscribe,
-		},
+		Commands:               commands,
 	}
 }
 

+ 4 - 0
cmd/publish.go

@@ -12,6 +12,10 @@ import (
 	"strings"
 )
 
+func init() {
+	commands = append(commands, cmdPublish)
+}
+
 var cmdPublish = &cli.Command{
 	Name:      "publish",
 	Aliases:   []string{"pub", "send", "trigger"},

+ 4 - 0
cmd/serve.go → cmd/serve_linux.go

@@ -14,6 +14,10 @@ import (
 	"time"
 )
 
+func init() {
+	commands = append(commands, cmdServe)
+}
+
 var flagsServe = []cli.Flag{
 	&cli.StringFlag{Name: "config", Aliases: []string{"c"}, EnvVars: []string{"NTFY_CONFIG_FILE"}, Value: "/etc/ntfy/server.yml", DefaultText: "/etc/ntfy/server.yml", Usage: "config file"},
 	altsrc.NewStringFlag(&cli.StringFlag{Name: "base-url", Aliases: []string{"B"}, EnvVars: []string{"NTFY_BASE_URL"}, Usage: "externally visible base URL for this host (e.g. https://ntfy.sh)"}),

+ 0 - 0
cmd/serve_test.go → cmd/serve_linux_test.go


+ 4 - 0
cmd/subscribe.go

@@ -13,6 +13,10 @@ import (
 	"strings"
 )
 
+func init() {
+	commands = append(commands, cmdSubscribe)
+}
+
 var cmdSubscribe = &cli.Command{
 	Name:      "subscribe",
 	Aliases:   []string{"sub"},

+ 5 - 0
cmd/user.go → cmd/user_linux.go

@@ -11,7 +11,12 @@ import (
 	"strings"
 )
 
+func init() {
+	commands = append(commands, cmdUser)
+}
+
 var flagsUser = userCommandFlags()
+
 var cmdUser = &cli.Command{
 	Name:      "user",
 	Usage:     "Manage/show users",

+ 0 - 0
cmd/user_test.go → cmd/user_linux_test.go