Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

is-archived-version.js 982 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  1. const patterns = require('../lib/patterns')
  2. const { deprecated } = require('../lib/enterprise-server-releases')
  3. module.exports = function isArchivedVersion (req) {
  4. // if this is an assets path, use the referrer
  5. // if this is a docs path, use the req.path
  6. const pathToCheck = patterns.assetPaths.test(req.path)
  7. ? req.get('referrer')
  8. : req.path
  9. // ignore paths that don't have an enterprise version number
  10. if (!(patterns.getEnterpriseVersionNumber.test(pathToCheck) || patterns.getEnterpriseServerNumber.test(pathToCheck))) {
  11. return {}
  12. }
  13. // extract enterprise version from path, e.g. 2.16
  14. const requestedVersion = pathToCheck.includes('enterprise-server@')
  15. ? pathToCheck.match(patterns.getEnterpriseServerNumber)[1]
  16. : pathToCheck.match(patterns.getEnterpriseVersionNumber)[1]
  17. // bail if the request version is not deprecated
  18. if (!deprecated.includes(requestedVersion)) {
  19. return {}
  20. }
  21. return { isArchived: true, requestedVersion }
  22. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...