Skip to content

Commit

Permalink
feat: add update_check
Browse files Browse the repository at this point in the history
Resource now checks to see if it's running the latest version. Then, in 30 min intervals, checks if any updates are available.

Documented the `blips generate` command. Some poeple might not have known about it otherwise.
  • Loading branch information
TGRHavoc committed May 17, 2019
1 parent f12837f commit c592948
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 61 deletions.
138 changes: 77 additions & 61 deletions CHANGELOG.rst
Expand Up @@ -5,8 +5,18 @@ Changelog
v2.1.4 (20-10-2017)
-------------------

New
~~~
- Add update_check. [Jordan Dalton]

Resource now checks to see if it's running the latest version. Then, in 30 min intervals, checks if any updates are available.
- Add better changelog. [Jordan Dalton]

Hopefully this is nicer to deal with when geenerating and releasing changelogs.

Changes
~~~~~~~
- Update changelog. [Jordan Dalton]
- Update changelog file extension. [Jordan Dalton]

Apparently Github doesn't render RST text normally so hopefully putting the file extension will make it nice and pretty.
Expand All @@ -22,9 +32,6 @@ Fix

Other
~~~~~
- Add better changelog. [Jordan Dalton]

Hopefully this is nicer to deal with when geenerating and releasing changelogs.
- Merge pull request #9 from TGRHavoc/develop. [Jordan Dalton]

Fixed listener only listening on loopback address
Expand Down Expand Up @@ -87,6 +94,12 @@ Other
v2.1.1 (20-09-2017)
-------------------

New
~~~
- Add changelog. [Jordan Dalton]

There's now a changelog! Yey

Changes
~~~~~~~
- Update how players are handled. [Jordan Dalton]
Expand All @@ -95,16 +108,40 @@ Changes

Socket data is now sent by the server every .5 seconds instead of waiting for the client to send a message.

Other
~~~~~
- Add changelog. [Jordan Dalton]

There's now a changelog! Yey


v2.1.0 (19-09-2017)
-------------------

New
~~~
- Add vehicle icons. [Jordan Dalton]

Player's icon now changes when they enter/exit vehicles.
- Add allow-origin header. [Jordan Dalton]

