1
0
Fork 0
Commit graph

165 commits

Author SHA1 Message Date
6da1ed8fd2 Fix some “Numerical overflow” errors
When starting a new blog, or trying to run on some very old data, there is no
data available on any bogus or legitimate comments. When this happens Tekuti
will try to divide by 0 and divide 0 by other things in a few places, assuming
that there is at least _some_ data about bogus and legitimate comments.

I’m not 100% sure what the expectation is of these calculations, so I might have
chosen the wrong solution, but it seems to me that if there is no data
available, all we know is that there is nothing (0).

This fixes an issue with both trying to comment on a fresh new data set, or a
dataset that hasn’t been touched since 2014.
2021-05-30 01:21:47 -07:00
480c050275 Check that a revision has been provided before trying to parse it
When setting up Tekuti for the first time the ‘compute-bogus-comments’ will get
the current commit passed in and try to get the parent. Since there is only the
“initial commit” at this stage it will get ‘#f’ as the parent commit and pass it
in to ‘fold-commits’. Trying to parse revision ‘#f’ will surely fail.

The ‘fold-commits’ function already expects that ‘rev’ might be empty, so this
should work out fine.
2021-05-30 01:16:48 -07:00
Andy Wingo
ae3d83d5f2 Fix comments-open? logic. sadness 2021-03-08 15:49:41 +01:00
Andy Wingo
70a93318b4 Fix comments-closed-timestamp spec parser 2021-03-08 15:42:29 +01:00
Andy Wingo
768578c873 Fix comments-closed-timestamp spec parser 2021-03-08 15:37:34 +01:00
Andy Wingo
d6cee09123 Fix serializing no-comments-closed-date state 2021-03-08 15:16:26 +01:00
Andy Wingo
60bc3db10f Add comment closing window feature
* tekuti/config.scm (*comments-open-window*): New config, indicating
seconds for which to keep comments open.
* tekuti/page-helpers.scm (post-editing-form): Expose comments closed
date feature.
* tekuti/page.scm (page-new-comment): Oops -- we were missing a
server-side comments-open check!
* tekuti/post.scm (*post-spec*): Serialize comments-closed-timestamp.
(post-comments-open?): Return false if we are after the
comments-closed-timestamp.
(post-comments-closed-timestamp): New accessor.
(munge-post): Write comments-closed-timestamp.
(parse-post-data): Parse comments-closed-timestamp from form data.
2021-03-08 15:04:23 +01:00
Andy Wingo
bb11cb984e Fix a nodelist issue in admin edit page 2019-06-26 15:37:37 +02:00
Andy Wingo
83c47a9185 Make raw text closing tag check reflect the spec
* tekuti/page-helpers.scm (shtml->html): The previous code was too
  strict.
2019-05-31 16:11:32 +02:00
Andy Wingo
5cdda50445 Fix another accidental-nodelist area
* tekuti/page.scm (page-admin): Fix accidental nodelist.
2019-05-31 15:56:41 +02:00
Andy Wingo
9d9d39c7f5 Allow numbers in shtml->html
* tekuti/page-helpers.scm (shtml->html): Allow numbers.
2019-05-31 15:51:08 +02:00
Andy Wingo
83fd0a044e Unroll a few locations that were receiving nodelists
* tekuti/page-helpers.scm (post-editing-form):
* tekuti/page.scm (page-index, page-show-post): show-post returns a
  nodelist; deal with it.
2019-05-31 15:42:30 +02:00
Andy Wingo
b16c08a385 Serialize as HTML rather than XHTML
* tekuti/page-helpers.scm (html-doctype): Relax to HTML doctype.
  (define-tag-set, void-element?, template-element?, raw-text-element?)
  (escapable-raw-text-element?, foreign-element?, make-char-quotator)
  (attribute-value-empty?, attribute-value-needs-quotes-chars)
  (attribute-value-needs-quotes?, print-attribute-value/quoted)
  (print-text/quoted, shtml->html): Emit HTML by default.  This will
  allow documents to contain <script> tags which themselves have &, <,
  and so on.
2019-05-31 15:31:04 +02:00
Andy Wingo
ff529670e1 Fix env invocation 2017-03-06 14:18:37 +00:00
Andy Wingo
493fe697ba Update parsed entities 2017-03-06 11:17:39 +01:00
Andy Wingo
5e603daa9e Add bogus comment detector.
* tekuti/classifier.scm: New file.
* Makefile.am: Add new file.
* tekuti/comment.scm:
* tekuti/git.scm:
* tekuti/index.scm:
* tekuti/page.scm: Update to include bogus comment detector.
2017-03-06 09:41:52 +01:00
Andy Wingo
42b77efe6a Neutralize links in comments. 2017-03-03 17:13:36 +01:00
Andy Wingo
01ca951b76 Improve security question. Fix reindexing. 2017-03-02 15:28:55 +00:00
Andy Wingo
e700e4af7a Fix spurious 304 error
* tekuti/cache.scm (make-entry): Only return a cached not-modified
  response if the request was conditional.
2016-08-28 10:58:34 +02:00
Andy Wingo
7643585d12 Fix 304 edge case in atom feed
* tekuti/page.scm (atom-feed-from-posts): Don't bomb if the client sends
  a if-modified-since but we have no posts.
2016-08-28 10:40:36 +02:00
Andy Wingo
cf10aa7056 New posts start in private status
* tekuti/page-helpers.scm (post-editing-form): Fix status of new posts.
2014-12-17 11:19:49 +01:00
Andy Wingo
acc13819e1 Minor aesthetic fixups
* tekuti/page-helpers.scm (post-editing-form): Aesthetic fixups.
2014-12-17 11:17:56 +01:00
Andy Wingo
20e7658295 Add ability to share draft posts
As a side effect of this change, any pending posts in your repository
that are in "draft" status will effectively move into the new "draft"
state, which means they can be reached by their URL.  That's not a big
deal though because those URLs are not trivial to guess.

* tekuti/page-helpers.scm (post-editing-form): Add radio button to
  choose post status.

* tekuti/post.scm (post-public?, post-draft?, post-private?): New
  accessors for post status.
  (post-from-key): Add #:allow-draft? keyword argument.

* tekuti/page.scm (page-show-post): Allow direct access to draft posts.
2014-12-17 11:05:07 +01:00
Andy Wingo
7ecade64bd Fix expanduser on absolute paths.
* tekuti/util.scm (expanduser): Fix when given absolute paths.
2014-10-22 16:14:59 +02:00
Andy Wingo
e45cd521f9 Add example nginx config.
* nginx-config: New file.
2014-10-22 15:50:31 +02:00
Andy Wingo
68e7b82b21 Add example config
* example-config: New file
2014-10-22 15:46:35 +02:00
Andy Wingo
6d491994f7 ensure-uri-reference works with older Guiles
* tekuti/page-helpers.scm (ensure-uri-reference): Fix to work with Guile
  without build-uri-reference.
2014-10-22 15:29:28 +02:00
Andy Wingo
ab54aca59f Support for relative URIs for https + http access.
* tekuti/page-helpers.scm (ensure-uri): Rename from ensure-public-uri.
  A URI is absolute by definition.
  (ensure-uri-reference): New helper.  Requires git guile.
  (respond): Use ensure-URI-reference to get the reference.
  (atom-header, atom-entry): Use ensure-uri.

* tekuti/page.scm (atom-feed-from-posts): Pass the URI scheme from the
  request-uri when reconstructing

* tekuti/config.scm (*public-scheme*): New config variable, defaulting
  to http.
2014-10-15 12:08:51 +02:00
Andy Wingo
c631aaf35c Allow scheme-relative URIs in urlish?
* tekuti/util.scm (urlish?): Allow scheme-relative URIs.
2014-10-15 09:46:53 +02:00
Andy Wingo
c087e7b6fa Scheme-relative URL
* tekuti/template.scm (templatize): Use scheme-relative URL for tekuti.
2014-10-15 09:35:36 +02:00
Andy Wingo
89da28b752 Better mobile experience
* tekuti/template.scm (templatize): Render using device width as
  viewport, for better mobile experience.
2014-10-09 20:38:18 +02:00
Andy Wingo
9d43521793 Downcase when creating posts.
* tekuti/post.scm (parse-post-data): Downcase when creating posts also.
2014-01-19 20:53:28 +01:00
Andy Wingo
e8eb7aa176 Work around uri-encode changing capitalization
* tekuti/page.scm (make-post-key): Downcase, to cope with uri-encode
  from Guile changing from lower-case hexidecimals to upper-case.
  Otherwise older post keys wouldn't work...
2014-01-19 18:56:52 +01:00
Andy Wingo
a08ae0c9a7 make urlish? less -ish
* tekuti/util.scm (urlish?): Use string->uri.
2012-06-03 23:49:14 +02:00
Andy Wingo
085b4c76ef faster git-rev-parse
* tekuti/git.scm (git-rev-parse): Try to read the ref ourselves, first.
  Fall back to using git if that doesn't work (for example, if it's a
  packed ref).
2012-02-15 22:31:54 +01:00
Andy Wingo
8034123827 no sxml, no body
* tekuti/page-helpers.scm (respond): Give no body if there is no SXML.
  Fixes perhaps spurious errors raised by Guile's web server.
2012-02-14 17:29:08 +01:00
Andy Wingo
82c7790016 remove trailing whitespace 2012-02-12 20:48:50 +01:00
Andy Wingo
29a6144123 handle HEAD requests (requires Guile from today)
* tekuti/request.scm (request-path-case): Dispatch HEAD requests as GET
  requests, relying on new Guile web servers to elide the HEAD body.
2012-02-12 13:46:22 +01:00
Andy Wingo
afec0daa99 stop hitting git when fetching post metadata
Inspired by a patch from Aleix Conchillo Flaqué.  Thanks, Aleix!

* tekuti/index.scm (index-specs):
* tekuti/post.scm (reindex-posts, reindex-posts-by-date): Change to have
  the "posts" index be a hash table mapping key -> post.
  "posts-by-date" is a list of keys, from newest to oldest.
  (post-from-git): This is what post-from-key was.
  (post-from-key): New function, pulls out a post from the posts hash
  table.
  (munge-post): Use post-from-git.
  (delete-post): Take the post directly.
  (latest-posts): New awesome helper for fetching the lastest N posts
  that match some predicates.

* tekuti/page-helpers.scm (find-posts-matching): Adapt to post-from-key
  change.
  (published-posts): Remove, replaced with latest-posts.

* tekuti/page.scm (page-admin, page-admin-posts, page-admin-post)
  (page-archives, page-feed-atom): Use the new latest-posts helper.
  (page-admin-delete-post, page-admin-delete-comment, page-show-post)
  (page-new-comment, page-show-tag): Adapt to post-from-key change.

* tekuti/tags.scm (compute-related-posts, compute-related-tags): Adapt
  to post-from-key change.
  (reindex-tags): Use latest-posts.
2012-02-11 18:54:51 +01:00
Andy Wingo
f89e4b128b better errors when reindexing
* tekuti/index.scm (maybe-reindex): Reindex within a
  call-with-error-handling.
2012-02-11 18:38:21 +01:00
Andy Wingo
7a1944b240 per-tag feed links
* tekuti/page.scm (page-show-tag): Add a feed link here.
2011-04-26 15:39:06 +02:00
Andy Wingo
62a351d8d5 optimization for with=foo
* tekuti/page.scm (page-feed-atom): Reduce "with=unknown" to nothing.
2011-04-26 15:12:05 +02:00
Andy Wingo
cee672f117 multiple with query args add tags to the set
* tekuti/page.scm (page-feed-atom): Reimplement more clearly, and give
  "with" inclusionary meaning.
2011-04-25 20:30:57 +02:00
Andy Wingo
08e1e58f1f add ?with=guile&without=gnu
* tekuti/page.scm (page-feed-atom): Reimplement Brian's thing with
  "with" and "without" query args, to allow for multiple tags to be
  included or excluded.

* tekuti/request.scm (request-query-ref-all): New helper.
2011-04-25 20:06:11 +02:00
Andy Wingo
26216a593a with-i/o procedures close their ports
* tekuti/util.scm (with-output-to-string*, with-input-from-string*): New
  hacky helpers, which close the port before returning the string or
  result.  Hopefully reduce pressure on the GC.
  (shell:quote):
* tekuti/git.scm (git-commit-reverse-operations, with-output-to-blob*)
  (with-input-from-blob*):
* tekuti/filters.scm (wordpress->sxml): Use the string* procedures.
2011-04-25 19:10:07 +02:00
Brian Gough
a4bad7a561 add atom feeds for tags 2011-04-25 19:05:49 +02:00
Andy Wingo
efc25df8f4 don't bother allocating iconv info on pipe
* tekuti/git.scm (run): Don't set encoding on pipe, as we just use
  bytevector io anyway.
2011-02-22 23:52:11 +01:00
Andy Wingo
a05d9a5df8 use ice-9 binary-ports
* tekuti/git.scm:
* tekuti/request.scm: Use ice-9 binary-ports instead of (rnrs io
  ports).
2011-02-22 22:21:30 +01:00
Andy Wingo
1636c96f9f remove obsolete (tekuti url)
* tekuti/url.scm: Remove.
* Makefile.am: Remove url.scm

* tekuti/post.scm: Remove reference to (tekuti url).
  (parse-post-data): Use uri-encode.
2011-02-22 22:19:30 +01:00
Aleix Conchillo Flaque
800e7d9a05 do not remove numbers and s/./-/ in post keys 2011-02-18 23:36:10 +01:00