Skip to content

Commit

Permalink
chore(deps): Bumping deps to fix parse of flags
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Aug 28, 2023
1 parent 379a464 commit b3a9ebf
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 56 deletions.
40 changes: 20 additions & 20 deletions cmd/fibr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ import (
)

type configuration struct {
thumbnail thumbnail.Config
metadata metadata.Config
telemetry telemetry.Config
webhook webhook.Config
alcotest alcotest.Config
basic basicMemory.Config
share share.Config
storage storage.Config
logger logger.Config
renderer renderer.Config
crud crud.Config
owasp owasp.Config
amqp amqp.Config
absto absto.Config
amqpThumbnail amqphandler.Config
amqpExif amqphandler.Config
redis redis.Config
appServer server.Config
health health.Config
sanitizer sanitizer.Config
thumbnail *thumbnail.Config
metadata *metadata.Config
telemetry *telemetry.Config
webhook *webhook.Config
alcotest *alcotest.Config
basic *basicMemory.Config
share *share.Config
storage *storage.Config
logger *logger.Config
renderer *renderer.Config
crud *crud.Config
owasp *owasp.Config
amqp *amqp.Config
absto *absto.Config
amqpThumbnail *amqphandler.Config
amqpExif *amqphandler.Config
redis *redis.Config
appServer *server.Config
health *health.Config
sanitizer *sanitizer.Config
disableAuth bool
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/fibr/fibr.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
//go:embed templates static
var content embed.FS

func newLoginService(tracerProvider trace.TracerProvider, basicConfig basicMemory.Config) provider.Auth {
func newLoginService(tracerProvider trace.TracerProvider, basicConfig *basicMemory.Config) provider.Auth {
basicService, err := basicMemory.New(basicConfig)
if err != nil {
slog.Error("auth memory", "err", err)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/ViBiOh/fibr
go 1.21

require (
github.com/ViBiOh/ChatPotte v0.3.2
github.com/ViBiOh/absto v1.7.1
github.com/ViBiOh/auth/v2 v2.16.0
github.com/ViBiOh/ChatPotte v0.3.3
github.com/ViBiOh/absto v1.7.2
github.com/ViBiOh/auth/v2 v2.16.1
github.com/ViBiOh/exas v0.7.1
github.com/ViBiOh/flags v1.4.1
github.com/ViBiOh/httputils/v4 v4.64.0
github.com/ViBiOh/httputils/v4 v4.64.1
github.com/ViBiOh/vith v0.6.0
github.com/rabbitmq/amqp091-go v1.8.1
github.com/redis/go-redis/v9 v9.1.0
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
github.com/ViBiOh/ChatPotte v0.3.2 h1:Ey2E17D44IjnZwVroDC2+dqnOYL/3m5SsuWTxt7fB6o=
github.com/ViBiOh/ChatPotte v0.3.2/go.mod h1:TjeTdhQgB2RdyNPtty2hs7W/hodkSbzMU0Qtb5vV2VA=
github.com/ViBiOh/absto v1.7.1 h1:ZPcBh7kYx+I6lsRMKMY3/A2ounOxB0bE01bqhzYitL4=
github.com/ViBiOh/absto v1.7.1/go.mod h1:3lyoRt8V5odr6X2kuA5eFtvfLFat61I0EAedk9rxYsM=
github.com/ViBiOh/auth/v2 v2.16.0 h1:oP3O18S0FIaLRFujD5ZwAd9c3RiGpdDsmT8WqAaRha4=
github.com/ViBiOh/auth/v2 v2.16.0/go.mod h1:UijugoDpkX9Ub9+QTokwLUSa7S2kyLNZcBw9t4Ingfc=
github.com/ViBiOh/ChatPotte v0.3.3 h1:WoOAmSSiuXVpcz1X3iDSpvCmJF5IA2a38Hqm0klZUMk=
github.com/ViBiOh/ChatPotte v0.3.3/go.mod h1:hK71q8Yufgo+BVJvn9SmyLP5/ZktuaOj+AcmtoUn+RM=
github.com/ViBiOh/absto v1.7.2 h1:TectPiswC68mVXIWEOyZv5AQ3Fo0ahZrCDh5B6xO9ys=
github.com/ViBiOh/absto v1.7.2/go.mod h1:3lyoRt8V5odr6X2kuA5eFtvfLFat61I0EAedk9rxYsM=
github.com/ViBiOh/auth/v2 v2.16.1 h1:june68lfZ7gZJ3AX/AzMDN5506s1QR6LTZyj0xjjOpc=
github.com/ViBiOh/auth/v2 v2.16.1/go.mod h1:t93zD/GbHiFcqV+cqidCzulnq67iLYGe/aVrP/NHq5E=
github.com/ViBiOh/exas v0.7.1 h1:nzh6E1668OFRgoTIJZJa1RybCW64Gd918qi0Z+0Q4WA=
github.com/ViBiOh/exas v0.7.1/go.mod h1:MvIWQZXpWgg45Vsde9bMV48Kb0J8frya8vimmrkQ04E=
github.com/ViBiOh/flags v1.4.1 h1:qEAO70rWTYcVlU9BgCuz0SgMjth12oi502cq3SHDudg=
github.com/ViBiOh/flags v1.4.1/go.mod h1:Ocgx/QhY7WYNfGokFT3kw5C05pDooQyLbI/9ZWwylI4=
github.com/ViBiOh/httputils/v4 v4.64.0 h1:prVu49deaZvS24b17rvrkd58K9tYnT+TdDRa/DR0mug=
github.com/ViBiOh/httputils/v4 v4.64.0/go.mod h1:wQcLPM1DA7d8w/ojU1jIZzXwMYBlDJuSw0DrcS33vNc=
github.com/ViBiOh/httputils/v4 v4.64.1 h1:Qc84vfQX9aUedjfjBzrRB+BwABOYZbDvKLQ6pYKKKd4=
github.com/ViBiOh/httputils/v4 v4.64.1/go.mod h1:wQcLPM1DA7d8w/ojU1jIZzXwMYBlDJuSw0DrcS33vNc=
github.com/ViBiOh/vith v0.6.0 h1:bdLmwgqUEWi3ivShtAhtM9gOZlWQzvZi2Z5b0BRSB1U=
github.com/ViBiOh/vith v0.6.0/go.mod h1:eRqtDU2uB8g85vll4spbnCV93DHyHNAYwXCMIBH1GuQ=
github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
Expand Down
6 changes: 3 additions & 3 deletions pkg/crud/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ type Config struct {
ChunkUpload bool
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("BcryptDuration", "Wanted bcrypt duration for calculating effective cost").Prefix(prefix).DocPrefix("crud").StringVar(fs, &config.BcryptDuration, "0.25s", nil)
flags.New("ChunkUpload", "Use chunk upload in browser").Prefix(prefix).DocPrefix("crud").BoolVar(fs, &config.ChunkUpload, false, nil)
flags.New("TemporaryFolder", "Temporary folder for chunk upload").Prefix(prefix).DocPrefix("crud").StringVar(fs, &config.TemporaryFolder, "/tmp", nil)

return config
return &config
}

func New(config Config, storageService absto.Storage, filteredStorage absto.Storage, rendererService *renderer.Service, shareService provider.ShareManager, webhookService provider.WebhookManager, thumbnailService thumbnail.Service, exifService provider.MetadataManager, searchService search.Service, eventProducer provider.EventProducer, tracerProvider trace.TracerProvider) (Service, error) {
func New(config *Config, storageService absto.Storage, filteredStorage absto.Storage, rendererService *renderer.Service, shareService provider.ShareManager, webhookService provider.WebhookManager, thumbnailService thumbnail.Service, exifService provider.MetadataManager, searchService search.Service, eventProducer provider.EventProducer, tracerProvider trace.TracerProvider) (Service, error) {
service := Service{
chunkUpload: config.ChunkUpload,
temporaryFolder: config.TemporaryFolder,
Expand Down
6 changes: 3 additions & 3 deletions pkg/metadata/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type Config struct {
DirectAccess bool
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("URL", "Exif Tool URL (exas)").Prefix(prefix).DocPrefix("exif").StringVar(fs, &config.ExifURL, "http://exas:1080", nil)
Expand All @@ -72,10 +72,10 @@ func Flags(fs *flag.FlagSet, prefix string) Config {
flags.New("AmqpExchange", "AMQP Exchange Name").Prefix(prefix).DocPrefix("exif").StringVar(fs, &config.AmqpExchange, "fibr", nil)
flags.New("AmqpRoutingKey", "AMQP Routing Key for exif").Prefix(prefix).DocPrefix("exif").StringVar(fs, &config.AmqpRoutingKey, "exif_input", nil)

return config
return &config
}

func New(config Config, storageService absto.Storage, meterProvider metric.MeterProvider, traceProvider trace.TracerProvider, amqpClient *amqpclient.Client, redisClient redis.Client, exclusiveService exclusive.Service) (Service, error) {
func New(config *Config, storageService absto.Storage, meterProvider metric.MeterProvider, traceProvider trace.TracerProvider, amqpClient *amqpclient.Client, redisClient redis.Client, exclusiveService exclusive.Service) (Service, error) {
var amqpExchange string

if amqpClient != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/sanitizer/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ type Config struct {
SanitizeOnStart bool
}

func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) Config {
func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) *Config {
var config Config

flags.New("SanitizeOnStart", "Sanitize on start").Prefix(prefix).DocPrefix("crud").BoolVar(fs, &config.SanitizeOnStart, false, nil)

return config
return &config
}

func New(config Config, storageService absto.Storage, exclusiveService exclusive.Service, renamer Renamer, pushEvent provider.EventProducer) Service {
func New(config *Config, storageService absto.Storage, exclusiveService exclusive.Service, renamer Renamer, pushEvent provider.EventProducer) Service {
return Service{
done: make(chan struct{}),
storage: storageService,
Expand Down
6 changes: 3 additions & 3 deletions pkg/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ type Config struct {
PubsubChannel string
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("PubSubChannel", "Channel name").Prefix(prefix).DocPrefix("share").StringVar(fs, &config.PubsubChannel, "fibr:shares-channel", nil)

return config
return &config
}

func New(config Config, storageService absto.Storage, redisClient redis.Client, exclusiveService exclusive.Service) (*Service, error) {
func New(config *Config, storageService absto.Storage, redisClient redis.Client, exclusiveService exclusive.Service) (*Service, error) {
return &Service{
clock: time.Now,
shares: make(map[string]provider.Share),
Expand Down
6 changes: 3 additions & 3 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ type Config struct {
Ignore string
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("IgnorePattern", "Ignore pattern when listing files or directory").Prefix(prefix).DocPrefix("crud").StringVar(fs, &config.Ignore, "", nil)

return config
return &config
}

func Get(config Config, storage absto.Storage) (absto.Storage, error) {
func Get(config *Config, storage absto.Storage) (absto.Storage, error) {
var pattern *regexp.Regexp

if len(config.Ignore) != 0 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/thumbnail/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Config struct {
LargeSize uint64
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("URL", "Vith Thumbnail URL").Prefix(prefix).DocPrefix("thumbnail").StringVar(fs, &config.VithURL, "http://vith:1080", nil)
Expand All @@ -87,10 +87,10 @@ func Flags(fs *flag.FlagSet, prefix string) Config {

flags.New("LargeSize", "Size of large thumbnail for story display (thumbnail are always squared). 0 to disable").Prefix(prefix).DocPrefix("thumbnail").Uint64Var(fs, &config.LargeSize, 800, nil)

return config
return &config
}

func New(config Config, storage absto.Storage, redisClient redis.Client, meterProvider metric.MeterProvider, traceProvider trace.TracerProvider, amqpClient *amqp.Client) (Service, error) {
func New(config *Config, storage absto.Storage, redisClient redis.Client, meterProvider metric.MeterProvider, traceProvider trace.TracerProvider, amqpClient *amqp.Client) (Service, error) {
var amqpExchange string

if amqpClient != nil {
Expand Down
5 changes: 3 additions & 2 deletions pkg/webhook/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
absto "github.com/ViBiOh/absto/pkg/model"
"github.com/ViBiOh/fibr/pkg/provider"
"github.com/ViBiOh/fibr/pkg/thumbnail"
"github.com/ViBiOh/httputils/v4/pkg/cache"
"github.com/ViBiOh/httputils/v4/pkg/request"
)

Expand Down Expand Up @@ -121,13 +120,15 @@ func (s *Service) discordHandle(ctx context.Context, webhook provider.Webhook, e
time.Sleep(pubsubThumbnailDiscordDelay)
}

if s.thumbnail.HasThumbnail(cache.Bypass(ctx), event.Item, thumbnail.SmallSize) {
if s.thumbnail.HasThumbnail(ctx, event.Item, thumbnail.SmallSize) {
thumbnailURL := event.GetURL() + "?thumbnail"

if _, ok := provider.VideoExtensions[event.Item.Extension]; ok {
thumbnailURL += "&scale=large"
}

slog.Info("Discord with thumbnail", "url", thumbnailURL)

embed.Thumbnail = discord.NewImage(thumbnailURL)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ type Config struct {
PubsubChannel string
}

func Flags(fs *flag.FlagSet, prefix string) Config {
func Flags(fs *flag.FlagSet, prefix string) *Config {
var config Config

flags.New("Secret", "Secret for HMAC Signature").Prefix(prefix).DocPrefix("webhook").StringVar(fs, &config.HmacSecret, "", nil)
flags.New("PubSubChannel", "Channel name").Prefix(prefix).DocPrefix("share").StringVar(fs, &config.PubsubChannel, "fibr:webhooks-channel", nil)

return config
return &config
}

func New(config Config, storageService absto.Storage, meterProvider metric.MeterProvider, redisClient redis.Client, rendererService *renderer.Service, thumbnailService thumbnail.Service, exclusiveApp exclusive.Service) *Service {
func New(config *Config, storageService absto.Storage, meterProvider metric.MeterProvider, redisClient redis.Client, rendererService *renderer.Service, thumbnailService thumbnail.Service, exclusiveApp exclusive.Service) *Service {
var counter metric.Int64Counter
if meterProvider != nil {
meter := meterProvider.Meter("github.com/ViBiOh/fibr/pkg/webhook")
Expand Down

0 comments on commit b3a9ebf

Please sign in to comment.