diff --git a/src/quotesite.nim b/src/quotesite.nim index 7daa94b..1b4aac9 100644 --- a/src/quotesite.nim +++ b/src/quotesite.nim @@ -26,7 +26,8 @@ try: db.exec(sql"""create table if not exists votes ( id integer primary key, quoteid integer, - ip TEXT UNIQUE);""") + ip TEXT, + UNIQUE (quoteid, ip));""") try: db.exec(sql"""ALTER TABLE quotes @@ -176,7 +177,7 @@ routes: case @"kind": of "browse": - rows = db.getAllRows(sql"SELECT * FROM quotes ORDER BY time desc LIMIT 20 OFFSET ?", (qid * 20)) + rows = db.getAllRows(sql"SELECT * FROM quotes where deleted=0 ORDER BY time desc LIMIT 20 OFFSET ?", (qid * 20)) title = "page " & @"id" of "quotes": @@ -187,7 +188,7 @@ routes: if (@"kind").startsWith "hashtag-": let channel = (@"kind").replace("hashtag-", "#") - rows = db.getAllRows(sql"SELECT * FROM quotes WHERE channel=? ORDER BY time desc LIMIT 20 OFFSET ?", channel, qid * 20) + rows = db.getAllRows(sql"SELECT * FROM quotes WHERE channel=?, deleted=0 ORDER BY time desc LIMIT 20 OFFSET ?", channel, qid * 20) title = channel & " page " & @"id" else: diff --git a/src/quotesite.nims b/src/quotesite.nims index e69de29..68c9832 100644 --- a/src/quotesite.nims +++ b/src/quotesite.nims @@ -0,0 +1,2 @@ +--define:release +--deadCodeElim:on