From f6e7a6a5a8aec2bbf5bcbc964b655f1f98cefd71 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 18 May 2022 00:23:28 -0400 Subject: [PATCH 01/19] Configurable Polling - All categories are now configurable in config.api.polling - Unit in seconds - Falls back to 10s --- server/src/configs/default.json | 12 ++++++++++++ server/src/routes/rootRouter.js | 1 + src/components/QueryData.jsx | 18 ++---------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/server/src/configs/default.json b/server/src/configs/default.json index 30eb5ad33..14b2e121a 100644 --- a/server/src/configs/default.json +++ b/server/src/configs/default.json @@ -18,6 +18,18 @@ "time": 60, "requests": 1000 }, + "polling": { + "devices": 10, + "gyms": 10, + "nests": 300, + "pokemon": 20, + "pokestops": 300, + "portals": 300, + "scanAreas": 10000, + "scanCells": 10, + "submissionCells": 500, + "weather": 30 + }, "queryUpdateHours": { "pokemon": 0.5, "quests": 1, diff --git a/server/src/routes/rootRouter.js b/server/src/routes/rootRouter.js index 751910d33..f3c0d5647 100644 --- a/server/src/routes/rootRouter.js +++ b/server/src/routes/rootRouter.js @@ -112,6 +112,7 @@ rootRouter.get('/settings', async (req, res) => { ...config.map, ...config.multiDomainsObj[req.headers.host], excludeList: config.authentication.excludeFromTutorial, + polling: config.api.polling, }, localeSelection: Object.fromEntries(config.map.localeSelection.map(l => [l, { name: l }])), tileServers: Object.fromEntries(config.tileServers.map(s => [s.name, s])), diff --git a/src/components/QueryData.jsx b/src/components/QueryData.jsx index 1dc17c7d1..317cce40d 100644 --- a/src/components/QueryData.jsx +++ b/src/components/QueryData.jsx @@ -10,20 +10,6 @@ import ActiveWeather from './layout/general/ActiveWeather' const filterSkipList = ['filter', 'enabled', 'legacy'] -const getPolling = category => { - switch (category) { - case 'devices': - case 'gyms': - case 'scanCells': - return 10 * 1000 - case 'pokemon': - return 20 * 1000 - case 'pokestops': return 5 * 60 * 1000 - case 'weather': return 30 * 1000 - default: return 10 * 60 * 1000 - } -} - export default function QueryData({ bounds, onMove, map, tileStyle, clusteringRules, config, params, isMobile, category, filters, staticFilters, staticUserSettings, sizeKey, @@ -83,14 +69,14 @@ export default function QueryData({ const { data, previousData, refetch, error } = useQuery( Query[category](filters, perms, map.getZoom(), clusteringRules.zoomLevel), { - context: { timeout: getPolling(category) }, + context: { timeout: (config.polling[category] || 10) * 1000 }, variables: { ...bounds, filters: trimFilters(filters), version: inject.VERSION, }, fetchPolicy: active ? 'cache-first' : 'cache-only', - pollInterval: getPolling(category), + pollInterval: (config.polling[category] || 10) * 1000, skip: !active, }, ) From ca14633f62f01b23968835d14ac1db55407e944a Mon Sep 17 00:00:00 2001 From: TurtIeSocks Date: Wed, 18 May 2022 04:23:50 +0000 Subject: [PATCH 02/19] Synced docker env vars with latest config Files changed:\nM server/src/configs/custom-environment-variables.json --- .../configs/custom-environment-variables.json | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/server/src/configs/custom-environment-variables.json b/server/src/configs/custom-environment-variables.json index 17a45b7a6..970c28d2c 100644 --- a/server/src/configs/custom-environment-variables.json +++ b/server/src/configs/custom-environment-variables.json @@ -45,6 +45,48 @@ "__format": "number" } }, + "polling": { + "devices": { + "__name": "API_POLLING_DEVICES", + "__format": "number" + }, + "gyms": { + "__name": "API_POLLING_GYMS", + "__format": "number" + }, + "nests": { + "__name": "API_POLLING_NESTS", + "__format": "number" + }, + "pokemon": { + "__name": "API_POLLING_POKEMON", + "__format": "number" + }, + "pokestops": { + "__name": "API_POLLING_POKESTOPS", + "__format": "number" + }, + "portals": { + "__name": "API_POLLING_PORTALS", + "__format": "number" + }, + "scanAreas": { + "__name": "API_POLLING_SCAN_AREAS", + "__format": "number" + }, + "scanCells": { + "__name": "API_POLLING_SCAN_CELLS", + "__format": "number" + }, + "submissionCells": { + "__name": "API_POLLING_SUBMISSION_CELLS", + "__format": "number" + }, + "weather": { + "__name": "API_POLLING_WEATHER", + "__format": "number" + } + }, "queryUpdateHours": { "pokemon": { "__name": "API_QUERY_UPDATE_HOURS_POKEMON", From cfd19aac1d7e6e3637eed8b657c3ed42a27565bf Mon Sep 17 00:00:00 2001 From: Ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Wed, 18 May 2022 16:00:20 +0300 Subject: [PATCH 03/19] Fixed despawn time verificated checkmark for mad spawns If calc_endminsec was 00:xx this would return null --- server/src/models/Pokemon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/models/Pokemon.js b/server/src/models/Pokemon.js index a91025b60..dcdb1d93d 100644 --- a/server/src/models/Pokemon.js +++ b/server/src/models/Pokemon.js @@ -40,7 +40,7 @@ const getMadSql = q => ( 'pokemon_display.pokemon AS display_pokemon_id', 'pokemon_display.form AS ditto_form', 'weather_boosted_condition AS weather', - raw('IF(calc_endminsec, 1, NULL)') + raw('IF(calc_endminsec IS NOT NULL, 1, NULL)') .as('expire_timestamp_verified'), raw('Unix_timestamp(disappear_time)') .as('expire_timestamp'), From a02e635bc7a3e2cabbcde4b6d49d85fb32c39a8d Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 18 May 2022 18:39:49 -0400 Subject: [PATCH 04/19] available api - Adds an available api for checking and updating what's currently in memory or the database --- .gitignore | 1 + server/src/routes/api/v1/available.js | 117 ++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 server/src/routes/api/v1/available.js diff --git a/.gitignore b/.gitignore index 05d724b9e..e5652d1ab 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ server/src/strategies/* server/src/routes/api/v1/* !server/src/routes/api/v1/users.js !server/src/routes/api/v1/sessions.js +!server/src/routes/api/v1/available.js # custom model server/src/models/Custom.js diff --git a/server/src/routes/api/v1/available.js b/server/src/routes/api/v1/available.js new file mode 100644 index 000000000..21f15acff --- /dev/null +++ b/server/src/routes/api/v1/available.js @@ -0,0 +1,117 @@ +/* eslint-disable no-console */ +const path = require('path') +const router = require('express').Router() +const { api } = require('../../../services/config') +const { Db, Event } = require('../../../services/initialization') + +const queryObj = { + pokemon: { model: 'Pokemon', category: 'pokemon' }, + quests: { model: 'Pokestop', category: 'pokestops' }, + raids: { model: 'Gym', category: 'gyms' }, + nests: { model: 'Nest', category: 'nests' }, +} + +const resolveCategory = (category) => { + switch (category) { + case 'gym': + case 'gyms': + case 'raid': + case 'raids': return 'raids' + case 'pokestop': + case 'pokestops': + case 'quest': + case 'quests': return 'quests' + case 'pokemon': + case 'pokemons': return 'pokemon' + default: return 'all' + } +} + +const getAll = async (compare) => { + const available = compare + ? await Promise.all([ + Db.getAvailable('Pokemon'), + Db.getAvailable('Pokestop'), + Db.getAvailable('Gym'), + Db.getAvailable('Nest'), + ]) + : [ + Event.available.pokemon, + Event.available.pokestops, + Event.available.gyms, + Event.available.nests, + ] + return Object.fromEntries(Object.keys(queryObj).map((key, i) => [key, available[i]])) +} + +router.get('/:category', async (req, res) => { + const { model, category } = queryObj[resolveCategory(req.params.category)] || {} + const { current, equal } = req.query + try { + if (api.reactMapSecret && req.headers['react-map-secret'] === api.reactMapSecret) { + if (model && category) { + const available = current !== undefined + ? await Db.getAvailable(model) + : Event.available[category] + available.sort((a, b) => a.localeCompare(b)) + + if (equal !== undefined) { + const compare = current !== undefined + ? Event.available[category] + : await Db.getAvailable(model) + compare.sort((a, b) => a.localeCompare(b)) + res.status(200).json(available.every((item, i) => item === compare[i])) + } else { + res.status(200).json(available) + } + } else { + const available = await getAll(current) + Object.values(available).forEach(c => c.sort((a, b) => a.localeCompare(b))) + + if (equal !== undefined) { + const compare = await getAll(!current) + Object.values(compare).forEach(c => c.sort((a, b) => a.localeCompare(b))) + + res.status(200).json(Object.keys(available).every(cat => ( + available[cat].every((item, j) => item === compare[cat][j]) + ))) + } else { + res.status(200).json(available) + } + } + } else { + throw new Error('Incorrect or missing API secret') + } + console.log(`[API] api/v1/${path.parse(__filename).name}`) + } catch (e) { + console.error(`[API Error] api/v1/${path.parse(__filename).name}`, e) + res.status(500).json({ status: 'ServerError', reason: e.message }) + } +}) + +router.put('/:category', async (req, res) => { + const { model, category } = queryObj[resolveCategory(req.params.category)] || {} + try { + if (api.reactMapSecret && req.headers['react-map-secret'] === api.reactMapSecret) { + if (model && category) { + await Event.setAvailable(category, model, Db) + } else { + await Promise.all([ + Event.setAvailable('pokemon', 'Pokemon', Db), + Event.setAvailable('pokestops', 'Pokestop', Db), + Event.setAvailable('gyms', 'Gym', Db), + Event.setAvailable('nests', 'Nest', Db), + ]) + } + res.status(200).json({ status: `updated availabled for ${category || 'all'}` }) + } else { + throw new Error('Incorrect or missing API secret') + } + console.log(`[API] api/v1/${path.parse(__filename).name} - updated availabled for ${category || 'all'}`) + } catch (e) { + console.error(`[API] api/v1/${path.parse(__filename).name}`, e) + res.status(500).json({ status: 'ServerError', reason: e.message }) + } +}) + +module.exports = router From ac8e51ed3a4c13dde2f4d7a2a9faa1672f276aba Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Thu, 19 May 2022 17:33:41 -0400 Subject: [PATCH 05/19] Update available.js --- server/src/routes/api/v1/available.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/routes/api/v1/available.js b/server/src/routes/api/v1/available.js index 21f15acff..4fa62adfc 100644 --- a/server/src/routes/api/v1/available.js +++ b/server/src/routes/api/v1/available.js @@ -44,7 +44,7 @@ const getAll = async (compare) => { return Object.fromEntries(Object.keys(queryObj).map((key, i) => [key, available[i]])) } -router.get('/:category', async (req, res) => { +router.get(['/', '/:category'], async (req, res) => { const { model, category } = queryObj[resolveCategory(req.params.category)] || {} const { current, equal } = req.query try { From 98237a1bdcb886691c807e73f7d1cefb2085cc15 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Fri, 20 May 2022 18:39:20 -0400 Subject: [PATCH 06/19] Cleanup gym filtering logic --- server/src/models/Gym.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/models/Gym.js b/server/src/models/Gym.js index 94bd06fcf..f0aee49dc 100644 --- a/server/src/models/Gym.js +++ b/server/src/models/Gym.js @@ -239,9 +239,11 @@ module.exports = class Gym extends Model { raidFields.forEach(field => newGym[field] = gym[field]) newGym.hasRaid = true } - if (newGym.hasRaid || newGym.badge - || finalTeams.includes(gym.team_id) - || finalSlots[gym.team_id]?.includes(gym.available_slots)) { + if (onlyAllGyms && (finalTeams.includes(gym.team_id) + || finalSlots[gym.team_id]?.includes(gym.available_slots))) { + newGym.hasGym = true + } + if (newGym.hasRaid || newGym.badge || newGym.hasGym) { filteredResults.push(newGym) } }) From da0e16d2d03f8bbf92679d6cdfd9fea0273641fb Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Sat, 21 May 2022 22:01:25 -0400 Subject: [PATCH 07/19] Update Gym.js --- server/src/models/Gym.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/models/Gym.js b/server/src/models/Gym.js index f0aee49dc..615e32a41 100644 --- a/server/src/models/Gym.js +++ b/server/src/models/Gym.js @@ -239,7 +239,7 @@ module.exports = class Gym extends Model { raidFields.forEach(field => newGym[field] = gym[field]) newGym.hasRaid = true } - if (onlyAllGyms && (finalTeams.includes(gym.team_id) + if ((onlyAllGyms || onlyExEligible || onlyArEligible || onlyInBattle) && (finalTeams.includes(gym.team_id) || finalSlots[gym.team_id]?.includes(gym.available_slots))) { newGym.hasGym = true } From ab8188e3dfa957012610c33e6e9dc8d7c1d62ef7 Mon Sep 17 00:00:00 2001 From: Ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Sun, 22 May 2022 14:25:31 +0300 Subject: [PATCH 08/19] Added user id to array of chat id's to check in TG auth This allows setting user specific permissions --- server/src/strategies/telegram.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/strategies/telegram.js b/server/src/strategies/telegram.js index 3597baab3..604325528 100644 --- a/server/src/strategies/telegram.js +++ b/server/src/strategies/telegram.js @@ -21,7 +21,7 @@ const authHandler = async (req, profile, done) => { }, } - const groupInfo = [] + const chatInfo = [user.id] await Promise.all(strategyConfig.groups.map(async (group) => { try { const response = await Fetch.json(`https://api.telegram.org/bot${strategyConfig.botToken}/getChatMember?chat_id=${group}&user_id=${user.id}`) @@ -32,7 +32,7 @@ const authHandler = async (req, profile, done) => { throw new Error(`Telegram API error: ${response.status} ${response.statusText}`) } if (response.result.status !== 'left' && response.result.status !== 'kicked') { - groupInfo.push(group) + chatInfo.push(group) } } catch (e) { console.error(e.message, `Telegram Group: ${group}`, `User: ${user.id} (${user.username})`) @@ -42,14 +42,14 @@ const authHandler = async (req, profile, done) => { Object.entries(perms).forEach(([perm, info]) => { if (info.enabled && (alwaysEnabledPerms.includes(perm) - || info.roles.some(role => groupInfo.includes(role)))) { + || info.roles.some(role => chatInfo.includes(role)))) { user.perms[perm] = true } }) - user.perms.areaRestrictions = Utility.areaPerms(groupInfo, 'telegram') - user.perms.webhooks = Utility.webhookPerms(groupInfo, 'telegramGroups') - user.perms.scanner = Utility.scannerPerms(groupInfo, 'telegramGroups') + user.perms.areaRestrictions = Utility.areaPerms(chatInfo, 'telegram') + user.perms.webhooks = Utility.webhookPerms(chatInfo, 'telegramGroups') + user.perms.scanner = Utility.scannerPerms(chatInfo, 'telegramGroups') try { await User.query() From 9ea97e329cdc1ea817c5736beaa4e57076deaf64 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Fri, 27 May 2022 00:21:05 -0400 Subject: [PATCH 09/19] Add Ultra Beast Support --- public/base-locales/en.json | 1 + server/scripts/generateMasterfile.js | 1 + 2 files changed, 2 insertions(+) diff --git a/public/base-locales/en.json b/public/base-locales/en.json index 80ffee9ea..5a44a2b10 100644 --- a/public/base-locales/en.json +++ b/public/base-locales/en.json @@ -164,6 +164,7 @@ "event": "Event", "legendary": "Legendary", "mythical": "Mythical", + "ultra_beast": "Ultra Beast", "alt_forms": "Alt Forms", "alola": "Alola", "galarian": "Galarian", diff --git a/server/scripts/generateMasterfile.js b/server/scripts/generateMasterfile.js index ea0f102a3..a251531b9 100644 --- a/server/scripts/generateMasterfile.js +++ b/server/scripts/generateMasterfile.js @@ -19,6 +19,7 @@ const getRarityLevel = (id, pkmn) => { } if (pkmn.legendary) pkmnRarity = 'legendary' if (pkmn.mythical) pkmnRarity = 'mythical' + if (pkmn.ultraBeast) pkmnRarity = 'ultraBeast' return pkmnRarity } From d99d2389dc3c744a07e306346bc2efa33f8727f5 Mon Sep 17 00:00:00 2001 From: Ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Fri, 27 May 2022 13:44:25 +0300 Subject: [PATCH 10/19] Improved areas.example.json Improved the format in the example file to better display the order of longitude and latitude, and that the first and last coordinates of the fence need to be the same --- server/src/configs/areas.example.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/server/src/configs/areas.example.json b/server/src/configs/areas.example.json index c850d6079..7d8b916f9 100644 --- a/server/src/configs/areas.example.json +++ b/server/src/configs/areas.example.json @@ -7,8 +7,20 @@ "coordinates": [ [ [ - -100, - 4 + lon1, + lat1 + ], + [ + lon2, + lat2 + ], + [ + lon3, + lat3 + ], + [ + lon1, + lat1 ] ] ] From 254c96a29238ce6b14a42d9d630139dcd2fab22f Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Sat, 28 May 2022 12:35:44 -0400 Subject: [PATCH 11/19] Add nginx image example --- docker-compose.example.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docker-compose.example.yml b/docker-compose.example.yml index d84b214b2..53c7551ad 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -25,7 +25,17 @@ services: - ./server/src/configs/local.json:/home/node/server/src/configs/local.json - ./server/src/configs/geofence.json/:/home/node/server/src/configs/geofence.json - ./example.env:/home/node/.env - security_opt: - - no-new-privileges:true #https://nodramadevops.com/2019/06/running-docker-application-containers-more-securely/ + security_opt: + - no-new-privileges:true #https://nodramadevops.com/2019/06/running-docker-application-containers-more-securely/ ports: - "9090:8080" + # nginx: + # image: nginx + # container_name: nginx + # depends_on: + # - reactmap + # ports: + # - "80:80" + # - "443:443" + # volumes: + # - ./server/src/configs/nginx.conf:/etc/nginx/conf.d/default.conf From 115535302cb611359d2292086563dec09db0e407 Mon Sep 17 00:00:00 2001 From: ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Sun, 29 May 2022 13:50:25 +0200 Subject: [PATCH 12/19] Edited poracleToGeoJSON.js to check for coordinate format If the first and last coordinates of a polygon aren't identical, add the first coordinates to the end --- server/scripts/poracleToGeoJSON.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/scripts/poracleToGeoJSON.js b/server/scripts/poracleToGeoJSON.js index 24ed4e23a..1c4bdbd7d 100644 --- a/server/scripts/poracleToGeoJSON.js +++ b/server/scripts/poracleToGeoJSON.js @@ -48,6 +48,10 @@ if (fs.existsSync(geofencesFile)) { const coord = inGeofence.path[j] inGeofence.path[j] = [coord[1], coord[0]] } + const lastCoords = inGeofence.path.slice(-1) + if (inGeofence.path[0][0] !== lastCoords[0][0] || inGeofence.path[0][1] !== lastCoords[0][1]) { + inGeofence.path.push(inGeofence.path[0]) + } outGeofence.geometry.coordinates[0] = inGeofence.path outGeoJSON.features.push(outGeofence) } From 94a5fa52233b16e33a4778464eba06301118aaf8 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Sun, 29 May 2022 13:32:28 -0400 Subject: [PATCH 13/19] Fix Scanner Perms - Allow scanner perms if enabled and no roles/groups found in the array for users that don't login --- server/src/routes/rootRouter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/routes/rootRouter.js b/server/src/routes/rootRouter.js index f3c0d5647..21594d229 100644 --- a/server/src/routes/rootRouter.js +++ b/server/src/routes/rootRouter.js @@ -69,7 +69,7 @@ rootRouter.get('/settings', async (req, res) => { req.session.perms = { areaRestrictions: Utility.areaPerms(['none']), webhooks: [], - scanner: [], + scanner: Object.keys(config.scanner).filter((key) => key !== 'backendConfig' && config.scanner[key].enabled && !config.scanner[key].discordRoles.length && !config.scanner[key].telegramGroups.length), } config.authentication.alwaysEnabledPerms.forEach(perm => { if (config.authentication.perms[perm]) { From a1435e9e22121c0329e074a0c8d621bf0bcfb606 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Sun, 29 May 2022 13:52:29 -0400 Subject: [PATCH 14/19] Add no minified option to .env --- esbuild.config.mjs | 4 +++- example.env | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/esbuild.config.mjs b/esbuild.config.mjs index d256f635b..3e8210579 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -124,7 +124,9 @@ const esbuild = { publicPath: '/', entryNames: isDevelopment ? undefined : '[name].[hash]', metafile: true, - minify: isRelease || !isDevelopment, + minify: env.parsed.NO_MINIFIED + ? false + : isRelease || !isDevelopment, logLevel: isDevelopment ? 'info' : 'error', target: ['safari11.1', 'chrome64', 'firefox66', 'edge88'], watch: isDevelopment diff --git a/example.env b/example.env index efa006cf7..f38ada270 100644 --- a/example.env +++ b/example.env @@ -1,4 +1,4 @@ -GOOGLE_ANALYTICS_ID= +GOOGLE_ANALYTICS_ID="" TITLE="Map" SENTRY_DSN="" SENTRY_AUTH_TOKEN="" @@ -7,3 +7,4 @@ SENTRY_PROJECT="" SENTRY_TRACES_SAMPLE_RATE=0.1 SENTRY_DEBUG= DEV_PORT="" +NO_MINIFIED="" \ No newline at end of file From cf093cdfe171f8a6548d5032047c315f73983534 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Thu, 2 Jun 2022 00:41:02 -0400 Subject: [PATCH 15/19] quest form fallback when null --- server/src/models/Pokestop.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/models/Pokestop.js b/server/src/models/Pokestop.js index c58f181b7..e071ef8db 100644 --- a/server/src/models/Pokestop.js +++ b/server/src/models/Pokestop.js @@ -357,6 +357,7 @@ module.exports = class Pokestop extends Model { newQuest.key = `c${quest.candy_pokemon_id}` fields.push('candy_pokemon_id', 'candy_amount'); break case 7: + quest.quest_form_id = quest.quest_form_id ?? 0 newQuest.key = `${quest.quest_pokemon_id}-${quest.quest_form_id}` fields.push('quest_pokemon_id', 'quest_form_id', 'quest_costume_id', 'quest_gender_id', 'quest_shiny'); break case 9: @@ -606,7 +607,7 @@ module.exports = class Pokestop extends Model { case 'stardust': rewards.forEach(reward => finalList.add(`d${reward.amount}`)); break case 'candy': rewards.forEach(reward => finalList.add(`c${reward.id}`)); break case 'xlCandy': rewards.forEach(reward => finalList.add(`x${reward.id}`)); break - default: rewards.forEach(reward => finalList.add(`${reward.quest_pokemon_id}-${reward.form}`)); break + default: rewards.forEach(reward => finalList.add(`${reward.quest_pokemon_id}-${reward.form ?? 0}`)); break } }) From d81baed1c19db869a822b33cbda3795d138c5b1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jun 2022 23:04:02 +0000 Subject: [PATCH 16/19] Bump protobufjs from 6.11.2 to 6.11.3 Bumps [protobufjs](https://github.com/protobufjs/protobuf.js) from 6.11.2 to 6.11.3. - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/v6.11.3/CHANGELOG.md) - [Commits](https://github.com/protobufjs/protobuf.js/compare/v6.11.2...v6.11.3) --- updated-dependencies: - dependency-name: protobufjs dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/yarn.lock b/yarn.lock index 922310473..1a152c1be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -296,7 +296,7 @@ "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" - integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78= + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== "@protobufjs/base64@^1.1.2": version "1.1.2" @@ -311,12 +311,12 @@ "@protobufjs/eventemitter@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" - integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A= + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== "@protobufjs/fetch@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" - integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU= + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== dependencies: "@protobufjs/aspromise" "^1.1.1" "@protobufjs/inquire" "^1.1.0" @@ -324,27 +324,27 @@ "@protobufjs/float@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" - integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E= + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== "@protobufjs/inquire@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" - integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik= + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== "@protobufjs/path@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" - integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0= + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== "@protobufjs/pool@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" - integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q= + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== "@protobufjs/utf8@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" - integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== "@react-leaflet/core@^1.0.2", "@react-leaflet/core@^1.1.1": version "1.1.1" @@ -580,24 +580,19 @@ integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= "@types/long@^4.0.0", "@types/long@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" - integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== "@types/mime@^1": version "1.3.2" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== -"@types/node@*": - version "16.0.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.1.tgz#70cedfda26af7a2ca073fdcc9beb2fff4aa693f8" - integrity sha512-hBOx4SUlEPKwRi6PrXuTGw1z6lz0fjsibcWCM378YxsSu/6+C30L6CR49zIBKHiwNWCYIcOLjg4OHKZaFeLAug== - -"@types/node@>=13.7.0": - version "16.6.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.1.tgz#aee62c7b966f55fc66c7b6dfa1d58db2a616da61" - integrity sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw== +"@types/node@*", "@types/node@>=13.7.0": + version "17.0.38" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.38.tgz#f8bb07c371ccb1903f3752872c89f44006132947" + integrity sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g== "@types/node@^10.1.0": version "10.17.60" @@ -3779,9 +3774,9 @@ prop-types@^15.6.2, prop-types@^15.7.2: react-is "^16.8.1" protobufjs@^6.10.2: - version "6.11.2" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b" - integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw== + version "6.11.3" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74" + integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" From 4a34af4d21b236ac5dff6ff4a5d4c0311a270361 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Mon, 6 Jun 2022 08:36:05 -0400 Subject: [PATCH 17/19] Update fetchJson.js --- server/src/services/api/fetchJson.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/services/api/fetchJson.js b/server/src/services/api/fetchJson.js index 7e323c2d2..81d88b439 100644 --- a/server/src/services/api/fetchJson.js +++ b/server/src/services/api/fetchJson.js @@ -21,7 +21,7 @@ module.exports = async function fetchJson(url, options = undefined, log = false) console.log('Request to', url, 'timed out and was aborted') } else if (log) { console.warn(e) - } else { + } else if (e instanceof Error) { console.warn(e.message, '\n', e.code, `\nUnable to fetch ${url}`) } return null From 47e6ccbe55d02423d4499cb59a4d402974754d34 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Tue, 7 Jun 2022 08:44:00 -0400 Subject: [PATCH 18/19] Version bump --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8a9a275ab..38730dc69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactmap", - "version": "1.2.6", + "version": "1.2.7", "description": "React based frontend map.", "main": "ReactMap.mjs", "author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>", @@ -26,8 +26,8 @@ "release": "node server/scripts/newRelease.js" }, "engines": { - "node": ">=16", - "yarn": "1.22.x" + "node": "^16", + "yarn": "^1.22.x" }, "devDependencies": { "@craftamap/esbuild-plugin-html": "^0.4.0", From 132605ba70915df4db6f37170257c406c6a56e70 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Tue, 7 Jun 2022 08:50:54 -0400 Subject: [PATCH 19/19] Update workflows --- .github/workflows/docker.yml | 1 + .github/workflows/lint.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c6dca5b7c..6faf6bc72 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,6 +27,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} commit_message: Synced docker env vars with latest config Docker: + if: ${{ always() }} needs: Sync runs-on: ubuntu-latest steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index be25c98ee..e09776e06 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,5 @@ name: Lint -on: [push, pull_request] +on: [push] jobs: Lint: