Skip to content

Commit 147ca2e

Browse files
authored
Merge pull request #213 from mreishman/3.4.2
3.4.2
2 parents 6006a54 + 4a5c3cb commit 147ca2e

File tree

10 files changed

+183
-117
lines changed

10 files changed

+183
-117
lines changed

core/conf/config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
'onlyRefreshVisible' => 'true',
2121
'defaultViewBranchCookie' => 'false',
2222
'loginAuthType' => 'disabled',
23+
'blockGitBranchName' => 'false',
24+
'blockGitCommitDiff' => 'false',
25+
'blockGitCommitHistory' => 'false',
26+
'blockGitShowCommitStuff' => 'false',
2327
'defaultBranchList' => 'master',
2428
'errorAndColorArray' => array(
2529
'error' => array(

core/html/changelog.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
<ul>
2+
<li>
3+
Version 3.4.2
4+
<ul>
5+
<li>
6+
Features
7+
<ul>
8+
<li>
9+
Added back individual refresh for poll type 2
10+
</li>
11+
<li>
12+
Advanced
13+
<ul>
14+
<li>
15+
Added option to block specific requests
16+
</li>
17+
</ul>
18+
</li>
19+
</ul>
20+
</li>
21+
</ul>
22+
</li>
223
<li>
324
Version 3.4.1.1
425
<ul>

core/js/main.js

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,12 @@ function getToday()
198198
return mm+'/'+dd+'/'+yyyy;
199199
}
200200

201-
function tryHTTPForPollRequest(count)
201+
function tryHTTPForPollRequest(count, name = null)
202202
{
203-
var name = "branchNameDevBox1"+arrayOfFiles[count]["Name"];
203+
if(!name)
204+
{
205+
name = "branchNameDevBox1"+arrayOfFiles[count]["Name"];
206+
}
204207
name = name.replace(/\s/g, '_');
205208
var doPollLogic = true;
206209
var dateForEnd = null;
@@ -260,16 +263,38 @@ function hideLoadingSpinnerHeader(name)
260263
}
261264
}
262265

266+
function getPollDataTypeTwo(name)
267+
{
268+
var urlForSend = 'http://'+arrayOfWatchFilters[name]["WebsiteBase"]+'/status/core/php/functions/gitBranchName.php?format=json';
269+
if("urlHit" in arrayOfWatchFilters[name] && arrayOfWatchFilters[name]["urlHit"] !== "")
270+
{
271+
urlForSend = 'http://'+arrayOfWatchFilters[name]["urlHit"]+'?format=json';
272+
}
273+
var folder = "";
274+
var githubRepo = "";
275+
var branchList = "";
276+
if("branchList" in arrayOfWatchFilters[name])
277+
{
278+
branchList = arrayOfWatchFilters[name]["branchList"];
279+
}
280+
if("Folder" in arrayOfWatchFilters[name])
281+
{
282+
folder = arrayOfWatchFilters[name]["Folder"];
283+
}
284+
if("githubRepo" in arrayOfWatchFilters[name])
285+
{
286+
githubRepo = arrayOfWatchFilters[name]["githubRepo"];
287+
}
288+
return {pollType, location: folder, name, githubRepo, urlForSend ,websiteBase: arrayOfWatchFilters[name]["WebsiteBase"], id: name.replace("branchNameDevBox1", ""),branchList};
289+
}
263290

