Currently, the special "tagged-devices" user (which exists for any
tagged devices in the tailnet) can own go links. This change permits
tagged devices to continue to create go links, but skips over them for
ownership checks, allowing any human user can take over ownership.
Fixes#37
Signed-off-by: Will Norris <will@tailscale.com>
When loading stats from the database, map IDs back to their canonical
short name, which is what we want to show in the frontend. This is only
called once on cold start, so performance of loading all links isn't a
big concern.
Fixes#13
Signed-off-by: Will Norris <will@tailscale.com>
Build docker images for amd64, arm64, and arm/v7. Also several other
small improvements to docker workflow like documenting which actions we
run on, setting concurrency settings, and reversing the logic for when
we push new images live (specifically looking for a push event rather
than a "not pull request" event, in case we add other events later).
Fixes#26
Specify a command line argument to resolve a link locally and exit.
Also add a new flag, -resolve-from-backup, which loads a snapshot into
an in-memory database and resolves the specified link.
go/.export doesn't include click data anymore since we switched over to
sqlite. Remove that code as well as the Link.Clicks field. Remove old
/_/export redirect, since we've long since moved off of using it.
We still support directly setting LastSnapshot to support embedding the
snapshot in the binary (like we do internally). But this allows an
alternate way have restoring backups which doesn't require recompiling
binaries.
Even though we have our own build and deploy scripts, most users will be
more comfortable with a standard Dockerfile. We could publish our
scripts later if warranted. For now, we'll just keep them in corp.
Go 1.19 rejects relative paths in $PATH (https://go.dev/cl/403274),
so resolve the tool/ path before adding it.
Updates tailscale/tailscale#5210
Change-Id: I891dd2739fe18534e0facb4dbbaaf6a98b91aeb1
remove FileDB implementation, related flags, and filedb to sqlite
migration code. Also remove the DB interface since it's no longer
needed. dev mode now creates a temporary SQLite database.
Change-Id: I22f92dccdd575f6c35a10523ede8ecf85ae330bb
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 flags to specify sqlite database and migration from files to sqlite.
Migration is only supported in one direction (and flag name makes that
clear). If both sqlite and linkdir flags are provided, sqlite is
preferred. This has no change in behavior if neither of the new flags
are provided.
Change-Id: Ie13116ec3b80835b4389d228583e7a1476c00bfb
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
When a user visits a non-existing go link, it's reasonable to assume
that they may then want to create that link, so autofocus on the
destination input.
We could also autofocus the short input on initial page load without a
provided short name, but I think that's less of a safe assumption.
Change-Id: Id8e15e2f02f81d319eb782576e5e19f73c0ccee4
add new DB.LoadStats and DB.SaveStats methods. DB.SaveSaveStats takes
an incremental count of clicks since the last call. This is a noop for
FileDB (the full count is still saved in the Link struct on disk), but
will allow for the SqliteDB to store stats in a separate table with
timestamps to display only recent clicks.
Change-Id: I18c7db871854923b873ae100c844940242a32bb3