Commit graph

223 commits

Author SHA1 Message Date
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
25ff41452b feat(tvl/template): support markdown via cheddar
Since the template already was a derivation we can just reimplement a
specialized writeText which runs cheddar on parts of its input to avoid
import from derivation.

Change-Id: I0cffd0e86fd23a749599174260d04269379f4b5f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3114
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-05-12 15:36:44 +00:00
sterni
513e733f8a feat(tvl/template): link to atward in footer
Change-Id: I929b8344251ceaba5a22c735c599407a0ec162a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3113
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
Florian Klink
85001c3540 fix(web/tvl): add two pixels to make favicon square
Fixes b/126.

Change-Id: I5caac45797738bccdbc346288fdf891dafdcefbb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3106
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-05-11 22:50:58 +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
grfn
17239c597d revert: "feat(web/panettone): Allow requesting JSON"
This reverts commit 77c09076ec.

Reason for revert: It doesn't work - attempting to request any of the pages now gives:

[ERROR]] No keys match in SWITCH. Testing against
         "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
         with EQUAL.

Change-Id: Ic4c795fd2a971003a6823a3b68ddee9a03b9f7c9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3061
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-04-30 11:54:45 +00:00
Griffin Smith
77c09076ec feat(web/panettone): Allow requesting JSON
Allow specifying an `Accept: application/json` header to the index and
show issue routes, to request that those pages be returned as JSON.

Change-Id: Ic225139fc9e7fdce0da98984df4ca987685dafe0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3043
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-22 15:35:55 +00:00
sterni
f88ac5c0b5 feat(nix/utils): add storePathName, a more generic baseNameOf
This is a wrapper around baseNameOf which also can deal with
derivations. Added to //nix/utils since I've found myself introducing an
ad-hoc implementation of this for both //web/bubblegum and //nix/buildC.

Change-Id: I2fcd97a150d6eda21ab323fa0d881ff7442a892e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3049
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-20 11:00:52 +00:00
Vincent Ambo
929b38e8ae refactor(web/converse): Refactor first handlers to rouille
This commit starts the refactoring process towards dropping actix (and
tokio, ...). It builds, but at this commit, Converse does *not* work.

I decided to commit to avoid more ridiculous diffs.

Included changes:

* Added dependency on rouille.

* Refactored DbExecutor (formerly actix actor) to simply be a type
  with a few methods. Most actor messages still exist as they are
  being referred to by handlers.

* Started refactoring two of the handlers (and their related renderer
  functions) into Rouille's call scheme.

Important note: Rouille does not have safe session management out of
the box, and it will need to be implemented as this progresses.

Change-Id: I3e3f203e0705e561e1a3392e8f75dbe273d5fa81
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2861
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-20 10:44:57 +00:00
sterni
d485ebf01a fix(bubblegum): import lib from the new correct place
Since cl/2910 depot has no lib attribute anymore. Import it from the
depot fix point via depot.third_party.nixpkgs.lib to avoid passing
another argument and enlargening the shebang further.

Change-Id: I3c719eba38a5ceb36689ebf0409bd19d4f46a609
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3050
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-20 08:42:58 +00:00
Vincent Ambo
f520bd40ca refactor: Replace 'depotPath' with 'depot.path'
Instead of having two ways of accessing the path to the depot (one of
which was stuttering, depot.depotPath) we settle on only one:
depot.path.

This was mostly used for NixOS module imports.

Co-Authored-By: Florian Klink <flokli@flokli.de>
Change-Id: I2c0db23383fc34f6ca76baaad4cc4af2d9dfae15
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2962
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-12 21:55:07 +00:00
Griffin Smith
6266c5d32f refactor(users/glittershark): Rename to grfn
Rename my //users directory and all places that refer to glittershark to
grfn, including nix references and documentation.

This may require some extra attention inside of gerrit's database after
it lands to allow me to actually push things.