264-
265-
function tryHttpActuallyPollLogic(count, name)
291+
function getPollData(count, name)
266292
{
267293
var urlForSend = 'http://'+arrayOfFiles[count]["WebsiteBase"]+'/status/core/php/functions/gitBranchName.php?format=json';
268294
if(arrayOfFiles[count]["urlHit"] !== "")
269295
{
270296
urlForSend = 'http://'+arrayOfFiles[count]["urlHit"]+'?format=json';
271297
}
272-
showLoadingSpinnerHeader(name);
273298
var id = name.replace("branchNameDevBox1", "");
274299
var subBoxes = document.getElementsByClassName(id);
275300
var countOfSubServers = subBoxes.length;
@@ -282,8 +307,6 @@ function tryHttpActuallyPollLogic(count, name)
282307
showLoadingSpinnerHeader(noSpaceName);
283308
}
284309
}
285-
loadingSpinnerText.innerHTML = (counterForSave);
286-
document.getElementById("refreshDiv").style.display = "none";
287310
var folder = "";
288311
var githubRepo = "";
289312
var branchList = "";
@@ -299,13 +322,32 @@ function tryHttpActuallyPollLogic(count, name)
299322
{
300323
githubRepo = arrayOfFiles[count]["githubRepo"];
301324
}
302-
var data = {pollType, location: folder, name, githubRepo, urlForSend ,websiteBase: arrayOfFiles[count]["WebsiteBase"], id: arrayOfFiles[count]["Name"],branchList};
325+
return {pollType, location: folder, name, githubRepo, urlForSend ,websiteBase: arrayOfFiles[count]["WebsiteBase"], id: arrayOfFiles[count]["Name"],branchList};
326+
}
327+
328+
329+
function tryHttpActuallyPollLogic(count, name)
330+
{
331+
var data = {};
303332
var innerData = {};
304-
if(pollType == "1")
333+
if(count !== null)
305334
{
335+
data = getPollData(count, name);
336+
if(pollType == "1")
337+
{
338+
innerData = data;
339+
}
340+
}
341+
else
342+
{
343+
data = getPollDataTypeTwo(name);
306344
innerData = data;
307345
}
308-
(function(_data){
346+
var urlForSend = data["urlForSend"];
347+
showLoadingSpinnerHeader(name);
348+
loadingSpinnerText.innerHTML = (counterForSave);
349+
document.getElementById("refreshDiv").style.display = "none";
350+
(function(_data, _innerData){
309351
$.ajax({
310352
url: urlForSend,
311353
dataType: 'json',
@@ -316,38 +358,33 @@ function tryHttpActuallyPollLogic(count, name)
316358
pollSuccess(data, _data);
317359
},
318360
error: function(xhr, error){
319-
tryHTTPSForPollRequest(_data);
361+
tryHTTPSForPollRequest(_data, _innerData);
320362
}
321363
});
322-
}(data));
364+
}(data, innerData));
323365
}
324366

325367

326-
function tryHTTPSForPollRequest(_data)
368+
function tryHTTPSForPollRequest(_data, _innerData)
327369
{
328370
var urlForSend = _data.urlForSend;
329371
urlForSend = urlForSend.replace("http","https");
330-
var data = {pollType, location: _data.location, name: _data.name, githubRepo: _data.githubRepo, websiteBase: _data.websiteBase, id: _data.id, branchList: _data.branchList};
331-
var innerData = {};
332-
if(pollType == "1")
333-
{
334-
innerData = data;
335-
}
336-
(function(_data){
337-
$.ajax({
338-
url: urlForSend,
339-
dataType: 'json',
340-
global: false,
341-
data: innerData,
342-
type: 'POST',
343-
success: function(data){
344-
pollSuccess(data, _data);
345-
},
346-
error: function(xhr, error){
347-
pollFailure(xhr.status, error, _data);
348-
}
349-
});
350-
}(data));
372+
var data = _innerData;
373+
(function(_data){
374+
$.ajax({
375+
url: urlForSend,
376+
dataType: 'json',
377+
global: false,
378+
data: data,
379+
type: 'POST',
380+
success: function(data){
381+
pollSuccess(data, _data);
382+
},
383+
error: function(xhr, error){
384+
pollFailure(xhr.status, error, _data);
385+
}
386+
});
387+
}(data));
351388
}
352389

