Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit dbaf217

Browse files
committed
Proxy latest_note to avoid re-asking authentification to update site.
1 parent 26bd9d8 commit dbaf217

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

core/src/plugins/action.updater/class.AjaXplorerUpgrader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public static function getUpgradePath($url, $format = "php", $channel="stable")
121121
if(defined('AJXP_PACKAGE_NAME')){
122122
$packageName = AJXP_PACKAGE_NAME;
123123
}
124+
$packageName .= ConfService::getInfo();
124125
if (isSet(self::$context)) {
125126
$json = file_get_contents($url."?channel=".$channel."&version=".AJXP_VERSION."&package=".$packageName, null, self::$context);
126127
} else {

core/src/plugins/action.updater/class.UpdateController.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,25 @@ public function switchAction($action, $httpVars, $fileVars)
8585

8686
case "get_upgrade_path":
8787

88+
if(isSet($httpVars["proxy_note"])){
89+
$latestNote = $_SESSION["pydio-upgrade-latest-note"];
90+
if(!empty($latestNote)){
91+
$html = file_get_contents($latestNote, null, AjaXplorerUpgrader::getContext());
92+
header("Content-type: text/html");
93+
echo $html;
94+
return;
95+
}
96+
}
8897
header("Content-type: application/json");
89-
print AjaXplorerUpgrader::getUpgradePath($this->pluginConf["UPDATE_SITE"], "json", $this->pluginConf["UPDATE_CHANNEL"]);
98+
$jsonString = AjaXplorerUpgrader::getUpgradePath($this->pluginConf["UPDATE_SITE"], "json", $this->pluginConf["UPDATE_CHANNEL"]);
99+
$data = json_decode($jsonString, true);
100+
if(!empty($this->pluginConf["UPDATE_SITE_USER"]) && isSet($data["latest_note"]) && strpos($data["latest_note"], $this->pluginConf["UPDATE_SITE"]) === 0 && ConfService::$useSession){
101+
$_SESSION["pydio-upgrade-latest-note"] = $data["latest_note"];
102+
$data["latest_note"] = rtrim(AJXP_Utils::detectServerURL(true), "/")."/?get_action=get_upgrade_path&proxy_note=true&secure_token=".$httpVars["secure_token"];
103+
echo json_encode($data);
104+
}else{
105+
echo $jsonString;
106+
}
90107

91108
break;
92109

0 commit comments

Comments
 (0)