From 8b839f94063704782872cc11251975cfeae4584c Mon Sep 17 00:00:00 2001 From: lost+skunk Date: Fri, 5 Jul 2024 11:08:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20RSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/router.go | 3 ++ app/util.go | 102 +++++++++++++++++++++++++++++++++++------------- app/wraper.go | 14 +++++-- atom.xml | 43 ++++++++++++++++++++ html/gruser.htm | 4 +- html/list.htm | 2 +- 6 files changed, 135 insertions(+), 33 deletions(-) create mode 100644 atom.xml diff --git a/app/router.go b/app/router.go index 4da2f7d..d7f48b8 100644 --- a/app/router.go +++ b/app/router.go @@ -60,6 +60,9 @@ func Router() { } p, _ := strconv.Atoi(arg("p")) skunky.Page = p + if arg("atom") == "true" { + skunky.atom = true + } // пути switch path[1] { diff --git a/app/util.go b/app/util.go index cda0ffc..0d36fd8 100644 --- a/app/util.go +++ b/app/util.go @@ -200,39 +200,87 @@ func (s skunkyart) NavBase(c dlist) string { func (s skunkyart) DeviationList(devs []devianter.Deviation, content ...dlist) string { var list strings.Builder - list.WriteString(`
`) + if !s.atom { + list.WriteString(`
`) + } else { + list.WriteString(``) + list.WriteString(`SkunkyArt`) + // list.WriteString(``) + } for _, data := range devs { url := devianter.UrlFromMedia(data.Media) + if s.atom { + id := strconv.Itoa(data.ID) + list.WriteString(``) + list.WriteString(data.Author.Username) + list.WriteString(``) + list.WriteString(data.Title) + list.WriteString(``) + list.WriteString(id) + list.WriteString(``) + list.WriteString(data.PublishedTime.UTC().Format("Mon, 02 Jan 2006 15:04:05 -0700")) + list.WriteString(``) + list.WriteString(``) + list.WriteString(data.Title) + list.WriteString(`

`) + list.WriteString(ParseDescription(data.TextContent)) + list.WriteString(`

`) + } else { + list.WriteString(`") } - list.WriteString("
") - list.WriteString(s.NavBase(content[0])) + + if s.atom { + list.WriteString("") + s.Writer.Write([]byte(list.String())) + return "" + } else { + list.WriteString("
") + list.WriteString(s.NavBase(content[0])) + } return list.String() } diff --git a/app/wraper.go b/app/wraper.go index f3f025d..757602c 100644 --- a/app/wraper.go +++ b/app/wraper.go @@ -20,6 +20,7 @@ type skunkyart struct { Type rune Query string Page int + atom bool Templates struct { GroupUser struct { GR devianter.GRuser @@ -64,6 +65,7 @@ func (s skunkyart) GRUser() { switch s.Type { case 'a': g := group.GR + s.atom = false for _, x := range g.Gruser.Page.Modules { switch x.Name { case "about", "group_about": @@ -173,7 +175,9 @@ func (s skunkyart) GRUser() { s.ReturnHTTPError(400) } - s.ExecuteTemplate("html/gruser.htm", &s) + if !s.atom { + s.ExecuteTemplate("html/gruser.htm", &s) + } } // посты @@ -217,13 +221,17 @@ func (s skunkyart) Deviation(author, postname string) { func (s skunkyart) DD() { dd := devianter.DailyDeviationsFunc(s.Page) - s.ExecuteTemplate("html/list.htm", s.DeviationList(dd.Deviations, dlist{ + ddparsed := s.DeviationList(dd.Deviations, dlist{ Pages: 0, More: dd.HasMore, - })) + }) + if !s.atom { + s.ExecuteTemplate("html/list.htm", &ddparsed) + } } func (s skunkyart) Search() { + s.atom = false var e error ss := &s.Templates.Search switch s.Type { diff --git a/atom.xml b/atom.xml new file mode 100644 index 0000000..784f37d --- /dev/null +++ b/atom.xml @@ -0,0 +1,43 @@ + + + + yt:channel:UCuxpxCCevIlF-k-K5YU8XPA + UCuxpxCCevIlF-k-K5YU8XPA + https://yt3.googleusercontent.com/ytc/AIdro_n7bKr9iusclFjvYw3U8UR74iTCoMcdGTKI3h55SOG8mSsY=s900-c-k-c0x00ffffff-no-rj + Test + + + lost+skunk + https://skunky.ebloid.ru + + + https://ebloid.ru/_matrix/media/v3/download/ebloid.ru/enfAtfdjzCQMRNBgLXmiURfJ?allow_redirect=true + lost+skunk + + + + Test + + + lost+skunk + https://skunky.ebloid.ru + + +
+ + + +

test

+
+
+ 2024-07-04T00:37:55+00:00 + + GM Just Announced Their Shutting Down Production in America and Firing Their Workers + + test + + + + +
+
diff --git a/html/gruser.htm b/html/gruser.htm index 9035a88..89347aa 100644 --- a/html/gruser.htm +++ b/html/gruser.htm @@ -13,8 +13,8 @@

HOME | DD - | Gallery

{{else}}about">About - {{end}} + | Gallery{{else}}about">About{{end}} + | RSS
diff --git a/html/list.htm b/html/list.htm index 42bd2a5..23d48e5 100644 --- a/html/list.htm +++ b/html/list.htm @@ -6,7 +6,7 @@
-

HOME | DD

+

HOME | DD | RSS