update net-im/teleirc
This commit is contained in:
parent
7c22aac087
commit
5a1f753526
|
@ -0,0 +1,32 @@
|
|||
From 1170475966c09e71a2cd770bc53b15fa70dcf582 Mon Sep 17 00:00:00 2001
|
||||
From: Ville Valkonen <weezel@users.noreply.github.com>
|
||||
Date: Mon, 6 Mar 2023 01:11:19 +0200
|
||||
Subject: [PATCH 01/10] Fix implicit memory aliasing in a loop. (#406)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Otherwise the code will point into the same memory address during the
|
||||
loop.
|
||||
|
||||
Signed-off-by: Ville Valkonen <weezelding@gmail.com>
|
||||
Co-authored-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
internal/handlers/telegram/handler.go | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/internal/handlers/telegram/handler.go b/internal/handlers/telegram/handler.go
|
||||
index 5921d6794ebb..12404273adf4 100644
|
||||
--- a/internal/handlers/telegram/handler.go
|
||||
+++ b/internal/handlers/telegram/handler.go
|
||||
@@ -120,6 +120,7 @@ joinHandler handles when users join the Telegram group
|
||||
func joinHandler(tg *Client, users *[]tgbotapi.User) {
|
||||
if tg.IRCSettings.ShowJoinMessage {
|
||||
for _, user := range *users {
|
||||
+ user := user
|
||||
username := GetFullUsername(tg.IRCSettings.ShowZWSP, &user)
|
||||
formatted := username + " has joined the Telegram Group!"
|
||||
tg.sendToIrc(formatted)
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
From e927b34224a54255ec1d135e062c8e525daffa73 Mon Sep 17 00:00:00 2001
|
||||
From: Regis David Souza Mesquita <rdsm@posteo.net>
|
||||
Date: Wed, 22 Nov 2023 21:47:29 +0000
|
||||
Subject: [PATCH 02/10] Update who-uses-teleirc.rst (#419)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Adds RubyBrasil to the users list.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
docs/about/who-uses-teleirc.rst | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/docs/about/who-uses-teleirc.rst b/docs/about/who-uses-teleirc.rst
|
||||
index ae505c9fcc43..659552c6e89d 100644
|
||||
--- a/docs/about/who-uses-teleirc.rst
|
||||
+++ b/docs/about/who-uses-teleirc.rst
|
||||
@@ -14,6 +14,8 @@ The following projects and communities use RITlug TeleIRC v2.0.0 or later:
|
||||
|
||||
- mIRC Italia Crew (`@mircitaliacrew <https://t.me/mircitaliacrew>`_ | `#mircitaliacrew <https://webchat.freenode.net/#mircitaliacrew>`_)
|
||||
|
||||
+- `Ruby Brasil <https://github.com/guru-br>`_ (`@RubyBrasilOffTopic <https://t.me/RubyBrasilOffTopic>`_ | `#rubybr <https://web.libera.chat/#rubybr>`_)
|
||||
+
|
||||
|
||||
******
|
||||
v1.x.x
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,289 @@
|
|||
From c8edf2cb4dc675444b2cba285f9c642f069bc81c Mon Sep 17 00:00:00 2001
|
||||
From: Vencislav Atanasov <user890104@users.noreply.github.com>
|
||||
Date: Wed, 22 Nov 2023 23:52:16 +0200
|
||||
Subject: [PATCH 03/10] Add tests for replying to UTF-8 messages, use runes to
|
||||
substring by character offset instead of byte offset (#418)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Co-authored-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
internal/handlers/telegram/handler.go | 4 +-
|
||||
internal/handlers/telegram/handler_test.go | 124 ++++++++++++++++-----
|
||||
internal/handlers/telegram/helpers.go | 6 +-
|
||||
internal/handlers/telegram/helpers_test.go | 63 +++++++++--
|
||||
4 files changed, 156 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/internal/handlers/telegram/handler.go b/internal/handlers/telegram/handler.go
|
||||
index 12404273adf4..2600b1dc42ef 100644
|
||||
--- a/internal/handlers/telegram/handler.go
|
||||
+++ b/internal/handlers/telegram/handler.go
|
||||
@@ -97,8 +97,8 @@ func replyHandler(tg *Client, u tgbotapi.Update) {
|
||||
replyUser := GetUsername(tg.IRCSettings.ShowZWSP, u.Message.ReplyToMessage.From)
|
||||
|
||||
// Only show a portion of the reply text
|
||||
- if len(replyText) > tg.Settings.ReplyLength {
|
||||
- replyText = replyText[0:tg.Settings.ReplyLength] + "…"
|
||||
+ if replyTextAsRunes := []rune(replyText); len(replyTextAsRunes) > tg.Settings.ReplyLength {
|
||||
+ replyText = string(replyTextAsRunes[:tg.Settings.ReplyLength]) + "…"
|
||||
}
|
||||
|
||||
formatted := fmt.Sprintf("%s%s%s %sRe %s: %s%s %s",
|
||||
diff --git a/internal/handlers/telegram/handler_test.go b/internal/handlers/telegram/handler_test.go
|
||||
index a2413c70d616..e356c5b54433 100644
|
||||
--- a/internal/handlers/telegram/handler_test.go
|
||||
+++ b/internal/handlers/telegram/handler_test.go
|
||||
@@ -762,39 +762,107 @@ func TestMessageReply(t *testing.T) {
|
||||
testChat := &tgbotapi.Chat{
|
||||
ID: 100,
|
||||
}
|
||||
- initMessage := &tgbotapi.Message{
|
||||
- From: testUser,
|
||||
- Text: "Initial Text",
|
||||
- Chat: testChat,
|
||||
- }
|
||||
- correct := "<replyUser> [Re test: Initial Text] Response Text"
|
||||
|
||||
- updateObj := tgbotapi.Update{
|
||||
- Message: &tgbotapi.Message{
|
||||
- From: replyUser,
|
||||
- Text: "Response Text",
|
||||
- Chat: testChat,
|
||||
- ReplyToMessage: initMessage,
|
||||
+ tests := []struct {
|
||||
+ name string
|
||||
+ updateFn func() tgbotapi.Update
|
||||
+ expected string
|
||||
+ }{
|
||||
+ {
|
||||
+ name: "ascii",
|
||||
+ updateFn: func() tgbotapi.Update {
|
||||
+ return tgbotapi.Update{
|
||||
+ Message: &tgbotapi.Message{
|
||||
+ From: replyUser,
|
||||
+ Text: "Response Text",
|
||||
+ Chat: testChat,
|
||||
+ ReplyToMessage: &tgbotapi.Message{
|
||||
+ From: testUser,
|
||||
+ Text: "Initial Text",
|
||||
+ Chat: testChat,
|
||||
+ },
|
||||
+ },
|
||||
+ }
|
||||
+ },
|
||||
+ expected: "<replyUser> [Re test: Initial Text] Response Text",
|
||||
},
|
||||
- }
|
||||
- clientObj := &Client{
|
||||
- Settings: &internal.TelegramSettings{
|
||||
- Prefix: "<",
|
||||
- Suffix: ">",
|
||||
- ReplyPrefix: "[",
|
||||
- ReplySuffix: "]",
|
||||
- ReplyLength: 15,
|
||||
- ChatID: 100,
|
||||
+ {
|
||||
+ name: "cyrillic-short",
|
||||
+ updateFn: func() tgbotapi.Update {
|
||||
+ return tgbotapi.Update{
|
||||
+ Message: &tgbotapi.Message{
|
||||
+ From: replyUser,
|
||||
+ Text: "Response Text",
|
||||
+ Chat: testChat,
|
||||
+ ReplyToMessage: &tgbotapi.Message{
|
||||
+ From: testUser,
|
||||
+ Text: "Тест",
|
||||
+ Chat: testChat,
|
||||
+ },
|
||||
+ },
|
||||
+ }
|
||||
+ },
|
||||
+ expected: "<replyUser> [Re test: Тест] Response Text",
|
||||
},
|
||||
- IRCSettings: &internal.IRCSettings{
|
||||
- ShowZWSP: false,
|
||||
+ {
|
||||
+ name: "cyrillic-long",
|
||||
+ updateFn: func() tgbotapi.Update {
|
||||
+ return tgbotapi.Update{
|
||||
+ Message: &tgbotapi.Message{
|
||||
+ From: replyUser,
|
||||
+ Text: "Response Text",
|
||||
+ Chat: testChat,
|
||||
+ ReplyToMessage: &tgbotapi.Message{
|
||||
+ From: testUser,
|
||||
+ Text: "Уикипедия е свободна енциклопедия",
|
||||
+ Chat: testChat,
|
||||
+ },
|
||||
+ },
|
||||
+ }
|
||||
+ },
|
||||
+ expected: "<replyUser> [Re test: Уикипедия е сво…] Response Text",
|
||||
},
|
||||
- sendToIrc: func(s string) {
|
||||
- assert.Equal(t, correct, s)
|
||||
+ {
|
||||
+ name: "japanese-long",
|
||||
+ updateFn: func() tgbotapi.Update {
|
||||
+ return tgbotapi.Update{
|
||||
+ Message: &tgbotapi.Message{
|
||||
+ From: replyUser,
|
||||
+ Text: "Response Text",
|
||||
+ Chat: testChat,
|
||||
+ ReplyToMessage: &tgbotapi.Message{
|
||||
+ From: testUser,
|
||||
+ Text: "1234567テストテストテスト",
|
||||
+ Chat: testChat,
|
||||
+ },
|
||||
+ },
|
||||
+ }
|
||||
+ },
|
||||
+ expected: "<replyUser> [Re test: 1234567テストテストテス…] Response Text",
|
||||
},
|
||||
}
|
||||
|
||||
- messageHandler(clientObj, updateObj)
|
||||
+ for _, test := range tests {
|
||||
+ t.Run(test.name, func(t *testing.T) {
|
||||
+ clientObj := &Client{
|
||||
+ Settings: &internal.TelegramSettings{
|
||||
+ Prefix: "<",
|
||||
+ Suffix: ">",
|
||||
+ ReplyPrefix: "[",
|
||||
+ ReplySuffix: "]",
|
||||
+ ReplyLength: 15,
|
||||
+ ChatID: 100,
|
||||
+ },
|
||||
+ IRCSettings: &internal.IRCSettings{
|
||||
+ ShowZWSP: false,
|
||||
+ },
|
||||
+ sendToIrc: func(actual string) {
|
||||
+ assert.Equal(t, test.expected, actual)
|
||||
+ },
|
||||
+ }
|
||||
+ messageHandler(clientObj, test.updateFn())
|
||||
+ })
|
||||
+ }
|
||||
}
|
||||
|
||||
func TestMessageReplyZwsp(t *testing.T) {
|
||||
@@ -891,8 +959,8 @@ func TestLocationHandlerWithLocationEnabled(t *testing.T) {
|
||||
LastName: "123",
|
||||
}
|
||||
|
||||
- // https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#Location
|
||||
- location := &tgbotapi.Location{
|
||||
+ // https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#Location
|
||||
+ location := &tgbotapi.Location{
|
||||
Latitude: 43.0845274,
|
||||
Longitude: -77.6781174,
|
||||
}
|
||||
diff --git a/internal/handlers/telegram/helpers.go b/internal/handlers/telegram/helpers.go
|
||||
index f092979a9ffd..19b65ab722e3 100644
|
||||
--- a/internal/handlers/telegram/helpers.go
|
||||
+++ b/internal/handlers/telegram/helpers.go
|
||||
@@ -37,7 +37,8 @@ Adds ZWSP to username to prevent username pinging across platform.
|
||||
func GetFullUserZwsp(u *tgbotapi.User) string {
|
||||
// Add ZWSP to prevent pinging across platforms
|
||||
// See https://github.com/42wim/matterbridge/issues/175
|
||||
- return u.FirstName + " (@" + u.UserName[:1] + "\u200b" + u.UserName[1:] + ")"
|
||||
+ userNameAsRunes := []rune(u.UserName)
|
||||
+ return u.FirstName + " (@" + string(userNameAsRunes[:1]) + "\u200b" + string(userNameAsRunes[1:]) + ")"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -47,7 +48,8 @@ username.
|
||||
func ZwspUsername(u *tgbotapi.User) string {
|
||||
// Add ZWSP to prevent pinging across platforms
|
||||
// See https://github.com/42wim/matterbridge/issues/175
|
||||
- return u.UserName[:1] + "\u200b" + u.UserName[1:]
|
||||
+ userNameAsRunes := []rune(u.UserName)
|
||||
+ return string(userNameAsRunes[:1]) + "\u200b" + string(userNameAsRunes[1:])
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/internal/handlers/telegram/helpers_test.go b/internal/handlers/telegram/helpers_test.go
|
||||
index 52eaa475c409..710f5a2c3ad7 100644
|
||||
--- a/internal/handlers/telegram/helpers_test.go
|
||||
+++ b/internal/handlers/telegram/helpers_test.go
|
||||
@@ -16,12 +16,34 @@ func TestGetFullUsername(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFullUserZwsp(t *testing.T) {
|
||||
- user := &tgbotapi.User{ID: 1, FirstName: "John", UserName: "jsmith"}
|
||||
- correct := user.FirstName + " (@" + user.UserName[:1] +
|
||||
- "\u200b" + user.UserName[1:] + ")"
|
||||
- name := GetFullUsername(true, user)
|
||||
+ tests := []struct {
|
||||
+ name string
|
||||
+ user *tgbotapi.User
|
||||
+ expected string
|
||||
+ }{
|
||||
+ {
|
||||
+ name: "ascii",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "John", UserName: "jsmith"},
|
||||
+ expected: "John (@j\u200bsmith)",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "cyrillic",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "Иван", UserName: "иван"},
|
||||
+ expected: "Иван (@и\u200bван)",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "japanese",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "まこと", UserName: "まこと"},
|
||||
+ expected: "まこと (@ま\u200bこと)",
|
||||
+ },
|
||||
+ }
|
||||
|
||||
- assert.Equal(t, correct, name)
|
||||
+ for _, test := range tests {
|
||||
+ t.Run(test.name, func(t *testing.T) {
|
||||
+ actual := GetFullUsername(true, test.user)
|
||||
+ assert.Equal(t, test.expected, actual)
|
||||
+ })
|
||||
+ }
|
||||
}
|
||||
|
||||
func TestGetFullNoUsername(t *testing.T) {
|
||||
@@ -49,9 +71,32 @@ func TestGetUsername(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestZwspUsername(t *testing.T) {
|
||||
- user := &tgbotapi.User{ID: 1, FirstName: "John", UserName: "jsmith"}
|
||||
- correct := "j" + "\u200b" + "smith"
|
||||
- name := GetUsername(true, user)
|
||||
+ tests := []struct {
|
||||
+ name string
|
||||
+ user *tgbotapi.User
|
||||
+ expected string
|
||||
+ }{
|
||||
+ {
|
||||
+ name: "ascii",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "John", UserName: "jsmith"},
|
||||
+ expected: "j\u200bsmith",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "cyrillic",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "Иван", UserName: "иван"},
|
||||
+ expected: "и\u200bван",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "japanese",
|
||||
+ user: &tgbotapi.User{ID: 1, FirstName: "まこと", UserName: "まこと"},
|
||||
+ expected: "ま\u200bこと",
|
||||
+ },
|
||||
+ }
|
||||
|
||||
- assert.Equal(t, correct, name)
|
||||
+ for _, test := range tests {
|
||||
+ t.Run(test.name, func(t *testing.T) {
|
||||
+ actual := GetUsername(true, test.user)
|
||||
+ assert.Equal(t, test.expected, actual)
|
||||
+ })
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
From 9ad5f9a1cced4f3e701ec1e0cb355994e197673b Mon Sep 17 00:00:00 2001
|
||||
From: Johnny Hsieh <32300164+mnixry@users.noreply.github.com>
|
||||
Date: Fri, 26 Jan 2024 01:44:39 +0800
|
||||
Subject: [PATCH 04/10] Add GitHub Action to automatic build and push Docker
|
||||
Image (#417)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Co-authored-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
.github/workflows/main.yml | 54 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 54 insertions(+)
|
||||
create mode 100644 .github/workflows/main.yml
|
||||
|
||||
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
|
||||
new file mode 100644
|
||||
index 000000000000..811508e8dadf
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/main.yml
|
||||
@@ -0,0 +1,54 @@
|
||||
+# This workflow uses actions that are not certified by GitHub.
|
||||
+# They are provided by a third-party and are governed by
|
||||
+# separate terms of service, privacy policy, and support
|
||||
+# documentation.
|
||||
+
|
||||
+name: Docker
|
||||
+
|
||||
+on:
|
||||
+ push:
|
||||
+ branches: [main]
|
||||
+
|
||||
+env:
|
||||
+ REGISTRY: ghcr.io
|
||||
+ IMAGE_NAME: ${{ github.repository }}
|
||||
+
|
||||
+concurrency:
|
||||
+ group: ${{ github.workflow }}-${{ github.ref }}
|
||||
+ cancel-in-progress: true
|
||||
+
|
||||
+jobs:
|
||||
+ build-and-push-image:
|
||||
+ name: Build and Push Image
|
||||
+
|
||||
+ runs-on: ubuntu-latest
|
||||
+ permissions:
|
||||
+ contents: read
|
||||
+ packages: write
|
||||
+
|
||||
+ steps:
|
||||
+ - name: Checkout repository
|
||||
+ uses: actions/checkout@v3
|
||||
+
|
||||
+ - name: Log in to the Container registry
|
||||
+ uses: docker/login-action@v2
|
||||
+ with:
|
||||
+ registry: ${{ env.REGISTRY }}
|
||||
+ username: ${{ github.actor }}
|
||||
+ password: ${{ secrets.GITHUB_TOKEN }}
|
||||
+
|
||||
+ - name: Extract metadata (tags, labels) for Docker
|
||||
+ id: meta
|
||||
+ uses: docker/metadata-action@v4
|
||||
+ with:
|
||||
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
+ github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
+
|
||||
+ - name: Build and push Docker image
|
||||
+ uses: docker/build-push-action@v4
|
||||
+ with:
|
||||
+ push: true
|
||||
+ context: .
|
||||
+ file: ./deployments/container/Dockerfile
|
||||
+ tags: ${{ steps.meta.outputs.tags }}
|
||||
+ labels: ${{ steps.meta.outputs.labels }}
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
From 40a9c2c6c817144504ba4fec38145b71f2e78382 Mon Sep 17 00:00:00 2001
|
||||
From: tazjin <tazjin@tvl.su>
|
||||
Date: Tue, 28 May 2024 22:06:25 +0300
|
||||
Subject: [PATCH 05/10] Check if IRC messages come from the expected channel
|
||||
(#422)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Explicitly check that the channel from which a message is
|
||||
received matches the channel that is configured in teleirc.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
internal/handlers/irc/handlers.go | 9 +++--
|
||||
internal/handlers/irc/handlers_test.go | 50 ++++++++++++++++++++++++--
|
||||
2 files changed, 54 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/internal/handlers/irc/handlers.go b/internal/handlers/irc/handlers.go
|
||||
index 4c3332568379..5f0b16dad2ec 100644
|
||||
--- a/internal/handlers/irc/handlers.go
|
||||
+++ b/internal/handlers/irc/handlers.go
|
||||
@@ -113,13 +113,16 @@ and channel messages. However, it only cares about channel messages
|
||||
*/
|
||||
func messageHandler(c ClientInterface) func(*girc.Client, girc.Event) {
|
||||
var colorStripper = regexp.MustCompile(`[\x02\x1F\x0F\x16]|\x03(\d\d?(,\d\d?)?)?`)
|
||||
+ var ircChannel = c.IRCSettings().Channel
|
||||
|
||||
return func(gc *girc.Client, e girc.Event) {
|
||||
c.Logger().LogDebug("messageHandler triggered")
|
||||
- // Only send if user is not in blacklist
|
||||
- if !(checkBlacklist(c, e.Source.Name)) {
|
||||
|
||||
- if e.IsFromChannel() {
|
||||
+ // Only send if user is not in blacklist ...
|
||||
+ if !(checkBlacklist(c, e.Source.Name)) {
|
||||
+ // ... and if the channel matches. Array index is safe because IsFromChannel
|
||||
+ // itself does it this way.
|
||||
+ if e.IsFromChannel() && e.Params[0] == ircChannel {
|
||||
formatted := ""
|
||||
if e.IsAction() {
|
||||
msg := e.Last()
|
||||
diff --git a/internal/handlers/irc/handlers_test.go b/internal/handlers/irc/handlers_test.go
|
||||
index afab7cf2e460..0a2460753377 100644
|
||||
--- a/internal/handlers/irc/handlers_test.go
|
||||
+++ b/internal/handlers/irc/handlers_test.go
|
||||
@@ -937,7 +937,8 @@ func TestMessageHandlerInBlacklist(t *testing.T) {
|
||||
mockClient.
|
||||
EXPECT().
|
||||
IRCSettings().
|
||||
- Return(&ircSettings)
|
||||
+ Return(&ircSettings).
|
||||
+ MaxTimes(2)
|
||||
mockClient.
|
||||
EXPECT().
|
||||
SendToTg(gomock.Any()).
|
||||
@@ -972,7 +973,8 @@ func TestMessageHandlerNotChannel(t *testing.T) {
|
||||
mockClient.
|
||||
EXPECT().
|
||||
IRCSettings().
|
||||
- Return(&ircSettings)
|
||||
+ Return(&ircSettings).
|
||||
+ MaxTimes(2)
|
||||
mockClient.
|
||||
EXPECT().
|
||||
SendToTg(gomock.Any()).
|
||||
@@ -1043,6 +1045,7 @@ func TestMessageHandlerFull(t *testing.T) {
|
||||
IRCBlacklist: []string{},
|
||||
Prefix: "<<",
|
||||
Suffix: ">>",
|
||||
+ Channel: "#testchannel",
|
||||
}
|
||||
|
||||
mockClient := NewMockClientInterface(ctrl)
|
||||
@@ -1076,3 +1079,46 @@ func TestMessageHandlerFull(t *testing.T) {
|
||||
},
|
||||
})
|
||||
}
|
||||
+
|
||||
+func TestMessageHandlerWrongChannel(t *testing.T) {
|
||||
+ ctrl := gomock.NewController(t)
|
||||
+
|
||||
+ defer ctrl.Finish()
|
||||
+
|
||||
+ ircSettings := internal.IRCSettings{
|
||||
+ IRCBlacklist: []string{},
|
||||
+ Channel: "#testchannel",
|
||||
+ }
|
||||
+
|
||||
+ mockClient := NewMockClientInterface(ctrl)
|
||||
+ mockLogger := internal.NewMockDebugLogger(ctrl)
|
||||
+ mockClient.
|
||||
+ EXPECT().
|
||||
+ Logger().
|
||||
+ Return(mockLogger)
|
||||
+ mockLogger.
|
||||
+ EXPECT().
|
||||
+ LogDebug(gomock.Eq("messageHandler triggered"))
|
||||
+ mockClient.
|
||||
+ EXPECT().
|
||||
+ IRCSettings().
|
||||
+ Return(&ircSettings).
|
||||
+ MaxTimes(2)
|
||||
+ mockClient.
|
||||
+ EXPECT().
|
||||
+ SendToTg(gomock.Any()).
|
||||
+ MaxTimes(0)
|
||||
+
|
||||
+ myHandler := messageHandler(mockClient)
|
||||
+ myHandler(&girc.Client{}, girc.Event{
|
||||
+ Source: &girc.Source{
|
||||
+ Name: "SomeUser",
|
||||
+ },
|
||||
+ // Need to be PRIVMSG
|
||||
+ Command: girc.PRIVMSG,
|
||||
+ Params: []string{
|
||||
+ "#otherchannel",
|
||||
+ "a message",
|
||||
+ },
|
||||
+ })
|
||||
+}
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
From 344a8ffe16718d812b380b294c1b2cd3a0d949b5 Mon Sep 17 00:00:00 2001
|
||||
From: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Date: Thu, 11 Jul 2024 01:33:49 -0400
|
||||
Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=91=B7=20ci:=20Add=20GitHub=20Actio?=
|
||||
=?UTF-8?q?ns=20(#421)?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* Create go.yml GHA
|
||||
* Fetch tags on GHA.
|
||||
|
||||
Signed-off-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
.github/workflows/go.yml | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
create mode 100644 .github/workflows/go.yml
|
||||
|
||||
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
|
||||
new file mode 100644
|
||||
index 000000000000..ee29b1ad3e11
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/go.yml
|
||||
@@ -0,0 +1,32 @@
|
||||
+# This workflow will build a golang project
|
||||
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||
+
|
||||
+name: Go
|
||||
+
|
||||
+on:
|
||||
+ push:
|
||||
+ branches: [ "main" ]
|
||||
+ pull_request:
|
||||
+ branches: [ "main" ]
|
||||
+
|
||||
+jobs:
|
||||
+
|
||||
+ build:
|
||||
+ runs-on: ubuntu-latest
|
||||
+ strategy:
|
||||
+ matrix:
|
||||
+ go: [ '1.18', '1.19', '1.20' ]
|
||||
+ steps:
|
||||
+ - uses: actions/checkout@v4
|
||||
+ with:
|
||||
+ fetch-depth: 0
|
||||
+ - name: Set up Go
|
||||
+ uses: actions/setup-go@v5
|
||||
+ with:
|
||||
+ go-version: ${{ matrix.go-version }}
|
||||
+
|
||||
+ - name: Build TeleIRC
|
||||
+ run: ./build_binary.sh
|
||||
+
|
||||
+ - name: Test
|
||||
+ run: go test -v ./...
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 1471b5fe33edf65c48cc6b63814af9c951a10b81 Mon Sep 17 00:00:00 2001
|
||||
From: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Date: Sun, 11 Aug 2024 20:00:23 -0400
|
||||
Subject: [PATCH 07/10] IRC communication is officially on libera.
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
README.md | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index 8638c2782d8e..87e61e858b73 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -27,7 +27,7 @@ A public Telegram supergroup and IRC channel (on Freenode) are available for tes
|
||||
Our developer community is found in these channels.
|
||||
|
||||
* **[Telegram](https://t.me/teleirc)**
|
||||
-* **[IRC](https://webchat.freenode.net/?channels=rit-lug-teleirc)** (#rit-lug-teleirc @ irc.freenode.net)
|
||||
+* **[IRC](https://web.libera.chat/#rit-teleirc)** (#rit-teleirc @ irc.libera.chat)
|
||||
|
||||
|
||||
## Contribute to TeleIRC
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
From 6af8bbfa1e3f03dc4174f9898b67e97492da0e46 Mon Sep 17 00:00:00 2001
|
||||
From: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Date: Fri, 15 Nov 2024 21:30:53 -0500
|
||||
Subject: [PATCH 08/10] Rename Go GHA workflow to main.yml (#426)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
.github/workflows/go.yml | 32 ------------
|
||||
.github/workflows/main.yml | 61 +++++++---------------
|
||||
.github/workflows/publish_docker_image.yml | 49 +++++++++++++++++
|
||||
3 files changed, 68 insertions(+), 74 deletions(-)
|
||||
delete mode 100644 .github/workflows/go.yml
|
||||
create mode 100644 .github/workflows/publish_docker_image.yml
|
||||
|
||||
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
|
||||
deleted file mode 100644
|
||||
index ee29b1ad3e11..000000000000
|
||||
--- a/.github/workflows/go.yml
|
||||
+++ /dev/null
|
||||
@@ -1,32 +0,0 @@
|
||||
-# This workflow will build a golang project
|
||||
-# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||
-
|
||||
-name: Go
|
||||
-
|
||||
-on:
|
||||
- push:
|
||||
- branches: [ "main" ]
|
||||
- pull_request:
|
||||
- branches: [ "main" ]
|
||||
-
|
||||
-jobs:
|
||||
-
|
||||
- build:
|
||||
- runs-on: ubuntu-latest
|
||||
- strategy:
|
||||
- matrix:
|
||||
- go: [ '1.18', '1.19', '1.20' ]
|
||||
- steps:
|
||||
- - uses: actions/checkout@v4
|
||||
- with:
|
||||
- fetch-depth: 0
|
||||
- - name: Set up Go
|
||||
- uses: actions/setup-go@v5
|
||||
- with:
|
||||
- go-version: ${{ matrix.go-version }}
|
||||
-
|
||||
- - name: Build TeleIRC
|
||||
- run: ./build_binary.sh
|
||||
-
|
||||
- - name: Test
|
||||
- run: go test -v ./...
|
||||
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
|
||||
index 811508e8dadf..6d3c75c5ec74 100644
|
||||
--- a/.github/workflows/main.yml
|
||||
+++ b/.github/workflows/main.yml
|
||||
@@ -1,54 +1,31 @@
|
||||
-# This workflow uses actions that are not certified by GitHub.
|
||||
-# They are provided by a third-party and are governed by
|
||||
-# separate terms of service, privacy policy, and support
|
||||
-# documentation.
|
||||
+name: Build and Test TeleIRC
|
||||
|
||||
-name: Docker
|
||||
-
|
||||
-on:
|
||||
- push:
|
||||
- branches: [main]
|
||||
-
|
||||
-env:
|
||||
- REGISTRY: ghcr.io
|
||||
- IMAGE_NAME: ${{ github.repository }}
|
||||
+on: [push]
|
||||
|
||||
+# Cancel job in favor of newer commit
|
||||
concurrency:
|
||||
- group: ${{ github.workflow }}-${{ github.ref }}
|
||||
+ group: go-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
- build-and-push-image:
|
||||
- name: Build and Push Image
|
||||
-
|
||||
+ build:
|
||||
runs-on: ubuntu-latest
|
||||
- permissions:
|
||||
- contents: read
|
||||
- packages: write
|
||||
+ strategy:
|
||||
+ matrix:
|
||||
+ go-version: [ '1.18', '1.19', '1.20' ]
|
||||
|
||||
steps:
|
||||
- - name: Checkout repository
|
||||
- uses: actions/checkout@v3
|
||||
+ - uses: actions/checkout@v4
|
||||
+ with:
|
||||
+ fetch-depth: 0
|
||||
|
||||
- - name: Log in to the Container registry
|
||||
- uses: docker/login-action@v2
|
||||
- with:
|
||||
- registry: ${{ env.REGISTRY }}
|
||||
- username: ${{ github.actor }}
|
||||
- password: ${{ secrets.GITHUB_TOKEN }}
|
||||
+ - name: Set up Go
|
||||
+ uses: actions/setup-go@v5
|
||||
+ with:
|
||||
+ go-version: ${{ matrix.go-version }}
|
||||
|
||||
- - name: Extract metadata (tags, labels) for Docker
|
||||
- id: meta
|
||||
- uses: docker/metadata-action@v4
|
||||
- with:
|
||||
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
- github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
+ - name: Build TeleIRC
|
||||
+ run: ./build_binary.sh
|
||||
|
||||
- - name: Build and push Docker image
|
||||
- uses: docker/build-push-action@v4
|
||||
- with:
|
||||
- push: true
|
||||
- context: .
|
||||
- file: ./deployments/container/Dockerfile
|
||||
- tags: ${{ steps.meta.outputs.tags }}
|
||||
- labels: ${{ steps.meta.outputs.labels }}
|
||||
+ - name: Test
|
||||
+ run: go test -v ./...
|
||||
diff --git a/.github/workflows/publish_docker_image.yml b/.github/workflows/publish_docker_image.yml
|
||||
new file mode 100644
|
||||
index 000000000000..822d48f8ef34
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/publish_docker_image.yml
|
||||
@@ -0,0 +1,49 @@
|
||||
+name: Build and Push Docker Image
|
||||
+
|
||||
+on:
|
||||
+ push:
|
||||
+ branches: [main]
|
||||
+
|
||||
+env:
|
||||
+ REGISTRY: ghcr.io
|
||||
+ IMAGE_NAME: ${{ github.repository }}
|
||||
+
|
||||
+concurrency:
|
||||
+ group: teleirc-docker-${{ github.workflow }}-${{ github.ref }}
|
||||
+ cancel-in-progress: true
|
||||
+
|
||||
+jobs:
|
||||
+ build-and-push-image:
|
||||
+ name: Build and Push Image
|
||||
+
|
||||
+ runs-on: ubuntu-latest
|
||||
+ permissions:
|
||||
+ contents: read
|
||||
+ packages: write
|
||||
+
|
||||
+ steps:
|
||||
+ - name: Checkout repository
|
||||
+ uses: actions/checkout@v4
|
||||
+
|
||||
+ - name: Log in to the Container registry
|
||||
+ uses: docker/login-action@v2
|
||||
+ with:
|
||||
+ registry: ${{ env.REGISTRY }}
|
||||
+ username: ${{ github.actor }}
|
||||
+ password: ${{ secrets.GITHUB_TOKEN }}
|
||||
+
|
||||
+ - name: Extract metadata (tags, labels) for Docker
|
||||
+ id: meta
|
||||
+ uses: docker/metadata-action@v4
|
||||
+ with:
|
||||
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
+ github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
+
|
||||
+ - name: Build and push Docker image
|
||||
+ uses: docker/build-push-action@v4
|
||||
+ with:
|
||||
+ push: true
|
||||
+ context: .
|
||||
+ file: ./deployments/container/Dockerfile
|
||||
+ tags: ${{ steps.meta.outputs.tags }}
|
||||
+ labels: ${{ steps.meta.outputs.labels }}
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 1835aff6b61610a598afd1f08816f1337804ed51 Mon Sep 17 00:00:00 2001
|
||||
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
|
||||
Date: Tue, 19 Nov 2024 09:39:09 -0500
|
||||
Subject: [PATCH 09/10] Bump urllib3 from 1.26.5 to 1.26.19 in /docs (#432)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.5 to 1.26.19.
|
||||
- [Release notes](https://github.com/urllib3/urllib3/releases)
|
||||
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
|
||||
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.5...1.26.19)
|
||||
|
||||
---
|
||||
updated-dependencies:
|
||||
- dependency-name: urllib3
|
||||
dependency-type: direct:production
|
||||
...
|
||||
|
||||
Signed-off-by: dependabot[bot] <support@github.com>
|
||||
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
||||
Co-authored-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
docs/requirements.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/requirements.txt b/docs/requirements.txt
|
||||
index 8c90140ab55f..9c2adbbc0374 100644
|
||||
--- a/docs/requirements.txt
|
||||
+++ b/docs/requirements.txt
|
||||
@@ -26,4 +26,4 @@ sphinxcontrib-htmlhelp==2.0.0
|
||||
sphinxcontrib-jsmath==1.0.1
|
||||
sphinxcontrib-qthelp==1.0.3
|
||||
sphinxcontrib-serializinghtml==1.1.5
|
||||
-urllib3==1.26.5
|
||||
+urllib3==1.26.19
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
From 0af3dfe6c59969f28a9019766e6f75ae9770a656 Mon Sep 17 00:00:00 2001
|
||||
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
|
||||
Date: Tue, 19 Nov 2024 09:43:38 -0500
|
||||
Subject: [PATCH 10/10] Bump certifi from 2021.5.30 to 2024.7.4 in /docs (#429)
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bumps [certifi](https://github.com/certifi/python-certifi) from 2021.5.30 to 2024.7.4.
|
||||
- [Commits](https://github.com/certifi/python-certifi/compare/2021.05.30...2024.07.04)
|
||||
|
||||
---
|
||||
updated-dependencies:
|
||||
- dependency-name: certifi
|
||||
dependency-type: direct:production
|
||||
...
|
||||
|
||||
Signed-off-by: dependabot[bot] <support@github.com>
|
||||
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
||||
Co-authored-by: Tim Zabel <Tjzabel21@gmail.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
docs/requirements.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/requirements.txt b/docs/requirements.txt
|
||||
index 9c2adbbc0374..9c5ce5f8ac10 100644
|
||||
--- a/docs/requirements.txt
|
||||
+++ b/docs/requirements.txt
|
||||
@@ -1,7 +1,7 @@
|
||||
-i https://pypi.org/simple
|
||||
alabaster==0.7.12
|
||||
babel==2.9.1
|
||||
-certifi==2021.5.30
|
||||
+certifi==2024.7.4
|
||||
chardet==4.0.0
|
||||
commonmark==0.9.1
|
||||
docutils==0.17.1
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -20,6 +20,10 @@ RDEPEND="${DEPEND}
|
|||
BDEPEND=""
|
||||
|
||||
src_prepare() {
|
||||
local PATCHES=(
|
||||
# meh, genpatches have no directory
|
||||
"${FILESDIR}"/*.patch
|
||||
)
|
||||
default
|
||||
|
||||
sed -i "s@/usr/local/bin/@/usr/bin/@" deployments/systemd/teleirc@.service || die
|
||||
|
|
Loading…
Reference in New Issue