diff options
Diffstat (limited to '')
-rw-r--r-- | contexts.c | 3 | ||||
-rw-r--r-- | networks.c | 4 | ||||
-rw-r--r-- | scooper.1 | 61 | ||||
-rw-r--r-- | server.c | 5 | ||||
-rw-r--r-- | server.h | 1 |
5 files changed, 45 insertions, 29 deletions
diff --git a/contexts.c b/contexts.c index 77774ae..d8eb4fd 100644 --- a/contexts.c +++ b/contexts.c @@ -26,7 +26,7 @@ const char *ContextsQuery = SQL( SELECT time, context FROM events ORDER BY event DESC - LIMIT 500 // TODO: Configurable. + LIMIT :recent ), activeContexts AS ( SELECT name, query FROM contexts @@ -60,6 +60,7 @@ enum kcgi_err pageContexts(struct kreq *req) { || htmlNav(&html, network, NULL); if (error) return error; + dbBindInt(stmt.contexts, ":recent", pageRecent); dbBindText(stmt.contexts, ":network", network); if (pagePublic) dbBindInt(stmt.contexts, ":query", false); diff --git a/networks.c b/networks.c index f397bab..7f974c4 100644 --- a/networks.c +++ b/networks.c @@ -26,7 +26,7 @@ const char *NetworksQuery = SQL( SELECT time, context FROM events ORDER BY event DESC - LIMIT 500 // TODO: Configurable. + LIMIT :recent ), activeNetworks AS ( SELECT DISTINCT network FROM contexts @@ -55,6 +55,8 @@ enum kcgi_err pageNetworks(struct kreq *req) { || htmlNav(&html, NULL, NULL); if (error) return error; + dbBindInt(stmt.networks, ":recent", pageRecent); + enum State { None, Active, diff --git a/scooper.1 b/scooper.1 index 9350ad1..c05676b 100644 --- a/scooper.1 +++ b/scooper.1 @@ -1,21 +1,29 @@ -.Dd July 9, 2020 +.Dd July 10, 2020 .Dt SCOOPER 1 .Os . .Sh NAME .Nm scooper -.Nd web interface for litterbox +.Nd litterbox web interface . .Sh SYNOPSIS .Nm -.Op Fl cfp +.Op Fl fp +.Op Fl l Ar limit +.Op Fl r Ar recent .Op Fl s Ar url .Ar database . +.Nm +.Fl c +.Ar database +. .Sh DESCRIPTION +The .Nm -is a CGI and FastCGI -web interface to the +daemon +provides a CGI or FastCGI +web interface for the .Xr litterbox 1 IRC log database. . @@ -23,41 +31,42 @@ IRC log database. The arguments are as follows: .Bl -tag -width Ds .It Fl c -Exit after preparing statements. +Prepare all SQL statements against the given +.Ar database +and exit. +. .It Fl f Become a FastCGI worker, which can be managed by .Xr kfcgi 8 . +. +.It Fl l Ar limit +Limit the number of events +to be displayed on one page. +The default limit is 100. +. .It Fl p -Only show public contexts, +Show only public contexts, i.e. channels. +. +.It Fl r Ar recent +Limit the number of recent events +used to determine active networks and contexts. +The default limit is 500. +. .It Fl s Ar url -Use the stylesheet -.Ar url . +Include the stylesheet +.Ar url +rather than the default. +. .It Ar database The path to the .Xr litterbox 1 database. .El . -.Ss Pages -.Bl -tag -width Ds -.It Pa /networks -Lists the networks in the database. -.It Pa /contexts?network=network -Lists the contexts in the given network. -.It Pa /events?network=network&context=context&after=time -Shows events from the given context -starting from -.Ar time . -.It Pa /search?network=network&context=context&query=query -Shows events from the optional context which match -.Ar query . -.El -. .Sh SEE ALSO -.Xr litterbox 1 , -.Xr scoop 1 +.Xr litterbox 1 . .Sh AUTHORS .An June Bug Aq Mt june@causal.agency diff --git a/server.c b/server.c index ac8fc4f..4955524 100644 --- a/server.c +++ b/server.c @@ -47,6 +47,7 @@ const struct kvalid Keys[KeysLen] = { bool pagePublic; int pageLimit = 100; +int pageRecent = 500; static const char CSS[] = { #include "default.css.h" @@ -77,11 +78,13 @@ int main(int argc, char *argv[]) { bool fastCGI = false; bool test = false; - for (int opt; 0 < (opt = getopt(argc, argv, "cfps:"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "cfl:pr:s:"));) { switch (opt) { break; case 'c': test = true; break; case 'f': fastCGI = true; + break; case 'l': pageLimit = strtol(optarg, NULL, 10); break; case 'p': pagePublic = true; + break; case 'r': pageRecent = strtol(optarg, NULL, 10); break; case 's': htmlStylesheet = optarg; break; default: return EX_USAGE; } diff --git a/server.h b/server.h index 5d37176..ba08a89 100644 --- a/server.h +++ b/server.h @@ -110,6 +110,7 @@ extern const struct kvalid Keys[KeysLen]; extern bool pagePublic; extern int pageLimit; +extern int pageRecent; enum kcgi_err pageNetworks(struct kreq *req); enum kcgi_err pageContexts(struct kreq *req); |