From 17c7738d6ea776f40f3ecdb12f1fbc08c0b9cf54 Mon Sep 17 00:00:00 2001 From: Ben Sherman Date: Thu, 30 May 2024 20:40:16 -0700 Subject: [PATCH 1/6] Properly apply REDLIB_DEFAULT_HIDE_SIDEBAR_AND_SUMMARY This change fixes the REDLIB_DEFAULT_HIDE_SIDEBAR_AND_SUMMARY environment variable being ignored. --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index c7ebb58..e345537 100644 --- a/src/config.rs +++ b/src/config.rs @@ -156,7 +156,7 @@ fn get_setting_from_config(name: &str, config: &Config) -> Option { "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(), "REDLIB_DEFAULT_WIDE" => config.default_wide.clone(), "REDLIB_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(), - "REDLIB_DEFAULT_HIDE_SIDEBAR_AND_SUMMARY" => config.default_hide_awards.clone(), + "REDLIB_DEFAULT_HIDE_SIDEBAR_AND_SUMMARY" => config.default_hide_sidebar_and_summary.clone(), "REDLIB_DEFAULT_HIDE_SCORE" => config.default_hide_score.clone(), "REDLIB_DEFAULT_SUBSCRIPTIONS" => config.default_subscriptions.clone(), "REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION" => config.default_disable_visit_reddit_confirmation.clone(), From 190c92339ea58dd2047f2b56218c6cd522f3a15d Mon Sep 17 00:00:00 2001 From: Harm133 Date: Fri, 31 May 2024 10:19:44 +0200 Subject: [PATCH 2/6] Update build-artifacts.yaml Only build artifacts on published release --- .github/workflows/build-artifacts.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-artifacts.yaml b/.github/workflows/build-artifacts.yaml index 57632ef..695d1bf 100644 --- a/.github/workflows/build-artifacts.yaml +++ b/.github/workflows/build-artifacts.yaml @@ -7,6 +7,8 @@ on: - "compose.*" branches: - "main" + release: + types: [published] env: CARGO_TERM_COLOR: always @@ -60,7 +62,6 @@ jobs: - name: Upload release uses: softprops/action-gh-release@v1 - if: github.base_ref != 'main' && github.event_name == 'release' with: tag_name: ${{ steps.version.outputs.VERSION }} name: ${{ steps.version.outputs.VERSION }} - ${{ github.event.head_commit.message }} From 3caa0592f33012f64de61b2da67961385bc9f9fd Mon Sep 17 00:00:00 2001 From: Pim Date: Fri, 31 May 2024 11:40:01 +0200 Subject: [PATCH 3/6] fix: healthcheck in Dockerfile Fix typo causing wget to return a warning: ``` # wget --q wget: option '--q' is ambiguous; possibilities: '--quiet' '--quota' ``` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9412565..314a784 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ USER redlib EXPOSE 8080 # Run a healthcheck every minute to make sure redlib is functional -HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1 +HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1 CMD ["redlib"] From ec11a5511b7702563635eb2b5617ade200c3673e Mon Sep 17 00:00:00 2001 From: Arul Agrawal Date: Fri, 31 May 2024 17:04:43 +0400 Subject: [PATCH 4/6] add nix flake --- .envrc | 1 + .gitignore | 4 ++ flake.lock | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 71 +++++++++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 323a69d..a8d371a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ .env # Idea Files .idea/ + +# nix files +.direnv/ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4569244 --- /dev/null +++ b/flake.lock @@ -0,0 +1,106 @@ +{ + "nodes": { + "crane": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717025063, + "narHash": "sha256-dIubLa56W9sNNz0e8jGxrX3CAkPXsq7snuFA/Ie6dn8=", + "owner": "ipetkov", + "repo": "crane", + "rev": "480dff0be03dac0e51a8dfc26e882b0d123a450e", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1717112898, + "narHash": "sha256-7R2ZvOnvd9h8fDd65p0JnB7wXfUvreox3xFdYWd1BnY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6132b0f6e344ce2fe34fc051b72fb46e34f668e0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717121863, + "narHash": "sha256-/3sxIe7MZqF/jw1RTQCSmgTjwVod43mmrk84m50MJQ4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2a7b53172ed08f856b8382d7dcfd36a4e0cbd866", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8bcacf6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,71 @@ +{ + description = "Redlib: Private front-end for Reddit"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + crane = { + url = "github:ipetkov/crane"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + }; + + outputs = { nixpkgs, crane, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; + + inherit (pkgs) lib; + + rustToolchain = pkgs.rust-bin.stable.latest.default.override { + targets = [ "x86_64-unknown-linux-musl" ]; + }; + + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + + + src = lib.cleanSourceWith { + src = craneLib.path ./.; + filter = path: type: + (lib.hasInfix "/templates/" path) || + (lib.hasInfix "/static/" path) || + (craneLib.filterCargoSources path type); + }; + + redlib = craneLib.buildPackage { + inherit src; + strictDeps = true; + doCheck = false; + + CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl"; + CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; + }; + in + { + checks = { + my-crate = redlib; + }; + + packages.default = redlib; + packages.docker = pkgs.dockerTools.buildImage { + name = "quay.io/redlib/redlib"; + tag = "latest"; + created = "now"; + copyToRoot = with pkgs.dockerTools; [ caCertificates fakeNss ]; + config.Cmd = "${redlib}/bin/redlib"; + }; + }); +} From 8ece7562ec1927e76cfaef918d30646c1cbce26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89li=20Marshal?= <835958+EMarshal@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:45:49 -0600 Subject: [PATCH 5/6] Remove obsolete references to latest-arm and latest-armv7 images --- README.md | 6 ------ compose.yaml | 2 -- 2 files changed, 8 deletions(-) diff --git a/README.md b/README.md index 4b945ad..1773858 100644 --- a/README.md +++ b/README.md @@ -203,12 +203,6 @@ docker logs -f redlib ### Docker CLI -> [!IMPORTANT] -> If deploying on: -> -> - an `arm64` platform, use the `quay.io/redlib/redlib:latest-arm` image instead. -> - an `armv7` platform, use the `quay.io/redlib/redlib:latest-armv7` image instead. - Deploy Redlib: ```bash diff --git a/compose.yaml b/compose.yaml index 493e37e..4260d65 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,8 +1,6 @@ services: redlib: image: quay.io/redlib/redlib:latest - # image: quay.io/redlib/redlib:latest-arm # uncomment if you use arm64 - # image: quay.io/redlib/redlib:latest-armv7 # uncomment if you use armv7 restart: always container_name: "redlib" ports: From 7fa37e48d5220414f9845cc5cb01f46818a5e338 Mon Sep 17 00:00:00 2001 From: Sangeeth Sudheer Date: Tue, 11 Jun 2024 21:16:44 +0530 Subject: [PATCH 6/6] Add font-weight range in @font-face rule This makes Safari render the bold weights correctly which otherwise looks wrong. --- static/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/static/style.css b/static/style.css index 98c968e..7cef37c 100644 --- a/static/style.css +++ b/static/style.css @@ -34,6 +34,7 @@ font-family: 'Inter'; src: url('/Inter.var.woff2') format('woff2-variations'); font-style: normal; + font-weight: 100 900; } /* Automatic theme selection */