Make bookmarklet origin configurable for tests
This commit is contained in:
parent
11316d952b
commit
771cfc9ca6
|
@ -306,7 +306,8 @@ Zotero.Server.DataListener.prototype._generateResponse = function(status, conten
|
||||||
if(!Zotero.isServer) {
|
if(!Zotero.isServer) {
|
||||||
response += "X-Zotero-Version: "+Zotero.version+"\r\n";
|
response += "X-Zotero-Version: "+Zotero.version+"\r\n";
|
||||||
response += "X-Zotero-Connector-API-Version: "+CONNECTOR_API_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-Origin: "+this.origin+"\r\n";
|
||||||
response += "Access-Control-Allow-Methods: POST, GET, OPTIONS\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";
|
response += "Access-Control-Allow-Headers: Content-Type,X-Zotero-Connector-API-Version,X-Zotero-Version\r\n";
|
||||||
|
|
|
@ -35,6 +35,8 @@ const ZOTERO_CONFIG = {
|
||||||
API_URL: 'https://api.zotero.org/',
|
API_URL: 'https://api.zotero.org/',
|
||||||
API_VERSION: 2,
|
API_VERSION: 2,
|
||||||
PREF_BRANCH: 'extensions.zotero.',
|
PREF_BRANCH: 'extensions.zotero.',
|
||||||
|
BOOKMARKLET_ORIGIN : 'https://www.zotero.org',
|
||||||
|
HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org',
|
||||||
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
|
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
|
||||||
VERSION: "4.0.5.SOURCE"
|
VERSION: "4.0.5.SOURCE"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user