commit 6d7dcc44bcc6cbe0f555a264c569745294596222
parent 322b20fc1214e3de17ca6d096436245ca340048d
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Tue, 18 Jul 2017 10:25:54 +0300
Add connector endpoint to retrieve proxies. Closes #1265
Diffstat:
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js
@@ -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