Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live removal of issue comments using htmx websocket #28958

Open
wants to merge 82 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
2b247dd
Update issue comments
anbraten Jan 27, 2024
5005245
move dep
anbraten Jan 27, 2024
7cf50ef
fix htmx ws loading
anbraten Jan 28, 2024
4947abc
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Jan 30, 2024
3b35637
add listeners
anbraten Feb 3, 2024
e85f85b
Merge branch 'main' into issue-updates
anbraten Feb 3, 2024
d77073b
add websocket service
anbraten Feb 3, 2024
17f4faf
improve websocket service
anbraten Feb 3, 2024
948f1bd
cleanup
anbraten Feb 3, 2024
1d6a34d
update templates
anbraten Feb 3, 2024
337456a
Merge branch 'main' into issue-updates
anbraten Feb 3, 2024
e4beba8
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 3, 2024
21bcb1b
adust template
anbraten Feb 3, 2024
c2ca7d8
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Feb 3, 2024
fb49e6b
undo some changes
anbraten Feb 3, 2024
4c03093
sort imports
anbraten Feb 3, 2024
7173bea
render comment template
anbraten Feb 3, 2024
bc2a352
improve session data and rendering
anbraten Feb 11, 2024
26ab35c
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 11, 2024
b2f4aae
cleanup
anbraten Feb 11, 2024
afcdd78
Merge branch 'main' into issue-updates
anbraten Feb 11, 2024
21485f8
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 16, 2024
7cda3aa
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Feb 16, 2024
d9c4554
Merge branch 'main' into issue-updates
anbraten Feb 16, 2024
ea06a25
cleanup
anbraten Feb 16, 2024
9ace44c
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 16, 2024
78b94ff
finish
anbraten Feb 16, 2024
c595916
fix permission
anbraten Feb 16, 2024
b805631
sort imports
anbraten Feb 16, 2024
e9ded26
Merge branch 'main' into issue-updates
anbraten Feb 17, 2024
b5f61df
Merge branch 'main' into issue-updates
anbraten Feb 19, 2024
7de741c
use custom create-websocket
anbraten Feb 20, 2024
bdde78a
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Feb 20, 2024
3d2ec73
Merge branch 'main' into issue-updates
anbraten Feb 20, 2024
4f97ad2
Merge branch 'main' into issue-updates
anbraten Feb 22, 2024
72bb32f
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 24, 2024
c1512d3
rename event to e
anbraten Feb 24, 2024
201fd83
rename event to e
anbraten Feb 24, 2024
39421d6
undo prettier
anbraten Feb 24, 2024
634834b
undo more prettier changes
anbraten Feb 24, 2024
671a8df
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Feb 27, 2024
94bcdba
fix imports
anbraten Feb 27, 2024
77f89b7
Merge branch 'main' into issue-updates
anbraten Mar 4, 2024
1602afd
remove websocket init for now, fix lint
silverwind Mar 4, 2024
f2f97a2
Tweak comment
silverwind Mar 7, 2024
4d75e28
add return
anbraten Mar 9, 2024
7f3435f
Merge branch 'main' into issue-updates
anbraten Mar 9, 2024
cf23cd6
go mod tidy
anbraten Mar 9, 2024
bb4443d
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Mar 9, 2024
372faaa
add melody pubsub
anbraten Mar 11, 2024
d86c1dc
Update services/pubsub/types.go
techknowlogick Mar 11, 2024
70f2fee
Merge branch 'main' into pubsub
silverwind Mar 13, 2024
154f61c
Merge remote-tracking branch 'upstream/main' into pubsub
anbraten Mar 21, 2024
8919106
Merge branch 'pubsub' of github.com:anbraten/gitea into pubsub
anbraten Mar 21, 2024
1328b2b
undo
anbraten Mar 21, 2024
0aa3d5e
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Mar 21, 2024
40fc078
tidy
anbraten Mar 21, 2024
c6abd32
fmt
anbraten Mar 21, 2024
e9502e0
Merge branch 'main' into issue-updates
anbraten Apr 3, 2024
b8dab69
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Apr 3, 2024
088454f
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Apr 3, 2024
43ad9f5
add comma
anbraten Apr 3, 2024
7cb8e2f
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Apr 6, 2024
602a42a
adjust websocket
anbraten Apr 6, 2024
6af641f
Merge remote-tracking branch 'upstream/main' into pubsub
anbraten Jun 20, 2024
f83d6fe
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Jun 20, 2024
0262846
adjust
anbraten Jun 26, 2024
aed4810
Merge remote-tracking branch 'upstream/main' into pubsub
anbraten Jul 9, 2024
a2e1c14
Merge remote-tracking branch 'upstream/main' into pubsub
anbraten Sep 19, 2024
85cf27e
adjsut
anbraten Sep 19, 2024
abcc609
fix
anbraten Sep 19, 2024
597fac4
add pubsub
anbraten Sep 20, 2024
63f4e6c
cleanup
anbraten Sep 20, 2024
7daafae
Merge branch 'issue-updates' into pubsub
anbraten Sep 20, 2024
edb0f9c
merge
anbraten Sep 20, 2024
f2001a2
fix
anbraten Sep 20, 2024
cbfb0bd
Merge branch 'main' into pubsub
anbraten Sep 20, 2024
56d11fc
update
anbraten Sep 20, 2024
877eb69
Merge branch 'pubsub' of github.com:anbraten/gitea into pubsub
anbraten Sep 20, 2024
d34e36b
Merge branch 'main' into issue-updates
anbraten Sep 25, 2024
e6da1b1
Merge remote-tracking branch 'upstream/main' into issue-updates
anbraten Oct 1, 2024
5ceae12
Merge branch 'issue-updates' of github.com:anbraten/gitea into issue-…
anbraten Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ require (
github.com/msteinert/pam v1.2.0
github.com/nektos/act v0.2.52
github.com/niklasfasching/go-org v1.7.0
github.com/olahol/melody v1.1.4
github.com/olivere/elastic/v7 v7.0.32
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc6
Expand Down Expand Up @@ -210,6 +211,7 @@ require (
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE
github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY=
github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
Expand Down Expand Up @@ -696,6 +698,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olahol/melody v1.1.4 h1:RQHfKZkQmDxI0+SLZRNBCn4LiXdqxLKRGSkT8Dyoe/E=
github.com/olahol/melody v1.1.4/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/olivere/elastic/v7 v7.0.32 h1:R7CXvbu8Eq+WlsLgxmKVKPox0oOwAE/2T9Si5BnvK6E=
Expand Down
13 changes: 13 additions & 0 deletions modules/context/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
package context

import (
"bufio"
"errors"
"net"
"net/http"

web_types "code.gitea.io/gitea/modules/web/types"
Expand All @@ -30,6 +33,14 @@ type Response struct {
status int
befores []func(ResponseWriter)
beforeExecuted bool
hijacker http.Hijacker
}

func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if r.hijacker == nil {
return nil, nil, errors.New("http.Hijacker not implemented by underlying http.ResponseWriter")
}
return r.hijacker.Hijack()
}

// Write writes bytes to HTTP endpoint
Expand Down Expand Up @@ -95,9 +106,11 @@ func WrapResponseWriter(resp http.ResponseWriter) *Response {
if v, ok := resp.(*Response); ok {
return v
}
hijacker, _ := resp.(http.Hijacker)
return &Response{
ResponseWriter: resp,
status: 0,
befores: make([]func(ResponseWriter), 0),
hijacker: hijacker,
}
}
Loading
Loading