diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index c7f83c2c..00000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -target -.git diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 155d6ee0..eb61fe8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,11 +18,7 @@ jobs: - name: Test run: | set -euo pipefail - IFS=$'\n\t' # Check if the code is good cargo build --all --locked cargo clippy -- --deny warnings cargo test --all --locked - - - name: Build the Docker image - run: docker build -t website . diff --git a/Cargo.lock b/Cargo.lock index c8acb949..a01260ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "rust_team_data" version = "1.0.0" -source = "git+https://github.com/rust-lang/team#8f53fe78ea4abd17ed09a43562784fe77d0c5cc6" +source = "git+https://github.com/rust-lang/team#5c6c007c3325bb47e55e09f26b8f16832764aa98" dependencies = [ "indexmap", "serde", @@ -2418,9 +2418,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.20" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "serde", "serde_spanned", @@ -2430,26 +2430,33 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + [[package]] name = "tower" version = "0.5.2" diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c606329f..00000000 --- a/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -################# -# Build image # -################# - -FROM ubuntu:focal AS build - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates \ - curl \ - build-essential \ - pkg-config \ - libsass-dev \ - libssl-dev - -# Install the Rust toolchain with rustup -ENV RUSTUP_VERSION="1.24.3" -ENV RUSTUP_TRIPLE="x86_64-unknown-linux-gnu" -ENV RUSTUP_SHA="3dc5ef50861ee18657f9db2eeb7392f9c2a6c95c90ab41e45ab4ca71476b4338" -RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUSTUP_TRIPLE}/rustup-init" >/tmp/rustup-init && \ - echo "${RUSTUP_SHA} /tmp/rustup-init" | sha256sum --check && \ - chmod +x /tmp/rustup-init && \ - /tmp/rustup-init -y --no-modify-path -ENV PATH=/root/.cargo/bin:$PATH - -WORKDIR /build -COPY src /build/src/ -COPY locales /build/locales/ -COPY static /build/static/ -COPY templates /build/templates/ -COPY Cargo.toml Cargo.lock /build/ -RUN cargo build --release - -###################### -# Production image # -###################### - -FROM ubuntu:focal - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates \ - tini \ - libsass1 - -COPY --from=build /build/target/release/www-rust-lang-org /usr/local/bin/www-rust-lang-org - -WORKDIR /app -COPY templates /app/templates/ -COPY locales /app/locales/ -COPY static /app/static/ -COPY src/styles /app/src/styles/ - -ENV ROCKET_PORT 80 -ENV ROCKET_PROFILE release - -# Use `tini` (a small PID 1) to properly handle signals. -CMD ["tini", "--", "www-rust-lang-org"] diff --git a/LICENSE-APACHE b/LICENSE-APACHE index d88f6f26..4c45d9d1 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work. same "printed page" as the copyright notice for easier identification within third-party archives. -Copyright 2018 The Rust Programming Language Team +Copyright (c) The Rust Project Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/LICENSE-MIT b/LICENSE-MIT index 31aa7938..a2070c4b 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,3 +1,5 @@ +Copyright (c) The Rust Project Contributors + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the diff --git a/src/main.rs b/src/main.rs index b087a03d..eaa8285e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,6 @@ use cache::Cached; use rocket::catch; use rocket::get; use rocket::tokio::sync::RwLock; -use rust_version::RustReleasePost; use rust_version::RustVersion; use serde::Serialize; use teams::RustTeams; @@ -156,20 +155,13 @@ fn robots_txt() -> Option> { } #[get("/")] -async fn index( - version_cache: &Cache, - release_post_cache: &Cache, -) -> Template { - render_index(ENGLISH.into(), version_cache, release_post_cache).await +async fn index(version_cache: &Cache) -> Template { + render_index(ENGLISH.into(), version_cache).await } #[get("/", rank = 3)] -async fn index_locale( - locale: SupportedLocale, - version_cache: &Cache, - release_post_cache: &Cache, -) -> Template { - render_index(locale.0, version_cache, release_post_cache).await +async fn index_locale(locale: SupportedLocale, version_cache: &Cache) -> Template { + render_index(locale.0, version_cache).await } #[get("/")] @@ -328,26 +320,15 @@ fn concat_app_js(files: Vec<&str>) -> String { String::from(&js_path[1..]) } -async fn render_index( - lang: String, - version_cache: &Cache, - release_post_cache: &Cache, -) -> Template { +async fn render_index(lang: String, version_cache: &Cache) -> Template { #[derive(Serialize)] struct IndexData { rust_version: String, - rust_release_post: String, } let page = "index"; - let release_post = rust_version::rust_release_post(release_post_cache).await; let data = IndexData { rust_version: rust_version::rust_version(version_cache).await, - rust_release_post: if !release_post.is_empty() { - format!("https://blog.rust-lang.org/{}", release_post) - } else { - String::new() - }, }; let context = Context::new(page, "", true, data, lang); Template::render(page, context) @@ -438,14 +419,12 @@ async fn rocket() -> _ { }); let rust_version = RustVersion::fetch().await.unwrap_or_default(); - let rust_release_post = RustReleasePost::fetch().await.unwrap_or_default(); let teams = RustTeams::fetch().await.unwrap_or_default(); rocket::build() .attach(templating) .attach(headers::InjectHeaders) .manage(Arc::new(RwLock::new(rust_version))) - .manage(Arc::new(RwLock::new(rust_release_post))) .manage(Arc::new(RwLock::new(teams))) .mount( "/", diff --git a/src/rust_version.rs b/src/rust_version.rs index b84f6468..e1ce547c 100644 --- a/src/rust_version.rs +++ b/src/rust_version.rs @@ -5,11 +5,9 @@ use std::time::Instant; use crate::cache::{Cache, Cached}; static MANIFEST_URL: &str = "https://static.rust-lang.org/dist/channel-rust-stable.toml"; -static RELEASES_FEED_URL: &str = "https://blog.rust-lang.org/releases.json"; enum FetchTarget { Manifest, - ReleasesFeed, } async fn fetch(target: FetchTarget) -> Result> { @@ -27,7 +25,6 @@ async fn fetch(target: FetchTarget) -> Result MANIFEST_URL, - FetchTarget::ReleasesFeed => RELEASES_FEED_URL, }; Ok(client.get(url).send().await?) @@ -58,34 +55,6 @@ impl Cached for RustVersion { } } -#[derive(Debug, Clone)] -pub struct RustReleasePost(pub String, pub Instant); - -impl Default for RustReleasePost { - fn default() -> Self { - Self(Default::default(), Instant::now()) - } -} - -impl Cached for RustReleasePost { - fn get_timestamp(&self) -> Instant { - self.1 - } - async fn fetch() -> Result> { - let releases = fetch(FetchTarget::ReleasesFeed) - .await? - .text() - .await? - .parse::()?; - let url = releases["releases"][0]["url"].as_str().unwrap().to_string(); - Ok(RustReleasePost(url, Instant::now())) - } -} - pub async fn rust_version(version_cache: &Cache) -> String { RustVersion::get(version_cache).await.0 } - -pub async fn rust_release_post(release_post_cache: &Cache) -> String { - RustReleasePost::get(release_post_cache).await.0 -} diff --git a/src/teams.rs b/src/teams.rs index 24bd5c4c..23a9983f 100644 --- a/src/teams.rs +++ b/src/teams.rs @@ -31,6 +31,8 @@ pub struct PageData { subteams: Vec, wgs: Vec, project_groups: Vec, + // Marker teams and other kinds of groups that have a website entry + other_teams: Vec, } #[derive(Clone)] @@ -112,6 +114,7 @@ impl Data { let mut raw_subteams = Vec::new(); let mut wgs = Vec::new(); let mut project_groups = Vec::new(); + let mut other_teams = Vec::new(); let superteams: HashMap<_, _> = self .teams @@ -142,12 +145,13 @@ impl Data { TeamKind::Team => raw_subteams.push(team), TeamKind::WorkingGroup => wgs.push(team), TeamKind::ProjectGroup => project_groups.push(team), - _ => {} + TeamKind::MarkerTeam | TeamKind::Unknown => other_teams.push(team), }); raw_subteams.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight)); wgs.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight)); project_groups.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight)); + other_teams.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight)); // Lay out subteams according to their hierarchy. // Superteams come first and subteams come after, recursively. @@ -181,6 +185,7 @@ impl Data { subteams, wgs, project_groups, + other_teams, }) } } diff --git a/templates/components/footer.html.hbs b/templates/components/footer.html.hbs index 444d2814..c7ae27d4 100644 --- a/templates/components/footer.html.hbs +++ b/templates/components/footer.html.hbs @@ -1,6 +1,6 @@