This commit is contained in:
blank X 2021-08-11 20:22:30 +07:00
parent 301edec262
commit 6926e9f3e4
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
4 changed files with 25 additions and 24 deletions

20
main.go
View File

@ -1,18 +1,18 @@
package main package main
import ( import (
"os"
"fmt"
"log"
"sort"
"time"
"errors"
"context" "context"
"strings"
"net/url"
"crypto/x509" "crypto/x509"
"encoding/xml" "encoding/xml"
"errors"
"fmt"
"log"
"net/url"
"os"
"path/filepath" "path/filepath"
"sort"
"strings"
"time"
"git.sr.ht/~adnano/go-gemini" "git.sr.ht/~adnano/go-gemini"
"git.sr.ht/~adnano/go-gemini/tofu" "git.sr.ht/~adnano/go-gemini/tofu"
@ -181,10 +181,10 @@ func main() {
if len(aw.Items) == 0 { if len(aw.Items) == 0 {
feed.Updated = time.Now().Format(time.RFC3339) feed.Updated = time.Now().Format(time.RFC3339)
} else { } else {
feed.Updated = aw.Items[len(aw.Items) - 1].Date.Format(time.RFC3339) feed.Updated = aw.Items[len(aw.Items)-1].Date.Format(time.RFC3339)
} }
for i := len(aw.Items); i != 0; i-- { for i := len(aw.Items); i != 0; i-- {
item := aw.Items[i - 1] item := aw.Items[i-1]
link, err := req.URL.Parse(item.Link) link, err := req.URL.Parse(item.Link)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)

View File

@ -1,9 +1,9 @@
package main package main
import ( import (
"time"
"strings"
"encoding/xml" "encoding/xml"
"strings"
"time"
"git.sr.ht/~adnano/go-gemini" "git.sr.ht/~adnano/go-gemini"
) )
@ -41,6 +41,7 @@ type FeedItem struct {
} }
type ByTime []FeedItem type ByTime []FeedItem
func (a ByTime) Len() int { func (a ByTime) Len() int {
return len(a) return len(a)
} }

View File

@ -1,12 +1,12 @@
package main package main
import ( import (
"os"
"bufio" "bufio"
"net/url"
"os"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"net/url"
"path/filepath"
"git.sr.ht/~adnano/go-gemini" "git.sr.ht/~adnano/go-gemini"
) )

View File

@ -1,11 +1,11 @@
package main package main
import ( import (
"os"
"bufio" "bufio"
"strings"
"net/url" "net/url"
"os"
"path/filepath" "path/filepath"
"strings"
) )
var predirs map[string]*url.URL var predirs map[string]*url.URL