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

Commit 9a6cd23

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 6cff34e + 57fadc9 commit 9a6cd23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+669
-2144
lines changed

core/src/core/classes/class.PydioSdkGenerator.php

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,41 @@
2828
* @subpackage Core
2929
*/
3030

31+
//define("JSON_DIR", AJXP_INSTALL_PATH."/core/doc/api");
3132
define("JSON_DIR", AJXP_INSTALL_PATH."/../api");
3233
define("JSON_URL", "https://pydio.com/static-docs/api");
34+
define("API_DOC_PAGE", "https://pydio.com/en/docs/references/pydio-api#!/");
3335

3436
class PydioSdkGenerator
3537
{
38+
static $apiGroups = [
39+
"fs" => ["access.fs", "index.*", "meta.*", "editor.*", "action.share", "action.powerfs"],
40+
"conf" => ["access.ajxp_conf", "action.scheduler", "action.updater"],
41+
"lifecycle" => ["conf.*", "auth.*", "gui.*", "core.*", "action.avatar"],
42+
"nonfs" => ["access.*"],
43+
"misc" => ["*"]
44+
];
45+
46+
static $apiGroupsLabels = [
47+
"fs" => "Most current operations on files and folders, their metadata, and additional sharing features.",
48+
"conf" => "Administration task : users/groups/workspaces provisionning, maintenance tasks, etc... Generally performed using /settings/ as workspace alias.",
49+
"lifecycle" => "Application objects lifecycle, like current user access rights and preferences, authentication utils, etc. As they are generally not linked to a specific workspace, these actions can be performed using /pydio/ instead of a workspace alias.",
50+
"nonfs" => "Non-standard drivers accessing to structured data like IMAP, MySQL, Apis, etc.",
51+
"misc" => "Other plugins actions."
52+
];
53+
54+
public static function findApiGroupForPlugin($pluginId){
55+
list($pType, $pName) = explode(".", $pluginId);
56+
foreach(self::$apiGroups as $groupName => $pluginPatterns){
57+
foreach($pluginPatterns as $pattern){
58+
if($pattern == "*" || $pattern == "$pType.*" || $pattern == "$pType.$pName"){
59+
return $groupName;
60+
}
61+
}
62+
}
63+
return "misc";
64+
}
65+
3666
public static function analyzeRegistry($versionString)
3767
{
3868
if(!AJXP_SERVER_DEBUG) {
@@ -96,9 +126,12 @@ public static function analyzeRegistry($versionString)
96126
$comment = $callbackNode->getAttribute("developerComment");
97127
$http = $callbackNode->getAttribute("preferredHttp");
98128
$restParams = $callbackNode->getAttribute("restParams");
99-
$prefix = "/default";
100-
if($pluginName == "access.ajxp_conf"){
101-
$prefix = "/ajxp_conf";
129+
$prefix = "/workspace_alias";
130+
$apiGroup = self::findApiGroupForPlugin($pluginName);
131+
if($apiGroup == "conf"){
132+
$prefix = "/settings";
133+
}else if($apiGroup == "lifecycle"){
134+
$prefix = "/pydio";
102135
}
103136
$api = array(
104137
"path" => $prefix."/".$actionName . (empty($restParams) ? "" : $restParams),
@@ -118,12 +151,14 @@ public static function analyzeRegistry($versionString)
118151

119152
file_put_contents($jsFile, "window.sdkMethods = ".json_encode($methods, JSON_PRETTY_PRINT));
120153

121-
122154
$apidocs = array(
123155
"apiVersion" => $versionString,
124156
"swaggerVersion" => "1.2",
125157
"apis" => array()
126158
);
159+
$allDocs = array();
160+
$markdowns = array();
161+
127162
foreach($swaggerAPIs as $pluginName => $apis){
128163

129164
echo("Writing file for $pluginName");
@@ -138,13 +173,55 @@ public static function analyzeRegistry($versionString)
138173
);
139174
file_put_contents($swaggerJsonDir."/".$pluginName, json_encode($swaggerJson, JSON_PRETTY_PRINT));
140175
$p = $pServ->findPluginById($pluginName);
176+
$apiGroup = self::findApiGroupForPlugin($pluginName);
177+
if(!isset($allDocs[$apiGroup])) {
178+
$allDocs[$apiGroup] = array();
179+
$markdowns[$apiGroup] = array();
180+
}
181+
$markdowns[$apiGroup][] = self::makeMarkdown($p, $apis);
182+
$allDocs[$apiGroup][] = array(
183+
"path" => JSON_URL."/$versionString/".$pluginName,
184+
"description" => $p->getManifestDescription()
185+
);
141186
$apidocs["apis"][] = array(
142187
"path" => JSON_URL."/$versionString/".$pluginName,
143188
"description" => $p->getManifestDescription()
144189
);
145190

146191
}
192+
foreach($allDocs as $apiGroupName => $groupApis){
193+
$groupApiDocs = array(
194+
"apiVersion" => $versionString,
195+
"swaggerVersion" => "1.2",
196+
"apis" => $groupApis
197+
);
198+
file_put_contents($swaggerJsonDir."/api-docs-".$apiGroupName, json_encode($groupApiDocs, JSON_PRETTY_PRINT));
199+
file_put_contents($swaggerJsonDir."/api-md-".$apiGroupName, self::$apiGroupsLabels[$apiGroupName]."\n\n".implode("", $markdowns[$apiGroupName]));
200+
}
201+
// Store file with all apis.
147202
file_put_contents($swaggerJsonDir."/api-docs", json_encode($apidocs, JSON_PRETTY_PRINT));
148203
}
149204

205+
/**
206+
* @param AJXP_Plugin $plugin
207+
* @param array $apis
208+
* @return string
209+
*/
210+
static public function makeMarkdown($plugin, $apis){
211+
212+
$md = "\n\n";
213+
$md .= "## ".$plugin->getManifestLabel()." ";
214+
$md .= "\n".$plugin->getManifestDescription()."\n\n";
215+
$id = $plugin->getId();
216+
foreach($apis as $index => $api) {
217+
$md .= "\n";
218+
$md .= "- **".$api["path"]."** \n";
219+
$md .= " ".$api["operations"][0]["notes"]." \n";
220+
$md .= " [Details](".API_DOC_PAGE."".$id."/".$api["operations"][0]["nickname"]."_".strtolower($api["operations"][0]["method"])."_".$index.")";
221+
}
222+
223+
return $md;
224+
225+
}
226+
150227
}

core/src/core/classes/class.Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function getOption($oName, $safe=false, $resolveUser = null)
374374
$pvalue = rtrim(str_replace("AJXP_WORKSPACE_SLUG", $this->getSlug(), $pvalue), "/");
375375
$pathChanged = true;
376376
}
377-
if (is_string($pvalue) && strstr($value, "AJXP_ALLOW_SUB_PATH") !== false) {
377+
if (is_string($pvalue) && strstr($pvalue, "AJXP_ALLOW_SUB_PATH") !== false) {
378378
$pvalue = rtrim(str_replace("AJXP_ALLOW_SUB_PATH", "", $pvalue), "/")."/".$this->options[$oName];
379379
$pathChanged = true;
380380
}

core/src/plugins/access.ajxp_home/res/home.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
white-space: nowrap;
132132
text-overflow: ellipsis;
133133
}
134+
#home_account_pane #home_left_bar #workspaces_center .workspaces .workspace-entry .workspace-additional-action {
135+
float: right;
136+
margin-top: -40px;
137+
padding: 12px;
138+
border-radius: 50%;
139+
}
134140
#home_account_pane #home_left_bar #workspaces_center .workspaces .workspace-entry.ws_selector_title h3 {
135141
font-size: 13px;
136142
font-weight: 500;