Users can now restrict who can request the blip data via HTTP.
- Added blip helper (Fixes #2) [Jordan Dalton]

Technically this doesn't fix #2 but, I have added all the available blips to the UI and this. So..
- Add blips.json file (Fixes #5) [Jordan Dalton]

Blips that are generated are now saved to a file, this file is then exposed to the web and can be gotten by HTTP requets.
- Add default client file. [Jordan Dalton]

Added the default live_map client file.

This keeps track of the following:
- Player position
- Vehicle (if in one)
- License Plate (if in vehicle)
- Weapon (uses a reverse hash function to get the name)
- Add reverse hash file. [Jordan Dalton]

Added a file to make it easy to reverse a weapon's hash to get it's name. Also, something for the server owners to mess with f they want :P
- Add ability to remove players and data. [Jordan Dalton]

You can now remove players or ttheir data from the object that is sent via websockets.

Changes
~~~~~~~
- Update gitignore. [Jordan Dalton]
Expand Down Expand Up @@ -138,45 +175,18 @@ Other
~~~~~
- Merge branch 'develop' [Jordan Dalton]
- Merge branch 'feature/vehicle_icons' into develop. [Jordan Dalton]
- Add vehicle icons. [Jordan Dalton]

Player's icon now changes when they enter/exit vehicles.
- Add allow-origin header. [Jordan Dalton]

Users can now restrict who can request the blip data via HTTP.
- Removed old files. [Jordan Dalton]

Old files aren't needed anymore and have been removed.
- Added blip helper (Fixes #2) [Jordan Dalton]

Technically this doesn't fix #2 but, I have added all the available blips to the UI and this. So..
- Add blips.json file (Fixes #5) [Jordan Dalton]

Blips that are generated are now saved to a file, this file is then exposed to the web and can be gotten by HTTP requets.
- A wild license appears! [Jordan Dalton]

Added a license to the project
- Add default client file. [Jordan Dalton]

Added the default live_map client file.

This keeps track of the following:
- Player position
- Vehicle (if in one)
- License Plate (if in vehicle)
- Weapon (uses a reverse hash function to get the name)
- Forgot to update __resource.lua. [Jordan Dalton]

Shhh..
- Add reverse hash file. [Jordan Dalton]

Added a file to make it easy to reverse a weapon's hash to get it's name. Also, something for the server owners to mess with f they want :P
- Slighly better logging. [Jordan Dalton]

Added a "log hierarchy" so that the console doesn't get spammed with text if the user doesn't want it to.
- Add ability to remove players and data. [Jordan Dalton]

You can now remove players or ttheir data from the object that is sent via websockets.
- FXServer Update (fixes #1) [Jordan Dalton]

Main changes are that this version now works with FX server (only tested on 374)
Expand Down Expand Up @@ -205,35 +215,14 @@ Other
v1.0.0 (24-05-2017)
-------------------

Changes
~~~~~~~
- Update websocket handler. [Jordan Dalton]

Data sent to the websocket is now split by the space character, allows for additional arguments to be passed in case it's needed in future.
- Update readme. [Jordan Dalton]
- Update comments. [Jordan Dalton]

My comments were wrong... They're now correct.
- Update O'Neil Ranch icon. [Jordan Dalton]

Changed the O'Neil ranch icon to an animal instead of the jail icon
- Update to use SSL. [Jordan Dalton]
- Update lua files for SSL. [Jordan Dalton]
- Update binaries. [Jordan Dalton]

Other
~~~~~
New
~~~
- Add vehicle data with player data. [Jordan Dalton]

Vehicle data is now attached to the player object and sent over websockets.
- Add resource_manifest_version. [Jordan Dalton]

Apparently it's going to be required in future so, I'm going to add it now
- Removed file writer and console.writelines. [Jordan Dalton]

Pretty much all the Console.WriteLine's have been changed to Debug,WriteLine and I've removed the file writer.

The websocket server now defaults back to the insecure websocket protocol when the certificate couldn't be loaded.
- Add readme. [Jordan Dalton]

Holy mother of... Documentation !!!
Expand All @@ -248,9 +237,7 @@ Other
- Add ability to add custom data to players. [Jordan Dalton]

Making it easier to add custom data to player such as their job. Also moved from the player name being the identifier.
- Remove license. [Jordan Dalton]
- Add license and gas station blips. [Jordan Dalton]
- Remove self-signed certs. [Jordan Dalton]
- Add default SSL stuff. [Jordan Dalton]

Secure websockets are now done over a self-signed certificate.
Expand All @@ -263,9 +250,38 @@ Other

When the socket server is stopped, the JArrays are cleared.

Changes
~~~~~~~
- Update websocket handler. [Jordan Dalton]

Data sent to the websocket is now split by the space character, allows for additional arguments to be passed in case it's needed in future.
- Update readme. [Jordan Dalton]
- Update comments. [Jordan Dalton]

My comments were wrong... They're now correct.
- Update O'Neil Ranch icon. [Jordan Dalton]

Changed the O'Neil ranch icon to an animal instead of the jail icon
- Update to use SSL. [Jordan Dalton]
- Update lua files for SSL. [Jordan Dalton]
- Update binaries. [Jordan Dalton]

Other
~~~~~
- Removed file writer and console.writelines. [Jordan Dalton]

Pretty much all the Console.WriteLine's have been changed to Debug,WriteLine and I've removed the file writer.

The websocket server now defaults back to the insecure websocket protocol when the certificate couldn't be loaded.
- Remove license. [Jordan Dalton]
- Remove self-signed certs. [Jordan Dalton]


v0.0.0 (21-05-2017)
-------------------

New
~~~
- Add C# source. [Jordan Dalton]

Added the C# source code needed for the game server.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -20,6 +20,9 @@ set livemap_access_control "*"
start live_map
```

To get the in-game blips to show on the interface, you will need to generate a "blips" file.
This can be easily done with the in-game command `blips generate` (must be ran as admin).

## Configuration

### Convars
Expand Down
1 change: 1 addition & 0 deletions __resource.lua
Expand Up @@ -11,6 +11,7 @@ exports{
}

server_scripts{
"server/update_check.lua",
"server/live_map.net.dll",
"server/wrapper.lua",
"server/blips_server.lua"
Expand Down
27 changes: 27 additions & 0 deletions server/update_check.lua
@@ -0,0 +1,27 @@

local url = "https://gist.githubusercontent.com/TGRHavoc/581ec66730b7abafe49ab616db87b0bb/raw/f27c6f2573dd1df0692f97c78a73f5687d20f791/live_map.versions"
local version = "2.1.4"
local latest = true

function checkForUpdate()
PerformHttpRequest(url, function(err, data, headers)
local parsed = json.decode(data)

if (parsed["resource"] ~= version) then
print("|===================================================|")
print("| Live Map Update Available |")
print("| Download at: https://github.com/TGRHavoc/live_map |")
print("|===================================================|")
latest = false -- Stop running the timeout
end

if (latest) then -- If it's the latest then check for updates every 30 mins
SetTimeout( 30 * (60*1000), checkForUpdate)
end

end, "GET", "", { ["Content-Type"] = 'application/json' })

end


checkForUpdate();

0 comments on commit c592948

Please sign in to comment.