From 4f3dbb24555b4b44d6922044c170a70a0aa0f5b3 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Wed, 18 Nov 2020 19:59:12 -0500 Subject: [PATCH] Get version from info.rkt --- info.rkt | 2 +- tt.rkt | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/info.rkt b/info.rkt index afe2865..a9c77f7 100644 --- a/info.rkt +++ b/info.rkt @@ -6,7 +6,7 @@ (define pkg-desc "twtxt client") (define version - "0.3.5") + "0.3.6") (define pkg-authors '("Siraaj Khandkar ")) (define deps diff --git a/tt.rkt b/tt.rkt index 421af36..c63f35d 100644 --- a/tt.rkt +++ b/tt.rkt @@ -216,11 +216,9 @@ "https://raw.githubusercontent.com/mdom/we-are-twtxt/master/we-are-twtxt.txt") (str->feeds (uri-fetch uri))) -(define user-agent +(define (user-agent prog-name prog-version) (let* - ([prog-name "tt"] - [prog-version "0.3.5"] - [prog-uri "https://github.com/xandkar/tt"] + ([prog-uri "https://github.com/xandkar/tt"] [user-feed-file (expand-user-path "~/twtxt-me.txt")] [user (if (file-exists? user-feed-file) @@ -231,6 +229,7 @@ (format "~a/~a (~a)" prog-name prog-version user))) (module+ main + (require setup/getinfo) (define (setup-logging) (define logger (make-logger #f #f 'debug #f)) (define log-chan (make-log-receiver logger 'debug)) @@ -247,7 +246,10 @@ (setup-logging) (current-http-response-auto #f) - (current-http-user-agent user-agent) + (let* ([prog-name "tt"] + [prog-version ((get-info (list prog-name)) 'version)] + [user-agent (user-agent prog-name prog-version)]) + (current-http-user-agent user-agent)) (date-display-format 'rfc2822) (define args (current-command-line-arguments)) -- 2.20.1