Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/vreg/node_modules/html-to-image/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/vreg/node_modules/html-to-image/lib/getBlobFromURL.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBlobFromURL = void 0;
var util_1 = require("./util");
var cache = {};
function getCacheKey(url) {
    var key = url.replace(/\?.*/, '');
    // font resourse
    if (/ttf|otf|eot|woff2?/i.test(key)) {
        key = key.replace(/.*\//, '');
    }
    return key;
}
function getBlobFromURL(url, options) {
    var cacheKey = getCacheKey(url);
    if (cache[cacheKey] != null) {
        return cache[cacheKey];
    }
    // cache bypass so we dont have CORS issues with cached images
    // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
    if (options.cacheBust) {
        // eslint-disable-next-line no-param-reassign
        url += (/\?/.test(url) ? '&' : '?') + new Date().getTime();
    }
    var failed = function (reason) {
        var placeholder = '';
        if (options.imagePlaceholder) {
            var parts = options.imagePlaceholder.split(/,/);
            if (parts && parts[1]) {
                placeholder = parts[1];
            }
        }
        var msg = "Failed to fetch resource: " + url;
        if (reason) {
            msg = typeof reason === 'string' ? reason : reason.message;
        }
        if (msg) {
            console.error(msg);
        }
        return {
            blob: placeholder,
            contentType: '',
        };
    };
    var deferred = window
        .fetch(url)
        .then(function (res) {
        // eslint-disable-next-line promise/no-nesting
        return res.blob().then(function (blob) { return ({
            blob: blob,
            contentType: res.headers.get('Content-Type') || '',
        }); });
    })
        .then(function (_a) {
        var blob = _a.blob, contentType = _a.contentType;
        return new Promise(function (resolve, reject) {
            var reader = new FileReader();
            reader.onloadend = function () {
                return resolve({
                    contentType: contentType,
                    blob: reader.result,
                });
            };
            reader.onerror = reject;
            reader.readAsDataURL(blob);
        });
    })
        .then(function (_a) {
        var blob = _a.blob, contentType = _a.contentType;
        return ({
            contentType: contentType,
            blob: (0, util_1.parseDataUrlContent)(blob),
        });
    })
        // on failed
        .catch(failed);
    // cache result
    cache[cacheKey] = deferred;
    return deferred;
}
exports.getBlobFromURL = getBlobFromURL;
//# sourceMappingURL=getBlobFromURL.js.map

Spamworldpro Mini