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()
|
||||
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
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user