taviso / nntpit

minimalist reddit2nntp gateway
MIT License
245 stars 10 forks source link

Add an “X-Reddit-URL” header #10

Closed bdesham closed 3 years ago

bdesham commented 3 years ago

Sometimes while reading a post I’d like to view the “real thing” on Reddit. This commit adds an X-Reddit-URL header to all stories and comments that gives the content’s permalink.

taviso commented 3 years ago

Seems like a good idea to me! Happy to merge this, but I wonder if it should be added to the body, maybe as a signature as well?

e.g.

This is a post!

-- 
http://reddit.com/a/bc/d/
bdesham commented 3 years ago

I like that idea. One thing to consider is that Reddit URLs can be really long (at least by Usenet standards); should we be shortening them? Reddit supports shortening post URLs from

https://www.reddit.com/r/NixOS/comments/8hefx5/nixshell_as_interpreter_for_a_makefile/

to

https://reddit.com/8hefx5

Comment URLs can’t get quite that short, but you can at least go from

https://www.reddit.com/r/NixOS/comments/8hefx5/nixshell_as_interpreter_for_a_makefile/dyjewns/

to

https://reddit.com/r/NixOS/comments/8hefx5/-/dyjewns

Do you think we should shorten URLs this way, in the header and/or in the sig? They may not be the canonical URLs, but it seems safe to assume that Reddit will continue to support them—it’s not like we’re using a third-party link shortener that could disappear at any time.