Added permissions for web panel approvals getting #111

Merged
romanskijdev merged 1 commits from fix-permissions into main 2026-08-06 15:48:26 +03:00
3 changed files with 28 additions and 34 deletions

View File

@ -341,7 +341,9 @@ func (c *Client) Request(cfg tgbotapi.Chattable) (*tgbotapi.APIResponse, error)
// заданном proxyCfg реально оборачиваем транспорт в CustomAPIProxyTransport.
func buildHTTPClient(proxyCfg *ProxyConfig, timeout time.Duration) (*http.Client, error) {
baseTransport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: false},
MaxIdleConns: 100, // Увеличиваем общий пул
MaxIdleConnsPerHost: 100, // Увеличиваем пул для api.telegram.org / прокси
TLSClientConfig: &tls.Config{InsecureSkipVerify: false},
}
var finalTransport http.RoundTripper = baseTransport

View File

@ -247,7 +247,7 @@ func (h *Handler) HandleAttachSubmit(bot *tgbotapi.BotAPI, cq *tgbotapi.Callback
// Уведомляем всех участников с отправкой самих файлов медиагруппами
fileDesc := fmt.Sprintf("%d файл(ов)", savedCount)
h.notifyAllParticipantsAboutFile(bot, approvalID, user, fileDesc)
go h.notifyAllParticipantsAboutFile(bot, approvalID, user, fileDesc)
}
// HandleAttachClear — очистить список файлов

View File

@ -435,10 +435,12 @@ func (h *Handler) performActualRevoke(
commentKeyboard := keyboard.BuildCommentNotificationKeyboard(approvalID, commentsCount)
notify := func(chatID int64, text string) {
msg := tgbotapi.NewMessage(chatID, text)
msg.ParseMode = "HTML"
msg.ReplyMarkup = commentKeyboard
bot.Send(msg) //nolint:errcheck
go func() {
msg := tgbotapi.NewMessage(chatID, text)
msg.ParseMode = "HTML"
msg.ReplyMarkup = commentKeyboard
bot.Send(msg) //nolint:errcheck
}()
}
// Инициатор (если не сам отзывал)
@ -694,41 +696,31 @@ func (h *Handler) HandleViewFilesCallback(bot *tgbotapi.BotAPI, cq *tgbotapi.Cal
return
}
//cardButton := tgkit.NewInlineKeyboard().
// Row(tgkit.Btn("📋 Показать заявку", fmt.Sprintf("appr_show_card:%d", approvalID))).
// Build()
caption := fmt.Sprintf("📎 <b>Файлы к заявке #%d (%d шт.):</b>", approvalID, len(files))
for i, f := range files {
if f.FileBase64 == nil || f.FileName == nil {
continue
}
data, err := base64.StdEncoding.DecodeString(*f.FileBase64)
if err != nil {
logrus.Errorf("HandleViewFilesCallback: decode err=%v", err)
continue
}
doc := tgbotapi.NewDocument(chatID, tgbotapi.FileBytes{
Name: *f.FileName,
Bytes: data,
})
doc.ParseMode = "HTML"
//isLast := i == len(files)-1
// Подпись — на первом файле, чтобы сразу было видно к какой заявке относится
if i == 0 {
doc.Caption = caption
}
//// Кнопка возврата к карточке — на последнем файле
//if isLast {
// doc.ReplyMarkup = cardButton
//}
if _, err := bot.Send(doc); err != nil {
logrus.Errorf("HandleViewFilesCallback: Send err=%v", err)
}
go func(fileBase64 string, fileName string, isFirst bool) {
data, err := base64.StdEncoding.DecodeString(fileBase64)
if err != nil {
logrus.Errorf("HandleViewFilesCallback: decode err=%v", err)
return
}
doc := tgbotapi.NewDocument(chatID, tgbotapi.FileBytes{
Name: fileName,
Bytes: data,
})
doc.ParseMode = "HTML"
if isFirst {
doc.Caption = caption
}
if _, err := bot.Send(doc); err != nil {
logrus.Errorf("HandleViewFilesCallback: Send err=%v", err)
}
}(*f.FileBase64, *f.FileName, i == 0)
}
}