mirror of
https://github.com/catppuccin/catppuccin
synced 2024-11-10 06:04:21 +00:00
ci: add script to check url expiry dates
This commit is contained in:
parent
fa2280893c
commit
14ef5ba87a
2 changed files with 42 additions and 0 deletions
0
tools/domain-expiry-check/deps.ts
Normal file
0
tools/domain-expiry-check/deps.ts
Normal file
42
tools/domain-expiry-check/main.ts
Executable file
42
tools/domain-expiry-check/main.ts
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env deno run --allow-net --allow-read
|
||||
import whois from 'npm:whois@2.14.0'
|
||||
|
||||
const urls = Deno.readTextFileSync('resources/url-allowlist.txt')
|
||||
.split('\n')
|
||||
.filter((content) => content.length > 0)
|
||||
|
||||
const expiryWarning = new Date()
|
||||
expiryWarning.setDate(expiryWarning.getDate() + 180)
|
||||
|
||||
let i = 1
|
||||
|
||||
for (const url of urls) {
|
||||
whois.lookup(url, (err: any, data: string) => {
|
||||
if (err) {
|
||||
console.error(`error on ${url}:`, err)
|
||||
return
|
||||
} else {
|
||||
if (data.length === 0) {
|
||||
console.error(`no data on ${url}`)
|
||||
return
|
||||
}
|
||||
|
||||
const d = data.match(/expir(ation|y) date: (.*)/gi)
|
||||
console.log(d)
|
||||
const date = new Date(d ? d[1] : '1970-01-01')
|
||||
|
||||
if (date < expiryWarning) {
|
||||
console.warn(`WARN: ${url} expires on ${date}`)
|
||||
}
|
||||
console.log(
|
||||
'Processed',
|
||||
i++,
|
||||
'of',
|
||||
urls.length,
|
||||
'domains (',
|
||||
url,
|
||||
')'
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue