Commit graph

29 commits

Author SHA1 Message Date
Vincent Ambo
ba4e979d19 chore(web/atward): bump cargo dependencies
Change-Id: I691e87c6b596fcc7028717a5a22d5619bd87a089
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6121
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-08-22 21:15:01 +00:00
Vincent Ambo
70972c8fd9 chore(atward): Bump dependencies
Change-Id: I949d71648e82aaed2f1f571c4c537f0a1c075225
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5473
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2022-04-17 13:16:34 +00:00
Vincent Ambo
4be5aaa001 refactor(atward): Split tests into separate file
Change-Id: I447bc95b60a7dca912ca75e118c075e52f8c8ebe
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5402
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: wpcarro <wpcarro@gmail.com>
2022-04-11 21:45:02 +00:00
Vincent Ambo
3d8ee62087 style(rust): Format all Rust code with rustfmt
Change-Id: Iab7e00cc26a4f9727d3ab98691ef379921a33052
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5240
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
2022-02-08 12:06:39 +00:00
Vincent Ambo
59134253db chore(web/atward): Bump all dependencies
Change-Id: I4a79204e50cf519dce729e5c86bc397b82715008
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4758
Tested-by: BuildkiteCI
Autosubmit: tazjin <mail@tazj.in>
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-01-01 15:30:16 +00:00
Vincent Ambo
4f71638e49 docs(atward): Document availability of new query types
Change-Id: Ie96eae39722c0bd22f3801cc9e24c28148f0a0cd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3779
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-11-07 14:08:38 +00:00
Vincent Ambo
10e279ac13 feat(atward): Support depot revision queries (r/...)
Redirects these to the cgit commit view. Only supports cgit because we
don't have a good way to coax Sourcegraph into fetching these refs.

Change-Id: I8c28ed015ba37c04eb4b7a667bde70ff6a92bf4c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3772
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-11-05 12:26:44 +00:00
Vincent Ambo
26f0ba5464 refactor(web): use static.tvl.{fyi|su} for static assets
Replaces all uses of relative static paths in TVL pages with the
static.tvl.fyi domain. Where possible, the drv hash is directly
embedded in the content.

Change-Id: Ia882dd37ceae9d047cd81cf1eb37a856b339643a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3682
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-10-07 14:21:18 +00:00
Vincent Ambo
5c9c4aa566 refactor(web/tvl/template): Make static asset URL configurable
Change-Id: I168924cd7b15103d64c9ad72172f72304e1d3a7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3659
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-10-01 15:33:47 +00:00
Vincent Ambo
d0c0227a7b refactor(web/tvl/template): Don't forcefully embed title in page
This hands more layout control back to the page content instead of the
template. There are cases (currently experimenting with logo layout)
where it's visually nicer if there isn't a page title, but the rest of
the template still applies.

Change-Id: Ia3cd0c750beec5408e631760f1faeea8efec91db
2021-09-22 21:28:43 +03:00
Vincent Ambo
72ebd3411b fix(atward): Redirect // queries to depot root
Makes it possible to open the default code viewer for the user at the
depot root by searching for `//`.

Fixes b/134.

Change-Id: I409ad36cea28de27cd1789a84eda71f8979d3133
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3437
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-08-26 19:02:23 +00:00
Vincent Ambo
6f238c1c90 feat(atward): Handle plain host queries
Redirects host queries with no parameters (e.g. `cs`, `todo`, `b`) to
the start page of the appropriate host.

Fixes: b/133

Change-Id: I9d9dee753cfb460a97b73f39bbfe3cae54aae89b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3184
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-06-12 19:14:55 +00:00
Cynthia Revström
0491fb24bf fix(atward): Update link to use at.tvl.fyi
The link for atward's source code was using atward.tvl.fyi,
this makes the cs cookie (if set) for at.tvl.fyi not work.

Change-Id: I644f0341ecaf2caea0b71a950686579dfd18d092
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3155
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-24 20:34:07 +00:00
sterni
1da235518a feat(web/atward): make checkbox label clickable
Change-Id: I147f1f2eee4f6b8f7ecea1b341d192477182d61c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3116
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
c92f4ceacc refactor(web/atward): translate index page to markdown
Change-Id: I03ccbec1dd8ba58d80bd97eb40148dd395e500b2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3115
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
040416b3eb refactor(web): common template for index pages of tvl and atward
Use simple string interpolation based approach to templating and allow
changing the main body, the title and to inject extra HTML into the head
element. Additionally we can use `https://tvl.fyi/` instead of `/` when
referring to assets.

One limitation currently is that the template only works for index pages
(it link to self using `href="/"`), but this should be easy to fix.

For atward, instead of using the `onload` attribute of `body`, we now
register an event listener in JavaScript which makes the template code
less complicated. When building the derivation the template is rendered
to HTML and injected into the source.

Change-Id: I2ea0c5bf5f6286e781285ade7751a348bab3bdc8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3112
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
Vincent Ambo
ebf6301941 feat(atward): Support reading configuration from cookies
Adds support for reading configuration (currently only the `cs`
parameter) from cookies and from URL query parameters. The latter take
precedence if set explicitly.

