mirror of
https://github.com/mmahdium/TGSS.git
synced 2026-08-14 17:52:49 +03:30
feat: add ImageHandler and ImageService for image retrieval from channels
This commit is contained in:
@@ -25,6 +25,7 @@ type RouterParams struct {
|
||||
|
||||
ChannelHandler *handlers.ChannelHandler
|
||||
AuthHandler *handlers.AuthHandler
|
||||
ImageHandler *handlers.ImageHandler
|
||||
}
|
||||
|
||||
func NewGin() *gin.Engine {
|
||||
@@ -47,12 +48,13 @@ func RegisterRoutes(params RouterParams) {
|
||||
})
|
||||
})
|
||||
|
||||
// params.GinEngine.GET("/feed/:id/json", params.ChannelHandler.GetMessagesJson)
|
||||
params.GinEngine.GET("/feed/:id/json", params.ChannelHandler.GetMessagesJson)
|
||||
params.GinEngine.GET("/feed/:id", params.RateLimiter.RateLimit(), params.ChannelHandler.GetMessagesRSS)
|
||||
params.GinEngine.GET("/image/:channelId/:messageId", params.ImageHandler.GetImage)
|
||||
|
||||
// TODO: improve accurecy in rss channel fields
|
||||
// TODO: add ui with templates under /setup with fetch
|
||||
// TODO: image endpoint + hash and expiry
|
||||
// TODO: image endpoint + HMAC
|
||||
authStatCtx, cancel := context.WithTimeout(context.Background(), config.AuthStatusTimeout)
|
||||
authStat, err := params.TgService.AuthStatus(authStatCtx)
|
||||
cancel()
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
// TODO: another limiter rate for images
|
||||
type ClientLimiter struct {
|
||||
limiter *rate.Limiter
|
||||
lastSeen time.Time
|
||||
|
||||
Reference in New Issue
Block a user