Skip to content

Commit

Permalink
Add connector endpoint to retrieve proxies. Closes zotero#1265
Browse files Browse the repository at this point in the history
  • Loading branch information
adomasven committed Jul 18, 2017
1 parent 322b20f commit 6d7dcc4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions chrome/content/zotero/xpcom/server_connector.js
Expand Up @@ -776,6 +776,31 @@ Zotero.Server.Connector.GetClientHostnames.prototype = {
})
};

/**
* Get a list of stored proxies
*
* Accepts:
* Nothing
* Returns:
* {Array} hostnames
*/
Zotero.Server.Connector.Proxies = {};
Zotero.Server.Connector.Proxies = function() {};
Zotero.Server.Endpoints["/connector/proxies"] = Zotero.Server.Connector.Proxies;
Zotero.Server.Connector.Proxies.prototype = {
supportedMethods: ["POST"],
supportedDataTypes: ["application/json"],
permitBookmarklet: false,

/**
* Returns a 200 response to say the server is alive
*/
init: Zotero.Promise.coroutine(function* () {
let proxies = Zotero.Proxies.proxies.map((p) => Object.assign(p.toJSON(), {hosts: p.hosts}));
return [200, "application/json", JSON.stringify(proxies)];
})
};


/**
* Test connection
Expand Down

0 comments on commit 6d7dcc4

Please sign in to comment.