Fix screenshot URLs

This commit is contained in:
Chandler Swift 2021-10-18 17:56:43 -05:00
parent 3b04e71da1
commit d2fce5a876
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -26,6 +26,7 @@ done
*/ */
import ( import (
"encoding/base64"
"flag" "flag"
"fmt" "fmt"
"html/template" "html/template"
@ -42,7 +43,7 @@ type HatsSite struct {
DomainName string DomainName string
Owner string Owner string
Since time.Time Since time.Time
ScreenshotURL string ScreenshotURL template.URL
Title string Title string
FetchTime time.Time FetchTime time.Time
HTTPOpen bool HTTPOpen bool
@ -71,7 +72,7 @@ func getSites(largest int, wd selenium.WebDriver) (sites []HatsSite, err error)
sites = append(sites, HatsSite{ sites = append(sites, HatsSite{
DomainName: domainName, DomainName: domainName,
Owner: "unknown", Owner: "unknown",
ScreenshotURL: string(screenshot), ScreenshotURL: template.URL(fmt.Sprintf("data:image/png;base64,%v", base64.StdEncoding.EncodeToString(screenshot))),
Title: title, Title: title,
FetchTime: time.Now(), FetchTime: time.Now(),
HTTPOpen: false, // TODO HTTPOpen: false, // TODO