Skip to content

Commit ed87f91

Browse files
authored
Merge pull request #933 from KartulUdus/develop
Sync to master
2 parents 21eff51 + a816e4f commit ed87f91

34 files changed

+343
-91
lines changed

config/default.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@
512512
// webhook queue is kept under control; if this clears nicely in between drops from your scanner you are keeping up. For outbound, a lower number of
513513
// concurrent senders will reduce chance of hitting the global rate limit (probably) which is why we haven't defaulted too high here
514514
//
515+
// fastMonsters - Eliminate SQL lookups for monster matching by activating in memory pokemon matching
516+
// disablePokemonCache - The impact of this will be that poracle uses a lot less memory
515517
// maxDatabaseConnections - This is the max number of database connections Poracle can have (per worker)
516518
// webhookProcessingWorkers - Number of threads to run inbound webhook workers. Five is enough for very big systems, going too high is probably
517519
// counter productive so talk to me before playing with this one
@@ -524,7 +526,8 @@
524526
// concurrentDiscordWebhookConnections - How many concurrent discord webhook destinations to send to at once
525527
//
526528
"tuning": {
527-
"fastMonsters": false,
529+
"fastMonsters": true,
530+
"disablePokemonCache": true,
528531
"maxDatabaseConnections": 15,
529532
"webhookProcessingWorkers": 5,
530533
"concurrentWebhookProcessorsPerWorker": 4,

locale/de.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"channel":"Kanal",
4747
"Charged TM":"Lade-TM",
4848
"Chill":"Gefriermodul",
49-
"clean":"aufräumen",
49+
"clean":"bereinigen",
5050
"Cleaning finished":"Säuberung beendet!",
5151
"clear":"leeren",
5252
"Cliff":"Cliff",
@@ -147,6 +147,7 @@
147147
"incident":"ereignis",
148148
"include_empty":"auch_leer",
149149
"including battle changes":"inklusive Teamänderungen",
150+
"including rsvp updates":"mit rsvp updates",
150151
"including slot changes":"inklusive Platzänderungen",
151152
"individually":"individuell",
152153
"instinct":"Intuition",
@@ -290,6 +291,7 @@
290291
"Rock":"Gestein",
291292
"role":"Rolle",
292293
"Roles available":"Aktuell sind folgende Rollen verfügbar",
294+
"rsvp only":"nur rsvp",
293295
"russian":"Russisch",
294296
"s location to : ":"“ wurde gesetzt auf: ",
295297
"'s location to the following coordinates in":"“ wurde wie folgt gesetzt:",
@@ -299,6 +301,7 @@
299301
"settime":"Zeit",
300302
"Shadow":"Crypto",
301303
"Shadow Legendary":"Crypto Legendär",
304+
"Shiny":"schillernd",
302305
"Shiny information not yet calculated - wait a few minutes and try again":"Shinyinfos noch nicht berechnet - warte ein paar Minuten und versuche es erneut",
303306
"Shiny Rate":"Shinyrate",
304307
"Shiny Stats (Last few hours)":"Shiny Statistik (der letzen Stunden)",
@@ -416,11 +419,20 @@
416419
"Winter":"Winter",
417420
"with":"mit",
418421
"with move":"mit Attacke",
422+
"without rsvp updates":"ohne rsvp updates",
419423
"yellow":"gelb",
420424
"You are currently set to receive alarms in":"Folgende Gebiete sind gesetzt:",
421425
"You can start receiving alerts again using {0}{1}":"Du kannst mit {0}{1} wieder Benachrichtigungen erhalten",
422426
"You do not have any profiles":"Kein Profil vorhanden",
423427
"You do not have permission to execute this command":"keine Berechtigung dieses Komando zu benutzen",
428+
"You do not have permission to track monsters":"keine Berechtigung Pokémon zu tracken",
429+
"You do not have permission to track raids":"keine Berechtigung Raids zu tracken",
430+
"You do not have permission to track quests":"keine Berechtigung Quests zu tracken",
431+
"You do not have permission to track invasions":"keine Berechtigung Team-GO-Rocket-Invasionen zu tracken",
432+
"You do not have permission to track lures":"keine Berechtigung Lockmodule zu tracken",
433+
"You do not have permission to track nests":"keine Berechtigung Nester zu tracken",
434+
"You do not have permission to track gyms":"keine Berechtigung Arenen zu tracken",
435+
"You do not have permission to track fort changes":"keine Berechtigung Gym und Stop Änderungen zu tracken",
424436
"You don't have a profile set":"Kein Profil gewählt",
425437
"You have been granted the role {0}":"Folgende Rolle wurde hinzugefügt: {0}",
426438
"You have breached the rate limit too many times in the last 24 hours. Your messages are now stopped, use {0}start to resume":"24 Std. Nachrichtenlimit wurde überschritten. Benachrichtigungen sind nun deaktiviert, nutze {0}start um diese wieder zu aktivieren",
@@ -443,12 +455,14 @@
443455
"You're not tracking any nests":"Es werden keine Nester beobachtet.",
444456
"You're not tracking any quests":"Es werden keine Quests beobachtet.",
445457
"You're not tracking any raids":"Es werden keine Raids beobachtet.",
458+
"You're not tracking any fort changes":"Es werden keine Gym und Stop Änderungen beobachtet.",
446459
"You're tracking the following gyms:":"Folgende Arenen werden beobachtet:",
447460
"You're tracking the following invasions:":"Folgende Team-GO-Rocket-Invasionen werden beobachtet:",
448461
"You're tracking the following lures:":"Folgende Lockmodule werden beobachtet:",
449462
"You're tracking the following monsters:":"Folgende Pokémon werden beobachtet:",
450463
"You're tracking the following nests:":"Folgende Nester werden beobachtet:",
451464
"You're tracking the following quests:":"Folgende Quests werden beobachtet:",
452465
"You're tracking the following raids:":"Folgende Raids werden beobachtet:",
466+
"You're tracking the following fort changes:":"Folgende Gym und Stop Änderungen werden beobachtet:",
453467
"Zen":"Trance-Modus"
454468
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "poracle",
3-
"version": "4.8.3",
3+
"version": "4.8.4",
44
"description": "Webhook processing and personalised discord|telegram alarms",
55
"keywords": [
66
"poracle",
@@ -42,7 +42,7 @@
4242
"discord.js": "^13.16.0",
4343
"fast-json-stable-stringify": "^2.1.0",
4444
"fastify": "^4.25.2",
45-
"flat-cache": "^4.0.0",
45+
"flat-cache": "^5.0.0",
4646
"form-data": "^4.0.0",
4747
"geo-tz": "^8.0.0",
4848
"handlebars": "^4.7.7",

src/app.js

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,50 @@ async function processOne(hook) {
589589
fastify.webhooks.info(`raid ${JSON.stringify(hook.message)}`)
590590
const cacheKey = `${hook.message.gym_id}${hook.message.end}${hook.message.pokemon_id}`
591591

592-
if (fastify.cache.get(cacheKey)) {
592+
const raidDetails = fastify.cache.get(cacheKey)
593+
let rsvpDifference = false
594+
const oldRsvpsLen = raidDetails?.rsvps?.length ?? 0
595+
const newRsvpsLen = hook.message.rsvps?.length ?? 0
596+
if (newRsvpsLen > oldRsvpsLen) {
597+
rsvpDifference = true
598+
} else if (raidDetails && raidDetails.rsvps && hook.message.rsvps) {
599+
// Allow for old timeslots to have disappeared, so only compare the
600+
// new ones present
601+
for (let x = 0; x < newRsvpsLen; x++) {
602+
const newRsvp = hook.message.rsvps[x]
603+
604+
let found = false
605+
for (const oldRsvp of raidDetails.rsvps) {
606+
if (newRsvp.timeslot === oldRsvp.timeslot) {
607+
found = true
608+
if (newRsvp.going_count !== oldRsvp.going_count
609+
|| newRsvp.maybe_count !== oldRsvp.maybe_count) {
610+
rsvpDifference = true
611+
}
612+
break
613+
}
614+
}
615+
616+
if (found) {
617+
if (rsvpDifference) break
618+
} else {
619+
// timeslot was not in old rsvps
620+
rsvpDifference = true
621+
break
622+
}
623+
}
624+
}
625+
626+
if (raidDetails && !rsvpDifference) {
593627
fastify.controllerLog.debug(`${hook.message.gym_id}: Raid was sent again too soon, ignoring`)
594628
break
595629
}
596630

597-
fastify.cache.set(cacheKey, 'x')
631+
hook.message.firstNotification = !raidDetails
632+
633+
fastify.cache.set(cacheKey, {
634+
rsvps: hook.message.rsvps,
635+
})
598636
}
599637

600638
await processHook(hook)

src/controllers/fortupdate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class FortUpdate extends Controller {
8383
data.fortType = data.new?.type || data.old?.type || 'unknown'
8484
Object.assign(data, this.config.general.dtsDictionary)
8585
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
86-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
86+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
8787
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
8888
if (this.config.general.rdmURL) {
8989
data.rdmUrl = `${this.config.general.rdmURL}${!this.config.general.rdmURL.endsWith('/') ? '/' : ''}@${data.latitude}/@${data.longitude}/18`

src/controllers/gym.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Gym extends Controller {
8989
Object.assign(data, this.config.general.dtsDictionary)
9090
data.gymId = data.id || data.gym_id
9191
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
92-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
92+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
9393
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
9494
if (this.config.general.rdmURL) {
9595
data.rdmUrl = `${this.config.general.rdmURL}${!this.config.general.rdmURL.endsWith('/') ? '/' : ''}@gym/${data.gymId}`

src/controllers/monster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class Monster extends Controller {
233233
if (data.boosted_weather) data.weather = data.boosted_weather
234234
if (!data.weather) data.weather = 0
235235
Object.assign(data, this.config.general.dtsDictionary)
236-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
236+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
237237
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
238238
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
239239
if (this.config.general.rdmURL) {

src/controllers/nest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Nest extends Controller {
7676

7777
Object.assign(data, this.config.general.dtsDictionary)
7878
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
79-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
79+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
8080
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
8181
if (this.config.general.rdmURL) {
8282
data.rdmUrl = `${this.config.general.rdmURL}${!this.config.general.rdmURL.endsWith('/') ? '/' : ''}@${data.latitude}/@${data.longitude}/18`

src/controllers/pokestop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Invasion extends Controller {
7373

7474
Object.assign(data, this.config.general.dtsDictionary)
7575
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
76-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
76+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
7777
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
7878
if (this.config.general.rdmURL) {
7979
data.rdmUrl = `${this.config.general.rdmURL}${!this.config.general.rdmURL.endsWith('/') ? '/' : ''}@pokestop/${data.pokestop_id}`

src/controllers/pokestop_lure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Lure extends Controller {
7575

7676
Object.assign(data, this.config.general.dtsDictionary)
7777
data.googleMapUrl = `https://maps.google.com/maps?q=${data.latitude},${data.longitude}`
78-
data.appleMapUrl = `https://maps.apple.com/maps?daddr=${data.latitude},${data.longitude}`
78+
data.appleMapUrl = `https://maps.apple.com/place?coordinate=${data.latitude},${data.longitude}`
7979
data.wazeMapUrl = `https://www.waze.com/ul?ll=${data.latitude},${data.longitude}&navigate=yes&zoom=17`
8080
if (this.config.general.rdmURL) {
8181
data.rdmUrl = `${this.config.general.rdmURL}${!this.config.general.rdmURL.endsWith('/') ? '/' : ''}@pokestop/${data.pokestop_id}`

0 commit comments

Comments
 (0)