Permalink
Browse files

Fix how we retrieve options from core.mq in JS. Fix options visibility.

  • Loading branch information...
1 parent eb5afdb commit 3ea52247c4a9be31734af6ee38aab6a8782790e4 @cdujeu cdujeu committed Aug 29, 2016
View
@@ -1,3 +1,4 @@
+/plugins/core.mq/vendor
/plugins/action.scheduler/vendor
/plugins/access.s3/aws-v3.phar
/plugins/access.s3/aws.phar
@@ -66,7 +66,7 @@
};
connexion.sendAsync();
]]></clientCallback>
- <serverCallback methodName="switchAction" developerComment="Run the scheduler: check if some tasks must be run now, and launch them. Generally launched from command line."/>
+ <serverCallback methodName="switchAction" restParams="/" developerComment="Run the scheduler: check if some tasks must be run now, and launch them. Generally launched from command line."/>
</processing>
</action>
<action name="scheduler_loadTask">
@@ -81,7 +81,16 @@ Class.create("PydioInstantMessenger", {
}
}else{
if(repoId){
- var url = "ws"+(this.configs.get("WS_SECURE")?"s":"")+"://"+this.configs.get("WS_HOST")+":"+this.configs.get("WS_PORT")+"/"+this.configs.get("WS_PATH");
+ var host = this.configs.get("BOOSTER_MAIN_HOST");
+ if(this.configs.get("BOOSTER_WS_ADVANCED") && this.configs.get("BOOSTER_WS_ADVANCED")['booster_ws_advanced'] === 'custom' && this.configs.get("BOOSTER_WS_ADVANCED")['WS_HOST']){
+ host = this.configs.get("BOOSTER_WS_ADVANCED")['WS_HOST'];
+ }
+ var port = this.configs.get("BOOSTER_MAIN_PORT");
+ if(this.configs.get("BOOSTER_WS_ADVANCED") && this.configs.get("BOOSTER_WS_ADVANCED")['booster_ws_advanced'] === 'custom' && this.configs.get("BOOSTER_WS_ADVANCED")['WS_PORT']){
+ port = this.configs.get("BOOSTER_WS_ADVANCED")['WS_PORT'];
+ }
+
+ var url = "ws"+(this.configs.get("WS_SECURE")?"s":"")+"://"+host+":"+port+"/"+this.configs.get("WS_PATH");
this.ws = new WebSocket(url);
this.ws.onmessage = function(event){
@@ -13,19 +13,18 @@
<global_param group="CONF_MESSAGE[Pydio Booster]" type="button" name="PYDIO_BOOSTER_SWITCH_OFF" choices="run_plugin_action:core.mq:switchPydioBoosterOff" label="CONF_MESSAGE[Stop Process]" description="CONF_MESSAGE[Switch Booster OFF]" mandatory="false"/>
<global_param group="CONF_MESSAGE[Pydio Booster]" type="monitor" name="PYDIO_BOOSTER_STATUS" choices="run_plugin_action:core.mq:getPydioBoosterStatus" label="CONF_MESSAGE[Process Status]" description="CONF_MESSAGE[Process is running or not]" mandatory="false"/>
<global_param group="CONF_MESSAGE[Pydio Booster]" name="CLI_PYDIO" type="string" label="CONF_MESSAGE[Command-line Pydio]" description="CONF_MESSAGE[On specific hosts, you may have to use a specific path to access the pydio command line]" mandatory="false" default="pydio"/>
- <global_param group="CONF_MESSAGE[Pydio Booster]" type="boolean" name="WS_ACTIVE" description="CONF_MESSAGE[WebSocket Server provides a server-to-client messaging feature, avoiding regular polling from browsers and sync applications, thus reducing the server load.]" label="CONF_MESSAGE[WebSocket Server]" default="true" expose="true"/>
- <global_param group="CONF_MESSAGE[Pydio Booster]" description="CONF_MESSAGE[Pydio Upload Server is a unique feature used to delegate file uploads to our dedicated binary, that will send the files directly to the storage.]" label="CONF_MESSAGE[Upload Server]" name="UPLOAD_ACTIVE" type="boolean" expose="true"/>
- <global_param group="CONF_MESSAGE[Pydio Booster]" description="CONF_MESSAGE[WebSocket Authentication Key]" label="CONF_MESSAGE[WS Admin Key]" name="WS_SERVER_ADMIN" type="string" default="adminsecretkey"/>
+ <global_param group="CONF_MESSAGE[Pydio Booster]" name="WS_ACTIVE" type="boolean" description="CONF_MESSAGE[WebSocket Server provides a server-to-client messaging feature, avoiding regular polling from browsers and sync applications, thus reducing the server load.]" label="CONF_MESSAGE[WebSocket Server]" default="true" expose="true"/>
+ <global_param group="CONF_MESSAGE[Pydio Booster]" name="UPLOAD_ACTIVE" description="CONF_MESSAGE[Pydio Upload Server is a unique feature used to delegate file uploads to our dedicated binary, that will send the files directly to the storage.]" label="CONF_MESSAGE[Upload Server]" type="boolean" expose="true"/>
<global_param group="CONF_MESSAGE[Network Main Configurations]" name="BOOSTER_MAIN_HOST" type="string" label="CONF_MESSAGE[Host]" description="CONF_MESSAGE[Host]" expose="true" default="127.0.0.1"/>
<global_param group="CONF_MESSAGE[Network Main Configurations]" name="BOOSTER_MAIN_PORT" type="string" label="CONF_MESSAGE[Port]" description="CONF_MESSAGE[Port]" expose="true" default="8090"/>
<global_param group="CONF_MESSAGE[Network Main Configurations]" name="BOOSTER_MAIN_SECURE" type="boolean" label="CONF_MESSAGE[SSL]" description="CONF_MESSAGE[Use secure connection]" expose="true" default="true"/>
- <global_param group="CONF_MESSAGE[Network Main Configurations]" name="NSQ_PORT" type="string" label="CONF_MESSAGE[NSQ Port]" description="CONF_MESSAGE[NSQ Port]" expose="true" default="4150"/>
- <global_param group="CONF_MESSAGE[Network Main Configurations]" name="BOOSTER_INTERNAL_CONNECTION" type="group_switch:booster_internal_connection" label="CONF_MESSAGE[Internal Connection]" description="CONF_MESSAGE[If different from default host/port]" expose="true" default="same" mandatory="true"/>
+ <global_param group="CONF_MESSAGE[Network Main Configurations]" name="NSQ_PORT" type="string" label="CONF_MESSAGE[NSQ Port]" description="CONF_MESSAGE[NSQ Port]" default="4150"/>
+ <global_param group="CONF_MESSAGE[Network Main Configurations]" name="BOOSTER_INTERNAL_CONNECTION" type="group_switch:booster_internal_connection" label="CONF_MESSAGE[Internal Connection]" description="CONF_MESSAGE[If different from default host/port]" default="same" mandatory="true"/>
<global_param group_switch_name="booster_internal_connection" group_switch_label="Same as external" group_switch_value="same" name="booster_internal_connection" type="hidden" label="same" description="custom" default="same"/>
<global_param group_switch_name="booster_internal_connection" group_switch_label="Custom" group_switch_value="custom" name="booster_internal_connection" type="hidden" label="custom" description="custom" default="custom"/>
- <global_param group_switch_name="booster_internal_connection" group_switch_label="Custom" group_switch_value="custom" name="BOOSTER_INTERNAL_HOST" type="string" label="CONF_MESSAGE[Internal Host (if LAN IP is different from outside-world IP).]" description="CONF_MESSAGE[Internal Host]" expose="true" default="127.0.0.1"/>
- <global_param group_switch_name="booster_internal_connection" group_switch_label="Custom" group_switch_value="custom" name="BOOSTER_INTERNAL_PORT" type="string" label="CONF_MESSAGE[Internal Port (if LAN Port is different from outside-world Port).]" description="CONF_MESSAGE[Internal Host]" expose="true" default="8090"/>
+ <global_param group_switch_name="booster_internal_connection" group_switch_label="Custom" group_switch_value="custom" name="BOOSTER_INTERNAL_HOST" type="string" label="CONF_MESSAGE[Internal Host (if LAN IP is different from outside-world IP).]" description="CONF_MESSAGE[Internal Host]" default="127.0.0.1"/>
+ <global_param group_switch_name="booster_internal_connection" group_switch_label="Custom" group_switch_value="custom" name="BOOSTER_INTERNAL_PORT" type="string" label="CONF_MESSAGE[Internal Port (if LAN Port is different from outside-world Port).]" description="CONF_MESSAGE[Internal Host]" default="8090"/>
<global_param group="CONF_MESSAGE[Advanced Configurations]" name="BOOSTER_ADV_WS_LEGEND" type="legend" label="" description="Customize URL's depending on the features."/>
@@ -49,10 +48,10 @@
<global_param group_switch_name="booster_upload_advanced" group_switch_label="Customize" group_switch_value="custom" description="CONF_MESSAGE[Upload Server secure]" label="CONF_MESSAGE[Upload Server secure]" name="UPLOAD_SECURE" type="boolean" expose="true" default="false"/>
<global_param group="CONF_MESSAGE[Advanced Configurations]" description="CONF_MESSAGE[Upload Server path]" label="CONF_MESSAGE[Upload Server path]" name="UPLOAD_PATH" type="string" expose="true" default="io"/>
- <global_param group="CONF_MESSAGE[Advanced Configurations]" name="BOOSTER_NSQ_ADVANCED" type="group_switch:booster_nsq_advanced" label="CONF_MESSAGE[Messaging Service Network Configuration]" description="CONF_MESSAGE[Use custom URL for nsq service]" expose="true" default="same" mandatory="true"/>
+ <global_param group="CONF_MESSAGE[Advanced Configurations]" name="BOOSTER_NSQ_ADVANCED" type="group_switch:booster_nsq_advanced" label="CONF_MESSAGE[Messaging Service Network Configuration]" description="CONF_MESSAGE[Use custom URL for nsq service]" default="same" mandatory="true"/>
<global_param group_switch_name="booster_nsq_advanced" group_switch_label="Use main configurations" group_switch_value="same" name="booster_nsq_advanced" type="hidden" label="same" description="same" default="same"/>
<global_param group_switch_name="booster_nsq_advanced" group_switch_label="Customize" group_switch_value="custom" name="booster_nsq_advanced" type="hidden" label="custom" description="custom" default="custom"/>
- <global_param group_switch_name="booster_nsq_advanced" group_switch_label="Customize" group_switch_value="custom" description="CONF_MESSAGE[NSQ Host]" label="CONF_MESSAGE[NSQ Host]" name="NSQ_HOST" type="string" expose="true" default="localhost" />
+ <global_param group_switch_name="booster_nsq_advanced" group_switch_label="Customize" group_switch_value="custom" description="CONF_MESSAGE[NSQ Host]" label="CONF_MESSAGE[NSQ Host]" name="NSQ_HOST" type="string" default="localhost" />
<global_param group="CONF_MESSAGE[Server Internals]" type="plugin_instance:mq" name="UNIQUE_MS_INSTANCE" label="CONF_MESSAGE[MQ Instance]" description="CONF_MESSAGE[Choose the plugin, sql should be the default value]" mandatory="false" default="mq.sql"/>
<global_param group="CONF_MESSAGE[Server Internals]" description="CONF_MESSAGE[Post the notification in a temporary queue. You must set up the scheduler accordingly to make sure the queue is then consumed on a regularly basis.]" label="CONF_MESSAGE[Queue notifications]" name="USE_QUEUE" type="boolean" default="false"/>
@@ -123,7 +123,7 @@ public function generatePydioBoosterFile($params, $adminKeyString) {
$hosts = [];
// Getting URLs of the Pydio system
- $serverURL = ApplicationState::detectServerURL();
+ $serverURL = ApplicationState::detectServerURL(true);
$tokenURL = $serverURL . "?get_action=keystore_generate_auth_token";
// Websocket Server Config
@@ -105,6 +105,29 @@ public function init(ContextInterface $ctx, $options = [])
} catch (\Exception $e) {}
}
+ /**
+ * Override parent method
+ * @param $configName
+ * @param $configValue
+ */
+ public function exposeConfigInManifest($configName, $configValue)
+ {
+ // Do not expose those
+ if(in_array($configName, ["WS_HOST", "WS_PORT", "UPLOAD_HOST", "UPLOAD_PORT"])){
+ return;
+ }
+ if(is_array($configValue)){
+ $newValue = [];
+ foreach($configValue as $key => $val){
+ if(strpos($key, "INTERNAL") !== false) continue;
+ $newValue[$key] = $val;
+ }
+ parent::exposeConfigInManifest($configName, $newValue);
+ }else{
+ parent::exposeConfigInManifest($configName, $configValue);
+ }
+ }
+
/**
* @param Notification $notification
@@ -760,6 +760,16 @@ Class.create("XHRUploader", {
uri += '&' + queryStringParam;
}
} else {
+
+ var host = this.configs.get("BOOSTER_MAIN_HOST");
+ if(this.configs.get("BOOSTER_UPLOAD_ADVANCED") && this.configs.get("BOOSTER_UPLOAD_ADVANCED")['booster_ws_advanced'] === 'custom' && this.configs.get("BOOSTER_UPLOAD_ADVANCED")['WS_HOST']){
+ host = this.configs.get("BOOSTER_UPLOAD_ADVANCED")['WS_HOST'];
+ }
+ var port = this.configs.get("BOOSTER_MAIN_PORT");
+ if(this.configs.get("BOOSTER_UPLOAD_ADVANCED") && this.configs.get("BOOSTER_UPLOAD_ADVANCED")['booster_ws_advanced'] === 'custom' && this.configs.get("BOOSTER_UPLOAD_ADVANCED")['WS_PORT']){
+ port = this.configs.get("BOOSTER_UPLOAD_ADVANCED")['WS_PORT'];
+ }
+
xhr.withCredentials = true;
uri = "http"+(this.configs.get("UPLOAD_SECURE")?"s":"")+"://"+this.configs.get("UPLOAD_HOST")+":"+this.configs.get("UPLOAD_PORT")+"/"+this.configs.get("UPLOAD_PATH")+"/"+pydio.user.activeRepository + currentDir;

0 comments on commit 3ea5224

Please sign in to comment.