Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/koa-favicon/ drwxr-xr-x | |
| Viewing file: Select action/file-type: '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;
}
};
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0217 ]-- |