mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 14:02:03 +02:00
Initial commit
This commit is contained in:
7
node_modules/helmet-crossdomain/dist/index.d.ts
generated
vendored
Normal file
7
node_modules/helmet-crossdomain/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
interface CrossDomainOptions {
|
||||
permittedPolicies?: string;
|
||||
}
|
||||
declare const _default: (options?: CrossDomainOptions) => (_req: IncomingMessage, res: ServerResponse, next: () => void) => void;
|
||||
export = _default;
|
29
node_modules/helmet-crossdomain/dist/index.js
generated
vendored
Normal file
29
node_modules/helmet-crossdomain/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
function getHeaderValueFromOptions(options) {
|
||||
var DEFAULT_PERMITTED_POLICIES = 'none';
|
||||
var ALLOWED_POLICIES = [
|
||||
'none',
|
||||
'master-only',
|
||||
'by-content-type',
|
||||
'all',
|
||||
];
|
||||
var permittedPolicies;
|
||||
if ('permittedPolicies' in options) {
|
||||
permittedPolicies = options.permittedPolicies;
|
||||
}
|
||||
else {
|
||||
permittedPolicies = DEFAULT_PERMITTED_POLICIES;
|
||||
}
|
||||
if (ALLOWED_POLICIES.indexOf(permittedPolicies) === -1) {
|
||||
throw new Error("\"" + permittedPolicies + "\" is not a valid permitted policy. Allowed values: " + ALLOWED_POLICIES.join(', ') + ".");
|
||||
}
|
||||
return permittedPolicies;
|
||||
}
|
||||
module.exports = function crossdomain(options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var headerValue = getHeaderValueFromOptions(options);
|
||||
return function crossdomain(_req, res, next) {
|
||||
res.setHeader('X-Permitted-Cross-Domain-Policies', headerValue);
|
||||
next();
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user