Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Readme update + quick fix for file_get_contents #16

Merged
merged 3 commits into from
Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<a href="https://github.com/alexcroox/R3-Web/releases/latest">
<img src="https://img.shields.io/github/release/alexcroox/R3-Web.svg" alt="Project Version">
</a>
</a>

<a href="https://raw.githubusercontent.com/alexcroox/R3-Web/master/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-red.svg" alt="Project License">
</a>
Expand Down Expand Up @@ -35,6 +35,10 @@ An exact mirror of this repo [can be viewed here](https://aar.ark-group.org) whi
2. Download the [latest web release](https://github.com/alexcroox/R3-Web/releases/latest)
3. Rename `config.template.php` to `config.php`, pay close attention to `DB_*`, `WEB_PATH` and timezone configurations
4. Upload the files to your web server which matches the URL in `WEB_PATH` in `config.php`. Take note of `/.htaccess` in the download that may be hidden on your system before you upload.
5. _(linux specifc)_ give the `cache` directory permissions for your web-server user account:
```
chown www-data:www-data -R cache/
```

### Important information to get the most from R3

Expand All @@ -56,5 +60,5 @@ You can find me (Titan) on the [R3 Discord](https://discord.gg/qcE3dRP) or feel

### Why not x framework/language

In an ideal world I'd be using web sockets and node to stream from the game server straight to a flat json file, and to the browser.
In an ideal world I'd be using web sockets and node to stream from the game server straight to a flat json file, and to the browser.
However the goal is to allow Arma 3 server admins to be able to run this and contribute. PHP + MySQL is the most common setup these administrators (with potentially limited sysadmin knowledge or sudo access) will have so it is the correct choice, as limiting as that can be!
13 changes: 11 additions & 2 deletions dist/inc/classes/Replays.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,21 @@ public function getPlayerMissions($replayData) {

public function getIcons() {

return file_get_contents('https://r3icons.titanmods.xyz/config.json');
return $this->my_curl('https://r3icons.titanmods.xyz/config.json');
}

public function getObjectiveMarkers() {

return file_get_contents('https://r3icons.titanmods.xyz/markers.json');
return $this->my_curl('https://r3icons.titanmods.xyz/markers.json');
}

function my_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

public function getHtmlReplaysForPlayer($playerId, $replayData = FALSE) {
Expand Down
7 changes: 6 additions & 1 deletion dist/playback.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
$metaImage = WEB_PATH . '/maps/' . strtolower($replayDetails->map) . '/tiles/0/0/0.png';
$page = 'playback';

$mappingConfig = file_get_contents('https://r3tiles-a.titanmods.xyz/config.json');
$url = 'https://r3tiles-a.titanmods.xyz/config.json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$mappingConfig = curl_exec($ch);
curl_close($ch);

$playerList = $replays->fetchReplayPlayers($_GET['replayId'], $replayDetails->playerList);

Expand Down
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '2'

services:
db:
image: mariadb:10.1.26
container_name: r3_db
restart: always
environment:
MYSQL_USER: r3
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: r3
volumes:
- r3_db_data:/var/lib/mysql
ports:
- "3306:3306"

web:
depends_on:
- db
build:
context: .
dockerfile: web.docker
image: local/r3_web
container_name: r3_web
restart: always
environment:
VIRTUAL_HOST: r3.local
DB_HOST: r3_db
DB_USER: r3
DB_PASSWORD: password
DB_NAME: r3
ports:
- "8080:80"
volumes:
- ./dist:/var/www/html/

volumes:
r3_db_data:
dist: