repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
668ea26
parent
90b243e
author
Antonio Mika
date
2024-01-14 21:28:42 +0000 UTC
Update subscriber change for soju
1 files changed,  +20, -12
M bouncer/subscriber-change.diff
+20, -12
 1@@ -1,8 +1,8 @@
 2 diff --git a/downstream.go b/downstream.go
 3-index f383212..35082d4 100644
 4+index f28b40f..caef2e2 100644
 5 --- a/downstream.go
 6 +++ b/downstream.go
 7-@@ -2947,6 +2947,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
 8+@@ -2952,6 +2952,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
 9  				network.pushTargets.Del(target)
10  			}
11  			go network.broadcastWebPush(&irc.Message{
12@@ -12,7 +12,7 @@ index f383212..35082d4 100644
13  				Command: "MARKREAD",
14  				Params:  []string{target, timestampStr},
15  			})
16-@@ -3198,6 +3201,10 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
17+@@ -3203,6 +3206,10 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
18  				}}
19  			}
20  
21@@ -24,7 +24,7 @@ index f383212..35082d4 100644
22  				Endpoint: endpoint,
23  			}
24 diff --git a/server.go b/server.go
25-index 552104e..4b2ffe6 100644
26+index d26e873..407355f 100644
27 --- a/server.go
28 +++ b/server.go
29 @@ -10,6 +10,7 @@ import (
30@@ -51,20 +51,28 @@ index 552104e..4b2ffe6 100644
31  	var urgency webpush.Urgency
32  	switch msg.Command {
33  	case "PRIVMSG", "NOTICE", "INVITE":
34-@@ -339,7 +349,7 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap
35+@@ -339,12 +349,10 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap
36  		},
37  		VAPIDPublicKey:  s.webPush.VAPIDKeys.Public,
38  		VAPIDPrivateKey: s.webPush.VAPIDKeys.Private,
39--		Subscriber:      "https://soju.im",
40+-		// TODO: switch back to an HTTP URL once this is merged:
41+-		// https://github.com/SherClockHolmes/webpush-go/pull/57
42+-		Subscriber: "webpush@soju.im",
43+-		TTL:        7 * 24 * 60 * 60, // seconds
44+-		Urgency:    urgency,
45+-		RecordSize: 2048,
46 +		Subscriber:      "hello@pico.sh",
47- 		TTL:             7 * 24 * 60 * 60, // seconds
48- 		Urgency:         urgency,
49- 		RecordSize:      2048,
50++		TTL:             7 * 24 * 60 * 60, // seconds
51++		Urgency:         urgency,
52++		RecordSize:      2048,
53+ 	}
54+ 
55+ 	if vapidPubKey != options.VAPIDPublicKey {
56 diff --git a/upstream.go b/upstream.go
57-index 95bad3a..afbe314 100644
58+index e3bdf4e..38ed883 100644
59 --- a/upstream.go
60 +++ b/upstream.go
61-@@ -682,6 +682,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
62+@@ -683,6 +683,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
63  		}
64  
65  		if !self && (highlight || directMessage) {
66@@ -72,7 +80,7 @@ index 95bad3a..afbe314 100644
67  			go uc.network.broadcastWebPush(msg)
68  			if timestamp, err := time.Parse(xirc.ServerTimeLayout, string(msg.Tags["time"])); err == nil {
69  				uc.network.pushTargets.Set(bufferName, timestamp)
70-@@ -1611,6 +1612,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
71+@@ -1612,6 +1613,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
72  		})
73  
74  		if weAreInvited {