From a52e9051550b157c16edf10dea4414a836857796 Mon Sep 17 00:00:00 2001
From: robbt <robbt@azone.org>
Date: Mon, 11 May 2020 10:13:35 -0400
Subject: [PATCH] Added form - need to add CORS to db code

---
 .../airtime-setup/forms/general-settings.php   | 18 ++++++++++++++++++
 .../build/airtime-setup/setup-config.php       |  2 +-
 airtime_mvc/public/setup/general-setup.php     |  5 +++--
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/airtime_mvc/build/airtime-setup/forms/general-settings.php b/airtime_mvc/build/airtime-setup/forms/general-settings.php
index f15e06d5a..d3729f6a5 100644
--- a/airtime_mvc/build/airtime-setup/forms/general-settings.php
+++ b/airtime_mvc/build/airtime-setup/forms/general-settings.php
@@ -19,6 +19,20 @@
             <span class="glyphicon glyphicon-remove form-control-feedback"></span>
         </div>
         <input class="form-control" type="hidden" name="generalErr" id="generalErr" aria-describedby="helpBlock"/>
+        <p>The CORS URL can be setup during install if you are accessing your LibreTime instance behind a Proxy.
+            This is common with docker setups. If you have a reverse proxy setup enter the URL below, otherwise you
+            can safely ignore this.
+        </p>
+        <div id="corsSlideToggle">
+            <span><strong>CORS URL </strong></span><span id="corsCaret" class="caret"></span><hr/>
+        </div>
+        <div id="corsFormBody">
+            <div class="form-group">
+                <label class="control-label" for="corsURL">CORS URLs</label>
+                <textarea class="form-control" id="corsURL" rows="4" cols="50">
+                </textarea>
+            </div>
+        </div>
     </div>
     <div>
         <input type="submit" formtarget="generalSettingsForm" class="btn btn-primary btn-next" value="Next &#10097;"/>
@@ -27,6 +41,10 @@
 </form>
 
 <script>
+    $("#corsSlideToggle").click(function() {
+        $("#corsFormBody").slideToggle(500);
+        $("#corsCaret").toggleClass("caret-up");
+    });
     $("#generalSettingsForm").submit(function(e) {
         submitForm(e, "GeneralSetup");
     });
diff --git a/airtime_mvc/build/airtime-setup/setup-config.php b/airtime_mvc/build/airtime-setup/setup-config.php
index c116767cf..485009835 100644
--- a/airtime_mvc/build/airtime-setup/setup-config.php
+++ b/airtime_mvc/build/airtime-setup/setup-config.php
@@ -13,7 +13,7 @@
     <body>
         <div class="header">
             <h3 class="logo">
-                <img src="css/images/airtime_logo_jp.png" id="airtimeLogo" /><br/>
+                <img src="css/images/libretime_logo_jp.png" id="LibreTimeLogo" /><br/>
                 <strong>Setup</strong>
             </h3>
             <strong>Step <span id="stepCount">1</span> of 5</strong>
diff --git a/airtime_mvc/public/setup/general-setup.php b/airtime_mvc/public/setup/general-setup.php
index 7e86bdb69..a7d5a959e 100644
--- a/airtime_mvc/public/setup/general-setup.php
+++ b/airtime_mvc/public/setup/general-setup.php
@@ -15,8 +15,8 @@ class GeneralSetup extends Setup {
 
     // Constant form field names for passing errors back to the front-end
     const GENERAL_PORT = "generalPort",
-        GENERAL_HOST = "generalHost";
-
+        GENERAL_HOST = "generalHost",
+        CORS_URL = "corsURL";
     // Array of key->value pairs for airtime.conf
     protected static $_properties;
 
@@ -30,6 +30,7 @@ class GeneralSetup extends Setup {
             "api_key" => $this->generateRandomString(),
             "base_url" => $settings[self::GENERAL_HOST],
             "base_port" => $settings[self::GENERAL_PORT],
+            "cors_url" => $settings[self::CORS_URL]
         );
     }