Skip to content

Commit e26f1d6

Browse files
committedMay 17, 2019
refactor: update how you configure the webapp
All configuration stuff is now inside "utils/config.php".
1 parent 615b0e9 commit e26f1d6

File tree

2 files changed

+76
-28
lines changed

2 files changed

+76
-28
lines changed
 

‎index.php

+12-28
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@
33
<?php
44

55
require_once("utils/minifier.php");
6-
7-
// Set to false to enable the miinified versions of JS and CSS files
8-
// that should speed up content delivery on production websites
9-
$debug = true;
10-
11-
// Set to the IP of the GTA server that has live_map. Make sure it has the trailing slash (/)
12-
$gtaServer = "http://127.0.0.1:30120/";
13-
14-
// Set tpo the name of "live_map".
15-
// Note: If you change the folder name on the GTA server you NEED to change this
16-
$liveMapName = "live_map";
17-
18-
// Builds the url that we need to use in ajax requests to get the blips
19-
$blipUrl = $gtaServer . $liveMapName . "/blips.json";
6+
require_once("utils/config.php");
207
?>
218

229
<html>
@@ -51,9 +38,8 @@
5138

5239
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
5340
<?php
54-
41+
// Print the CSS stuff for the webapp. This will either print the minfied version or, links to the CSS filees
5542
printCss($debug);
56-
5743
?>
5844

5945
<script src="js/jquery-3.2.1.min.js"></script>
@@ -64,37 +50,35 @@
6450
<script>
6551

6652
///////////////////////////////////////////////////////////////////////////
67-
// CONFIGURATION STARTS HERE
53+
// PLEASE CHNAGE THE VAUES INSIDE THE CONFIG FILE
6854
///////////////////////////////////////////////////////////////////////////
6955

7056
// Set relative tile directory
71-
var _MAP_tileURL = "images/map/";
57+
var _MAP_tileURL = "<?php echo $mapTileUrl; ?>";
7258

7359
// Set relative icon directory
74-
var _MAP_iconURL = "images/icons/";
60+
var _MAP_iconURL = "<?php echo $mapIconUrl; ?>";
7561

7662
// Set if to show Atlas map (WARNING: REQUIRES "atlas" TILE DIRECTORY)
77-
var _MAP_atlasMap = true;
63+
var _MAP_atlasMap = <?php echo $atlasEnabled; ?>;
7864

7965
// Set if to show Satellite map (WARNING: REQUIRES "satellite" TILE DIRECTORY)
80-
var _MAP_satelliteMap = true;
66+
var _MAP_satelliteMap = <?php echo $satelliteEnabled; ?>;
8167

8268
// Set if to show Road map (WARNING: REQUIRES "road" TILE DIRECTORY)
83-
var _MAP_roadMap = true;
69+
var _MAP_roadMap = <?php echo $roadEnabled; ?>;
8470

8571
// Set if to show UV Invert map (WARNING: REQUIRES "uv-invert" TILE DIRECTORY)
86-
var _MAP_UVInvMap = false;
72+
var _MAP_UVInvMap = <?php echo $uvInveredEnabled; ?>;
8773

8874
// Set to the IP of the GTA server running "live_map" and change the port to the
8975
// number that is set
90-
var _SETTINGS_socketUrl = "ws://localhost:30121"
76+
var _SETTINGS_socketUrl = "<?php echo $socketUrl ?>";
9177

9278
// Set to false if you don't want to show the player's identifiers (this may be their IP)
93-
var _SETTINGS_showIdentifiers = true;
79+
var _SETTINGS_showIdentifiers = <?php echo $showIdentifiers; ?>;
9480

95-
<?php
96-
echo "var _SETTINGS_blipUrl = \"$blipUrl\";"
97-
?>
81+
var _SETTINGS_blipUrl = "<?php echo $blipUrl; ?>";
9882

9983
// Do not remove unless you know what you're doing (and you have a google api key)
10084
// Hack from https://stackoverflow.com/questions/38148097/google-maps-api-without-key/38809129#38809129

‎utils/config.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/*
3+
This is the config for the webapp.
4+
Please change the values to make it work.
5+
6+
DO NOT CHANGE ANY VARIABLE THAT SAYS NOT TO CHANGE.
7+
*/
8+
9+
// Set to false to enable the miinified versions of JS and CSS files
10+
// that should speed up content delivery on production websites
11+
$debug = true;
12+
13+
// Set to the IP of your FiveM server (public address).
14+
$fivemIP = "127.0.0.1";
15+
16+
// Set to the port your FiveM server is using (needs to be reachable from the internet)
17+
$fivemPort = "30120";
18+
19+
// Set to the port that you set in the "socket_port" convar.
20+
// If you haven't set this in the config, don't change this.
21+
$socketPort = "30121";
22+
23+
// Set to the name of the "live_map" resourcee that is added to the FiveM server.
24+
// Note: If you change the folder name on the GTA server you NEED to change this
25+
$liveMapName = "live_map";
26+
27+
// These will be injected into the JS code to configure how the map works
28+
29+
// The directory that contains the folders for the map tiles. Can be relative or, full URL..
30+
// Make sure it has the trailing slash
31+
$mapTileUrl = "images/map/";
32+
33+
// The directory that contains the folders for the map icons. Can be relative or a URL.
34+
// Make sure it has the trailing slash.
35+
$mapIconUrl = "images/icons/";
36+
37+
// Controls whether the atlas map is enabled or not
38+
// (WARNING: REQUIRES "atlas" TILE DIRECTORY INSIDE "mapTileUrl")
39+
$atlasEnabled = true;
40+
// Controls whether the satellite map is enabled or not
41+
// (WARNING: REQUIRES "satellite" TILE DIRECTORY INSIDE "mapTileUrl")
42+
$satelliteEnabled = true;
43+
// Controls whether the road map is enabled or not
44+
// (WARNING: REQUIRES "road" TILE DIRECTORY INSIDE "mapTileUrl")
45+
$roadEnabled = true;
46+
// Controls whether the uv-invert map is enabled or not
47+
// (WARNING: REQUIRES "uv-invert" TILE DIRECTORY INSIDE "mapTileUrl"
48+
$uvInveredEnabled = true;
49+
50+
// Do you want to show the player's identifiers on the map?
51+
// Note: THIS MAY BE THE PLAYER'S IP ADDRESS
52+
$showIdentifiers = true;
53+
54+
// DO NOT CHANGE
55+
$gtaServer = "http://$fivemIP:$fivemPort/";
56+
// DO NOT CHANGE
57+
$socketUrl = "ws://$fivemIP:$socketPort/";
58+
59+
// Builds the url that we need to use in ajax requests to get the blips
60+
// DO NOT CHANGE
61+
$blipUrl = $gtaServer . $liveMapName . "/blips.json";
62+
63+
64+
?>

0 commit comments

Comments
 (0)