Skip to content

Commit

Permalink
Increased items limit for the api query;
Browse files Browse the repository at this point in the history
Added ability to ignore some of the categories to focus the random on few
  • Loading branch information
Shebuka committed Dec 14, 2023
1 parent 45da1a3 commit 034438c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion scripts/generate_items_thumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ const categoryPages = require('../src/data/category-pages.json');
const { exit } = require('process');


const ignoredCategories = [
'headsets',
'helmets',
'glasses',
'armors',
'rigs',
'backpacks',
'guns',
// 'mods',
'pistol-grips',
'suppressors',
'grenades',
'containers',
'barter-items',
'keys',
'provisions'
];

const graphqlRequest = (queryString) => {
return fetch('https://api.tarkov.dev/graphql', {
method: 'POST',
Expand Down Expand Up @@ -48,6 +66,10 @@ function shuffle(array) {
const mapsPath = './public/images/items/';

for (const categoryPage of categoryPages) {
if (ignoredCategories.includes(categoryPage.key)) {
continue
}

const originalImg = await sharp(mapsPath + categoryPage.key + '-table.png');
const metadata = await originalImg.metadata();
const scale = metadata.width / maxWidth;
Expand All @@ -67,7 +89,7 @@ function shuffle(array) {

let type = categoryPage.type;
const query = `{
items(type: ${type}, limit:69) {
items(type: ${type}, limit:420) {
image512pxLink
}
}`;
Expand Down

0 comments on commit 034438c

Please sign in to comment.