Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 uid=1(daemon) gid=1(daemon) grupos=1(daemon) Safe-mode: OFF (not secure) /opt/apex_tdfonline/www/js/shindig/features/src/main/javascript/features/osapi/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
/**
* Provide a transport of osapi requests over JSON-RPC. Exposed JSON-RPC endpoints and
* their associated methods are available from config in the "osapi.services" field.
*/
(function() {
/**
* Called by a batch to execute all requests
* @param requests
* @param callback
*/
function execute(requests, callback) {
function processResponse(response) {
// Convert an XHR failure to a JSON-RPC error
if (response.errors[0]) {
callback({
error : {
code : response.rc,
message : response.text
}
});
} else {
var jsonResponse = response.data;
if (jsonResponse.error) {
callback(jsonResponse);
} else {
var responseMap = {};
for (var i = 0; i < jsonResponse.length; i++) {
responseMap[jsonResponse[i].id] = jsonResponse[i];
}
callback(responseMap);
}
}
}
var request = {
"POST_DATA" : gadgets.json.stringify(requests),
"CONTENT_TYPE" : "JSON",
"METHOD" : "POST",
"AUTHORIZATION" : "SIGNED"
};
var url = this.name;
var token = shindig.auth.getSecurityToken();
if (token) {
url += "?st=";
url += encodeURIComponent(token);
}
gadgets.io.makeNonProxiedRequest(url, processResponse, request, "application/json");
}
function init(config) {
var services = config["osapi.services"];
if (services) {
// Iterate over the defined services, extract the http endpoints and
// create a transport per-endpoint
for (var endpointName in services) if (services.hasOwnProperty(endpointName)) {
if (endpointName.indexOf("http") == 0 ||
endpointName.indexOf("//") == 0) {
// Expand the host & append the security token
var endpointUrl = endpointName.replace("%host%", document.location.host).replace("%toba_alias%", window.toba_alias).replace("%toba_href%", window.location.protocol+'//'+document.location.host+window.toba_alias);
var transport = { name : endpointUrl, "execute" : execute };
var methods = services[endpointName];
for (var i=0; i < methods.length; i++) {
osapi._registerMethod(methods[i], transport);
}
}
}
}
}
// Do not run this in container mode.
if (gadgets.config) {
gadgets.config.register("osapi.services", null, init);
}
})();
|
:: Command execute :: | |
--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.5509 ]-- |