Skip to content

Commit

Permalink
switch to chronological order in /local and drop /federated
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Apr 13, 2024
1 parent 17b06ad commit 9cac790
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 189 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Welcome, fedinaut! localhost.localdomain:8443 is an instance of tootik, a federa
⚡️ Followed users
😈 My profile
📡 This planet
✨ FOMO from outer space
🔥 Hashtags
🔭 Find user
🔎 Search posts
Expand Down
2 changes: 0 additions & 2 deletions front/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

* /local shows a compact list of local posts; each entry contains a link to /view.
* / is the homepage: it shows an ASCII art logo, a short description of this server and a list of local posts.
* /federated shows a compact list of federated posts.
* /hashtag shows a compact list of posts with a given hashtag.
* /search shows an input prompt and redirects to /hashtag.
* /hashtags shows a list of popular hashtags.
Expand Down Expand Up @@ -42,7 +41,6 @@ Users are authenticated using TLS client certificates; see [Gemini protocol spec
Some clients generate a certificate for / (all pages of this capsule) when /foo requests a client certificate, while others use the certificate requested by /foo only for /foo and /foo/bar. Therefore, pages that don't require authentication are also mirrored under /users:

* /users/local
* /users/federated
* /users/hashtag
* /users/hashtags
* /users/fts
Expand Down
38 changes: 0 additions & 38 deletions front/federated.go

This file was deleted.

3 changes: 0 additions & 3 deletions front/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ func NewHandler(domain string, closed bool, cfg *cfg.Config) (Handler, error) {
h.handlers[regexp.MustCompile(`^/local$`)] = withCache(withUserMenu(h.local), time.Minute*15, &cache, cfg)
h.handlers[regexp.MustCompile(`^/users/local$`)] = withCache(withUserMenu(h.local), time.Minute*15, &cache, cfg)

h.handlers[regexp.MustCompile(`^/federated$`)] = withCache(withUserMenu(h.federated), time.Minute*10, &cache, cfg)
h.handlers[regexp.MustCompile(`^/users/federated$`)] = withCache(withUserMenu(h.federated), time.Minute*10, &cache, cfg)

h.handlers[regexp.MustCompile(`^/outbox/(\S+)$`)] = withUserMenu(h.userOutbox)
h.handlers[regexp.MustCompile(`^/users/outbox/(\S+)$`)] = withUserMenu(h.userOutbox)
h.handlers[regexp.MustCompile(`^/users/me$`)] = withUserMenu(me)
Expand Down
35 changes: 7 additions & 28 deletions front/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,23 @@ func (h *Handler) local(w text.Writer, r *request, args ...string) {
func(offset int) (*sql.Rows, error) {
return r.Query(
`
select u.object, u.actor, u.sharer, u.inserted from
select object, actor, sharer, inserted from
(
select notes.id, notes.author, notes.object, notes.inserted, persons.actor, null as sharer from persons
select notes.object, persons.actor, null as sharer, notes.inserted from persons
join notes
on notes.author = persons.id
where notes.public = 1 and persons.host = $1
union
select notes.id, notes.author, notes.object, shares.inserted, persons.actor, sharers.actor as sharer from persons sharers
union all
select notes.object, persons.actor, sharers.actor as sharer, shares.inserted from persons sharers
join shares
on shares.by = sharers.id
join notes
on notes.id = shares.note
join persons
on persons.id = notes.author
where notes.public = 1 and notes.host != $1 and sharers.host = $1
) u
left join (
select object->>'$.inReplyTo' as id, count(*) as count from notes
where host = $1 and inserted > unixepoch()-60*60*24*7
group by object->>'$.inReplyTo'
) replies
on
replies.id = u.id
left join (
select author, max(inserted) as last, round(count(*)/7.0, 1) as avg from notes
where host = $1 and inserted > unixepoch()-60*60*24*7
group by author
) stats
on
stats.author = u.author
group by
u.id
order by
u.inserted / 86400 desc,
replies.count desc,
stats.avg asc,
stats.last asc,
u.inserted desc
where notes.public = 1 and sharers.host = $1
)
order by inserted desc
limit $2
offset $3
`,
Expand Down
1 change: 0 additions & 1 deletion front/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func writeUserMenu(w text.Writer, user *ap.Actor) {
}

w.Link(prefix+"/local", "📡 This planet")
w.Link(prefix+"/federated", "✨ FOMO from outer space")

if user == nil {
w.Link("/hashtags", "🔥 Hashtags")
Expand Down
17 changes: 0 additions & 17 deletions front/static/help.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ This is an instance of tootik, a "slow", "boring" and non-addictive social netwo

This page shows public posts published on this server.

Posts are sorted by:
* Day of posting
* Number of replies
* Author's number of posts
* Time since the author's previous post
* Exact time of posting

> ✨ FOMO from outer space

This page shows public posts from the fediverse.

Posts are sorted by:
* Hour of posting
* Author's number of posts
* Time since the author's previous post
* Exact time of posting

> 🔥 Hashtags

This page shows popular hashtags, allowing you to discover trends and shared interests.
Expand Down
17 changes: 0 additions & 17 deletions front/static/users/help.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ This page shows your profile.

This page shows public posts published on this server.

Posts are sorted by:
* Day of posting
* Number of replies
* Author's number of posts
* Time since the author's previous post
* Exact time of posting

> ✨ FOMO from outer space

This page shows public posts from the fediverse.

Posts are sorted by:
* Hour of posting
* Author's number of posts
* Time since the author's previous post
* Exact time of posting

> 🔥 Hashtags

This page shows popular hashtags, allowing you to discover trends and shared interests.
Expand Down
82 changes: 0 additions & 82 deletions test/federated_test.go

This file was deleted.

0 comments on commit 9cac790

Please sign in to comment.