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:
88 - name: Set up Go
99 uses: actions/setup-go@v3
1010 with:
11- go-version: 1.25
11+ go-version: 1.26
1212 - name: Lint the codebase
1313 uses: golangci/golangci-lint-action@v8
1414 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
22 LABEL maintainer="Pico Maintainers <hello@pico.sh>"
33
44 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
22 LABEL maintainer="Pico Maintainers <hello@pico.sh>"
33
44 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
22 LABEL maintainer="Pico Maintainers <hello@pico.sh>"
33
44 WORKDIR /app
+1, -1
......@@ -95,7 +95,7 @@ build: build-prose build-pastes build-feeds build-pgs build-auth build-pico buil
9595
9696 scripts:
9797 # 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
9999 .PHONY: scripts
100100
101101 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
22 LABEL maintainer="Pico Maintainers <hello@pico.sh>"
33
44 WORKDIR /app
......@@ -8,13 +8,13 @@ RUN apt-get install -y git ca-certificates
88
99 RUN git clone https://codeberg.org/emersion/soju.git
1010
11-# COPY subscriber-change.diff .
11+COPY subscriber-change.diff .
1212
1313 WORKDIR /app/soju
1414
1515 RUN git checkout v0.10.1
1616
17-# RUN git apply ../subscriber-change.diff
17+RUN git apply ../subscriber-change.diff
1818
1919 RUN --mount=type=cache,target=/go/pkg/,rw \
2020 --mount=type=cache,target=/root/.cache/,rw \
+16, -16
......@@ -1,8 +1,8 @@
11 diff --git a/downstream.go b/downstream.go
2-index 78044e1..c95a0f6 100644
2+index b627450..b845ecd 100644
33 --- a/downstream.go
44 +++ 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.
66 network.pushTargets.Del(target)
77 }
88 go network.broadcastWebPush(&irc.Message{
......@@ -12,7 +12,7 @@ index 78044e1..c95a0f6 100644
1212 Command: "MARKREAD",
1313 Params: []string{target, timestampStr},
1414 })
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.
1616 }}
1717 }
1818
......@@ -24,18 +24,18 @@ index 78044e1..c95a0f6 100644
2424 Endpoint: endpoint,
2525 }
2626 diff --git a/server.go b/server.go
27-index f6e1cf6..9114580 100644
27+index f1f56d7..81c8bd6 100644
2828 --- a/server.go
2929 +++ b/server.go
3030 @@ -10,6 +10,7 @@ import (
31- "net"
3231 "net/http"
32+ "net/netip"
3333 "runtime/debug"
3434 + "strings"
3535 "sync"
3636 "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
3939 ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
4040 defer cancel()
4141
......@@ -51,8 +51,8 @@ index f6e1cf6..9114580 100644
5151 var urgency webpush.Urgency
5252 switch msg.Command {
5353 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,
5656 VAPIDPublicKey: s.webPush.VAPIDKeys.Public,
5757 VAPIDPrivateKey: s.webPush.VAPIDKeys.Private,
5858 - Subscriber: "https://soju.im",
......@@ -61,18 +61,18 @@ index f6e1cf6..9114580 100644
6161 Urgency: urgency,
6262 RecordSize: 2048,
6363 diff --git a/upstream.go b/upstream.go
64-index ea309f4..e198dc7 100644
64+index 37cf508..8f6ff03 100644
6565 --- a/upstream.go
6666 +++ 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
6868 }
6969
70- if !self && !detached && msg.Command != "TAGMSG" && (highlight || directMessage) {
70+ if sendWebPush {
7171 + 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
7676 })
7777
7878 if weAreInvited {