mirror of
https://github.com/nkanaev/yarr.git
synced 2025-09-14 02:10:04 +00:00
readability integration
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"math"
|
||||
"html"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func IndexHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
@@ -472,3 +473,16 @@ func OPMLExportHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
rw.Write([]byte(builder.String()))
|
||||
}
|
||||
}
|
||||
|
||||
func PageCrawlHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
query := req.URL.Query()
|
||||
if url := query.Get("url"); len(url) > 0 {
|
||||
res, err := http.Get(url)
|
||||
if err == nil {
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
if err == nil {
|
||||
rw.Write(body)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -82,6 +82,7 @@ var routes []Route = []Route{
|
||||
p("/api/settings", SettingsHandler),
|
||||
p("/opml/import", OPMLImportHandler),
|
||||
p("/opml/export", OPMLExportHandler),
|
||||
p("/page", PageCrawlHandler),
|
||||
}
|
||||
|
||||
func Vars(req *http.Request) map[string]string {
|
||||
|
Reference in New Issue
Block a user