From 304e343a655bdf39dd51ba41e88d1131192f6f35 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 07:52:59 +0100 Subject: [PATCH 1/9] deps: go-toolkit to v0.1.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 992c159..1be122a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.nakama.town/fmartingr/smtp2shoutrrr go 1.23.3 require ( - git.nakama.town/fmartingr/gotoolkit v0.0.0-20241123184121-ef80892aa542 + git.nakama.town/fmartingr/gotoolkit v0.1.0 github.com/containrrr/shoutrrr v0.8.0 github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 github.com/emersion/go-smtp v0.21.3 diff --git a/go.sum b/go.sum index 889b388..7880fd7 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.nakama.town/fmartingr/gotoolkit v0.0.0-20241123184121-ef80892aa542 h1:y1LuMKkVUvrPDOuHmhHTGpNFu+S34NwxgAU3cHN/ihk= -git.nakama.town/fmartingr/gotoolkit v0.0.0-20241123184121-ef80892aa542/go.mod h1:wT4a0weU051koADRquRKWQeUsNeOyLDm7lqSqVl16Z8= +git.nakama.town/fmartingr/gotoolkit v0.1.0 h1:qZcoF+L/x5dTyhBSmo3siEYTy2Vlnlu1R6OvdF7jFsY= +git.nakama.town/fmartingr/gotoolkit v0.1.0/go.mod h1:wT4a0weU051koADRquRKWQeUsNeOyLDm7lqSqVl16Z8= github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJUSec= github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From b20d2d9735102ffd086105835aad298e5bba4164 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 07:53:52 +0100 Subject: [PATCH 2/9] ci: added forgejo action for codeberg.org --- .forgejo/workflows/release.yml | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..cef5f1e --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + tags: + - 'v*' + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Docker + uses: actions/setup-docker@v3 + + - name: Docker Login + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + docker login -u fmartingr -p $GITEA_TOKEN codeberg.org + + - name: Set up Go + uses: actions/setup-go@v4 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + distribution: goreleaser + version: latest + args: release --clean From 361175d6afe115b9319d7de079750a45026232b5 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 07:58:08 +0100 Subject: [PATCH 3/9] chore: ignore .DS_Store files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7a7ec77..7f14e85 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ dist/ # smtp2shoutrrr config.toml .aider* +.DS_Store From a15223a5c2279e718abd6f1bd6f474b7e3a6ff8c Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 08:14:39 +0100 Subject: [PATCH 4/9] refactor: change base url to codeberg.org --- .goreleaser.yml | 16 ++++++++-------- Makefile | 2 +- README.md | 8 ++++---- cmd/sendmail/main.go | 2 +- cmd/smtp2shoutrrr/main.go | 2 +- go.mod | 4 +--- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 1d3c91c..65309fd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,8 +1,8 @@ version: 2 gitea_urls: - api: https://git.nakama.town/api/v1 - download: https://git.nakama.town + api: https://codeberg.org/api/v1 + download: https://codeberg.org before: hooks: @@ -51,7 +51,7 @@ archives: dockers: - image_templates: - - &amd64_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-amd64" + - &amd64_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-amd64" use: buildx dockerfile: &dockerfile Containerfile goos: linux @@ -60,7 +60,7 @@ dockers: - "--pull" - "--platform=linux/amd64" - image_templates: - - &arm64_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-arm64" + - &arm64_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-arm64" use: buildx dockerfile: *dockerfile goos: linux @@ -69,7 +69,7 @@ dockers: - "--pull" - "--platform=linux/arm64" - image_templates: - - &armv7_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-armv7" + - &armv7_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-armv7" use: buildx dockerfile: *dockerfile goos: linux @@ -80,12 +80,12 @@ dockers: - "--platform=linux/arm/v7" docker_manifests: - - name_template: "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}" + - name_template: "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}" image_templates: - *amd64_image - *arm64_image - *armv7_image - # - name_template: "git.nakama.town/fmartingr/smtp2shoutrrr:latest" + # - name_template: "codeberg.org/fmartingr/smtp2shoutrrr:latest" # image_templates: # - *amd64_image # - *arm64_image @@ -94,7 +94,7 @@ docker_manifests: nfpms: - maintainer: Felipe Martin description: SMTP server to forward messages to shoutrrr endpoints - homepage: https://git.nakama.town/fmartingr/smtp2shoutrrr + homepage: https://codeberg.org/fmartingr/smtp2shoutrrr license: AGPL-3.0 formats: - deb diff --git a/Makefile b/Makefile index 90d86e1..290c9e5 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ FROM_MAKEFILE := y CONTAINERFILE_NAME := Containerfile CONTAINER_ALPINE_VERSION := 3.20 -CONTAINER_SOURCE_URL := "https://git.nakama.town/fmartingr/${PROJECT_NAME}" +CONTAINER_SOURCE_URL := "https://codeberg.org/fmartingr/${PROJECT_NAME}" CONTAINER_MAINTAINER := "Felipe Martin " CONTAINER_BIN_NAME := ${PROJECT_NAME} diff --git a/README.md b/README.md index 76c1bcb..c881c4c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# smtp2Shoutrrr +# smtp2shoutrrr A simple SMTP server that forwards incoming emails to a [Shoutrrr supported service](https://containrrr.dev/shoutrrr/). @@ -33,13 +33,13 @@ Target = "ntfy://ntfy.sh/catch-all-topic?tags=unmatched" ### From releases -- Grab the latest release from the [releases page](https://git.nakama.town/fmartingr/smtp2shoutrrr/releases) +- Grab the latest release from the [releases page](https://codeberg.org/fmartingr/smtp2shoutrrr/releases) - Put the configuration file in the same directory as the binary - Run the binary for your appropriate platform ### From source (development) -- Clone [this repository](https://git.nakama.town/fmartingr/smtp2shoutrrr) +- Clone [this repository](https://codeberg.org/fmartingr/smtp2shoutrrr) - Put the configuration file in the repository folder - Run `make quick-run` @@ -51,7 +51,7 @@ Target = "ntfy://ntfy.sh/catch-all-topic?tags=unmatched" ```bash docker run -v /path/to/config.toml:/config.toml \ -p 11025:11025 \ - git.nakama.town/fmartingr/smtp2shoutrrr:latest + codeberg.org/fmartingr/smtp2shoutrrr:latest ``` ## Development diff --git a/cmd/sendmail/main.go b/cmd/sendmail/main.go index df894b3..dfab1c1 100644 --- a/cmd/sendmail/main.go +++ b/cmd/sendmail/main.go @@ -10,7 +10,7 @@ import ( "git.nakama.town/fmartingr/gotoolkit/encoding" "github.com/emersion/go-sasl" - "git.nakama.town/fmartingr/smtp2shoutrrr" + "codeberg.org/fmartingr/smtp2shoutrrr" ) // The ANONYMOUS mechanism name. diff --git a/cmd/smtp2shoutrrr/main.go b/cmd/smtp2shoutrrr/main.go index 0d92081..60fe9b5 100644 --- a/cmd/smtp2shoutrrr/main.go +++ b/cmd/smtp2shoutrrr/main.go @@ -5,10 +5,10 @@ import ( "log/slog" "os" + "codeberg.org/fmartingr/smtp2shoutrrr" "git.nakama.town/fmartingr/gotoolkit/encoding" "git.nakama.town/fmartingr/gotoolkit/model" "git.nakama.town/fmartingr/gotoolkit/service" - "git.nakama.town/fmartingr/smtp2shoutrrr" _ "golang.org/x/crypto/x509roots/fallback" ) diff --git a/go.mod b/go.mod index 1be122a..e5c8462 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module git.nakama.town/fmartingr/smtp2shoutrrr +module codeberg.org/fmartingr/smtp2shoutrrr go 1.23.3 @@ -17,5 +17,3 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 // indirect golang.org/x/sys v0.22.0 // indirect ) - -//replace git.nakama.town/fmartingr/gotoolkit => ../gotoolkit From 8a684e9ec1d029b5df05ef2e07762a9c372eb417 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 09:59:12 +0100 Subject: [PATCH 5/9] test: added some tests --- backend.go | 1 - backend_test.go | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 23 ++++++++++--- go.sum | 60 ++++++++++++++++++++++++---------- server.go | 1 - 5 files changed, 147 insertions(+), 23 deletions(-) create mode 100644 backend_test.go diff --git a/backend.go b/backend.go index baba722..fd2c379 100644 --- a/backend.go +++ b/backend.go @@ -85,7 +85,6 @@ func (bkd *Backend) forwardEmail(email ReceivedEmail) error { type Session struct { addresses []string - body string config *Config diff --git a/backend_test.go b/backend_test.go new file mode 100644 index 0000000..27e59b1 --- /dev/null +++ b/backend_test.go @@ -0,0 +1,85 @@ +package smtp2shoutrrr + +import ( + "context" + "fmt" + "io" + "net/http" + "net/http/httptest" + "net/smtp" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestEmailForwarding(t *testing.T) { + // Start mock ntfy server + notifications := make([]string, 0) + mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.WriteHeader(http.StatusMethodNotAllowed) + return + } + + // Read body and log + body, err := io.ReadAll(r.Body) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } + + notifications = append(notifications, string(body)) + w.WriteHeader(http.StatusOK) + })) + defer mockServer.Close() + + // Configure the SMTP server + config := &Config{ + Port: 2525, + Username: "testuser", + Password: "testpass", + Recipients: []ConfigRecipient{ + { + Addresses: []string{"test@example.com"}, + Target: "generic+" + mockServer.URL + "/?template=json", + }, + }, + } + + ctx := context.Background() + smtpServer := NewSMTPServer(config) + + // Start the server + go func() { + if err := smtpServer.Start(ctx); err != nil { + t.Errorf("failed to start server: %v", err) + } + }() + + // Give the server time to start + time.Sleep(100 * time.Millisecond) + defer func() { + if err := smtpServer.Stop(ctx); err != nil { + t.Errorf("failed to stop server: %v", err) + } + }() + + // Send test email + auth := smtp.PlainAuth("", config.Username, config.Password, "localhost") + err := smtp.SendMail( + fmt.Sprintf("localhost:%d", config.Port), + auth, + "sender@example.com", + []string{"test@example.com"}, + []byte("Subject: Test Email\r\n\r\nThis is a test email body"), + ) + require.NoError(t, err) + + // Give some time for the notification to be processed + time.Sleep(100 * time.Millisecond) + + // Verify the notification was received + require.Len(t, notifications, 1) + require.Contains(t, notifications[0], "This is a test email body") +} diff --git a/go.mod b/go.mod index e5c8462..1e6bd9e 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,28 @@ go 1.23.3 require ( git.nakama.town/fmartingr/gotoolkit v0.1.0 github.com/containrrr/shoutrrr v0.8.0 - github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 + github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6 github.com/emersion/go-smtp v0.21.3 - golang.org/x/crypto/x509roots/fallback v0.0.0-20250118192723-a8ea4be81f07 + github.com/stretchr/testify v1.9.0 + golang.org/x/crypto/x509roots/fallback v0.0.0-20250214233241-911360c8a4f4 ) require ( - github.com/fatih/color v1.15.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect - golang.org/x/sys v0.22.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.8.1 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 7880fd7..c0021c5 100644 --- a/go.sum +++ b/go.sum @@ -2,28 +2,43 @@ git.nakama.town/fmartingr/gotoolkit v0.1.0 h1:qZcoF+L/x5dTyhBSmo3siEYTy2Vlnlu1R6 git.nakama.town/fmartingr/gotoolkit v0.1.0/go.mod h1:wT4a0weU051koADRquRKWQeUsNeOyLDm7lqSqVl16Z8= github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJUSec= github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ= github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= +github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6 h1:oP4q0fw+fOSWn3DfFi4EXdT+B+gTtzx8GC9xsc26Znk= +github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= github.com/emersion/go-smtp v0.21.3 h1:7uVwagE8iPYE48WhNsng3RRpCUpFvNl39JGNSIyGVMY= github.com/emersion/go-smtp v0.21.3/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc= github.com/jarcoal/httpmock v1.3.0/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -33,23 +48,36 @@ github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/crypto/x509roots/fallback v0.0.0-20250118192723-a8ea4be81f07 h1:Tuk3hxOkRoX4Xwph6/tRU1wGumEsVYM2TZfvAC6MllM= golang.org/x/crypto/x509roots/fallback v0.0.0-20250118192723-a8ea4be81f07/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/crypto/x509roots/fallback v0.0.0-20250214233241-911360c8a4f4 h1:QDiVWrFJ2lyXzr3pJnIREQWR8S7jkjzuWJPJda8Ic8E= +golang.org/x/crypto/x509roots/fallback v0.0.0-20250214233241-911360c8a4f4/go.mod h1:lxN5T34bK4Z/i6cMaU7frUU57VkDXFD4Kamfl/cp9oU= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/server.go b/server.go index afaa4a7..7262576 100644 --- a/server.go +++ b/server.go @@ -14,7 +14,6 @@ var _ model.Server = (*smtpServer)(nil) type smtpServer struct { backend *smtp.Server - config Config } func (s *smtpServer) IsEnabled() bool { From ba23c2816cbbd41719286e317e1bc500a16f92f2 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 09:59:45 +0100 Subject: [PATCH 6/9] deps: upgrade go 1.24 --- go.mod | 2 +- go.sum | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 1e6bd9e..34613c8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module codeberg.org/fmartingr/smtp2shoutrrr -go 1.23.3 +go 1.24 require ( git.nakama.town/fmartingr/gotoolkit v0.1.0 diff --git a/go.sum b/go.sum index c0021c5..3d41520 100644 --- a/go.sum +++ b/go.sum @@ -5,14 +5,11 @@ github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5Qe github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ= github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6 h1:oP4q0fw+fOSWn3DfFi4EXdT+B+gTtzx8GC9xsc26Znk= github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= github.com/emersion/go-smtp v0.21.3 h1:7uVwagE8iPYE48WhNsng3RRpCUpFvNl39JGNSIyGVMY= github.com/emersion/go-smtp v0.21.3/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= @@ -35,11 +32,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= @@ -56,16 +50,11 @@ github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XF github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto/x509roots/fallback v0.0.0-20250118192723-a8ea4be81f07 h1:Tuk3hxOkRoX4Xwph6/tRU1wGumEsVYM2TZfvAC6MllM= -golang.org/x/crypto/x509roots/fallback v0.0.0-20250118192723-a8ea4be81f07/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= golang.org/x/crypto/x509roots/fallback v0.0.0-20250214233241-911360c8a4f4 h1:QDiVWrFJ2lyXzr3pJnIREQWR8S7jkjzuWJPJda8Ic8E= golang.org/x/crypto/x509roots/fallback v0.0.0-20250214233241-911360c8a4f4/go.mod h1:lxN5T34bK4Z/i6cMaU7frUU57VkDXFD4Kamfl/cp9oU= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= From 7c588033c9474d4111c6f7bcc4cf2eb5c0290c5a Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Fri, 21 Feb 2025 09:59:59 +0100 Subject: [PATCH 7/9] ci: makefile commands to test, lint and format --- .forgejo/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ .woodpecker/ci.yml | 23 +++++++++++++++++++++++ Makefile | 16 +++++++++++++--- 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .forgejo/workflows/ci.yml create mode 100644 .woodpecker/ci.yml diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..9f233b8 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - name: Format + run: | + make format + git diff --exit-code + + - name: Lint + uses: golangci/golangci-lint-action@v4 + with: + version: v1.56 + args: --timeout=5m + + - name: Test + run: make test diff --git a/.woodpecker/ci.yml b/.woodpecker/ci.yml new file mode 100644 index 0000000..4353088 --- /dev/null +++ b/.woodpecker/ci.yml @@ -0,0 +1,23 @@ +when: + event: + - push + - pull_request + branch: + - main + +steps: + format: + image: golang:1.24 + commands: + - make format + - git diff --exit-code # Fail if files were changed + + lint: + image: golang:1.24 + commands: + - make ci-lint + + test: + image: golang:1.24 + commands: + - make test diff --git a/Makefile b/Makefile index 290c9e5..0951519 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ SOURCE_FILES ?=./... TEST_OPTIONS ?= -v -failfast -race -bench=. -benchtime=100000x -cover -coverprofile=coverage.out TEST_TIMEOUT ?=1m +GOLANGCI_LINT_VERSION ?= v1.64.5 + CLEAN_OPTIONS ?=-modcache -testcache CGO_ENABLED := 0 @@ -78,13 +80,21 @@ run: ### Executes the project build locally .PHONY: format format: ### Executes the formatting pipeline on the project $(info: Make: Format) - @bash scripts/format.sh + @go fmt ./... + @go mod tidy + +.PHONY: ci-lint +ci-lint: ### Check the project for errors + $(info: Make: Lint) + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} + @golangci-lint run ./... .PHONY: lint lint: ### Check the project for errors $(info: Make: Lint) - @bash scripts/lint.sh + @golangci-lint run ./... .PHONY: test test: ### Runs the test suite - @bash scripts/test.sh + $(info: Make: Test) + CGO_ENABLED=1 go test ${TEST_OPTIONS} -timeout=${TEST_TIMEOUT} ${SOURCE_FILES} From 98f7448d49894b74fae58b4f2c35520a1cbbc479 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Wed, 26 Mar 2025 17:37:13 +0100 Subject: [PATCH 8/9] Revert "refactor: change base url to codeberg.org" This reverts commit a15223a5c2279e718abd6f1bd6f474b7e3a6ff8c. --- .goreleaser.yml | 16 ++++++++-------- Makefile | 2 +- README.md | 8 ++++---- cmd/sendmail/main.go | 2 +- cmd/smtp2shoutrrr/main.go | 2 +- go.mod | 4 +++- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 65309fd..1d3c91c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,8 +1,8 @@ version: 2 gitea_urls: - api: https://codeberg.org/api/v1 - download: https://codeberg.org + api: https://git.nakama.town/api/v1 + download: https://git.nakama.town before: hooks: @@ -51,7 +51,7 @@ archives: dockers: - image_templates: - - &amd64_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-amd64" + - &amd64_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-amd64" use: buildx dockerfile: &dockerfile Containerfile goos: linux @@ -60,7 +60,7 @@ dockers: - "--pull" - "--platform=linux/amd64" - image_templates: - - &arm64_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-arm64" + - &arm64_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-arm64" use: buildx dockerfile: *dockerfile goos: linux @@ -69,7 +69,7 @@ dockers: - "--pull" - "--platform=linux/arm64" - image_templates: - - &armv7_image "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}-armv7" + - &armv7_image "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}-armv7" use: buildx dockerfile: *dockerfile goos: linux @@ -80,12 +80,12 @@ dockers: - "--platform=linux/arm/v7" docker_manifests: - - name_template: "codeberg.org/fmartingr/smtp2shoutrrr:{{ .Version }}" + - name_template: "git.nakama.town/fmartingr/smtp2shoutrrr:{{ .Version }}" image_templates: - *amd64_image - *arm64_image - *armv7_image - # - name_template: "codeberg.org/fmartingr/smtp2shoutrrr:latest" + # - name_template: "git.nakama.town/fmartingr/smtp2shoutrrr:latest" # image_templates: # - *amd64_image # - *arm64_image @@ -94,7 +94,7 @@ docker_manifests: nfpms: - maintainer: Felipe Martin description: SMTP server to forward messages to shoutrrr endpoints - homepage: https://codeberg.org/fmartingr/smtp2shoutrrr + homepage: https://git.nakama.town/fmartingr/smtp2shoutrrr license: AGPL-3.0 formats: - deb diff --git a/Makefile b/Makefile index 0951519..e9fe7e3 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ FROM_MAKEFILE := y CONTAINERFILE_NAME := Containerfile CONTAINER_ALPINE_VERSION := 3.20 -CONTAINER_SOURCE_URL := "https://codeberg.org/fmartingr/${PROJECT_NAME}" +CONTAINER_SOURCE_URL := "https://git.nakama.town/fmartingr/${PROJECT_NAME}" CONTAINER_MAINTAINER := "Felipe Martin " CONTAINER_BIN_NAME := ${PROJECT_NAME} diff --git a/README.md b/README.md index c881c4c..76c1bcb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# smtp2shoutrrr +# smtp2Shoutrrr A simple SMTP server that forwards incoming emails to a [Shoutrrr supported service](https://containrrr.dev/shoutrrr/). @@ -33,13 +33,13 @@ Target = "ntfy://ntfy.sh/catch-all-topic?tags=unmatched" ### From releases -- Grab the latest release from the [releases page](https://codeberg.org/fmartingr/smtp2shoutrrr/releases) +- Grab the latest release from the [releases page](https://git.nakama.town/fmartingr/smtp2shoutrrr/releases) - Put the configuration file in the same directory as the binary - Run the binary for your appropriate platform ### From source (development) -- Clone [this repository](https://codeberg.org/fmartingr/smtp2shoutrrr) +- Clone [this repository](https://git.nakama.town/fmartingr/smtp2shoutrrr) - Put the configuration file in the repository folder - Run `make quick-run` @@ -51,7 +51,7 @@ Target = "ntfy://ntfy.sh/catch-all-topic?tags=unmatched" ```bash docker run -v /path/to/config.toml:/config.toml \ -p 11025:11025 \ - codeberg.org/fmartingr/smtp2shoutrrr:latest + git.nakama.town/fmartingr/smtp2shoutrrr:latest ``` ## Development diff --git a/cmd/sendmail/main.go b/cmd/sendmail/main.go index dfab1c1..df894b3 100644 --- a/cmd/sendmail/main.go +++ b/cmd/sendmail/main.go @@ -10,7 +10,7 @@ import ( "git.nakama.town/fmartingr/gotoolkit/encoding" "github.com/emersion/go-sasl" - "codeberg.org/fmartingr/smtp2shoutrrr" + "git.nakama.town/fmartingr/smtp2shoutrrr" ) // The ANONYMOUS mechanism name. diff --git a/cmd/smtp2shoutrrr/main.go b/cmd/smtp2shoutrrr/main.go index 60fe9b5..0d92081 100644 --- a/cmd/smtp2shoutrrr/main.go +++ b/cmd/smtp2shoutrrr/main.go @@ -5,10 +5,10 @@ import ( "log/slog" "os" - "codeberg.org/fmartingr/smtp2shoutrrr" "git.nakama.town/fmartingr/gotoolkit/encoding" "git.nakama.town/fmartingr/gotoolkit/model" "git.nakama.town/fmartingr/gotoolkit/service" + "git.nakama.town/fmartingr/smtp2shoutrrr" _ "golang.org/x/crypto/x509roots/fallback" ) diff --git a/go.mod b/go.mod index 34613c8..31d8d3a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module codeberg.org/fmartingr/smtp2shoutrrr +module git.nakama.town/fmartingr/smtp2shoutrrr go 1.24 @@ -30,3 +30,5 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +//replace git.nakama.town/fmartingr/gotoolkit => ../gotoolkit From 103742ed350f226f11d55af47b3445050f71bd30 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Wed, 26 Mar 2025 17:37:58 +0100 Subject: [PATCH 9/9] chore: remove forgejo workflows --- .forgejo/workflows/ci.yml | 31 --------------------------- .forgejo/workflows/release.yml | 38 ---------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 .forgejo/workflows/ci.yml delete mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml deleted file mode 100644 index 9f233b8..0000000 --- a/.forgejo/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: CI -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Format - run: | - make format - git diff --exit-code - - - name: Lint - uses: golangci/golangci-lint-action@v4 - with: - version: v1.56 - args: --timeout=5m - - - name: Test - run: make test diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml deleted file mode 100644 index cef5f1e..0000000 --- a/.forgejo/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' - branches: - - main - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Docker - uses: actions/setup-docker@v3 - - - name: Docker Login - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - run: | - docker login -u fmartingr -p $GITEA_TOKEN codeberg.org - - - name: Set up Go - uses: actions/setup-go@v4 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - distribution: goreleaser - version: latest - args: release --clean