core/src/plugins/access.ajxp_home/res/home.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@
136136
text-overflow: ellipsis;
137137
}
138138

139+
.workspace-additional-action {
140+
float: right;
141+
margin-top: -40px;
142+
padding: 12px;
143+
border-radius: 50%;
144+
}
145+
139146
&.ws_selector_title{
140147
h3{
141148
font-size: 13px;

core/src/plugins/access.fs/class.fsAccessDriver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,9 @@ public function makeSharedRepositoryOptions($httpVars, $repository)
20402040
"PATH" => SystemTextEncoding::toStorageEncoding($repository->getOption("PATH")).AJXP_Utils::decodeSecureMagic($httpVars["file"]),
20412041
"CREATE" => $repository->getOption("CREATE"),
20422042
"RECYCLE_BIN" => isSet($httpVars["inherit_recycle"])? $repository->getOption("RECYCLE_BIN") : "",
2043-
"DEFAULT_RIGHTS" => "");
2043+
"DEFAULT_RIGHTS" => "",
2044+
"DATA_TEMPLATE" => ""
2045+
);
20442046
if ($repository->getOption("USE_SESSION_CREDENTIALS")===true) {
20452047
$newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
20462048
}

core/src/plugins/access.s3/class.s3AccessDriver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*
2121
*/
2222
defined('AJXP_EXEC') or die( 'Access not allowed');
23+
24+
require_once(AJXP_BIN_FOLDER . '/guzzle/vendor/autoload.php');
25+
2326
/**
2427
* AJXP_Plugin to access a webdav enabled server
2528
* @package AjaXplorer_Plugins

core/src/plugins/action.share/class.CompositeShare.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ public function getVisibilityScope(){
9494
}
9595
}
9696

97+
/**
98+
* @return bool
99+
*/
100+
public function isInvalid(){
101+
return $this->getRepository() == null;
102+
}
103+
97104
/**
98105
* @param MetaWatchRegister|false $watcher
99106
* @param ShareRightsManager $rightsManager

0 commit comments

Comments
 (0)