diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b77e57b0..73f7402b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,12 +45,12 @@ jobs: - name: Upload Test Coverage if: matrix.os == 'ubuntu-latest' && matrix.go == '1.18' - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: fail_ci_if_error: true - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: chatterino-api-${{ matrix.go }}-${{ matrix.os }} path: build/chatterino-api @@ -65,17 +65,17 @@ jobs: with: path: 'project-git-repo' - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: chatterino-api-1.18-ubuntu-latest path: bins/ubuntu/ - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: chatterino-api-1.18-macos-latest path: bins/macos/ - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: chatterino-api-1.18-windows-latest path: bins/windows/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5ddf5a..ef274847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ - Dev: Improve Twitter tests. (#293) - Dev: Improve SevenTV tests. (#294) - Dev: Improve FrankerFaceZ tests. (#295) -- Dev: Improve Livestreamfails tests. (#297) +- Dev: Improve Livestreamfails tests. (#297, #301) ## 1.2.3 diff --git a/go.mod b/go.mod index a3a4bc71..4e7a00eb 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/dyatlov/go-oembed v0.0.0-20191103150536-a57c85b3b37c github.com/frankban/quicktest v1.14.3 github.com/go-chi/chi/v5 v5.0.7 - github.com/go-chi/stampede v0.5.0 + github.com/go-chi/stampede v0.5.1 github.com/golang/mock v1.6.0 github.com/jackc/pgconn v1.11.0 github.com/jackc/pgx/v4 v4.15.0 @@ -21,7 +21,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.10.1 go.uber.org/zap v1.21.0 - google.golang.org/api v0.73.0 + google.golang.org/api v0.74.0 honnef.co/go/tools v0.3.0-0.dev.0.20220306074811-23e1086441d2 ) @@ -37,7 +37,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.7 // indirect - github.com/googleapis/gax-go/v2 v2.1.1 // indirect + github.com/googleapis/gax-go/v2 v2.2.0 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20200511160909-eb529947af53 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect @@ -68,14 +68,14 @@ require ( golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/mod v0.5.1 // indirect - golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect + golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect - golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect + golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.8 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 // indirect + google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb // indirect google.golang.org/grpc v1.45.0 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/go.sum b/go.sum index 29be4539..339ffbea 100644 --- a/go.sum +++ b/go.sum @@ -143,8 +143,8 @@ github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8= github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.0 h1:tV1g1XENQ8ku4Bq3K9ub2AtgG+p16SmzeMSGTwrOKdE= github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= -github.com/go-chi/stampede v0.5.0 h1:pby7lUVANhFHbjcorWiYhm/NVPyYnnLcBlpxbDpJrAI= -github.com/go-chi/stampede v0.5.0/go.mod h1:UFRS0DzmgIqq/LevhSX67qtc0hkykVdLHRc5MJxfgBQ= +github.com/go-chi/stampede v0.5.1 h1:faVKiLt5dCFrfTmAOzWxcW/YLfKUNJCNbbfUgGn8ESU= +github.com/go-chi/stampede v0.5.1/go.mod h1:lrMOBraJLDgizaoAD+LQoC/sVB2t9mYsGwqDTjUHPCE= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -237,8 +237,9 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0 h1:s7jOdKSaksJVOxE0Y/S32otcfiP+UQ0cL8/GTKaONwE= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= @@ -627,8 +628,9 @@ golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -646,6 +648,7 @@ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -735,8 +738,9 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 h1:eJv7u3ksNXoLbGSKuv2s/SIO4tJVxc/A+MTpzxDgz/Q= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -855,8 +859,9 @@ google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3h google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.73.0 h1:O9bThUh35K1rvUrQwTUQ1eqLC/IYyzUpWavYIO2EXvo= -google.golang.org/api v0.73.0/go.mod h1:lbd/q6BRFJbdpV6OUCXstVeiI5mL/d3/WifG7iNKnjI= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0 h1:ExR2D+5TYIrMphWgs5JCgwRhEDlPDXXrLwHHMgPHTXE= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -931,8 +936,10 @@ google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 h1:FglFEfyj61zP3c6LgjmVHxYxZWXYul9oiS1EZqD5gLc= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb h1:0m9wktIpOxGw+SSKmydXWB3Z3GTfcPP6+q75HCQa6HI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/resolvers/livestreamfails/clip_resolver_test.go b/internal/resolvers/livestreamfails/clip_resolver_test.go index 43e434a6..c5cbc232 100644 --- a/internal/resolvers/livestreamfails/clip_resolver_test.go +++ b/internal/resolvers/livestreamfails/clip_resolver_test.go @@ -120,14 +120,14 @@ func TestClipResolver(t *testing.T) { label: "normal", inputURL: utils.MustParseURL("https://livestreamfails.com/clip/123"), inputClipID: "123", - expectedBytes: []byte(`{"status":200,"thumbnail":"https://livestreamfails-image-prod.b-cdn.net/image/asd","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2027%20Mar%202022%0A%3C%2Fdiv%3E"}`), + expectedBytes: []byte(`{"status":200,"thumbnail":"https://livestreamfails-image-prod.b-cdn.net/image/asd","tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2010%20Nov%202019%0A%3C%2Fdiv%3E"}`), expectedError: nil, }, { label: "normal NSFW", inputURL: utils.MustParseURL("https://livestreamfails.com/clip/905"), inputClipID: "905", - expectedBytes: []byte(`{"status":200,"tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cli%3E%3Cb%3E%3Cspan%20style=%22color:%20red%22%3ENSFW%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fli%3E%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2027%20Mar%202022%0A%3C%2Fdiv%3E"}`), + expectedBytes: []byte(`{"status":200,"tooltip":"%3Cdiv%20style=%22text-align:%20left%3B%22%3E%0A%3Cli%3E%3Cb%3E%3Cspan%20style=%22color:%20red%22%3ENSFW%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fli%3E%0A%3Cb%3EClip%20Label%3C%2Fb%3E%3Chr%3E%0A%3Cb%3EStreamer:%3C%2Fb%3E%20Streamer%20Label%3Cbr%3E%0A%3Cb%3ECategory:%3C%2Fb%3E%20Category%20Label%3Cbr%3E%0A%3Cb%3EPlatform:%3C%2Fb%3E%20Twitch%3Cbr%3E%0A%3Cb%3EReddit%20score:%3C%2Fb%3E%2069%3Cbr%3E%0A%3Cb%3ECreated:%3C%2Fb%3E%2010%20Nov%202019%0A%3C%2Fdiv%3E"}`), expectedError: nil, }, { diff --git a/internal/resolvers/livestreamfails/data_test.go b/internal/resolvers/livestreamfails/data_test.go index ab2b08c5..aa5814ca 100644 --- a/internal/resolvers/livestreamfails/data_test.go +++ b/internal/resolvers/livestreamfails/data_test.go @@ -14,12 +14,13 @@ var ( ) func init() { + testTime := time.Date(2019, time.November, 10, 23, 0, 0, 0, time.UTC) // Normal clip data["123"] = &ClipAPIResponse{ Category: ClipAPICategory{ Label: "Category Label", }, - CreatedAt: time.Now(), + CreatedAt: testTime, ImageID: "asd", IsNSFW: false, Label: "Clip Label", @@ -35,7 +36,7 @@ func init() { Category: ClipAPICategory{ Label: "Category Label", }, - CreatedAt: time.Now(), + CreatedAt: testTime, ImageID: "asd", IsNSFW: true, Label: "Clip Label",