diff --git a/feed.go b/feed.go index c14e93c..9d9bea9 100644 --- a/feed.go +++ b/feed.go @@ -237,7 +237,13 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error { loadTS := time.Now() refreshRate := 600 - feedID := uuid.UrlNS.UUID5(cmp.Or(f.Twter().HashingURI, f.Twter().URI)) + feedURI, _ := f.Info().GetN("uri", 0) + + feedID := uuid.UrlNS.UUID5(cmp.Or( + feedURI.Value(), + f.Twter().HashingURI, + f.Twter().URI, + )) tx, err := db.BeginTx(ctx, nil) if err != nil { @@ -548,8 +554,8 @@ func (n *TwtTime) Scan(value any) error { n.Time, n.Valid = time.Time{}, false return nil case string: - n.Valid = true n.Time, err = time.Parse(time.RFC3339, value) + n.Valid = err == nil case time.Time: n.Valid = true n.Time = value diff --git a/fetcher.go b/fetcher.go index 37d018a..89d74ea 100644 --- a/fetcher.go +++ b/fetcher.go @@ -74,6 +74,7 @@ func NewHTTPFetcher() *httpFetcher { ForceAttemptHTTP2: false, MaxIdleConns: 100, IdleConnTimeout: 10 * time.Second, + ResponseHeaderTimeout: 5 * time.Second, TLSHandshakeTimeout: 5 * time.Second, ExpectContinueTimeout: 1 * time.Second, }, diff --git a/http-api.go b/http-api.go index 4cd194f..7ffa9f6 100644 --- a/http-api.go +++ b/http-api.go @@ -32,10 +32,10 @@ func (a *API) conv(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain; charset=utf-8") hash := r.PathValue("hash") - if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") { - w.WriteHeader(http.StatusBadRequest) - return - } + // if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") { + // w.WriteHeader(http.StatusBadRequest) + // return + // } limit := 100 if v, ok := strconv.Atoi(r.URL.Query().Get("limit")); ok == nil { diff --git a/http-html.go b/http-html.go index 526671a..937ea49 100644 --- a/http-html.go +++ b/http-html.go @@ -222,7 +222,7 @@ func (r *HTWriter) WriteTo(w io.Writer) (int64, error) { "/?uri="+twter.URI, twter.Nick, twter.URI, uri.Host, "/conv/"+subject, fmt.Sprintf("", twt.Created().Format(time.RFC3339), twt.Created().Format(time.RFC822)), - "/conv/"+subject, + "/conv/"+subject, twt, ) output += int64(i) diff --git a/http.go b/http.go index 99cec40..8fded7a 100644 --- a/http.go +++ b/http.go @@ -30,8 +30,8 @@ func httpServer(ctx context.Context, app *appState) error { } html := HTML{ - app: app, - db: db, + app: app, + db: db, hostname: app.args.Hostname, }