Skip to content

Commit

Permalink
feat: add allow-origin header
Browse files Browse the repository at this point in the history
Users can now restrict who can request the blip data via HTTP.
  • Loading branch information
TGRHavoc committed May 17, 2019
1 parent 5a99b20 commit b1bb783
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/blips_server.lua
Expand Up @@ -37,6 +37,9 @@ function cacheIsEmpty()
end

function sendBlips(res)
-- Restrict the origin if set, otherwise allow everyone
res.writeHead(200, { ["Access-Control-Allow-Origin"] = GetConvar("livemap_access_control", "*")} )

if not cacheIsEmpty() then
res.send(json.encode(cache))
return
Expand Down Expand Up @@ -85,7 +88,7 @@ RegisterCommand("blips", function(source, args, rawCommand)
playerWhoGeneratedBlips = playerId

TriggerClientEvent("livemap:getBlipsFromClient", source)

return
end

Expand Down

0 comments on commit b1bb783

Please sign in to comment.