Change-Id: I4728b7ec2c60024392c1c1fa6e0d4a59b3e266fa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2933
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: glittershark <grfn@gws.fyi>
2021-04-12 14:45:51 +00:00
sterni
4edef59ba4 feat(panettone): don't use _ for em in inline markdown
Since we are still using third_party, underscores are kind of common in
issue titles and are probably often forgotten to escape. Let's just
support `*` for emphasized text in titles for now.

Change-Id: I305bcf4d4c59123bba4ce816a6da2ee8b022c34e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2926
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
2021-04-11 20:11:07 +00:00
eta
d1fdf800e8 feat(tvl): remove aranea from tvl.dot
I've been told that they don't want to be in this any more, so references are
removed in this CL by request.

Change-Id: I80a04b714fc57781e57e8dce977d0aec2da4f009
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2927
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: eta <eta@theta.eu.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Tested-by: BuildkiteCI
2021-04-11 14:13:16 +00:00
Vincent Ambo
473604f567 refactor: Move nixpkgs attribute to third_party.nixpkgs
Please read b/108 to make sense of this.

This gets rid of the explicit list of exposed packages from nixpkgs,
and instead makes the entire package set available at
`third_party.nixpkgs`.

To accommodate this, a LOT of things have to be very slightly shuffled
around. Some of this was done in already submitted CLs, but this
change is unfortunately still quite noisy.

Pay extra attention to:

* overlay-like functionality that was partially moved to actual
  overlays (partially as in, the minimum required to get a green
  build)

* modified uses of the package set path, esp. in NixOS systems

Special notes:

* xanthous has been disabled in CI because of issues with the Haskell
  overlay
* //third_party/nix has been disabled because of other unclear
  dependency issues

Both of these will be tackled in a followup CL.

Change-Id: I2f9c60a4d275fdb5209264be0addfd7e06c53118
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2910
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-04-10 21:18:55 +00:00
sterni
055fe7ce8e fix(panettone): always use displayname in subjects
Emails for (re)opening and closing where send out with the user's DN in
the subject which is probably not what we want.

Using displayname-if-known is probably not necessary as there is not
really a case where (not *user*) wouldn't justify a 500 in this context.

Change-Id: Id12d3d9619f42eb5337c2d3482b7c1646b5d6a81
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2911
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-10 09:18:46 +00:00
sterni
435b883f5c fix(panettone): set external-format for stream from cheddar
drakma ignores the :external-format-in parameter if :want-stream is t:

> If want-stream is true, the message body is NOT read and instead
> the (open) socket stream is returned as the first return value.
> If the sixth value of HTTP-REQUEST is true, the stream should be
> closed (and not be re-used) after the body has been read. The
> stream returned is a flexi-stream with a chunked stream as its
> underlying stream. If you want to read binary data from this
> stream, read from the underlying stream which you can get with
> FLEXI-STREAM-STREAM.

Since it doesn't return a plain CL stream which would just work with
SBCL, we need to set the external format on the resulting flexi-stream.

Fixes b/107.

Change-Id: I6e3178123c0927ef21fabf8118d9d357c8afbd42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2869
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
2021-04-06 16:34:15 +00:00
sterni
63a0b28bea refactor(panettone): remove code duplication in render-markdown
Move the common part (encoding/decoding json and connecting to cheddar)
into request-markdown-from-cheddar. The two render-markdown
implementations are now only thin wrappers around that function.

Change-Id: I81bb34b684af44228dcad02fca541082e6d060ce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2868
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-06 16:34:15 +00:00
Vincent Ambo
a87533695f fix(web/converse): Update to use mime_guess::from_path
... instead of its deprecated predecessor.

Change-Id: I8af286c6b1ee7c25c153f1209d094ae4f5eb53cc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2860
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-05 19:19:00 +00:00
Vincent Ambo
3b0b21f8d1 refactor(web/converse): Use crimp instead of reqwest
This simpler, curl-based HTTP client (which I wrote years ago) is a
first step towards cleaning up the dependency mess of converse.

Dependency stats: +4, -28

