diff --git a/src/twtxtlist.nim b/src/twtxtlist.nim index a451c97..094c2f3 100644 --- a/src/twtxtlist.nim +++ b/src/twtxtlist.nim @@ -1,4 +1,4 @@ -import asyncdispatch, db_sqlite, httpclient, jester, moustachu, os, shorturl, +import asyncdispatch, db_sqlite, httpclient, jester, json, moustachu, os, shorturl, strutils, tables, templates/all, times, tweet/parse, twtxt, typetraits let @@ -122,6 +122,20 @@ routes: renderMustache "users", usersTemplate, ctx + get "/users.txt": + let + headers = { + "Content-Type": "text/plain" + } + users = db.getAllRows(sql"select username, url from users order by username") + + var outBuf = "" + + for user in users.items(): + outBuf &= "twtxt follow " & user[0] & " " & user[1] & "\r\n" + + resp Http200, headers, outBuf + get "/users/@name/@page": try: var