| Server IP : 216.238.66.20 / Your IP : 216.73.216.158 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/energia-cce.gamliel.mx/htdocs/energia-cce/node_modules/koa-favicon/ |
Upload File : |
'use strict';
/**
* Module dependencies.
*/
const resolve = require('path').resolve;
const fs = require('fs');
/**
* Serve favicon.ico
*
* @param {String} path
* @param {Object} [options]
* @param {Number} [options.maxAge=null]
* @param {String} [options.mime="image/x-icon"] MIME type of the file at path
* @return {Function}
* @api public
*/
module.exports = function (path, options){
if (!path) {
return (ctx, next) => {
if ('/favicon.ico' != ctx.path) {
return next();
}
};
}
path = resolve(path);
options = options || {};
let icon;
const maxAge = options.maxAge == null
? 86400000
: Math.min(Math.max(0, options.maxAge), 31556926000);
const cacheControl = `public, max-age=${maxAge / 1000 | 0}`;
const mime = options.mime || 'image/x-icon';
return (ctx, next) => {
if ('/favicon.ico' != ctx.path) {
return next();
}
if ('GET' !== ctx.method && 'HEAD' !== ctx.method) {
ctx.status = 'OPTIONS' == ctx.method ? 200 : 405;
ctx.set('Allow', 'GET, HEAD, OPTIONS');
} else {
// lazily read the icon
if (!icon) icon = fs.readFileSync(path);
ctx.set('Cache-Control', cacheControl);
ctx.type = mime;
ctx.body = icon;
}
};
};