package main import ( "fmt" "net/http" "strconv" "strings" "time" "go.wit.com/log" ) func indexHeader(w http.ResponseWriter) { fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "
") // fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, "") } func indexBodyStart(w http.ResponseWriter) { // fmt.Fprintln(w, " fmt.Fprintln(w, "") fmt.Fprintln(w, "Package (IPv6 only) | ") fmt.Fprintln(w, "Documentation | ") fmt.Fprintln(w, "Version | ") fmt.Fprintln(w, "Age | ") fmt.Fprintln(w, "Dev Version | ") fmt.Fprintln(w, "Description | ") // fmt.Fprintln(w, "Authoritative sources (IPv6 only) | ") // fmt.Fprintln(w, "") fmt.Fprintln(w, " | |
---|---|---|---|---|---|---|---|---|
", strings.Join(parts, " "), " | ||||||||
log/ (needed for the gui) | ||||||||
"+gourl+" | ") fmt.Fprintln(w, ""+gourl+" | ") fmt.Fprintln(w, "") // for i, s := range versionMap { // log.Println("found i =", i, "with", "s =", s) // } var vtime, version string gourl = strings.TrimSpace(gourl) tmp, _ := versionMap[gourl] parts := strings.Split(tmp, " ") if len(parts) > 0 { vtime = parts[0] } if len(parts) > 1 { version = parts[1] } log.Warn("gourl ", gourl, "vtime =", vtime, "version =", version) if vtime != "" { // Convert the string to an integer gitTagTimestampInt, _ := strconv.ParseInt(vtime, 10, 64) // Parse the Unix timestamp into a time.Time object gitTagDate := time.Unix(gitTagTimestampInt, 0) // Get the current time currentTime := time.Now() // Calculate the duration between the git tag date and the current time duration := currentTime.Sub(gitTagDate) vtime = formatDuration(duration) } fmt.Fprintln(w, " | "+version+" | ") // version fmt.Fprintln(w, ""+vtime+" | ") // dev version if gourl == "go.wit.com/apps/helloworld" { fmt.Fprintln(w, "Video Demo | ") // dev version } else { fmt.Fprintln(w, "") // dev version } fmt.Fprintln(w, " | "+desc+" | ") // fmt.Fprintln(w, ""+giturl+" | ") fmt.Fprintln(w, "