From 8fae9613d96be1f818eedf19165c174a63e16581 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Wed, 11 Nov 2020 12:18:34 -0500 Subject: [PATCH] Implement user agent format for discoverability --- tt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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)) -- 2.20.1