353390
function showPopupWithMessage(type, message)
@@ -546,7 +583,8 @@ function pollFailureInner(xhr, error, noSpaceName, nameForBackground)
546583
datePicker: null,
547584
groupInfo: "",
548585
location: null,
549-
WebsiteBase: null
586+
WebsiteBase: null,
587+
urlHit: ""
550588
};
551589
}
552590
else
@@ -568,6 +606,10 @@ function pollFailureInner(xhr, error, noSpaceName, nameForBackground)
568606
{
569607
arrayOfWatchFilters[noSpaceName]["WebsiteBase"] = null;
570608
}
609+
if(!("urlHit" in arrayOfWatchFilters[noSpaceName]))
610+
{
611+
arrayOfWatchFilters[noSpaceName]["urlHit"] = "";
612+
}
571613
}
572614
hideLoadingSpinnerHeader(noSpaceName);
573615
document.getElementById("refreshDiv").style.display = "inline-block";
@@ -984,6 +1026,15 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
9841026
dataToFilterBy = $.trim(dataToFilterByArray[1]);
9851027
}
9861028
var setFadeBool = false;
1029+
var urlHit = "";
1030+
if("urlForSend" in dataInnerPassMaster)
1031+
{
1032+
let urlCheck = dataInnerPassMaster["urlForSend"] + "/core/php/functions/gitBranchName.php?format=json";
1033+
if(dataInnerPassMaster["urlForSend"] !== "http://"+urlCheck || dataInnerPassMaster["urlForSend"] !== "https://"+urlCheck)
1034+
{
1035+
urlHit = dataInnerPassMaster["urlForSend"];
1036+
}
1037+
}
9871038
if(arrayOfWatchFilters && !arrayOfWatchFilters[noSpaceName])
9881039
{
9891040
arrayOfWatchFilters[noSpaceName] = {
@@ -999,7 +1050,8 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
9991050
groupInfo: groupNames,
10001051
location: "location" in dataInner ? dataInner["location"] : null,
10011052
WebsiteBase: "WebsiteBase" in dataInner ? dataInner["WebsiteBase"] : null,
1002-
branchList: branchList
1053+
branchList: branchList,
1054+
urlHit: urlHit
10031055
};
10041056
}
10051057
else
@@ -1021,6 +1073,7 @@ function pollSuccessInner(dataInner, dataInnerPass, dataInnerPassMaster)
10211073
arrayOfWatchFilters[noSpaceName]["location"] = "location" in dataInner ? dataInner["location"] : null;
10221074
arrayOfWatchFilters[noSpaceName]["WebsiteBase"] = "WebsiteBase" in dataInner ? dataInner["WebsiteBase"] : null;
10231075
arrayOfWatchFilters[noSpaceName]["branchList"] = branchList;
1076+
arrayOfWatchFilters[noSpaceName]["urlHit"] = urlHit;
10241077
}
10251078

