mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
code cleanup
This commit is contained in:
parent
c04f54619b
commit
b223233318
70
main.go
70
main.go
@ -1,80 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
//"github.com/nkanaev/yarr/storage"
|
||||
//"github.com/nkanaev/yarr/worker"
|
||||
"github.com/nkanaev/yarr/server"
|
||||
//"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
/*
|
||||
store, err := storage.New()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Print(store)
|
||||
*/
|
||||
/*
|
||||
folder := store.CreateFolder("foo")
|
||||
store.RenameFolder(folder.Id, "bar")
|
||||
store.ToggleFolderExpanded(folder.Id, false)
|
||||
log.Print(store.ListFolders())
|
||||
*/
|
||||
/*
|
||||
feed := store.CreateFeed(
|
||||
"title", "description", "link", "feedlink", "icon", 1)
|
||||
store.RenameFeed(feed.Id, "newtitle")
|
||||
log.Print(store.ListFeeds())
|
||||
*/
|
||||
/*;
|
||||
items := make([]storage.Item, 3, 3)
|
||||
items = append(items, storage.Item{
|
||||
Id: "id",
|
||||
FeedId: 0,
|
||||
Title: "title",
|
||||
Link: "link",
|
||||
Description: "description",
|
||||
Content: "content",
|
||||
Author: "author",
|
||||
Date: 1,
|
||||
DateUpdated: 1,
|
||||
Status: storage.UNREAD,
|
||||
Image: "image",
|
||||
})
|
||||
items = append(items, storage.Item{
|
||||
Id: "id2",
|
||||
FeedId: 0,
|
||||
Title: "title",
|
||||
Link: "link",
|
||||
Description: "description",
|
||||
Content: "content",
|
||||
Author: "author",
|
||||
Date: 1,
|
||||
DateUpdated: 50,
|
||||
Status: storage.UNREAD,
|
||||
Image: "image",
|
||||
})
|
||||
items = append(items, storage.Item{
|
||||
Id: "id",
|
||||
FeedId: 0,
|
||||
Title: "title",
|
||||
Link: "link",
|
||||
Description: "description",
|
||||
Content: "content",
|
||||
Author: "author",
|
||||
Date: 1,
|
||||
DateUpdated: 100,
|
||||
Status: storage.UNREAD,
|
||||
Image: "image",
|
||||
})
|
||||
log.Print(store.CreateItems(items))
|
||||
log.Print(store.ListItems())
|
||||
*/
|
||||
/*
|
||||
log.Print(worker.FindFeeds("https://horriblesubs.info/"))
|
||||
log.Print(worker.FindFeeds("http://daringfireball.net/"))
|
||||
*/
|
||||
srv := server.New()
|
||||
srv.ListenAndServe()
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"net/http"
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type FeedSource struct {
|
||||
@ -13,7 +13,6 @@ type FeedSource struct {
|
||||
|
||||
const feedLinks = `link[type='application/rss+xml'],link[type='application/atom+xml']`
|
||||
|
||||
|
||||
func FindFeeds(r *http.Response) ([]FeedSource, error) {
|
||||
sources := make([]FeedSource, 0, 0)
|
||||
doc, err := goquery.NewDocumentFromResponse(r)
|
||||
|
@ -1,23 +1,23 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/nkanaev/yarr/storage"
|
||||
"github.com/mmcdole/gofeed"
|
||||
"net/http"
|
||||
"html/template"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"os"
|
||||
"log"
|
||||
"fmt"
|
||||
"github.com/mmcdole/gofeed"
|
||||
"github.com/nkanaev/yarr/storage"
|
||||
"html"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"mime"
|
||||
"strings"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"math"
|
||||
"html"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func IndexHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
@ -78,7 +78,6 @@ func FolderListHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
type UpdateFolder struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
IsExpanded *bool `json:"is_expanded,omitempty"`
|
||||
|
@ -1,12 +1,12 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"context"
|
||||
"regexp"
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
"github.com/nkanaev/yarr/storage"
|
||||
"log"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Route struct {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"strings"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"golang.org/x/net/html"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ItemStatus int
|
||||
|
@ -1,10 +1,10 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"os"
|
||||
"log"
|
||||
"database/sql"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var initQuery string = `
|
||||
|
Loading…
x
Reference in New Issue
Block a user