Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1009B

12345678910111213141516171819202122232425
  1. "use strict"
  2. Object.defineProperty(exports, "__esModule", { value: true })
  3. function getHeaderValueFromOptions({ action = "SAMEORIGIN" }) {
  4. const normalizedAction = typeof action === "string" ? action.toUpperCase() : action
  5. switch (normalizedAction) {
  6. case "SAME-ORIGIN":
  7. return "SAMEORIGIN"
  8. case "DENY":
  9. case "SAMEORIGIN":
  10. return normalizedAction
  11. case "ALLOW-FROM":
  12. throw new Error("X-Frame-Options no longer supports `ALLOW-FROM` due to poor browser support. See <https://github.com/helmetjs/helmet/wiki/How-to-use-X%E2%80%93Frame%E2%80%93Options's-%60ALLOW%E2%80%93FROM%60-directive> for more info.")
  13. default:
  14. throw new Error(`X-Frame-Options received an invalid action ${JSON.stringify(action)}`)
  15. }
  16. }
  17. function xFrameOptions(options = {}) {
  18. const headerValue = getHeaderValueFromOptions(options)
  19. return function xFrameOptionsMiddleware(_req, res, next) {
  20. res.setHeader("X-Frame-Options", headerValue)
  21. next()
  22. }
  23. }
  24. module.exports = xFrameOptions
  25. exports.default = xFrameOptions