Change-Id: I4f5f3c9307895d261bfb0a6bcf2337b747f9a4c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2859
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-05 19:19:00 +00:00
Vincent Ambo
8fc4e083c9 chore(web/converse): Apply 'cargo fix --edition'
This does not yet change up `extern crate` and `macro_use` statements,
but since we still depend on Diesel that also wouldn't work right now.

Change-Id: I36de1b7b56f7d220f567346e13bad8da06461517
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2858
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-05 19:19:00 +00:00
Vincent Ambo
a0c4b91955 fix(web/converse): Bare minimum changes to build in 2021
This project depends on Tokio, via actix, and both of those are bad
ideas. This wasn't as clear 3 years ago as it is now, but to
demonstrate it the project has amassed issues which required at least
this minimum of changes to be buildable in 2021 (using a modern
rustc).

Yes, this adds dozens of new dependencies again (because of a
top-level update) but don't worry: They will be gone when I'm done
here.

Change-Id: I1dde9dc0325da7bdcb6608359fab33e27692dc1d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2857
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-05 19:19:00 +00:00
Vincent Ambo
5387cc9e7d docs(converse): Convert README to Markdown
Change-Id: Iad5902622a9993c94116edc55de8fa5f6c38d3f1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2856
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-05 15:47:42 +00:00
Vincent Ambo
8e91e70b05 chore(converse): Remove old Github-specific things
* remove files that depot already has, or doesn't need
* remove links to old source location

Change-Id: Idcd9361bfed00289f09af62f5342c4fd8bd04404
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2855
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-05 15:47:42 +00:00
Vincent Ambo
8142149e28 feat(web/converse): Import repository
Imports the converse forum software I wrote a few years ago. I want to
clean this up a bit and try using Hotwire with it.

Note: The original repository was AGPL-3.0 licensed. I'm the copyright
holder and have relicensed it to GPL-3.0 in the commit that is being
merged.

Imported from: https://github.com/tazjin/converse

git-subtree-dir: web/converse
git-subtree-mainline: 386afdc794
git-subtree-split: 09168021e7
Change-Id: Ia8b587db5174ef5b3c52910d3d027199150c58e0
2021-04-05 17:01:15 +02:00
sterni
386afdc794 feat(web/bubblegum): allow passing status as an int
The whole pass the name of the status as a string thing was mostly born
out of an overeager use of yants. It is still very neat especially for
common cases like "OK", so we'll keep it, but also allow passing the
integer variant of the status as well which probably feels more natural
for a lot of people, especially over getting the casing right for
"I'm a teapot".

Change-Id: I3f012a291447ef385efdd28132292a8b331998c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2850
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-05 10:54:32 +00:00
sterni
1c0f89f4ca feat(web/bubblegum): report some errors to the user via HTTP
We can actually catch some errors that may be generated in bubblegum
applications where we can report them to the user in a way that doesn't
require curl -vv:

* Type errors in the status argument: By removing yants completely we
  not only (presumably) gain some performance, but also the ability to
  return an internal server error on an unexpected type instead of
  throwing.

* User generated evaluation errors: by using builtins.tryEval we can
  catch throws and asserts the user inserted when generating the body
  and report to the user that something went wrong. To do: also support
  for the headers.

Change-Id: I8363b9825c6c730e624eb8016a5482d63cbc1890
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2849
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-05 10:54:32 +00:00
Griffin Smith
5319465f60 fix(panettone): Add email.lisp to source files
email.lisp was missing from the buildLisp derivaation's source files,
which meant that none of its definitions were being loaded into the
image even though the package was defined by packages.lisp.

As an aside, this really should've broken the build - we got a
style-warning in panettone.lisp for referencing the missing definitions,
but that only surfaced as a warning, and ended up breaking once deployed

Change-Id: Ie99c3efeef8e6943aa1f9cfc426957d622c2d718
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2845
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-04-04 14:43:14 +00:00
Griffin Smith
808448682c feat(panettone): Add some more info to emails
Add a little bit more information to issue notification emails,
including the IDs of issues and links to the issues themselves.

