From eec1ac28fb13a0c7ca086137c8c0b2d0dd1d5ad5 Mon Sep 17 00:00:00 2001
From: fickleheart <fickle@tinted.red>
Date: Sat, 19 Jan 2019 12:32:02 -0600
Subject: [PATCH] Add config option for allowed replay versions

---
 app/Services/ReplayParser.php | 6 ++++--
 config/app.php                | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/app/Services/ReplayParser.php b/app/Services/ReplayParser.php
index 8600f33..45d6bcc 100644
--- a/app/Services/ReplayParser.php
+++ b/app/Services/ReplayParser.php
@@ -80,11 +80,13 @@ class ReplayParser
 	
 	protected function validateVersion(int $version, int $subVersion, int $demoVersion) : void
 	{
-		if ($version !== 100 || $demoVersion !== 1) {
+		$cfg = config('app.replay_version');
+		
+		if ($version != $cfg['major'] || $demoVersion != $cfg['demo']) {
 			throw new ReplayException('This replay is not supported by the records site');
 		}
 		
-		if ($subVersion < 0) {
+		if ($subVersion < $cfg['sub']) {
 			throw new ReplayException('This replay was recorded on too old of a version');
 		}
 	}
diff --git a/config/app.php b/config/app.php
index 57ee5b7..53f2f13 100644
--- a/config/app.php
+++ b/config/app.php
@@ -226,4 +226,9 @@ return [
 
     ],
 
+	'replay_version' => [
+		'major' => env('REPLAY_MAJOR_VERSION', 100),
+		'sub'   => env('REPLAY_SUB_VERSION', 0),
+		'demo'  => env('REPLAY_DEMO_VERSION', 0),
+	],
 ];
-- 
GitLab