From 8b78454e86b2e59bb2c8efec910e9df1fe3417b4 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sun, 9 Mar 2025 19:04:23 +0100 Subject: [PATCH 1/8] Remove unused IFS from test workflow This has been present since moving from Travis CI to GitHub Actions. IFS controls how bash splits words, but we don't do any fancy word-splitting after that, so it's unused. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 155d6ee0..483c7518 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,6 @@ jobs: - name: Test run: | set -euo pipefail - IFS=$'\n\t' # Check if the code is good cargo build --all --locked cargo clippy -- --deny warnings From b6e33db7a692f4874308d5aaecbb3ff807ce6398 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sun, 9 Mar 2025 19:09:40 +0100 Subject: [PATCH 2/8] Remove unused docker setup --- .dockerignore | 2 -- .github/workflows/main.yml | 3 -- Dockerfile | 56 -------------------------------------- 3 files changed, 61 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile 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 483c7518..eb61fe8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,3 @@ jobs: 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/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"] From 602e5dc19076aeb4453fe9dbe631d54c346ca8d7 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 16 Apr 2025 18:28:07 +0200 Subject: [PATCH 3/8] Use the /releases/latest redirect of the blog --- src/main.rs | 31 +++++-------------------------- src/rust_version.rs | 31 ------------------------------- templates/index.html.hbs | 2 +- 3 files changed, 6 insertions(+), 58 deletions(-) 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/templates/index.html.hbs b/templates/index.html.hbs index b47f4efa..d2978d23 100644 --- a/templates/index.html.hbs +++ b/templates/index.html.hbs @@ -12,7 +12,7 @@ {{fluent "get-started"}}

- {{#fluent "homepage-version"}}{{#fluentparam "number"}}{{data.rust_version}}{{/fluentparam}}{{/fluent}} + {{#fluent "homepage-version"}}{{#fluentparam "number"}}{{data.rust_version}}{{/fluentparam}}{{/fluent}}

From 1683af87f63d66d538f37bfc61401f92f3ffe692 Mon Sep 17 00:00:00 2001 From: zopsicle Date: Wed, 30 Apr 2025 19:12:35 +0200 Subject: [PATCH 4/8] Add copyright notice to LICENSE-MIT --- LICENSE-MIT | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LICENSE-MIT b/LICENSE-MIT index 31aa7938..47e8d61a 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,3 +1,5 @@ +Copyright 2025 The Rust Programming Language Team + 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 From 2daf37d3af84656f4f2febc4cd95f63b2806d909 Mon Sep 17 00:00:00 2001 From: zopsicle Date: Wed, 30 Apr 2025 21:50:03 +0200 Subject: [PATCH 5/8] Match copyright notices with those in rust-lang/rust --- LICENSE-APACHE | 2 +- LICENSE-MIT | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 47e8d61a..a2070c4b 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright 2025 The Rust Programming Language Team +Copyright (c) The Rust Project Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated From 8e9f66f810137ba1b9fd4663991209a91364bbad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 20:03:51 +0000 Subject: [PATCH 6/8] Bump the all group with 2 updates Bumps the all group with 2 updates: [toml](https://github.com/toml-rs/toml) and [rust_team_data](https://github.com/rust-lang/team). Updates `toml` from 0.8.20 to 0.8.22 - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.20...toml-v0.8.22) Updates `rust_team_data` from `8f53fe7` to `5c6c007` - [Commits](https://github.com/rust-lang/team/compare/8f53fe78ea4abd17ed09a43562784fe77d0c5cc6...5c6c007c3325bb47e55e09f26b8f16832764aa98) --- updated-dependencies: - dependency-name: toml dependency-version: 0.8.22 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all - dependency-name: rust_team_data dependency-version: 5c6c007c3325bb47e55e09f26b8f16832764aa98 dependency-type: direct:production dependency-group: all ... Signed-off-by: dependabot[bot] --- Cargo.lock | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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" From 1d020cccabfee03b1c88cacf5105a58262958d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B4=A6=E0=B5=8D=E0=B4=A6=E0=B4=BF=CB=B6=F0=96=A5=A6=29?= =?UTF-8?q?=F0=9F=8D=8B?= Date: Sun, 4 May 2025 19:47:02 +0800 Subject: [PATCH 7/8] fix(i18n): home page footer layout overflow error --- templates/components/footer.html.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@