Change-Id: Ia54209f936a37c6dbdb60ebff5bb8c1034cffc9a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2809
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
6c78cb69c7 feat(panettone): Send notifications when issues are reopened
Send notifications both to IRC and email when issues are reopened after
being closed

Change-Id: I3a63419c6547ac28eeaafbe212a2a01a5fc2b5af
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2808
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
606d2af2da feat(panettone): Send emails when issues are closed
Send notification emails to the same group of users who receive
notifications on issue comments when issues are marked as closed. This
also takes the opportunity to generalize issue notification emails a
bit, and lay the groundwork for (but not implement) explicit issue
subscriber lists.

Change-Id: Ie2572ed3ad0207d415b4c362438f772925e7a2c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2807
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
3ec15ec9f9 feat(panettone): Add a settings page
Add a user settings page, with a single checkbox that allows disabling
receiving all email notifications.

Change-Id: Ibef2a497cd59f93b695ff8b9cd36047e514e00c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2806
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
8d3ab61e7c feat(panettone): Send email notifications for comments
When a user posts a comment on an issue, send email
notifications (respecting the enable-email-notifications setting) to the
author of that issue and all the other users who have commented on that
issue. Since the oauth & gmail API stuff that the relay does is slow,
this happens in a background thread.

Change-Id: Ic00c265deab1030d9ba64c29c9f56314dd179141
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2805
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
349b98ccc8 feat(panettone): Add functions to send email notifications
Add a new package to panettone, :panettone.email with functions to send
email notifications to users through the SMTP relay on whitby,
respecting the value of `enable_email_notifications` on the
user_settings table.

Change-Id: Ia4ec65965abda06f1fadb178143d66bb8eae6482
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2804
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
Griffin Smith
37d573479b feat(panettone): Add a user settings table
Add a new user-settings table and dao class, with a flag that allows an
individual user to disable receiving email notifications

Change-Id: I537bfca74490941934c0adc7328bcd6ed5c9c0b9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2803
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
2021-04-04 14:17:25 +00:00
sterni
b6818d3190 chore(web/bubblegum): add OWNERS file
Forgot to add this when moving it out of my //users directory.

Change-Id: If6d30a2a58a6bd73e160706cb706e3b2e100e909
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2754
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-04-01 22:05:31 +00:00
sterni
93a746aaaa feat(web/bubblegum): nix CGI programming framework
So here is what has been keeping me up at night: At some point I
realized that nix actually made a somewhat passable language for CGI
programming:

* That `builtins.getEnv` exists as one of the impurities of Nix is
  perfect as environment variables are the main way of communication
  from the web server to the CGI application.

* We can actually read from the filesystem via builtins.readDir and
  builtins.readFile with bearable overhead if we avoid importing the
  used paths into the nix store.

* Templating and routing are convenient to implement via indented strings
  and attribute sets respectively.

Of course there are obvious limitation:

* The overhead of derivations is probably much to great for them to be
  useful via IfD.

* Even without derivations, nix evaluation is very slow to the point
  were a trivial application takes between 100ms and 400ms to produce a
  response.

* We can't really cause effects other than producing a response which
  makes it not viable for a lot of applications. There are some ways
  around this:

  * With a custom interpreter we could have streaming and multiplexed
    I/O (using lazy lists emulated via attrsets) to cause such effects,
    but it would probably perform terribly.

  * We can use builtins.fetchurl to call other HTTP-based microservices,
    but only in very limited constraints, i. e. only GET, no headers,
    and only if the tarball ttl is set to 0 in the global nix.conf.

* Terrible error handling capabilities because builtins.tryEval actually
  doesn't catch a lot of errors.

To prove that it actually works, there are some demo applications,
which I invite you to run and potentially break horribly:

    nix-build -A web.bubblegum.examples && ./result
    # navigate to http://localhost:9000

The setup uses thttpd and executes the nix CGI scripts using
users.sterni.nint which automatically passed `depot`, so they can
import the cgi library.

Change-Id: I3a22a749612211627e5f8301c31ec2e7a872812c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2746
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-04-01 18:50:36 +00:00