Commit Graph
74 Commits
Author SHA1 Message Date
Will NorrisandWill Norris 406c48e54d skip "tagged-devices" in userExists check
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>
2022-12-22 12:15:49 -08:00
Samuel LijinandWill Norris 442e3446a5 fix(readme): another typo 2022-12-21 12:48:49 -08:00
Will NorrisandWill Norris b6f2ad4476 db: use canonical link short name in stats
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>
2022-12-21 10:52:23 -08:00
Samuel LijinandWill Norris ef8311b7f0 fix(readme): the "auth key" link is not a link
Signed-off-by: Sam Lijin <dev@sxlijin.com>
2022-12-20 09:15:26 -08:00
Will NorrisandWill Norris 5eb91a2ccf readme: add disambiguation links for other go link services
Signed-off-by: Will Norris <will@tailscale.com>
2022-12-14 12:12:31 -08:00
Will NorrisandWill Norris 7dd1eca5ce readme: add link to blog post
Signed-off-by: Will Norris <will@tailscale.com>
2022-12-13 21:33:10 -08:00
Will NorrisandWill Norris 5fefe2519f .github: cross-compile docker images
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
2022-12-06 20:33:21 -08:00
Will NorrisandWill Norris af7ceb5acb add support for resolving links locally
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.
2022-12-06 14:19:31 -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
Will NorrisandWill Norris bb3e973b80 remove static/opensearch.xml
This was replaced by tmpl/opensearch.xml and isn't needed.
2022-12-05 16:53:34 -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 NorrisandWill Norris f2105a032b README: add docker instructions for volume mount permissions 2022-12-05 12:34:19 -08:00
Adrian MouatandWill Norris e2d75cc50d Use a directory writable by nonroot.
Signed-off-by: Adrian Mouat <adrian@chainguard.dev>
2022-12-05 12:34:19 -08:00
Will Norris fa3b9f8e4f remove default value from hostname help text
Go's flag package will automatically append this already.
2022-12-02 08:01:50 -08:00
Zellyn HunterandWill Norris 76c67c0fda cmd/golink: add --hostname flag
Add a `--hostname` flag to allow changing the hostname from "go".
May be necessary if your workplace already has "go" links.
2022-12-01 09:09:05 -08:00
Edward VielmettiandGitHub 0755e37a91 add TrimSuffix to the function map (#10)
Adds strings.TrimSuffix to the function map, enabling it to be used in URL definitions.
2022-11-30 23:09:49 -08:00
William FerrellandGitHub f07445b0fc Update README.md to fix a change in flyctl (#8)
`Command "create" is deprecated, replaced by 'apps create'`
The secrets command has changed from create to set.
2022-11-16 23:13:18 -08:00
Will NorrisandWill Norris 4902f25d9f readme: add install and production notes 2022-11-09 17:38:47 -08:00
Will NorrisandWill Norris d346d3c966 all: remove some dead code
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.
2022-11-09 16:53:17 -08:00
Will NorrisandWill Norris 555d1339a8 golink: truncate clicks slice after sorting
previously, the 200 links included in the "popular links" list were
non-deterministic (though those 200 were sorted). Now, always shows the
top 200.
2022-11-09 13:18:01 -08:00
Will Norris 8e1aaaf768 readme: add simple description and screenshot 2022-11-09 08:50:32 -08:00
Will Norris 28cda737e9 .github: add workflow for basic unit tests 2022-11-08 17:25:12 -08:00
Will Norris 72df3a4fad .github: add workflow to build docker image 2022-11-08 16:22:59 -08:00
Will Norris 89c71fd520 bump tailwind and dependencies 2022-11-08 15:04:21 -08:00
Will Norris 86c4be3d46 go.mod: bump to recent snapshot of tailscale.com 2022-11-08 14:20:24 -08:00
Will Norris 1c076779d3 go.mod: align dependencies with tailscale/tailscale 2022-11-08 13:01:07 -08:00
Will Norris 8904b662cc add: add license and headers 2022-11-08 12:53:39 -08:00
Will Norris ae20fe110a all: add flag for specifying snapshot file
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.
2022-11-08 12:32:58 -08:00
Will Norris f3c448c4dd go.mod: bump dependencies 2022-11-08 12:28:39 -08:00
Will Norris 7c148f41c8 all: add standard Dockerfile
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.
2022-11-08 12:00:05 -08:00
Will NorrisandWill Norris 113923a9af all: librarify golink and make importable
Export LastSnapshot var so that snapshots can be stored in separate repo
from the golink code.
2022-08-20 07:25:26 -07:00
Will Norris d4f6b5f22e go.mod: setup new module 2022-08-19 12:10:32 -05:00
Mihai ParparitaandWill Norris 3ec89abb08 cmd: use absolute path for tool/ directory in Fly build.sh scripts
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
2022-07-29 11:34:50 -07:00
Mihai ParparitaandWill Norris 2d52583359 cmd: use better PATH in Fly build.sh scripts
Does not depend on the working directory being the same as the script

Followup to https://github.com/tailscale/corp/pull/6153#discussion_r925880552

Change-Id: Id1c849e1eb7578960aada033115e9a53b0f8ae1d
2022-07-20 10:42:10 -07:00
Will Norris 18e88921b5 cmd/golink: assume tailnet users exist in devmode
this prevents an error when viewing link detail pages in dev mode.

Change-Id: If62b65599f592215e044767f982a5187887cc1d2
2022-07-02 21:38:07 -07: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 7c31765ba4 cmd/golink: remove FileDB and associated code
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
2022-06-29 14:45:51 -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 2a38b842f7 cmd/golink: enable sqlite and data migration
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
2022-06-16 09:20:09 -07:00
Will Norris 619ecd14bf cmd/golink: add tests for DB implementations
Change-Id: I520aa5053199ff0be56669832aff2603a56f9e6c
2022-06-14 16:02:26 -07:00
Will Norris 4dff66c71c cmd/golink: add SQLiteDB implementation
Change-Id: I70d837e5c1bc65a7a3c13c7e0843f3c361af18ed
2022-06-14 13:00:04 -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
Will Norris ed35fa8624 cmd/golink: autofocus destination input if short exists
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
2022-06-16 17:06:16 -07:00
Will Norris 67b1a11f57 cmd/golink: display shortname as input group
Change-Id: Ie2d609d495e42b37b9d92d71604646134a512a7b
2022-06-17 17:05:26 -07:00
Jordan WhitedandWill Norris bb72cf0d0c cmd/tlsmon: add deployment artifacts (#5739)
Change-Id: I211946bf587fb9997ae52a90a60e5a72e2455e84
2022-06-16 16:49:05 -07:00
Will Norris 0a93d9a715 cmd/golink: short names must begin with word char
also move special "system" URLs like /_/export and /_/base to /.export
and /.base, respectively.

Change-Id: Ica2b11ce3f97575c2755ae1516dd4bc6d814ece4
2022-06-14 16:22:07 -07:00
Will Norris 0e1d350bb9 cmd/golink: add stat loading and saving to DB
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
2022-06-13 17:40:48 -07:00
Brad FitzpatrickandWill Norris 02e9d55070 cmd/golink: don't snapshot the Clicks field
Too noisy.

Change-Id: Iab3aa2621145e889d7645611c7b10e0f1573ea0a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-06-13 08:04:04 -07:00