SnailyCAD / fivem-integrations

FiveM Integrations for SnailyCADv4
https://docs.snailycad.org/docs/fivem-integrations/scripts
MIT License
7 stars 5 forks source link

911 call notifications being sent to all players in the server instead of only on-duty units. #112

Closed Legacy-TacticalGamingInteractive closed 1 month ago

Legacy-TacticalGamingInteractive commented 1 month ago

Unfortunately this seems to still be broken :(

Gameruxstudiosnz commented 1 month ago

Damn just to check u have updated to newest version of the fivem integrations for snailycad

anything that could help us see why it doing please let us know

Legacy-TacticalGamingInteractive commented 1 month ago

Damn just to check u have updated to newest version of the fivem integrations for snailycad

anything that could help us see why it doing please let us know

Indeed I have. Everythings updated.

[   3503985] [b3095_GTAProce]             MainThrd/ Info: Connected to SnailyCAD!
[   3503985] [b3095_GTAProce]        CrBrowserMain/ [`sna-sync-nui`][outgoing]: sna-sync-nui:connected (@sna-sync/nui/index-524ca964.js:14)
[   3598172] [b3095_GTAProce]        CrBrowserMain/ [`sna-sync-nui`][outgoing]: sna-sync-nui:create-911-call (@sna-sync/nui/index-524ca964.js:14)
[   3598656] [b3095_GTAProce]        CrBrowserMain/ [`sna-sync-nui`][incoming]: sna-sync:request-authentication-flow (@sna-sync/nui/index-524ca964.js:55)
[   3598656] [b3095_GTAProce]        CrBrowserMain/ [`sna-sync-nui`][incoming]: sna-sync:request-set-status-flow (@sna-sync/nui/index-524ca964.js:55)
[   3598656] [b3095_GTAProce]        CrBrowserMain/ [`sna-sync-nui`][incoming]: sna-sync:request-call-911-attach-flow (@sna-sync/nui/index-524ca964.js:55)
Legacy-TacticalGamingInteractive commented 1 month ago

Its crazy.

Off duty people who have not authenticated with a personal API token yet can see all 911 call notifications.

Off duty people who did authenticate with personal API token cannot see the 911 notifications.

Some on duty people who did authenticate with personal API token can see 911 notifications. Some can't. Wtf.

Gameruxstudiosnz commented 1 month ago

Now I am now confused

Legacy-TacticalGamingInteractive commented 1 month ago

By authenticated I mean they pasted their API token into the system in game. /sn-auth

jxckUK commented 1 month ago

When I tested this I was able to confirm that:

I can't say that I personally tested if users got the prompt without being authenticated, as I presumed this was not possible - I can test this shortly but is that the outstanding problem or are you saying you don't get the behaviour above either? @Legacy-TacticalGamingInteractive

casperiv0 commented 1 month ago

Correct, a player must be authenticated (via /sn-auth) and on-duty (via web or /sn-set-status). The scenario's Jack explained are the expected ones

Legacy-TacticalGamingInteractive commented 1 month ago

If a user has not set a token at all and simply is on the server they will see the 911s. Thats the biggest issue we have #1. Which is most people. Since most people such as civilians are not even authenticating themselves using the CAD integration commands.

One step at a time.

By the way we have:

Server Artifacts 8450. Game build 3095. OneSync Infiniti. 100+ players on server when tested.

casperiv0 commented 1 month ago

Are you sure you're on the latest version? This is simply not possible on the latest version since it does a backend check.

Legacy-TacticalGamingInteractive commented 1 month ago

Yes we installed all integrations including sync and updated CAD to latest version last night too.

I wish I had some prints or something to debug with but nothing is showing. I can see about adding some prints to help debug later today?

Its strange.

I did not clear server cache. Maybe it requires that?

On Thu, Jun 13, 2024, 6:25 AM Casper Iversen @.***> wrote:

Are you sure you're on the latest version? This is simply not possible on the latest version since it does a backend check.

— Reply to this email directly, view it on GitHub https://github.com/SnailyCAD/fivem-integrations/issues/112#issuecomment-2165247735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGALDB6VKZWMGATR4XETVWTZHFXR5AVCNFSM6AAAAABJHIV3EGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRVGI2DONZTGU . You are receiving this because you were mentioned.Message ID: @.***>

casperiv0 commented 1 month ago

I'll create a new release that prints out some debugging information in the F8 console. Will only be in about 4h from now though.

casperiv0 commented 1 month ago

@Legacy-TacticalGamingInteractive 0.14.1 is out now which has a debug print with the version. It will get logged when the sna-sync resource is initialized (on resource start/client player spawned)

Legacy-TacticalGamingInteractive commented 1 month ago

Nothing new is really logging. Here are my findings:

911 Incoming: Player who IS authenticated in CAD with the User API connected and IS OFF DUTY in Dashboard. (does not show 911 notification to attach to the call - works as expected now)

911 Incoming: Player who IS authenticated in CAD with the User API connected and IS ON DUTY in Dashboard. (shows 911 notification to attach to the call - works as expected now)

911 Incoming: Player who is NOT authenticated in CAD. Meaning they have never done the User API connect. image (doesn't work as expected)

Solution Needed: We need to make some logic where if someone is not authenticated in Snaily - then they will not be shown the 911 notification. Most civilians and even new cops won't be authenticated. They are not doing the whole /sn-auth stuff. By default it seems to be that anybody who isn't authenticated is treated as being on duty lol.

This is the notification I am referring to by the way: image

Georgie15 commented 1 month ago

I am getting the exact same issue. A player who isn't authenticated, off-duty, and is a cop is getting 911 calls. Now he is authenticated and he is not getting 911 calls off-duty.

jxckUK commented 1 month ago

I was able to validate this:

Screenshot 2024-06-14 102905

This also happens with panic button triggers alike.

It would seem the events ServerEvents.Incoming911Call and ServerEvents.PanicButtonOn are not hitting the clause on line 21 and 46 in validate-events.ts, is the data somehow cached or accessible without authentication?

casperiv0 commented 1 month ago

Would be very weird if any data is cached...

I'll add an explicit property that it does not cache any data. Ps @Georgie15, are you getting any additional logs?

jxckUK commented 1 month ago

Would be very weird if any data is cached...

I'll add an explicit property that it does not cache any data. Ps @Georgie15, are you getting any additional logs?

In this scenario, we'd expect even data to not return - is it possible we're not capturing for that instance? As tested, when we don't have data.unit this works as expected, its only when we would not have data at all that it seems to still send notification.

EDIT: From a logic perspective is it not easier to invert the clause, and only send the network event for the notification if data.unit is returned? Would capture all other scenarios and avoid sending notification.

casperiv0 commented 1 month ago

911 Incoming: Player who is NOT authenticated in CAD. Meaning they have never done the User API connect.

@Legacy-TacticalGamingInteractive The player does receive the notification?

casperiv0 commented 1 month ago

Ah, I found the bug. Working on it!

casperiv0 commented 1 month ago

All should be fixed in the latest version of SnailyCAD and 0.14.2 of fivem-integrations. Closing this one now!