Răsfoiți Sursa

Backend and API

causefx 9 ani în urmă
părinte
comite
115d8e2069
3 a modificat fișierele cu 30 adăugiri și 6 ștergeri
  1. 1 0
      config/configDefaults.php
  2. 1 1
      functions.php
  3. 28 5
      settings.php

+ 1 - 0
config/configDefaults.php

@@ -89,4 +89,5 @@ return array(
 	"ipInfoToken" => "ddd0c072ad5021",
 	"ipInfoToken" => "ddd0c072ad5021",
 	"historyRefresh" => "120000",
 	"historyRefresh" => "120000",
 	"downloadRefresh" => "30000",
 	"downloadRefresh" => "30000",
+	"organizrAPI" => "",
 );
 );

+ 1 - 1
functions.php

@@ -2,7 +2,7 @@
 
 
 // ===================================
 // ===================================
 // Define Version
 // Define Version
- define('INSTALLEDVERSION', '1.401');
+ define('INSTALLEDVERSION', '1.402');
 // ===================================
 // ===================================
 
 
 // Debugging output functions
 // Debugging output functions

+ 28 - 5
settings.php

@@ -1264,11 +1264,11 @@ echo buildSettings(
 						'labelTranslate' => 'AUTHTYPE',
 						'labelTranslate' => 'AUTHTYPE',
 						'name' => 'authType',
 						'name' => 'authType',
 						'value' => AUTHTYPE,
 						'value' => AUTHTYPE,
-						'onchange' => 'if (this.value == \'internal\') { $(\'.be-auth, #authBackend_id, #authBackendCreate_id\').parent().hide(); } else { $(\'#authBackend_id, #authBackendCreate_id\').trigger(\'change\').parent().show(); }',
+						'onchange' => 'if (this.value == \'internal\') { $(\'.be-auth, #authBackend_id, #authBackendCreate_id\').parent().hide(); } else { $(\'#authBackend_id, #authBackendCreate_id\').trigger(\'change\').parent().show(); }if (this.value == \'external\') { alert(\'ATTENTION! Before using this option, Make sure that the ADMIN account that you setup matches at least one username on your external backend.  Otherwide you will lose Admin functionality.  If something messes up, edit config/config.php and change authType to either internal or both.\') } ',
 						'options' => array(
 						'options' => array(
 							'Organizr' => 'internal',
 							'Organizr' => 'internal',
-							'Organizr & Backend' => 'both',
-							// 'Backend' => 'external',
+							(AUTHBACKEND) ? 'Organizr & '.ucwords(AUTHBACKEND) : 'Organizr & Backend' => 'both',
+                            (AUTHBACKEND) ? ucwords(AUTHBACKEND)." Only" : "Backend Only" => 'external',
 						),
 						),
 					),
 					),
 					array(
 					array(
@@ -1340,6 +1340,19 @@ echo buildSettings(
 						'class' => 'be-auth be-auth-plex',
 						'class' => 'be-auth be-auth-plex',
 						'value' => (empty(PLEXPASSWORD)?'':randString(20)),
 						'value' => (empty(PLEXPASSWORD)?'':randString(20)),
 					),
 					),
+                    array(
+						'type' => 'text',
+						'labelTranslate' => 'ORGANIZR_API_KEY',
+						'name' => 'organizrAPI',
+						'value' => ORGANIZRAPI,
+					),
+                    array(
+                        'type' => 'button',
+                        'id' => 'generateAPI',
+                        'labelTranslate' => 'GENERATE_API_KEY',
+                        'icon' => 'key',
+                        'onclick' => 'var code = generateCode(); $(\'#organizrAPI_id\').val(code); $(\'#organizrAPI_id\').attr(\'data-changed\', \'true\');',
+                    ),
 				),
 				),
 			),
 			),
 			array(
 			array(
@@ -2268,7 +2281,7 @@ echo buildSettings(
 
 
                                         <div id="loginStats">
                                         <div id="loginStats">
 
 
-                                            <div class="content-box ultra-widget">
+                                            <div class="ultra-widget">
 
 
                                                 <div class="w-progress">
                                                 <div class="w-progress">
 
 
@@ -2517,6 +2530,16 @@ echo buildSettings(
                     $('#plexError').text("Enter Username and Password");
                     $('#plexError').text("Enter Username and Password");
                 }
                 }
             });
             });
+            //Generate API
+            function generateCode() {
+                var code = "";
+                var possible = "abcdefghijklmnopqrstuvwxyz0123456789";
+
+                for (var i = 0; i < 20; i++)
+                    code += possible.charAt(Math.floor(Math.random() * possible.length));
+
+                return code;
+            }
 			function performUpdate(){
 			function performUpdate(){
 				$('#updateStatus').show();
 				$('#updateStatus').show();
 				setTimeout(function(){
 				setTimeout(function(){
@@ -3190,7 +3213,7 @@ echo buildSettings(
             //Enable Tooltips
             //Enable Tooltips
             $('[data-toggle="tooltip"]').tooltip(); 
             $('[data-toggle="tooltip"]').tooltip(); 
             //AJAX call to github to get version info	
             //AJAX call to github to get version info	
-			<?php if (GIT_CHECK) { echo 'checkGithub()'; } ?>
+			<?php if (GIT_CHECK == "true") { echo 'checkGithub()'; } ?>
 
 
             //Edit Info tab with Github info
             //Edit Info tab with Github info
             <?php if(file_exists(FAIL_LOG)) : ?>
             <?php if(file_exists(FAIL_LOG)) : ?>