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.

12345678910111213141516171819202122232425262728
  1. "use strict"
  2. Object.defineProperty(exports, "__esModule", { value: true })
  3. function parseMaxAge(value = 0) {
  4. if (value >= 0 && Number.isFinite(value)) {
  5. return Math.floor(value)
  6. } else {
  7. throw new Error(`Expect-CT: ${JSON.stringify(value)} is not a valid value for maxAge. Please choose a positive integer.`)
  8. }
  9. }
  10. function getHeaderValueFromOptions(options) {
  11. const directives = [`max-age=${parseMaxAge(options.maxAge)}`]
  12. if (options.enforce) {
  13. directives.push("enforce")
  14. }
  15. if (options.reportUri) {
  16. directives.push(`report-uri="${options.reportUri}"`)
  17. }
  18. return directives.join(", ")
  19. }
  20. function expectCt(options = {}) {
  21. const headerValue = getHeaderValueFromOptions(options)
  22. return function expectCtMiddleware(_req, res, next) {
  23. res.setHeader("Expect-CT", headerValue)
  24. next()
  25. }
  26. }
  27. module.exports = expectCt
  28. exports.default = expectCt