Skip to content

Commit a7f47fe

Browse files
authored
Merge pull request #466 from WatWowMap/bug-fixes
Bug fixes
2 parents f7d3cae + ffb63e0 commit a7f47fe

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reactmap",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "React based frontend map.",
55
"main": "ReactMap.mjs",
66
"author": "TurtIeSocks <[email protected]>",

server/src/configs/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@
354354
"joinGymBadgeTable": false,
355355
"hideOldQuests": false,
356356
"maxConnections": 10,
357-
"startupDelayMs": 1000
357+
"startupDelayMs": 1000,
358+
"availableRetryCount": 5
358359
},
359360
"schemas": [
360361
{

server/src/models/Pokestop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ module.exports = class Pokestop extends Model {
605605
}
606606
})
607607

608-
if (finalList.length === 0) {
608+
if (finalList.size === 0) {
609609
return fetchQuests()
610610
}
611611

@@ -754,7 +754,7 @@ module.exports = class Pokestop extends Model {
754754
getAreaSql(query, perms.areaRestrictions, isMad)
755755
}
756756
const results = await query
757-
const mapped = results.map(q => ({ ...q, with_ar: true }))
757+
const mapped = results.map(q => ({ ...q, with_ar: q.with_ar ?? true }))
758758

759759
if (hasAltQuests) {
760760
const altQuestQuery = this.query()

server/src/services/EventManager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-promise-executor-return */
12
/* eslint-disable no-await-in-loop */
23
/* eslint-disable no-console */
34
const { promises: fs } = require('fs')
@@ -16,6 +17,7 @@ module.exports = class EventManager {
1617
this.uicons = []
1718
this.baseUrl = 'https://raw.githubusercontent.com/WatWowMap/wwm-uicons/main/'
1819
this.webhookObj = {}
20+
this.pokestopTry = 1
1921

2022
setTimeout(async () => {
2123
// Set initials, comes with a timeout just to make sure all databases get configured first
@@ -24,9 +26,11 @@ module.exports = class EventManager {
2426
this.available.nests = await Db.getAvailable('Nest')
2527
this.available.pokemon = await Db.getAvailable('Pokemon')
2628
this.available.pokestops = await Db.getAvailable('Pokestop')
27-
while (!this.available.pokestops.length) {
28-
console.log('Trying again...')
29+
while (!this.available.pokestops.length && this.pokestopTry <= config.database.settings.availableRetryCount) {
30+
console.log(`[EVENT] No pokestops found, trying again in 1 second (attempt ${this.pokestopTry} / ${config.database.settings.availableRetryCount})`)
31+
await new Promise(resolve => setTimeout(resolve, 1000))
2932
this.available.pokestops = await Db.getAvailable('Pokestop')
33+
this.pokestopTry += 1
3034
}
3135
await this.getMasterfile()
3236
await this.getInvasions()

server/src/services/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ if (hasLittle) {
7373
config.api.pvp.leagueObj.little = hasLittle.littleCupRules ? 500 : { little: false, cap: 500 }
7474
}
7575

76+
if (!config.authentication.strategies.length || !config.authentication.strategies.find(strategy => strategy.enabled)) {
77+
config.authentication.alwaysEnabledPerms = Object.keys(config.authentication.perms)
78+
}
79+
7680
// Map manual areas
7781
config.manualAreas = Object.fromEntries(config.manualAreas.map(area => [area.name, area]))
7882

0 commit comments

Comments
 (0)