Commit abd75f3
Antonio Mika
·
2026-03-27 16:14:33 -0400 EDT
parent d2b70f4
Update soju build to support webpush changes and upgrade to go 1.26
7 files changed,
+24,
-24
+1,
-1
| ... | ... | @@ -8,7 +8,7 @@ runs: | |
| 8 | 8 | - name: Set up Go | |
| 9 | 9 | uses: actions/setup-go@v3 | |
| 10 | 10 | with: | |
| 11 | - | go-version: 1.25 | |
| 11 | + | go-version: 1.26 | |
| 12 | 12 | - name: Lint the codebase | |
| 13 | 13 | uses: golangci/golangci-lint-action@v8 | |
| 14 | 14 | with: |
+1,
-1
| ... | ... | @@ -1,4 +1,4 @@ | |
| 1 | - | FROM --platform=$BUILDPLATFORM golang:1.25 AS builder-deps | |
| 1 | + | FROM --platform=$BUILDPLATFORM golang:1.26 AS builder-deps | |
| 2 | 2 | LABEL maintainer="Pico Maintainers <hello@pico.sh>" | |
| 3 | 3 | ||
| 4 | 4 | WORKDIR /app |
+1,
-1
| ... | ... | @@ -1,4 +1,4 @@ | |
| 1 | - | FROM --platform=$BUILDPLATFORM golang:1.25 AS builder-deps | |
| 1 | + | FROM --platform=$BUILDPLATFORM golang:1.26 AS builder-deps | |
| 2 | 2 | LABEL maintainer="Pico Maintainers <hello@pico.sh>" | |
| 3 | 3 | ||
| 4 | 4 | WORKDIR /app |
+1,
-1
| ... | ... | @@ -1,4 +1,4 @@ | |
| 1 | - | FROM --platform=$BUILDPLATFORM golang:1.25 AS builder-deps | |
| 1 | + | FROM --platform=$BUILDPLATFORM golang:1.26 AS builder-deps | |
| 2 | 2 | LABEL maintainer="Pico Maintainers <hello@pico.sh>" | |
| 3 | 3 | ||
| 4 | 4 | WORKDIR /app |
M
Makefile
+1,
-1
| ... | ... | @@ -95,7 +95,7 @@ build: build-prose build-pastes build-feeds build-pgs build-auth build-pico buil | |
| 95 | 95 | ||
| 96 | 96 | scripts: | |
| 97 | 97 | # might need to set MINIO_URL | |
| 98 | - | docker run --rm -it --env-file .env -v $(shell pwd):/app -w /app golang:1.25 /bin/bash | |
| 98 | + | docker run --rm -it --env-file .env -v $(shell pwd):/app -w /app golang:1.26 /bin/bash | |
| 99 | 99 | .PHONY: scripts | |
| 100 | 100 | ||
| 101 | 101 | fmt: |
+3,
-3
| ... | ... | @@ -1,4 +1,4 @@ | |
| 1 | - | FROM --platform=$BUILDPLATFORM golang:1.25 AS builder-deps | |
| 1 | + | FROM --platform=$BUILDPLATFORM golang:1.26 AS builder-deps | |
| 2 | 2 | LABEL maintainer="Pico Maintainers <hello@pico.sh>" | |
| 3 | 3 | ||
| 4 | 4 | WORKDIR /app |
| ... | ... | @@ -8,13 +8,13 @@ RUN apt-get install -y git ca-certificates | |
| 8 | 8 | ||
| 9 | 9 | RUN git clone https://codeberg.org/emersion/soju.git | |
| 10 | 10 | ||
| 11 | - | # COPY subscriber-change.diff . | |
| 11 | + | COPY subscriber-change.diff . | |
| 12 | 12 | ||
| 13 | 13 | WORKDIR /app/soju | |
| 14 | 14 | ||
| 15 | 15 | RUN git checkout v0.10.1 | |
| 16 | 16 | ||
| 17 | - | # RUN git apply ../subscriber-change.diff | |
| 17 | + | RUN git apply ../subscriber-change.diff | |
| 18 | 18 | ||
| 19 | 19 | RUN --mount=type=cache,target=/go/pkg/,rw \ | |
| 20 | 20 | --mount=type=cache,target=/root/.cache/,rw \ |
+16,
-16
| ... | ... | @@ -1,8 +1,8 @@ | |
| 1 | 1 | diff --git a/downstream.go b/downstream.go | |
| 2 | - | index 78044e1..c95a0f6 100644 | |
| 2 | + | index b627450..b845ecd 100644 | |
| 3 | 3 | --- a/downstream.go | |
| 4 | 4 | +++ b/downstream.go | |
| 5 | - | @@ -3102,6 +3102,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc. | |
| 5 | + | @@ -3341,6 +3341,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc. | |
| 6 | 6 | network.pushTargets.Del(target) | |
| 7 | 7 | } | |
| 8 | 8 | go network.broadcastWebPush(&irc.Message{ |
| ... | ... | @@ -12,7 +12,7 @@ index 78044e1..c95a0f6 100644 | |
| 12 | 12 | Command: "MARKREAD", | |
| 13 | 13 | Params: []string{target, timestampStr}, | |
| 14 | 14 | }) | |
| 15 | - | @@ -3350,6 +3353,10 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc. | |
| 15 | + | @@ -3694,6 +3697,10 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc. | |
| 16 | 16 | }} | |
| 17 | 17 | } | |
| 18 | 18 |
| ... | ... | @@ -24,18 +24,18 @@ index 78044e1..c95a0f6 100644 | |
| 24 | 24 | Endpoint: endpoint, | |
| 25 | 25 | } | |
| 26 | 26 | diff --git a/server.go b/server.go | |
| 27 | - | index f6e1cf6..9114580 100644 | |
| 27 | + | index f1f56d7..81c8bd6 100644 | |
| 28 | 28 | --- a/server.go | |
| 29 | 29 | +++ b/server.go | |
| 30 | 30 | @@ -10,6 +10,7 @@ import ( | |
| 31 | - | "net" | |
| 32 | 31 | "net/http" | |
| 32 | + | "net/netip" | |
| 33 | 33 | "runtime/debug" | |
| 34 | 34 | + "strings" | |
| 35 | 35 | "sync" | |
| 36 | 36 | "sync/atomic" | |
| 37 | - | "time" | |
| 38 | - | @@ -333,6 +334,15 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap | |
| 37 | + | "syscall" | |
| 38 | + | @@ -340,6 +341,15 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap | |
| 39 | 39 | ctx, cancel := context.WithTimeout(ctx, 15*time.Second) | |
| 40 | 40 | defer cancel() | |
| 41 | 41 |
| ... | ... | @@ -51,8 +51,8 @@ index f6e1cf6..9114580 100644 | |
| 51 | 51 | var urgency webpush.Urgency | |
| 52 | 52 | switch msg.Command { | |
| 53 | 53 | case "PRIVMSG", "NOTICE", "INVITE": | |
| 54 | - | @@ -347,7 +357,7 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap | |
| 55 | - | }, | |
| 54 | + | @@ -352,7 +362,7 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap | |
| 55 | + | HTTPClient: webPushHTTPClient, | |
| 56 | 56 | VAPIDPublicKey: s.webPush.VAPIDKeys.Public, | |
| 57 | 57 | VAPIDPrivateKey: s.webPush.VAPIDKeys.Private, | |
| 58 | 58 | - Subscriber: "https://soju.im", |
| ... | ... | @@ -61,18 +61,18 @@ index f6e1cf6..9114580 100644 | |
| 61 | 61 | Urgency: urgency, | |
| 62 | 62 | RecordSize: 2048, | |
| 63 | 63 | diff --git a/upstream.go b/upstream.go | |
| 64 | - | index ea309f4..e198dc7 100644 | |
| 64 | + | index 37cf508..8f6ff03 100644 | |
| 65 | 65 | --- a/upstream.go | |
| 66 | 66 | +++ b/upstream.go | |
| 67 | - | @@ -694,6 +694,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err | |
| 67 | + | @@ -771,6 +771,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err | |
| 68 | 68 | } | |
| 69 | 69 | ||
| 70 | - | if !self && !detached && msg.Command != "TAGMSG" && (highlight || directMessage) { | |
| 70 | + | if sendWebPush { | |
| 71 | 71 | + msg.Tags["bouncerNetwork"] = strconv.FormatInt(uc.network.ID, 10) | |
| 72 | - | go uc.network.broadcastWebPush(msg) | |
| 73 | - | if timestamp, err := time.Parse(xirc.ServerTimeLayout, string(msg.Tags["time"])); err == nil { | |
| 74 | - | uc.network.pushTargets.Set(bufferName, timestamp) | |
| 75 | - | @@ -1640,6 +1641,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err | |
| 72 | + | timestamp, err := time.Parse(xirc.ServerTimeLayout, msg.Tags["time"]) | |
| 73 | + | if err != nil { | |
| 74 | + | // Cannot fail, was set above if unset or invalid. | |
| 75 | + | @@ -1760,6 +1761,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err | |
| 76 | 76 | }) | |
| 77 | 77 | ||
| 78 | 78 | if weAreInvited { |