Skip to content

Commit

Permalink
Merge pull request #4 from szpnygo/feature/update_gogs
Browse files Browse the repository at this point in the history
update gogs version
  • Loading branch information
szpnygo authored Oct 19, 2022
2 parents ffba810 + e5e0ed9 commit 4e0ccfb
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gtc is a p2p terminal chat app, using webrtc. All conversation content will not
### Install

```bash
go install github.com/szpnygo/gtc@v0.2.4
go install github.com/szpnygo/gtc@v0.2.5
```

or you can download from release
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
require (
github.com/gorilla/websocket v1.5.0
github.com/mattn/go-runewidth v0.0.14
github.com/metagogs/gogs v0.1.5
github.com/metagogs/gogs v0.1.6
github.com/nsf/termbox-go v1.1.1
github.com/pion/webrtc/v3 v3.1.47
github.com/pterm/pterm v0.12.49
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/metagogs/gogs v0.1.5 h1:rN+HKF5IX3F1CpcTjYRmT7Ux79ZFk1Yi21AkwvvFIJY=
github.com/metagogs/gogs v0.1.5/go.mod h1:yUr+u6FRemVcHv5xhvGL868f+mYIdG7R2dta57atyJo=
github.com/metagogs/gogs v0.1.6 h1:eGrU/gPhtmA0fjud0qFqwI/oTaSkNHzH90KQJZ4OEAI=
github.com/metagogs/gogs v0.1.6/go.mod h1:yUr+u6FRemVcHv5xhvGL868f+mYIdG7R2dta57atyJo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
3 changes: 2 additions & 1 deletion server/internal/logic/gtcserver/answer_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gtcserver
import (
"context"

"github.com/metagogs/gogs"
"github.com/metagogs/gogs/gslog"
"github.com/metagogs/gogs/session"
"github.com/szpnygo/gtc/server/internal/svc"
Expand All @@ -27,7 +28,7 @@ func NewAnswerLogic(ctx context.Context, svcCtx *svc.ServiceContext, sess *sessi
}

func (l *AnswerLogic) Handler(in *model.Answer) {
if sess, err := session.GetSessionByID(in.UserId); err == nil {
if sess, err := gogs.GetSessionByID(in.UserId); err == nil {
in.UserId = l.session.ID()
_ = sess.SendMessage(in)
}
Expand Down
3 changes: 2 additions & 1 deletion server/internal/logic/gtcserver/candidate_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gtcserver
import (
"context"

"github.com/metagogs/gogs"
"github.com/metagogs/gogs/gslog"
"github.com/metagogs/gogs/session"
"github.com/szpnygo/gtc/server/internal/svc"
Expand All @@ -27,7 +28,7 @@ func NewCandidateLogic(ctx context.Context, svcCtx *svc.ServiceContext, sess *se
}

func (l *CandidateLogic) Handler(in *model.Candidate) {
if sess, err := session.GetSessionByID(in.UserId); err == nil {
if sess, err := gogs.GetSessionByID(in.UserId); err == nil {
in.UserId = l.session.ID()
_ = sess.SendMessage(in)
}
Expand Down
5 changes: 3 additions & 2 deletions server/internal/logic/gtcserver/join_room_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"

"github.com/metagogs/gogs"
"github.com/metagogs/gogs/group"
"github.com/metagogs/gogs/gslog"
"github.com/metagogs/gogs/session"
Expand Down Expand Up @@ -65,7 +66,7 @@ func (l *JoinRoomLogic) Handler(in *model.JoinRoom) {
Users: usersFilted,
})

session.BroadcastMessage(users, &model.JoinRoomNotify{
gogs.BroadcastMessage(users, &model.JoinRoomNotify{
RoomId: group.GetGroupName(l.ctx),
Name: in.Name,
UserId: l.session.ID(),
Expand All @@ -77,7 +78,7 @@ func (l *JoinRoomLogic) removeUserFromGroup(g group.Group, name string) {
if err := g.RemoveUser(l.ctx, l.session.UID()); err == nil {
// broadcast the user left message if user is in the room
list := g.GetUsers(l.ctx)
session.BroadcastMessage(list, &model.LeaveRoomNotify{
gogs.BroadcastMessage(list, &model.LeaveRoomNotify{
RoomId: g.GetGroupName(l.ctx),
Name: name,
Users: filterUid(list),
Expand Down
3 changes: 2 additions & 1 deletion server/internal/logic/gtcserver/leave_room_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gtcserver
import (
"context"

"github.com/metagogs/gogs"
"github.com/metagogs/gogs/gslog"
"github.com/metagogs/gogs/session"
"github.com/szpnygo/gtc/server/internal/svc"
Expand Down Expand Up @@ -37,7 +38,7 @@ func (l *LeaveRoomLogic) Handler(in *model.LeaveRoom) {
if err := group.RemoveUser(l.ctx, l.session.UID()); err == nil {
users := group.GetUsers(l.ctx)

session.BroadcastMessage(users, &model.LeaveRoomNotify{
gogs.BroadcastMessage(users, &model.LeaveRoomNotify{
RoomId: group.GetGroupName(l.ctx),
UserId: l.session.ID(),
Name: in.Name,
Expand Down
3 changes: 2 additions & 1 deletion server/internal/logic/gtcserver/offer_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gtcserver
import (
"context"

"github.com/metagogs/gogs"
"github.com/metagogs/gogs/gslog"
"github.com/metagogs/gogs/session"
"github.com/szpnygo/gtc/server/internal/svc"
Expand All @@ -27,7 +28,7 @@ func NewOfferLogic(ctx context.Context, svcCtx *svc.ServiceContext, sess *sessio
}

func (l *OfferLogic) Handler(in *model.Offer) {
if sess, err := session.GetSessionByID(in.UserId); err == nil {
if sess, err := gogs.GetSessionByID(in.UserId); err == nil {
in.UserId = l.session.ID()
_ = sess.SendMessage(in)
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.3
v0.2.5

0 comments on commit 4e0ccfb

Please sign in to comment.