Skip to content

Commit f05f79c

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/src/tarkov-data-manager/npm-dependencies-a2cbe419f0
2 parents 8543710 + 14f1ad3 commit f05f79c

15 files changed

+351
-112
lines changed

src/tarkov-data-manager/data/missing_quests.json

Lines changed: 157 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@
27622762
"tarkovDataId": null,
27632763
"factionName": "Any"
27642764
},
2765-
"67af4c17f4f1fb58a907f8f6": {
2765+
"_67af4c17f4f1fb58a907f8f6": {
27662766
"id": "67af4c17f4f1fb58a907f8f6",
27672767
"name": "Never Too Late to Learn",
27682768
"trader": "58330581ace78e27b8b10cee",
@@ -2870,7 +2870,7 @@
28702870
"tarkovDataId": null,
28712871
"factionName": "Any"
28722872
},
2873-
"67af4c1991ee75c6d7060a16": {
2873+
"_67af4c1991ee75c6d7060a16": {
28742874
"id": "67af4c1991ee75c6d7060a16",
28752875
"name": "Get a Foothold",
28762876
"trader": "58330581ace78e27b8b10cee",
@@ -3057,7 +3057,7 @@
30573057
"tarkovDataId": null,
30583058
"factionName": "Any"
30593059
},
3060-
"67af4c1a6c3ebfd8e6034916": {
3060+
"_67af4c1a6c3ebfd8e6034916": {
30613061
"id": "67af4c1a6c3ebfd8e6034916",
30623062
"name": "Profit Retention",
30633063
"trader": "58330581ace78e27b8b10cee",
@@ -3154,7 +3154,7 @@
31543154
"tarkovDataId": null,
31553155
"factionName": "Any"
31563156
},
3157-
"67af4c1cc0e59d55e2010b97": {
3157+
"_67af4c1cc0e59d55e2010b97": {
31583158
"id": "67af4c1cc0e59d55e2010b97",
31593159
"name": "A Life Lesson",
31603160
"trader": "58330581ace78e27b8b10cee",
@@ -3266,7 +3266,7 @@
32663266
"tarkovDataId": null,
32673267
"factionName": "Any"
32683268
},
3269-
"67af4c1d8c9482eca103e477": {
3269+
"_67af4c1d8c9482eca103e477": {
32703270
"id": "67af4c1d8c9482eca103e477",
32713271
"name": "Consolation Prize",
32723272
"trader": "58330581ace78e27b8b10cee",
@@ -4474,5 +4474,157 @@
44744474
"experience": 11000,
44754475
"tarkovDataId": null,
44764476
"factionName": "Any"
4477+
},
4478+
"67e993f5ed537409f009da75": {
4479+
"id": "67e993f5ed537409f009da75",
4480+
"name": "Postponed Reward [PVP ZONE]",
4481+
"trader": "6617beeaa9cfa777ca915b7c",
4482+
"gameMode": ["regular"],
4483+
"location_id": null,
4484+
"locationName": null,
4485+
"minPlayerLevel": 0,
4486+
"taskRequirements": [
4487+
{
4488+
"task": "67e993b1ac26bf29380a320b",
4489+
"name": "Surprise Gift [PVP ZONE]",
4490+
"status": [
4491+
"complete"
4492+
]
4493+
}
4494+
],
4495+
"traderRequirements": [],
4496+
"objectives": [
4497+
{
4498+
"id": "67ebc5f501052193cdb4c9ac",
4499+
"type": "giveItem",
4500+
"optional": false,
4501+
"locationNames": [],
4502+
"map_ids": [],
4503+
"item_id": "6656560053eaaa7a23349c86",
4504+
"item_name": "Lega Medal",
4505+
"count": 1,
4506+
"item": "6656560053eaaa7a23349c86",
4507+
"dogTagLevel": 0,
4508+
"maxDurability": 100,
4509+
"minDurability": 0,
4510+
"foundInRaid": false
4511+
}
4512+
],
4513+
"startRewards": {
4514+
"traderStanding": [],
4515+
"items": [],
4516+
"offerUnlock": [],
4517+
"skillLevelReward": [],
4518+
"traderUnlock": []
4519+
},
4520+
"finishRewards": {
4521+
"traderStanding": [
4522+
{
4523+
"trader_id": "6617beeaa9cfa777ca915b7c",
4524+
"name": "Ref",
4525+
"standing": 0.01
4526+
}
4527+
],
4528+
"items": [
4529+
{
4530+
"item": "664a55d84a90fc2c8a6305c9",
4531+
"item_name": "Secure Container Theta",
4532+
"count": 1,
4533+
"contains": [],
4534+
"attributes": []
4535+
}
4536+
],
4537+
"offerUnlock": [],
4538+
"skillLevelReward": [],
4539+
"traderUnlock": []
4540+
},
4541+
"failureOutcome": {
4542+
"traderStanding": [],
4543+
"items": [],
4544+
"offerUnlock": [],
4545+
"skillLevelReward": [],
4546+
"traderUnlock": []
4547+
},
4548+
"failConditions": [],
4549+
"restartable": false,
4550+
"experience": 0,
4551+
"tarkovDataId": null,
4552+
"factionName": "Any"
4553+
},
4554+
"6834287b7559f4e6d50bc0fa": {
4555+
"id": "6834287b7559f4e6d50bc0fa",
4556+
"name": "Postponed Reward [PVE ZONE]",
4557+
"trader": "6617beeaa9cfa777ca915b7c",
4558+
"gameMode": ["pve"],
4559+
"location_id": null,
4560+
"locationName": null,
4561+
"minPlayerLevel": 0,
4562+
"taskRequirements": [
4563+
{
4564+
"task": "683427418f5b18d29a05d9e3",
4565+
"name": "Surprise Gift [PVE ZONE]",
4566+
"status": [
4567+
"complete"
4568+
]
4569+
}
4570+
],
4571+
"traderRequirements": [],
4572+
"objectives": [
4573+
{
4574+
"id": "6834287b7559f4e6d50bc0fd",
4575+
"type": "giveItem",
4576+
"optional": false,
4577+
"locationNames": [],
4578+
"map_ids": [],
4579+
"item_id": "6656560053eaaa7a23349c86",
4580+
"item_name": "Lega Medal",
4581+
"count": 1,
4582+
"item": "6656560053eaaa7a23349c86",
4583+
"dogTagLevel": 0,
4584+
"maxDurability": 100,
4585+
"minDurability": 0,
4586+
"foundInRaid": false
4587+
}
4588+
],
4589+
"startRewards": {
4590+
"traderStanding": [],
4591+
"items": [],
4592+
"offerUnlock": [],
4593+
"skillLevelReward": [],
4594+
"traderUnlock": []
4595+
},
4596+
"finishRewards": {
4597+
"traderStanding": [
4598+
{
4599+
"trader_id": "6617beeaa9cfa777ca915b7c",
4600+
"name": "Ref",
4601+
"standing": 0.01
4602+
}
4603+
],
4604+
"items": [
4605+
{
4606+
"item": "664a55d84a90fc2c8a6305c9",
4607+
"item_name": "Secure Container Theta",
4608+
"count": 1,
4609+
"contains": [],
4610+
"attributes": []
4611+
}
4612+
],
4613+
"offerUnlock": [],
4614+
"skillLevelReward": [],
4615+
"traderUnlock": []
4616+
},
4617+
"failureOutcome": {
4618+
"traderStanding": [],
4619+
"items": [],
4620+
"offerUnlock": [],
4621+
"skillLevelReward": [],
4622+
"traderUnlock": []
4623+
},
4624+
"failConditions": [],
4625+
"restartable": false,
4626+
"experience": 0,
4627+
"tarkovDataId": null,
4628+
"factionName": "Any"
44774629
}
44784630
}

src/tarkov-data-manager/index.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { createAndUploadFromSource, regenerateFromExisting } from './modules/ima
2424
import webSocketServer from './modules/websocket-server.mjs';
2525
import jobManager from './jobs/index.mjs';
2626
import presetData from './modules/preset-data.mjs';
27+
import tarkovDevData from './modules/tarkov-dev-data.mjs';
2728

2829
vm.runInThisContext(fs.readFileSync(import.meta.dirname + '/public/common.js'));
2930

@@ -97,7 +98,7 @@ app.set('trust proxy', true);
9798
//app.use(bodyParser.json());
9899
app.use(express.static('public'));
99100
app.use(session(sess));
100-
app.use(express.json({limit: '100mb'}));
101+
app.use(express.json({limit: '100mb'}), express.raw({type: 'image/*', limit: '50mb'}));
101102
app.use(express.urlencoded({extended: true}));
102103
app.use(maybe((req, res, next) => {
103104
if (req.session.loggedin) {
@@ -404,16 +405,17 @@ app.post('/items/refresh-images/:id', async (req, res) => {
404405
}
405406
let newImage;
406407
if (item.types.includes('preset')) {
407-
newImage = await webSocketServer.getJsonImage({
408-
id: item.id,
409-
items: item.properties.items,
408+
newImage = await this.fenceFetchImage('/preset-image', {
409+
method: 'POST',
410+
body: JSON.stringify({
411+
id: item.id,
412+
items: item.properties.items,
413+
}),
410414
});
411415
} else if (item.types.includes('replica')) {
412-
const results = await webSocketServer.getImages(item.properties.source);
413-
newImage = results[item.properties.source];
416+
newImage = await tarkovDevData.fenceFetchImage(`/item-image/${item.properties.source}`);
414417
} else {
415-
const results = await webSocketServer.getImages(item.id);
416-
newImage = results[item.id];
418+
newImage = await tarkovDevData.fenceFetchImage(`/item-image/${item.id}`);
417419
}
418420

419421
await createAndUploadFromSource(newImage, item.id);

src/tarkov-data-manager/jobs/refresh-item-images.mjs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ class UpdateProfileIndexJob extends DataJob {
3737
}
3838
try {
3939
let newImages = {};
40-
if (!item.types.includes('preset')) {
41-
newImages = await webSocketServer.getImages(item.id);
42-
} else if (gamePresets[id]) {
43-
continue;
44-
} else {
45-
newImages[id] = await webSocketServer.getJsonImage({
46-
id,
47-
items: item.properties.items ?? item.properties._items,
40+
if (item.types.includes('preset')) {
41+
if (gamePresets[id]) {
42+
continue;
43+
}
44+
newImages[id] = await this.fenceFetchImage('/preset-image', {
45+
method: 'POST',
46+
body: JSON.stringify({
47+
id,
48+
items: item.properties.items ?? item.properties._items,
49+
}),
4850
});
51+
} else if (item.types.includes('replica')) {
52+
newImages[id] = await this.fenceFetchImage(`/item-image/${item.properties.source}`);
53+
} else {
54+
newImages[id] = await this.fenceFetchImage(`/item-image/${item.id}`);
4955
}
5056

5157
await Promise.all(Object.keys(newImages).map(imageId => createAndUploadFromSource(newImages[imageId], imageId)));

src/tarkov-data-manager/jobs/update-hideout.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ class UpdateHideoutJob extends DataJob {
5050
filename:`station-${stationData.normalizedName}.png`,
5151
fallback: 'station-unknown.png',
5252
fetch: () => {
53-
return fetch(`https://fence.tarkov.dev/hideout-image/${stationData.id}`, {
54-
headers: {
55-
'Authorization': `Basic ${process.env.FENCE_BASIC_AUTH}`,
56-
},
57-
signal: this.abortController.signal,
58-
});
53+
return this.fenceFetch(`/hideout-image/${stationData.id}`);
5954
},
6055
});
6156
let skipArea = new Date() >= skipAreas[station._id];

src/tarkov-data-manager/jobs/update-item-cache.mjs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getLocalBucketContents, uploadAnyImage } from '../modules/upload-s3.mjs
1414
const excludeTypes = [
1515
'onlyFlea',
1616
'noHandbook',
17+
'noTranslation',
1718
];
1819

1920
class UpdateItemCacheJob extends DataJob {
@@ -107,23 +108,28 @@ class UpdateItemCacheJob extends DataJob {
107108
continue;
108109
}
109110

110-
if (!value.image_8x_link && webSocketServer.launchedScanners() > 0) {
111+
if (!value.image_8x_link) {
111112
try {
112113
let image;
113114
if (value.types.includes('preset')) {
114-
image = await webSocketServer.getJsonImage(value.properties.items);
115+
image = await this.fenceFetchImage('/preset-image', {
116+
method: 'POST',
117+
body: JSON.stringify({
118+
id: key,
119+
items: value.properties.items,
120+
}),
121+
});
115122
} else if (value.types.includes('replica')) {
116-
const images = await webSocketServer.getImages(value.properties.source);
117-
image = images[value.properties.source];
123+
image = await this.fenceFetchImage(`/item-image/${value.properties.source}`);
118124
} else {
119-
const images = await webSocketServer.getImages(key);
120-
image = images[key];
125+
image = await this.fenceFetchImage(`/item-image/${key}`);
121126
}
122127
await createAndUploadFromSource(image, key);
123-
this.logger.success(`Created ${key} item images`);
128+
this.logger.success(`Created ${key} item image`);
124129
} catch (error) {
125-
this.logger.error(`Error creating ${key} item images ${error}`);
130+
this.logger.error(`Error creating ${key} item image ${error}`);
126131
}
132+
return;
127133
}
128134

129135
itemData[key] = {
@@ -316,6 +322,10 @@ class UpdateItemCacheJob extends DataJob {
316322
continue;
317323
}
318324
const baseItem = itemData[itemProperties[item.id].base_item_id];
325+
if (!baseItem) {
326+
this.addJobSummary(`${item.id}; base: ${itemProperties[item.id].base_item_id}`, 'No base item found for preset');
327+
continue;
328+
}
319329
if (itemProperties[baseItem.id]?.defaultPreset !== item.id) {
320330
continue;
321331
}
@@ -720,7 +730,7 @@ class UpdateItemCacheJob extends DataJob {
720730
}
721731
}
722732
} else if (this.bsgItems[item.id] && !ignoreMissingBaseValue(item)) {
723-
this.logger.warn(`Unknown base value for ${this.getTranslation(item.name)} ${item.id} ${this.credits[item.id]}`);
733+
this.logger.warn(`Unknown base value for ${this.getTranslation(item.name)} ${item.id}`);
724734
}
725735
}
726736

@@ -849,12 +859,7 @@ class UpdateItemCacheJob extends DataJob {
849859
skill.imageLink = s3ImageLink;
850860
return;
851861
}
852-
const imageResponse = await fetch(`https://fence.tarkov.dev/skill-image/${skill.id}`, {
853-
headers: {
854-
'Authorization': `Basic ${process.env.FENCE_BASIC_AUTH}`,
855-
},
856-
signal: this.abortController.signal,
857-
});
862+
const imageResponse = await this.fenceFetch(`/skill-image/${skill.id}`);
858863
if (!imageResponse.ok) {
859864
return;
860865
}
@@ -877,15 +882,11 @@ class UpdateItemCacheJob extends DataJob {
877882
if (!category.Icon.endsWith('.png')) {
878883
return null;
879884
}
880-
const imageResponse = await fetch(`https://fence.tarkov.dev/passthrough-request`, {
881-
headers: {
882-
'Authorization': `Basic ${process.env.FENCE_BASIC_AUTH}`,
883-
},
885+
const imageResponse = await this.fenceFetch('/passthrough-request', {
884886
method: 'POST',
885887
body: JSON.stringify({
886888
url: `https://prod.escapefromtarkov.com${category.Icon}`,
887889
}),
888-
signal: this.abortController.signal,
889890
});
890891
if (!imageResponse.ok) {
891892
return null;

0 commit comments

Comments
 (0)