Make bookmarklet origin configurable for tests

This commit is contained in:
Simon Kornblith 2013-04-15 13:43:07 -04:00
parent 11316d952b
commit 771cfc9ca6
2 changed files with 4 additions and 1 deletions

View File

@ -306,7 +306,8 @@ Zotero.Server.DataListener.prototype._generateResponse = function(status, conten
if(!Zotero.isServer) {
response += "X-Zotero-Version: "+Zotero.version+"\r\n";
response += "X-Zotero-Connector-API-Version: "+CONNECTOR_API_VERSION+"\r\n";
if(this.origin === "https://www.zotero.org" || this.origin === "http://www.zotero.org") {
if(this.origin === ZOTERO_CONFIG.BOOKMARKLET_ORIGIN ||
this.origin === ZOTERO_CONFIG.HTTP_BOOKMARKLET_ORIGIN) {
response += "Access-Control-Allow-Origin: "+this.origin+"\r\n";
response += "Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n";
response += "Access-Control-Allow-Headers: Content-Type,X-Zotero-Connector-API-Version,X-Zotero-Version\r\n";

View File

@ -35,6 +35,8 @@ const ZOTERO_CONFIG = {
API_URL: 'https://api.zotero.org/',
API_VERSION: 2,
PREF_BRANCH: 'extensions.zotero.',
BOOKMARKLET_ORIGIN : 'https://www.zotero.org',
HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org',
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
VERSION: "4.0.5.SOURCE"
};