Skip to content

Commit

Permalink
Merge pull request #134 from SensCritique/fix/batch-request
Browse files Browse the repository at this point in the history
Fix/batch request
  • Loading branch information
audreylamy authored Feb 15, 2024
2 parents 6718e93 + 701bde9 commit 4cc6538
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ services:
build:
dockerfile: Dockerfile
context: docker/node
environment:
- NODE_ENV=production
volumes:
- ./:/app
- ./:/app
2 changes: 1 addition & 1 deletion manifest_chrome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "SensCritique",
"version": "1.4.9",
"version": "1.5.0",
"description": "Vous avez du mal à trouver des bons programmes sur vos plateformes de streaming ?",
"icons": {
"48": "images/logo-48.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest_firefox.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "SensCritique",
"version": "1.4.9",
"version": "1.5.0",
"description": "La note SensCritique est une boussole pour arrêter de perdre votre temps, et s’invite sur Netflix, Prime Video et Disney+ pour vous permettre de choisir de manière éclairée vos programmes.",
"icons": {
"48": "images/logo-48.png",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "senscritique-extension",
"version": "1.4.9",
"version": "1.5.0",
"description": "La note SensCritique est une boussole pour arrêter de perdre votre temps, et s’invite sur Netflix, Prime Video et Disney+ pour vous permettre de choisir de manière éclairée vos programmes.",
"author": "SensCritique",
"repository": {
Expand Down
22 changes: 10 additions & 12 deletions src/http/SensCritique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ const searchQuery = [
},
]

const searchByPlatformIdQuery = [
{
operationName: 'productByPlatform',
variables: {
platformIds: [],
provider: '%provider%',
},
query:
'query productByPlatform($platformIds: [String]!, $provider: String) {\n productByPlatform(platformIds: $platformIds, provider: $provider) {\n platformId\n rating\n slug\n typeId\n productId\n }\n}\n',
const searchByPlatformIdQuery = {
operationName: 'productByPlatform',
variables: {
platformIds: [],
provider: '%provider%',
},
]
query:
'query productByPlatform($platformIds: [String]!, $provider: String) {\n productByPlatform(platformIds: $platformIds, provider: $provider) {\n platformId\n rating\n slug\n typeId\n productId\n }\n}\n',
}

const SensCritique = class SensCritique implements Client {
protected requestInError = 0
Expand Down Expand Up @@ -167,7 +165,7 @@ const SensCritique = class SensCritique implements Client {
const headers = new Headers()
headers.append('User-Agent', `senscritique-extension v${app.version}`)
headers.append('Content-Type', 'application/json')
searchByPlatformIdQuery[0].variables.platformIds = platformProductIds
searchByPlatformIdQuery.variables.platformIds = platformProductIds
const request = JSON.stringify(searchByPlatformIdQuery).replace(
'%provider%',
provider
Expand All @@ -181,7 +179,7 @@ const SensCritique = class SensCritique implements Client {

if (response?.ok) {
return this.mapBrowserExtensionProduct(
(await response.json())[0]?.data?.productByPlatform
(await response.json())?.data?.productByPlatform
)
}
} catch (e) {
Expand Down

0 comments on commit 4cc6538

Please sign in to comment.