Compare commits
10 commits
b9d5c2df46
...
a4111ca13b
Author | SHA1 | Date | |
---|---|---|---|
Chandler Swift | a4111ca13b | ||
Chandler Swift | a8082d14d0 | ||
Chandler Swift | c9f0315db5 | ||
Chandler Swift | 9404a848ad | ||
Chandler Swift | c57cc6ad12 | ||
Chandler Swift | c1cf6ee3a7 | ||
Chandler Swift | 64d3923b1e | ||
Chandler Swift | 63895bed2d | ||
Chandler Swift | 4fee11b591 | ||
Chandler Swift | 07da911b05 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
main
|
main
|
||||||
index.html
|
index.html
|
||||||
|
.direnv
|
||||||
|
|
20
main.go
20
main.go
|
@ -57,7 +57,7 @@ type HatsSite struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSite(domainName string, wd selenium.WebDriver) (hatsSite HatsSite) {
|
func getSite(domainName string, wd selenium.WebDriver) (hatsSite HatsSite) {
|
||||||
log.Printf("Retrieving info for %v\n", hatsSite.DomainName)
|
log.Printf("Retrieving info for %v\n", domainName)
|
||||||
|
|
||||||
hatsSite.DomainName = domainName
|
hatsSite.DomainName = domainName
|
||||||
hatsSite.FetchTime = time.Now()
|
hatsSite.FetchTime = time.Now()
|
||||||
|
@ -147,7 +147,7 @@ func main() {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
geckoDriverPath = "deps/geckodriver"
|
geckoDriverPath = "deps/geckodriver"
|
||||||
geckoDriverPort = 8080
|
geckoDriverPort = 8081
|
||||||
)
|
)
|
||||||
|
|
||||||
opts := []selenium.ServiceOption{
|
opts := []selenium.ServiceOption{
|
||||||
|
@ -162,7 +162,9 @@ func main() {
|
||||||
}
|
}
|
||||||
defer service.Stop()
|
defer service.Stop()
|
||||||
|
|
||||||
wd, err := selenium.NewRemote(nil, fmt.Sprintf("http://localhost:%d", geckoDriverPort))
|
wd, err := selenium.NewRemote(selenium.Capabilities{
|
||||||
|
"acceptInsecureCerts": true,
|
||||||
|
}, fmt.Sprintf("http://localhost:%d", geckoDriverPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -170,12 +172,12 @@ func main() {
|
||||||
|
|
||||||
if *serve {
|
if *serve {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// err := generateHTML(w, *largest, wd)
|
err = generateHTML(getSites(*largest, wd), w)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
// }
|
}
|
||||||
})
|
})
|
||||||
fmt.Printf("Serving on %v\n", port)
|
fmt.Printf("Serving on %v\n", *port)
|
||||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", *port), nil))
|
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", *port), nil))
|
||||||
} else {
|
} else {
|
||||||
file, err := os.Create(*filename)
|
file, err := os.Create(*filename)
|
||||||
|
@ -184,7 +186,7 @@ func main() {
|
||||||
}
|
}
|
||||||
err = generateHTML(getSites(*largest, wd), file)
|
err = generateHTML(getSites(*largest, wd), file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
shell.nix
Normal file
12
shell.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
let
|
||||||
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
|
||||||
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs; [
|
||||||
|
go
|
||||||
|
xorg.xorgserver # xorg.xvfb once https://github.com/NixOS/nixpkgs/commit/43ebb05c575221362b44d7cc9a0f0cd1b5d3a53d hits stable
|
||||||
|
xorg.xauth
|
||||||
|
];
|
||||||
|
}
|
|
@ -6,36 +6,63 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{n}hats.com domains</title>
|
<title>{n}hats.com domains</title>
|
||||||
<style>
|
<style>
|
||||||
body { max-width: 800px; font-family: sans-serif; margin: auto; }
|
body { max-width: 800px; font-family: sans-serif; margin: auto; padding: 0 20px; }
|
||||||
dt { font-weight: bold; }
|
dt { font-weight: bold; }
|
||||||
img { max-width: 100%; box-shadow: 0 0 10px 10px lightgray; }
|
img { max-width: 100%; box-shadow: 0 0 10px 10px lightgray; }
|
||||||
img:hover { box-shadow: 0 0 10px 10px darkgray}
|
img:hover { box-shadow: 0 0 10px 10px darkgray}
|
||||||
h3 { margin-top: 100px; }
|
h3 { margin-top: 100px; }
|
||||||
|
.errors { padding: 0.5rem; border: 1px solid #f5c6cb; color: #721c24; background: #f8d7da; }
|
||||||
* { line-height: 1.5em; }
|
* { line-height: 1.5em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{n}hats.com domains</h1>
|
<h1>{n}hats.com domains</h1>
|
||||||
|
<p><em>Last updated {{(index . 0).FetchTime.Format "Jan 2, 2006" }}</em></p>
|
||||||
|
{{ $errors := false -}}
|
||||||
|
{{- range . -}}
|
||||||
|
{{- with .Error -}}
|
||||||
|
{{- $errors = true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if $errors -}}
|
||||||
|
<div class="errors">
|
||||||
|
<h4>Errors occurred during processing</h3>
|
||||||
|
<ol>
|
||||||
|
{{- range . -}}
|
||||||
|
{{- if .Error }}
|
||||||
|
<li>{{.DomainName}}: {{.Error}}</li>
|
||||||
|
{{ end -}}
|
||||||
|
{{- end -}}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
<h3>Summary</h3>
|
<h3>Summary</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{{range .}}
|
{{range .}}
|
||||||
{{if .Available}}
|
{{if not .Error}}
|
||||||
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> – Available!</li>
|
{{if .Available}}
|
||||||
{{else}}
|
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> – Available!</li>
|
||||||
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> – Registered since {{(parseTime .DomainInfo.CreatedDate).Format "Mon Jan 2 2006" }}</li>
|
{{else}}
|
||||||
|
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> – Registered since {{(parseTime .DomainInfo.CreatedDate).Format "Jan 2, 2006" }}</li>
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
{{range .}}
|
{{range .}}
|
||||||
|
{{if not .Error}}
|
||||||
<h3 id="{{.DomainName}}">{{.DomainName}}</h3>
|
<h3 id="{{.DomainName}}">{{.DomainName}}</h3>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Fetched</dt>
|
<dt>Fetched</dt>
|
||||||
<dd>{{.FetchTime.Format "Mon Jan 2 15:04:05 -0700 MST 2006" }}</dd>
|
<dd>{{.FetchTime.Format "Jan 2, 2006 15:04:05 -0700" }}</dd>
|
||||||
{{if not .Available}}
|
{{if not .Available}}
|
||||||
<dt>Owner</dt>
|
<dt>Owner</dt>
|
||||||
|
{{if .Registrant}}
|
||||||
<dd><a href="mailto:{{.Registrant.Email}}">{{.Registrant.Name}} <{{.Registrant.Email}}></a></dd>
|
<dd><a href="mailto:{{.Registrant.Email}}">{{.Registrant.Name}} <{{.Registrant.Email}}></a></dd>
|
||||||
|
{{else}}
|
||||||
|
<dd>Information unavailable</dd>
|
||||||
|
{{end}}
|
||||||
<dt>Since</dt>
|
<dt>Since</dt>
|
||||||
<dd>{{(parseTime .DomainInfo.CreatedDate).Format "Mon Jan 2 2006" }}</dd>
|
<dd>{{(parseTime .DomainInfo.CreatedDate).Format "Jan 2, 2006" }}</dd>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{with .Title}}
|
{{with .Title}}
|
||||||
<dt>Title</dt>
|
<dt>Title</dt>
|
||||||
|
@ -48,9 +75,10 @@
|
||||||
</dl>
|
</dl>
|
||||||
{{if .ScreenshotURL}}
|
{{if .ScreenshotURL}}
|
||||||
<a href="http://{{.DomainName}}">
|
<a href="http://{{.DomainName}}">
|
||||||
<img src="{{.ScreenshotURL}}" alt="screenshot of {{.DomainName}} as of {{.FetchTime.Format "Mon Jan 2 15:04:05 -0700 MST 2006" }}">
|
<img src="{{.ScreenshotURL}}" alt="screenshot of {{.DomainName}} as of {{.FetchTime.Format "Jan 2, 2006 15:04:05 -0700" }}">
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue