From: Siraaj Khandkar Date: Wed, 11 Nov 2020 17:18:34 +0000 (-0500) Subject: Implement user agent format for discoverability X-Git-Tag: 0.3.0 X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=8fae9613d96be1f818eedf19165c174a63e16581;p=tt.git Implement user agent format for discoverability --- diff --git a/tt b/tt index 0edaa8b..ecafb5c 100755 --- a/tt +++ b/tt @@ -34,9 +34,6 @@ ; - d | download ; - u | upload ; - calls user-configured command to upload user's own feed file to their server -; TODO user-agent format: / (+; @) -; - requires configurability -; - ref: https://twtxt.readthedocs.io/en/latest/user/discoverability.html #lang racket @@ -204,9 +201,21 @@ (current-logger logger)) (define (main) + (define user-agent + (let* + ([prog-name "tt"] + [prog-version "0.3.0"] + [user-feed-file (expand-user-path "~/twtxt-me.txt")] + [user (list-ref (file->feeds user-feed-file) 0)]) + (format "~a/~a (+~a; @~a)" + prog-name + prog-version + (feed-uri user) + (feed-nick user)))) + (setup-logging) (current-http-response-auto #f) - (current-http-user-agent "xandkar/tt 0.2.0") + (current-http-user-agent user-agent) (date-display-format 'rfc2822) (define args (current-command-line-arguments))