10261079
filterBGColor(dataToFilterBy, nameForBackground, 1);
@@ -1254,69 +1307,16 @@ function refreshAction(all = -1, status = 'outer')
12541307
{
12551308
if(isNaN(refreshNum))
12561309
{
1257-
var refreshName = all;
1258-
//this is string, find in fileArray
1259-
var foundInFileArray = false;
1260-
var lengthOfFileArray = arrayOfFiles.length;
1261-
for(var i = 0; i < lengthOfFileArray; i++)
1262-
{
1263-
var noSpaceName = arrayOfFiles[i]["Name"].replace(/\s/g, '');
1264-
if(noSpaceName === refreshName)
1265-
{
1266-
refreshNum = i;
1267-
foundInFileArray = true;
1268-
break;
1269-
}
1270-
}
1271-
1272-
if(!foundInFileArray)
1273-
{
1274-
//look for groups with ID of master server
1275-
if(document.getElementById("innerFirstDevBox"+refreshName))
1276-
{
1277-
var listOfClasses = document.getElementById("innerFirstDevBox"+refreshName).parentElement.classList;
1278-
var classListLength = listOfClasses.length;
1279-
var found = false;
1280-
for(var i = 0; i < classListLength; i++)
1281-
{
1282-
var lengthOfFileArray = arrayOfFiles.length;
1283-
for(var j = 0; j < lengthOfFileArray; j++)
1284-
{
1285-
var noSpaceName = arrayOfFiles[j]["Name"].replace(/\s/g, '');
1286-
if(noSpaceName === listOfClasses[i])
1287-
{
1288-
refreshNum = j;
1289-
found = true;
1290-
break;
1291-
}
1292-
}
1293-
if(found)
1294-
{
1295-
break;
1296-
}
1297-
}
1298-
1299-
if(found)
1300-
{
1301-
var classNameFound = arrayOfFiles[refreshNum]["Name"].replace(/\s/g, '');
1302-
listOfClasses = document.getElementsByClassName(classNameFound);
1303-
classListLength = listOfClasses.length;
1304-
for(var i = 0; i < classListLength; i++)
1305-
{
1306-
counterNew++;
1307-
}
1308-
}
1309-
}
1310-
}
1310+
counterForSave = counterNew;
1311+
tryHTTPForPollRequest(null, all);
1312+
refreshActionVar = setTimeout(function(){endRefreshAction()}, 1500);
13111313
}
13121314
}
1313-
if(isNaN(refreshNum))
1315+
else
13141316
{
1315-
refreshNum = -1;
1317+
poll();
1318+
refreshActionVar = setTimeout(function(){endRefreshAction()}, 1500);
13161319
}
1317-
poll(refreshNum, counterNew);
1318-
refreshActionVar = setTimeout(function(){endRefreshAction()}, 1500);
1319-
13201320
}
13211321

13221322
function endRefreshAction()

core/php/configStatic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?php
33

44
$configStatic = array(
5-
'version' => '3.4.1.1',
5+
'version' => '3.4.2',
66
'lastCheck' => '12-14-2018',
77
'newestVersion' => '3.3.4',
88
'versionList' => array(

core/php/functions/gitBranchName.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
<?php header('Access-Control-Allow-Origin: *');
1+
<?php header('Access-Control-Allow-Origin: *');
22

33
require_once("../../../core/conf/config.php");
44
require_once("../../../local/default/conf/config.php");
55
require_once("../../../core/php/loadVars.php");
66

7+
if($blockGitBranchName !== "false")
8+
{
9+
echo json_encode(array());
10+
die();
11+
}
12+
713
function sendCurlInner($requestUrl)
814
{
915
$curlInit = curl_init();
@@ -254,7 +260,7 @@ function getBranchStats($location)
254260
$blockedList = array();
255261
foreach ($serverWatchList as $key => $value)
256262
{
257-
if(isset($value["Archive"]) && "true" === $value["Archive"])
263+
if((isset($value["Archive"]) && "true" === $value["Archive"]) || (isset($_POST['id']) && $_POST['id'] !== str_replace(' ', '_', $key)))
258264
{
259265
continue;
260266
}

core/php/functions/gitCommitDiff.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
require_once("../../../local/default/conf/config.php");
55
require_once("../../../core/php/loadVars.php");
66

7+
if($blockGitCommitDiff !== "false")
8+
{
9+
echo json_encode(array());
10+
die();
11+
}
12+
713
$location = (string)$_POST['location'];
814
$branchListCompare = "master";
915
if(isset($_POST['branchList']))

core/php/functions/gitCommitHistory.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
require_once("../../../local/default/conf/config.php");
55
require_once("../../../core/php/loadVars.php");
66

7+
if($blockGitCommitHistory !== "false")
8+
{
9+
echo json_encode(array());
10+
die();
11+
}
12+
713
$newArrayOfData = array("","");
814
$location = (string)$_POST['location'];
915
$maxCount = 100;

0 commit comments

Comments
 (0)