This is useful for users which can not edit their search query
parameters.

To make this easier to use the atward landing page has been updated
with a simple form where settings can be toggled. This requires
Javascript, but the script is small, embedded and MIT licensed (as is
the rest of this project). Users without Javascript will be shown a
notice about this.

It is of course possible to set the cookies manually, too.

Change-Id: Ie9a9dbeab4d9a97a349d7988e21f1b46037e1f72
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3110
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-12 13:19:11 +00:00
Vincent Ambo
cb497a0cca feat(atward): Serve OpenSearch XML file to support Firefox
Firefox users can not easily add search engines to the browser unless
the page serves an OpenSearch description. This CL adds said
description according to the documentation:

https://developer.mozilla.org/en-US/docs/Web/OpenSearch

Change-Id: I358c5940304f4abd9e45dd72a64e46d3ce44b3e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3105
Tested-by: BuildkiteCI
Reviewed-by: cynthia <cynthia@tvl.fyi>
2021-05-11 22:45:08 +00:00
Vincent Ambo
99d11bef5f feat(atward): Add an index page with setup instructions
Adds an index page that is rendered when there is no query parameter
in the URL. This means that going to at.tvl.fyi / atward.tvl.fyi
yields an actually useful page.

Change-Id: I018973a3c3e8b7b7167876fa99f34a008a17a4f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3104
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2021-05-11 22:45:08 +00:00
Vincent Ambo
13336c6057 feat(atward): Add 'cs' query parameter to toggle Sourcegraph support
Users can set `?cs=true` to be sent to cs.tvl.fyi instead of
code.tvl.fyi for things that look like code paths.

Change-Id: I7c8f9b71cde25d35787c941e5308330c6f16f8d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3102
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-11 14:20:31 +00:00
Vincent Ambo
d4bdfe8127 refactor(atward): Construct an atward query type from user requests
Rather than dealing with passing down the rouille request to
handlers (which would have become necessary as we start supporting
more user-controlled features), a new `atward::Query` type is
constructed from requests and passed to the dispatching logic instead.

For now this introduces no new features, it just shuffles things
around to prepare for that.

Change-Id: I08e18422c1fdbac4712c739a7acbb810ada697ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3101
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-11 14:20:31 +00:00
Vincent Ambo
61783bd2ba fix(atward): Better align unsupported query error with inspiration
If you can make sense of this commit, it will make sense to you.

Change-Id: Ib223bf97b7a28828a04f01bc96365f654549fa60
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3100
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 21:33:39 +00:00
Vincent Ambo
4de6648ae9 refactor(atward): Rename Query -> Handler
Query is actually going to be a ... Query.

Change-Id: Icc910a8eef47e201054cb1346bc4059c0458659f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3099
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 21:33:39 +00:00
Vincent Ambo
90db61a6f4 feat(web/atward): Support depot paths (to cgit for now)
Sends depot paths (such as //web/atward or //nix/readTree/README.md)
to cgit. If Markdown files are detected the user is sent to the about
page to get the rendered view.

Future work will make cgit vs. SourceGraph configurable.

Change-Id: I48dea2dc8994644fb5a6f4bfbb846c771996cfc3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3095
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 13:39:23 +00:00
Vincent Ambo
67389b6b0b fix(atward): Use 'q' query parameter for query instead
This removes a bunch of awkwardness around slashes in URLs, which also
frequently feature in our patterns.

Change-Id: I68c69d4c68436421951ee133bfbc067609f27bb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3097
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-06 10:23:46 +00:00
Vincent Ambo
47d07e7b5f refactor(atward): Configure listen address
This appeases the flokli.

Change-Id: Ib6a6c1a2cc8780e7944913d9204b42505b29fdc0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3093
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-05-05 09:02:58 +00:00
Vincent Ambo
57502cfc46 feat(atward): Add query for changelists
Adds a query for things like cl/42

Change-Id: I144ee25c0f2c9956c81b349d653c5fec42602f9f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3092
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
2021-05-04 15:47:56 +00:00
Vincent Ambo
8c0776485e feat(web/atward): Wire up query resolution to a web server
Adds a simple web server which logs all incoming requests and either
sends the user to the correct destination, or gives up and displays an
error (in the future there'll be fallback searches so that peopple can
use this as their default search engine easily).

Change-Id: I4f10472dbc74fa9cc71fad0533da38eda2b6077c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3089
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2021-05-03 22:55:36 +00:00
Vincent Ambo
51b5475f40 feat(web/atward): Implement match scaffolding for TVL redirector
atward is going to be a new TVL service, living at atward.tvl.fyi,
which users can configure as a search engine in their browser.

It will understand a variety of TVL-specific query types (such as
bug/CL links or code paths). In the future it might also support
features like go-links.

This commit configures the initial setup for query matchers in atward
and adds an example query type (for bugs).

This is not yet wired up to a web server.

Change-Id: Ifaf06c3f5cc378eee7894b7576ef583fc89264f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3087
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2021-05-03 22:55:36 +00:00