diff --git a/.dockerignore b/.dockerignore
index da0a3465..c6c6d6de 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,4 +1,4 @@
-target
+**/target
**/node_modules
server/frontend/dist
.git
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 750b8aa2..a049f76d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -337,6 +337,7 @@ jobs:
packages: write
outputs:
server: ${{ steps.server.outputs.digest }}
+ app: ${{ steps.app.outputs.digest }}
renderer: ${{ steps.renderer.outputs.digest }}
steps:
- uses: actions/checkout@v4
@@ -361,6 +362,21 @@ jobs:
tags: ghcr.io/docspring/visualci-server:${{ github.sha }}
cache-from: type=gha,scope=server
cache-to: type=gha,mode=max,scope=server
+ # VisualCI on Laravel Rust (app/, sc-8900): built on main so the cutover has an image ready, deployed only at
+ # cutover (talira-ai/infra k3s/resources/visualci/laravel)
+ - id: app
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ file: docker/app.Dockerfile
+ push: true
+ build-args: |
+ BUILD_SHA=${{ github.sha }}
+ RENDERER_VERSION=${{ steps.version.outputs.renderer }}
+ VISUALCI_ANALYTICS=1
+ tags: ghcr.io/docspring/visualci-app:${{ github.sha }}
+ cache-from: type=gha,scope=app
+ cache-to: type=gha,mode=max,scope=app
# The renderer is rebuilt only when its inputs change, so its digest (and the running renderers) stay put
# through deploys that only touch the server. Rebuilding an unchanged renderer would give a new digest and roll
# the renderers mid-build for nothing.
diff --git a/app/Cargo.lock b/app/Cargo.lock
index 352842da..6591b927 100644
--- a/app/Cargo.lock
+++ b/app/Cargo.lock
@@ -286,6 +286,12 @@ version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
+[[package]]
+name = "base64ct"
+version = "1.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
+
[[package]]
name = "bcrypt"
version = "0.19.3"
@@ -617,6 +623,12 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "const-oid"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
[[package]]
name = "const-oid"
version = "0.10.3"
@@ -833,6 +845,17 @@ dependencies = [
"syn 3.0.10",
]
+[[package]]
+name = "der"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
+dependencies = [
+ "const-oid 0.9.6",
+ "pem-rfc7468",
+ "zeroize",
+]
+
[[package]]
name = "deranged"
version = "0.5.9"
@@ -852,6 +875,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer 0.10.4",
+ "const-oid 0.9.6",
"crypto-common 0.1.6",
"subtle",
]
@@ -863,7 +887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
dependencies = [
"block-buffer 0.12.1",
- "const-oid",
+ "const-oid 0.10.3",
"crypto-common 0.2.2",
"ctutils",
]
@@ -1993,6 +2017,21 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "jsonwebtoken"
+version = "9.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a87cc7a48537badeae96744432de36f4be2b4a34a05a5ef32e9dd8a1c169dde"
+dependencies = [
+ "base64 0.22.1",
+ "js-sys",
+ "pem",
+ "ring",
+ "serde",
+ "serde_json",
+ "simple_asn1",
+]
+
[[package]]
name = "laravel-rust"
version = "0.1.4"
@@ -2586,6 +2625,9 @@ name = "lazy_static"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
+dependencies = [
+ "spin",
+]
[[package]]
name = "libc"
@@ -2868,6 +2910,22 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "num-bigint-dig"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
+dependencies = [
+ "lazy_static",
+ "libm",
+ "num-integer",
+ "num-iter",
+ "num-traits",
+ "rand 0.8.8",
+ "smallvec",
+ "zeroize",
+]
+
[[package]]
name = "num-conv"
version = "0.2.2"
@@ -2883,6 +2941,16 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "num-iter"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"
+dependencies = [
+ "num-integer",
+ "num-traits",
+]
+
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -2890,6 +2958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
+ "libm",
]
[[package]]
@@ -3043,6 +3112,25 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
+[[package]]
+name = "pem"
+version = "3.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be"
+dependencies = [
+ "base64 0.22.1",
+ "serde_core",
+]
+
+[[package]]
+name = "pem-rfc7468"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
+dependencies = [
+ "base64ct",
+]
+
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -3055,6 +3143,27 @@ version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752"
+[[package]]
+name = "pkcs1"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
+dependencies = [
+ "der",
+ "pkcs8",
+ "spki",
+]
+
+[[package]]
+name = "pkcs8"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
+dependencies = [
+ "der",
+ "spki",
+]
+
[[package]]
name = "pkg-config"
version = "0.3.34"
@@ -3234,13 +3343,23 @@ version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+[[package]]
+name = "rand"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
+dependencies = [
+ "rand_chacha 0.3.1",
+ "rand_core 0.6.4",
+]
+
[[package]]
name = "rand"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
dependencies = [
- "rand_chacha",
+ "rand_chacha 0.9.0",
"rand_core 0.9.5",
]
@@ -3255,6 +3374,16 @@ dependencies = [
"rand_core 0.10.1",
]
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.4",
+]
+
[[package]]
name = "rand_chacha"
version = "0.9.0"
@@ -3265,6 +3394,15 @@ dependencies = [
"rand_core 0.9.5",
]
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
[[package]]
name = "rand_core"
version = "0.9.5"
@@ -3496,6 +3634,26 @@ dependencies = [
"syn 3.0.10",
]
+[[package]]
+name = "rsa"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
+dependencies = [
+ "const-oid 0.9.6",
+ "digest 0.10.7",
+ "num-bigint-dig",
+ "num-integer",
+ "num-traits",
+ "pkcs1",
+ "pkcs8",
+ "rand_core 0.6.4",
+ "signature",
+ "spki",
+ "subtle",
+ "zeroize",
+]
+
[[package]]
name = "rustc-demangle"
version = "0.1.28"
@@ -3871,6 +4029,16 @@ dependencies = [
"libc",
]
+[[package]]
+name = "signature"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+dependencies = [
+ "digest 0.10.7",
+ "rand_core 0.6.4",
+]
+
[[package]]
name = "simd-adler32"
version = "0.3.10"
@@ -3899,6 +4067,18 @@ version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
+[[package]]
+name = "simple_asn1"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d"
+dependencies = [
+ "num-bigint 0.4.8",
+ "num-traits",
+ "thiserror",
+ "time",
+]
+
[[package]]
name = "slab"
version = "0.4.12"
@@ -3950,6 +4130,16 @@ dependencies = [
"lock_api",
]
+[[package]]
+name = "spki"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
+dependencies = [
+ "base64ct",
+ "der",
+]
+
[[package]]
name = "sqlx"
version = "0.9.1"
@@ -4735,18 +4925,21 @@ dependencies = [
"hmac 0.12.1",
"image",
"include_dir",
+ "jsonwebtoken",
"laravel-rust",
"oauth-provider",
"oauth-provider-laravel",
"regex",
"reqwest 0.12.28",
"rmcp",
+ "rsa",
"rusty-s3",
"schemars",
"serde",
"serde_json",
"sha2 0.10.9",
"snapshot-diff",
+ "sqlx",
"tokio",
"tower",
"tracing",
diff --git a/app/Cargo.toml b/app/Cargo.toml
index dcabfa90..55389479 100644
--- a/app/Cargo.toml
+++ b/app/Cargo.toml
@@ -26,10 +26,12 @@ path = "src/main.rs"
laravel-rust = { version = "=0.1.4", features = ["database-postgres", "minijinja"] }
# The same axum Laravel Rust runs on, for extractors (auth::Principal)
axum = "0.8"
+base64 = "0.22"
hex = "0.4"
oauth-provider = "0.1.3"
oauth-provider-laravel = { version = "=0.1.1", features = ["postgres"] }
hmac = "0.12"
+jsonwebtoken = "9"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.10"
@@ -39,10 +41,10 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "rus
rusty-s3 = "0.12"
globset = "0.4"
schemars = "1"
+sqlx = { version = "0.9", default-features = false, features = ["runtime-tokio", "tls-rustls-ring", "postgres"] }
tracing = "0.1"
include_dir = "0.7"
rmcp = { version = "3.12", features = ["server", "transport-streamable-http-server", "macros"] }
-base64 = "0.22"
tower = { version = "0.5", features = ["util"] }
url = "2"
regex = "1"
@@ -51,9 +53,18 @@ visualci-core = { path = "../crates/visualci-core", features = ["bundle"] }
snapshot-diff = { path = "../crates/snapshot-diff" }
[dev-dependencies]
+regex = "1"
+# A GitHub App key made at test time, so no private key is committed
+rsa = { version = "0.9", features = ["pem"] }
[profile.dev]
debug = "line-tables-only"
[profile.dev.package."*"]
debug = false
+
+# Generating the tests' RSA key is slow unoptimised
+[profile.dev.package.num-bigint-dig]
+opt-level = 3
+[profile.dev.package.rsa]
+opt-level = 3
diff --git a/app/public/index.html b/app/public/index.html
new file mode 100644
index 00000000..3a0d4ea6
--- /dev/null
+++ b/app/public/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+VisualCI
+
+
+
+
+
diff --git a/app/src/auth/mod.rs b/app/src/auth/mod.rs
index 1f7ffc81..592a33d6 100644
--- a/app/src/auth/mod.rs
+++ b/app/src/auth/mod.rs
@@ -16,6 +16,7 @@ pub mod oauth;
pub mod orgs;
pub mod setup;
pub mod sign_in;
+pub mod staff;
pub mod tokens;
use axum::extract::FromRequestParts;
@@ -271,6 +272,7 @@ pub fn routes(route: &mut laravel::prelude::Router) {
orgs::routes(route);
me::routes(route);
device::routes(route);
+ staff::routes(route);
route.get("/auth/{forge}", sign_in::start);
route.post("/auth/{forge}/link", sign_in::link);
route.get("/auth/{forge}/callback", sign_in::callback);
@@ -278,4 +280,6 @@ pub fn routes(route: &mut laravel::prelude::Router) {
route.get("/auth/providers", sign_in::providers);
route.post("/auth/logout", sign_in::logout);
setup::routes(route);
+ // Anything else on the web group is a page of the React app
+ route.fallback(crate::http::app_shell::app_shell);
}
diff --git a/app/src/auth/staff.rs b/app/src/auth/staff.rs
new file mode 100644
index 00000000..18b56f6a
--- /dev/null
+++ b/app/src/auth/staff.rs
@@ -0,0 +1,130 @@
+//! Staff pages on the auth and emails side (sc-8900), ported from today's server: the latest sign-ups, every email
+//! VisualCI sends rendered with sample data, and failed emails to retry or dismiss. Anyone who isn't staff gets a 404.
+
+use laravel::auth::Authenticated;
+use laravel::db;
+use laravel::prelude::*;
+use serde_json::{Value, json};
+
+use super::me::summary;
+use crate::models::User;
+use crate::notify::outbox::AppUrl;
+use crate::notify::{About, DeliverEmails, render, render::samples};
+
+pub fn routes(route: &mut Router) {
+ route.get("/api/ui/staff/signups", signups);
+ route.get("/api/ui/staff/emails", emails);
+ route.post("/api/ui/staff/emails/{id}/resolve", resolve);
+}
+
+fn staff_only(user: &User) -> laravel::Result<()> {
+ if user.staff { Ok(()) } else { Err(laravel::abort(404)) }
+}
+
+const TIME: &str = "YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"";
+
+/// `GET /api/ui/staff/signups`: the latest 100 people, newest first, with how they heard about VisualCI.
+pub async fn signups(Authenticated(user): Authenticated) -> laravel::Result> {
+ staff_only(&user)?;
+ let rows = db::query!(
+ "SELECT name, email, heard_about_source, heard_about_detail, \
+ to_char(created_at AT TIME ZONE 'UTC', {TIME}) AS created_at, \
+ (SELECT login FROM identities WHERE user_id = users.id ORDER BY id LIMIT 1) AS login \
+ FROM users ORDER BY id DESC LIMIT 100"
+ )
+ .select()
+ .await?;
+ let mut list = Vec::new();
+ for r in rows {
+ let (source, detail): (Option, Option) =
+ (r.try_get("heard_about_source")?, r.try_get("heard_about_detail")?);
+ list.push(json!({
+ "name": r.try_get::("name")?, "email": r.try_get::("email")?,
+ "login": r.try_get::