chore: assorted fixes
This commit is contained in:
parent
be614cb67e
commit
e54869e4a1
10
feed.go
10
feed.go
@ -237,7 +237,13 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error {
|
|||||||
loadTS := time.Now()
|
loadTS := time.Now()
|
||||||
refreshRate := 600
|
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)
|
tx, err := db.BeginTx(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -548,8 +554,8 @@ func (n *TwtTime) Scan(value any) error {
|
|||||||
n.Time, n.Valid = time.Time{}, false
|
n.Time, n.Valid = time.Time{}, false
|
||||||
return nil
|
return nil
|
||||||
case string:
|
case string:
|
||||||
n.Valid = true
|
|
||||||
n.Time, err = time.Parse(time.RFC3339, value)
|
n.Time, err = time.Parse(time.RFC3339, value)
|
||||||
|
n.Valid = err == nil
|
||||||
case time.Time:
|
case time.Time:
|
||||||
n.Valid = true
|
n.Valid = true
|
||||||
n.Time = value
|
n.Time = value
|
||||||
|
@ -74,6 +74,7 @@ func NewHTTPFetcher() *httpFetcher {
|
|||||||
ForceAttemptHTTP2: false,
|
ForceAttemptHTTP2: false,
|
||||||
MaxIdleConns: 100,
|
MaxIdleConns: 100,
|
||||||
IdleConnTimeout: 10 * time.Second,
|
IdleConnTimeout: 10 * time.Second,
|
||||||
|
ResponseHeaderTimeout: 5 * time.Second,
|
||||||
TLSHandshakeTimeout: 5 * time.Second,
|
TLSHandshakeTimeout: 5 * time.Second,
|
||||||
ExpectContinueTimeout: 1 * time.Second,
|
ExpectContinueTimeout: 1 * time.Second,
|
||||||
},
|
},
|
||||||
|
@ -32,10 +32,10 @@ func (a *API) conv(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||||
|
|
||||||
hash := r.PathValue("hash")
|
hash := r.PathValue("hash")
|
||||||
if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") {
|
// if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
// w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
limit := 100
|
limit := 100
|
||||||
if v, ok := strconv.Atoi(r.URL.Query().Get("limit")); ok == nil {
|
if v, ok := strconv.Atoi(r.URL.Query().Get("limit")); ok == nil {
|
||||||
|
@ -222,7 +222,7 @@ func (r *HTWriter) WriteTo(w io.Writer) (int64, error) {
|
|||||||
"/?uri="+twter.URI, twter.Nick,
|
"/?uri="+twter.URI, twter.Nick,
|
||||||
twter.URI, uri.Host,
|
twter.URI, uri.Host,
|
||||||
"/conv/"+subject, fmt.Sprintf("<time datetime='%s'>%s</time>", twt.Created().Format(time.RFC3339), twt.Created().Format(time.RFC822)),
|
"/conv/"+subject, fmt.Sprintf("<time datetime='%s'>%s</time>", twt.Created().Format(time.RFC3339), twt.Created().Format(time.RFC822)),
|
||||||
"/conv/"+subject,
|
"/conv/"+subject,
|
||||||
twt,
|
twt,
|
||||||
)
|
)
|
||||||
output += int64(i)
|
output += int64(i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user