Use entitlements table for premium lookup

This commit is contained in:
rxdn 2024-08-29 17:39:47 +01:00
parent ff113c2871
commit 3fd7539d7f
3 changed files with 27 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/TicketsBot/GoPanel/utils"
"github.com/TicketsBot/archiverclient"
"github.com/TicketsBot/common/chatrelay"
"github.com/TicketsBot/common/model"
"github.com/TicketsBot/common/premium"
"github.com/TicketsBot/common/secureproxy"
"github.com/TicketsBot/worker/i18n"
@ -67,13 +68,12 @@ func main() {
if !config.Conf.Debug {
rpc.PremiumClient = premium.NewPremiumLookupClient(
premium.NewPatreonClient(config.Conf.Bot.PremiumLookupProxyUrl, config.Conf.Bot.PremiumLookupProxyKey),
redis.Client.Client,
cache.Instance.PgCache,
database.Client,
)
} else {
c := premium.NewMockLookupClient(premium.Whitelabel, premium.SourcePatreon)
c := premium.NewMockLookupClient(premium.Whitelabel, model.EntitlementSourcePatreon)
rpc.PremiumClient = &c
}

10
go.mod
View File

@ -7,10 +7,10 @@ toolchain go1.22.4
require (
github.com/BurntSushi/toml v1.2.1
github.com/TicketsBot/archiverclient v0.0.0-20240613013458-accc062facc2
github.com/TicketsBot/common v0.0.0-20240710005307-9cc26f78d8e3
github.com/TicketsBot/database v0.0.0-20240729222446-2c671b9b9366
github.com/TicketsBot/common v0.0.0-20240829163809-6f60869d8941
github.com/TicketsBot/database v0.0.0-20240829163737-86b657b7e506
github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c
github.com/TicketsBot/worker v0.0.0-20240720223640-84817ecc3309
github.com/TicketsBot/worker v0.0.0-20240829163848-84556c59ee72
github.com/apex/log v1.1.2
github.com/getsentry/sentry-go v0.24.0
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607
@ -29,7 +29,7 @@ require (
github.com/penglongli/gin-metrics v0.1.10
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/rxdn/gdl v0.0.0-20240708003854-64917d2277cf
github.com/rxdn/gdl v0.0.0-20240828205518-51a78bd387cb
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/weppos/publicsuffix-go v0.20.0
@ -39,7 +39,7 @@ require (
require (
github.com/ClickHouse/ch-go v0.52.1 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.10.0 // indirect
github.com/TicketsBot/analytics-client v0.0.0-20240415004242-017c23403af3 // indirect
github.com/TicketsBot/analytics-client v0.0.0-20240724103359-30f5dac821e6 // indirect
github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect

20
go.sum
View File

@ -43,12 +43,22 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
github.com/ReneKroon/ttlcache v1.6.0/go.mod h1:DG6nbhXKUQhrExfwwLuZUdH7UnRDDRA1IW+nBuCssvs=
github.com/TicketsBot/analytics-client v0.0.0-20240415004242-017c23403af3 h1:lSv0RoMTXohcN6yYKsBQftpYnRMZUYdmeFkpEMj6X7A=
github.com/TicketsBot/analytics-client v0.0.0-20240415004242-017c23403af3/go.mod h1:9Z9qP/yovb6DUe1KlzgN2wicc+8ey6MMoxfynFbMyRg=
github.com/TicketsBot/analytics-client v0.0.0-20240724103359-30f5dac821e6 h1:JigBTrKv/wRkCnz0G9m/EsqmG5DU6pFWBtrXNhcvK3E=
github.com/TicketsBot/analytics-client v0.0.0-20240724103359-30f5dac821e6/go.mod h1:9Z9qP/yovb6DUe1KlzgN2wicc+8ey6MMoxfynFbMyRg=
github.com/TicketsBot/archiverclient v0.0.0-20240613013458-accc062facc2 h1:x2AZWm2zeyIJxVJbq9JQB1Q2mAaaTuCbCiPIU1E8G1o=
github.com/TicketsBot/archiverclient v0.0.0-20240613013458-accc062facc2/go.mod h1:sc1kAppJn1fX6ZCsiU3ltGiXIj9GEZkjkdh8fbmwxWQ=
github.com/TicketsBot/common v0.0.0-20240613013221-1e27eb8bfe37 h1:NC5fn+uAup0JxLiX85+bjVdyfUUXW3pKZYmp72/29hw=
github.com/TicketsBot/common v0.0.0-20240613013221-1e27eb8bfe37/go.mod h1:UZ6Kzobh9akWyon7iGLPb4w/9gmKV+sLuR6PmthsS+U=
github.com/TicketsBot/common v0.0.0-20240710005307-9cc26f78d8e3 h1:Z4Ri2MC03YqLO+gY32SuWzt8SIL+QqwQYs59iizr7k8=
github.com/TicketsBot/common v0.0.0-20240710005307-9cc26f78d8e3/go.mod h1:W1AwQkgiRyLxrpf8civa7p5ksKOGCyS0QocT5CPZVq8=
github.com/TicketsBot/common v0.0.0-20240829130437-b3cc78b7d099 h1:/gB3JhwP24F+PMX/JefDZitOWQ+BC2LlvzWI9l0wpmc=
github.com/TicketsBot/common v0.0.0-20240829130437-b3cc78b7d099/go.mod h1:B1vHUs4teJ9kU9HXMHh/t21Rj/yenzitJdbxqAaymus=
github.com/TicketsBot/common v0.0.0-20240829155951-f7d89e0000ff h1:4FNquFLUS2cZXSwHPSHOe1Yb3s83P545o+7HIfGo4ts=
github.com/TicketsBot/common v0.0.0-20240829155951-f7d89e0000ff/go.mod h1:B1vHUs4teJ9kU9HXMHh/t21Rj/yenzitJdbxqAaymus=
github.com/TicketsBot/common v0.0.0-20240829163706-02537ffffe45 h1:ZWV6mpnzA9setwf6YNPN5FwNavI7FjFulAa1ezzeCcI=
github.com/TicketsBot/common v0.0.0-20240829163706-02537ffffe45/go.mod h1:B1vHUs4teJ9kU9HXMHh/t21Rj/yenzitJdbxqAaymus=
github.com/TicketsBot/common v0.0.0-20240829163809-6f60869d8941 h1:XjBjH4kDjvpdp7Zi2gcMPRvF0X0eCIAogU+BW9ljoRk=
github.com/TicketsBot/common v0.0.0-20240829163809-6f60869d8941/go.mod h1:WjOecM4+mPgj3l2TkLsssvBWMCw8OkNlLPD8jrJl2T4=
github.com/TicketsBot/database v0.0.0-20240622123318-f2e43bd962cb h1://4tzbjko/3ji+9lrp0tHGtBWavvJusBkfxmmLEIigs=
github.com/TicketsBot/database v0.0.0-20240622123318-f2e43bd962cb/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI=
github.com/TicketsBot/database v0.0.0-20240715172214-86ee61a85834/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI=
@ -56,6 +66,10 @@ github.com/TicketsBot/database v0.0.0-20240720222825-35466fd5fc96 h1:iOf8LxG3y7v
github.com/TicketsBot/database v0.0.0-20240720222825-35466fd5fc96/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI=
github.com/TicketsBot/database v0.0.0-20240729222446-2c671b9b9366 h1:KC7NWVXk8xX2M4rQUVoHTuTjkXumGIDRrUS741lfcD4=
github.com/TicketsBot/database v0.0.0-20240729222446-2c671b9b9366/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI=
github.com/TicketsBot/database v0.0.0-20240829155519-6b47874c9775 h1:4BhqGSlvI+tAZ0Gc1GT6NEDtO1mR5nYHmJoli6jH6f0=
github.com/TicketsBot/database v0.0.0-20240829155519-6b47874c9775/go.mod h1:XhV3kI4ogTxBJATmO20kxmaynUcqCf3PCnbVbxkYNyQ=
github.com/TicketsBot/database v0.0.0-20240829163737-86b657b7e506 h1:mU2wx9pyb7258RYyh9ZpTkDDFZMtP3C8YFphFEjxgWE=
github.com/TicketsBot/database v0.0.0-20240829163737-86b657b7e506/go.mod h1:tnSNh3i0tPw2xmTzF8JnQPPpKY9QdwbeH2d4xzYcqcM=
github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c h1:OqGjFH6mbE6gd+NqI2ARJdtH3UUvhiAkD0r0fhGJK2s=
github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c/go.mod h1:jgi2OXQKsd5nUnTIRkwvPmeuD/i7OhN68LKMssuQY1c=
github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261 h1:NHD5GB6cjlkpZFjC76Yli2S63/J2nhr8MuE6KlYJpQM=
@ -69,6 +83,10 @@ github.com/TicketsBot/worker v0.0.0-20240716011908-6750831195fe/go.mod h1:JKke72
github.com/TicketsBot/worker v0.0.0-20240720222927-f8792f3dec68/go.mod h1:JKke725voiVNSnNRE2VkdeRUFehzCGHxa4TzJfJmHes=
github.com/TicketsBot/worker v0.0.0-20240720223640-84817ecc3309 h1:KR5YkLLZJwD6MHN/0lygDfNfjO7OJeywOYjqAb4RDyo=
github.com/TicketsBot/worker v0.0.0-20240720223640-84817ecc3309/go.mod h1:0E2EZSbwyaWo438KB7YnqiDxrJEdQECZXsfSmn4+7tY=
github.com/TicketsBot/worker v0.0.0-20240829162344-2304017549f0 h1:wDXMZGUglpKF2AbsgoN0yxqkDz4BLTx6zgDjIyg/a7s=
github.com/TicketsBot/worker v0.0.0-20240829162344-2304017549f0/go.mod h1:uQuOo6sBWb5NyOUTbUbwzJAhI3QqqUMroRPOQSlfnd4=
github.com/TicketsBot/worker v0.0.0-20240829163848-84556c59ee72 h1:UAei+A2QvuJOgjZr25IY2luRbWqvBS/eDTw5CuI+cDE=
github.com/TicketsBot/worker v0.0.0-20240829163848-84556c59ee72/go.mod h1:0gnwqRPEhEwC574PTTqfeAdELWcSowBPU57faO5LRFc=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@ -482,6 +500,8 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/rxdn/gdl v0.0.0-20240708003854-64917d2277cf h1:TieDplNMS5jqxzHirSPwy2QLPCu11FB+fyrPc32Hmik=
github.com/rxdn/gdl v0.0.0-20240708003854-64917d2277cf/go.mod h1:HtxfLp4OaoPoDJHQ4JOx/QeLH2d40VgT3wNOf7ETsRE=
github.com/rxdn/gdl v0.0.0-20240828205518-51a78bd387cb h1:/hKrIoYi5vUn0G2/zLhrhN/Leuv46Blj3Z/9/1KMI40=
github.com/rxdn/gdl v0.0.0-20240828205518-51a78bd387cb/go.mod h1:HtxfLp4OaoPoDJHQ4JOx/QeLH2d40VgT3wNOf7ETsRE=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/schollz/progressbar/v3 v3.8.2 h1:2kZJwZCpb+E/V79kGO7daeq+hUwUJW0A5QD1Wv455dA=
github.com/schollz/progressbar/v3 v3.8.2/go.mod h1:9KHLdyuXczIsyStQwzvW8xiELskmX7fQMaZdN23nAv8=