Add a "Match" template func, which uses regexp.MatchString to match a
value against a regular expression pattern.
Fixes#125
Signed-off-by: Will Norris <will@tailscale.com>
If you visit a non-existent go link, we render the home page and pre-
populate the "short" input with the name of the link, and autofocus the
"long" input so that you can simply paste a long URL and submit.
It is common (at least at Tailscale) to create go links that correspond
to the name of a device on the tailnet. For example, go/who points to
http://who/. With this change, when you visit a non-existent go link,
we check to see if a peer exists on the tailnet with that name, and if
so we suggest that as the long URL.
Signed-off-by: Will Norris <will@tailscale.com>
golink: listen on HTTPS and redirect HTTP traffic
Updates tailscale/golink#9Fixestailscale/golink#29
On tailnets with HTTPS enabled golink will serve the primary endpoints via
HTTPS. With HTTPS enabled golink will respond to HTTP traffic with a
separate redirectHandler which redirects requests to their HTTPS equivalent.
Update documented examples of `curl` to include the `-L` flog to follow these
redirects if present.
Add a HTTPS section to the README documenting all of the above.
Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
The detail page of a link only displays the form if the link is editable
for the logged in user.
Therefore, it's not necessary to disable the input fields within the
form if the link isn't editable.
Signed-off-by: Marco Hofstetter <marco.hofstetter@bluewin.ch>
To delete a link, go to its page in `.detail` and click on the "Delete"
button. Stats for the deleted link are removed as well.
Co-authored-by: Will Norris <will@tailscale.com>
Signed-off-by: Gabriel Wong <gabriel@bifrost.ai>
Signed-off-by: Will Norris <will@tailscale.com>
Add "User" to the expansion environment for links. The intent here it
support personalized go links such as:
go/mycal => https://calendar.google.com/calendar/embed?src={{.User}}
That's not a terribly interesting example, but there are others I intend
to use internally.
Signed-off-by: Will Norris <will@tailscale.com>
use relative links throughout rather than hardcoding the go hostname,
which allows things to continue working when other hostnames are used.
Change-Id: I5df0d10214799de9722871cbad99bf9af129941f
Properly use html/template rather than text/template so that we don't
have to worry about escaping data that is passed in to the templates.
Also move the success page into a template for both better rendering and
consistency.
Finally, this includes some tailwind changes that apparently got missed
in previous commits.
Change-Id: Ic658ab940888c44483501e33699da9021be18ecf
Add a new /.help URL which contains a first pass at user docs, covering
naming rules for short links, using go templates, and basic API access.
Also add client side validation for short name and a link to help page.
Change-Id: I4b66793248eba17e567c4f422ee197617f74ee24