cropduster
Advanced tools
Comparing version 6.0.1 to 7.0.0
@@ -1,2 +0,2 @@ | ||
var CD=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};return o.pause(t.maxSuspension||0,a),(u=e,i=t,new Promise((e,t)=>{const r=new XMLHttpRequest;if(r.onerror=function(){t(this.status)},r.onload=function(){e(this)},r.open(i.method||"GET",u,!0),i.withoutCredentials||(r.withCredentials=!0),i.headers){const{headers:e}=i;Object.keys(e).forEach(t=>{r.setRequestHeader(t,e[t])})}r.send(i.body)})).then(e=>{const t=e.getResponseHeader("content-type"),{status:r,responseText:n}=e;return s(n,r,t),{data:n,status:r,contentType:t,response:e}}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t});var u,i},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()}};t.default=o}]); | ||
var CD=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||/profiles.movableink.com/.test(e)||/sorcerer.movableink-templates.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};return o.pause(t.maxSuspension||0,a),(u=e,i=t,new Promise((e,t)=>{const r=new XMLHttpRequest;if(r.onerror=function(){t(this.status)},r.onload=function(){e(this)},r.open(i.method||"GET",u,!0),i.withoutCredentials||(r.withCredentials=!0),i.headers){const{headers:e}=i;Object.keys(e).forEach(t=>{r.setRequestHeader(t,e[t])})}r.send(i.body)})).then(e=>{const t=e.getResponseHeader("content-type"),{status:r,responseText:n}=e;return s(n,r,t),{data:n,status:r,contentType:t,response:e}}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t});var u,i},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()}};t.default=o}]); | ||
//# sourceMappingURL=cropduster.browser.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cropduster=t():e.cropduster=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};return o.pause(t.maxSuspension||0,a),(u=e,i=t,new Promise((e,t)=>{const r=new XMLHttpRequest;if(r.onerror=function(){t(this.status)},r.onload=function(){e(this)},r.open(i.method||"GET",u,!0),i.withoutCredentials||(r.withCredentials=!0),i.headers){const{headers:e}=i;Object.keys(e).forEach(t=>{r.setRequestHeader(t,e[t])})}r.send(i.body)})).then(e=>{const t=e.getResponseHeader("content-type"),{status:r,responseText:n}=e;return s(n,r,t),{data:n,status:r,contentType:t,response:e}}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t});var u,i},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()}};t.default=o}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cropduster=t():e.cropduster=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||/profiles.movableink.com/.test(e)||/sorcerer.movableink-templates.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};return o.pause(t.maxSuspension||0,a),(u=e,i=t,new Promise((e,t)=>{const r=new XMLHttpRequest;if(r.onerror=function(){t(this.status)},r.onload=function(){e(this)},r.open(i.method||"GET",u,!0),i.withoutCredentials||(r.withCredentials=!0),i.headers){const{headers:e}=i;Object.keys(e).forEach(t=>{r.setRequestHeader(t,e[t])})}r.send(i.body)})).then(e=>{const t=e.getResponseHeader("content-type"),{status:r,responseText:n}=e;return s(n,r,t),{data:n,status:r,contentType:t,response:e}}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t});var u,i},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()}};t.default=o}])}); | ||
//# sourceMappingURL=cropduster.js.map |
@@ -179,3 +179,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
options.corsCacheTime = options.corsCacheTime || 10 * 1000; | ||
if (!/cors.movableink.com/.test(url)) { | ||
if (!/cors.movableink.com/.test(url) && !/profiles.movableink.com/.test(url) && !/sorcerer.movableink-templates.com/.test(url)) { | ||
url = CD.proxyUrl(url); | ||
@@ -182,0 +182,0 @@ } |
{ | ||
"name": "cropduster", | ||
"version": "6.0.1", | ||
"version": "7.0.0", | ||
"description": "Library for building web pages for use with Movable Ink Web Crops", | ||
@@ -5,0 +5,0 @@ "main": "dist/cropduster.js", |
@@ -242,2 +242,6 @@ # Cropduster | ||
### 7.0.0 | ||
* Skip proxying requests for internal domains that support CORS | ||
### 6.0.0 | ||
@@ -244,0 +248,0 @@ * Remove use of `fetch` (major bump as exposure to `response` object is a breaking change) |
@@ -175,3 +175,7 @@ const DEPRECATION_MSG = 'callbacks are deprecated in cropduster, prefer using promises for asynchronous operations'; | ||
options.corsCacheTime = options.corsCacheTime || 10 * 1000; | ||
if (!/cors.movableink.com/.test(url)) { | ||
if ( | ||
!/cors.movableink.com/.test(url) && | ||
!/profiles.movableink.com/.test(url) && | ||
!/sorcerer.movableink-templates.com/.test(url) | ||
) { | ||
url = CD.proxyUrl(url); | ||
@@ -178,0 +182,0 @@ } |
@@ -411,2 +411,36 @@ import CD from '../src/cropduster'; | ||
test("CD.getCORS to sorcerer.movableink-templates.com", function(assert) { | ||
const done = assert.async(); | ||
// the request goes directly to sorcerer which supports CORS | ||
this.fakeServer.get('http://sorcerer.movableink-templates.com', ({ requestHeaders }) => { | ||
assert.equal(requestHeaders['x-reverse-proxy-ttl'], 5); | ||
assert.equal(requestHeaders['x-mi-cbe'], '1503910540'); | ||
done(); | ||
return [200, {}, '']; | ||
}); | ||
CD.getCORS("http://sorcerer.movableink-templates.com", { | ||
corsCacheTime: 5000, | ||
headers: { 'Accept': 'application/json' } | ||
}); | ||
}); | ||
test("CD.getCORS to profiles.movableink.com", function(assert) { | ||
const done = assert.async(); | ||
// the request goes directly to sherlock which supports CORS | ||
this.fakeServer.get('http://profiles.movableink.com', ({ requestHeaders }) => { | ||
assert.equal(requestHeaders['x-reverse-proxy-ttl'], 5); | ||
assert.equal(requestHeaders['x-mi-cbe'], '750998333'); | ||
done(); | ||
return [200, {}, '']; | ||
}); | ||
CD.getCORS("http://profiles.movableink.com", { | ||
corsCacheTime: 5000, | ||
headers: { 'Accept': 'application/json' } | ||
}); | ||
}); | ||
test("_hashForRequest", function(assert) { | ||
@@ -413,0 +447,0 @@ let hash = CD._hashForRequest("http://www.google.com", {"foo": "bar"}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1168
363
99473
16