17 Commits
Author SHA1 Message Date
Will NorrisandWill Norris 187497a7ce add regexp.Match to template funcs
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>
2024-05-07 12:18:56 -07:00
Chris PalmerandGitHub c66cbb8eca Protect save and update from CSRF (#117)
Also, fix a lint.

Fixes #116

Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
2024-04-01 18:20:58 -07:00
Will NorrisandWill Norris 6c79b503e1 suggest long URL for new go links if peer exists
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>
2024-03-15 14:42:43 -07:00
Patrick O'DohertyandGitHub 3f822b66e7 golink: listen on HTTPS and redirect HTTP traffic (#99)
golink: listen on HTTPS and redirect HTTP traffic

Updates tailscale/golink#9
Fixes tailscale/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>
2023-12-18 14:14:52 -08:00
Marco HofstetterandWill Norris 843e615dbf remove unused disabled input fields in form
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>
2023-06-26 08:13:54 -07:00
c7ac33d04c golink: add support for deleting links
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>
2023-05-01 17:34:41 -07:00
Will NorrisandWill Norris 132a396390 update colors and tweak detail layout
Signed-off-by: Will Norris <will@tailscale.com>
2023-05-01 17:34:41 -07:00
Will NorrisandWill Norris 7fd2d35ba6 include current user resolving link in expandEnv
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>
2023-02-08 16:24:36 -08:00
Will NorrisandWill Norris 3c4fb78866 css: responsive design for /.all page
Signed-off-by: Will Norris <will@tailscale.com>
2023-02-07 16:08:19 -08:00
Gabriel WongandWill Norris 340adb143b golink: add .all page to display all existing links
Signed-off-by: Gabriel Wong <gabriel@bifrost.ai>
2023-02-07 16:08:19 -08:00
Will NorrisandWill Norris 9d1e45fb4e add basic favicon
Nothing fancy, just the text "go/" in the Inter font semi-bold.

Fixes #20
2022-12-05 20:03:25 -08:00
9d2c372f1d add support for browser bar search keyword
Respect custom hostname in open search document.

Co-authored-by: Will Norris <will@tailscale.com>
2022-12-05 15:01:33 -08:00
Will Norris 8a19d103dc cmd/golink: add info icon for link details
Change-Id: Ic13864fd1bde11263cc1783accdb6a5678f77253
2022-06-30 08:59:56 -07:00
Will Norris ed638ef9d3 cmd/go: add /.detail page for viewing and editing links
This also adds the ability to transfer links to new owners.

Change-Id: I2172291521db82982b0f30b0f9af92a063dc5100
2022-06-29 14:19:05 -07:00
Will Norris a6f3c8ed8d cmd/golink: use relative links
use relative links throughout rather than hardcoding the go hostname,
which allows things to continue working when other hostnames are used.

Change-Id: I5df0d10214799de9722871cbad99bf9af129941f
2022-06-29 13:32:58 -07:00
Will Norris c7f68940d6 cmd/golink: use html/template when rendering pages
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
2022-06-28 15:35:25 -07:00
Will Norris abf84df32e cmd/golink: provide user documentation
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
2022-06-21 09:25:14 -07:00