From c75dfed8500afd4f3385afef48767d9d4b8a15e1 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 25 Dec 2025 17:55:15 -0500 Subject: [PATCH] docs: add nightly release redirect --- docs/.gitignore | 1 + docs/content/nightly-release.md | 1 + docs/content/troubleshooting.md | 21 +++++++++++---------- docs/hooks/nightly_redirect.py | 27 +++++++++++++++++++++++++++ docs/mkdocs.yml | 6 ++++++ docs/requirements.txt | 2 +- docs/serve.sh | 12 ++++++------ 7 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 docs/content/nightly-release.md create mode 100644 docs/hooks/nightly_redirect.py diff --git a/docs/.gitignore b/docs/.gitignore index 0837bd4b..5ec01e14 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,4 @@ site/ venv/ .cache/ +hooks/__pycache__/ \ No newline at end of file diff --git a/docs/content/nightly-release.md b/docs/content/nightly-release.md new file mode 100644 index 00000000..e54dfb2a --- /dev/null +++ b/docs/content/nightly-release.md @@ -0,0 +1 @@ + diff --git a/docs/content/troubleshooting.md b/docs/content/troubleshooting.md index a1664e7c..8ee41cd6 100644 --- a/docs/content/troubleshooting.md +++ b/docs/content/troubleshooting.md @@ -80,36 +80,37 @@ Let's say you're installing [Iosevka](https://github.com/be5invis/Iosevka). The ## Why can't I see all my temperature sensors on Windows? -This is a [known limitation](./support/official.md#windows), some sensors may require admin privileges to get sensor data. +This is a known issue, some sensors may require admin privileges to get sensor data. ## Why don't I see dual batteries on Windows reported separately? (e.g. Thinkpads) -This is a [known limitation](./support/official.md#windows) which seems to be with how batteries are being detected on Windows. +This is a known issue which seems to be with how batteries are being detected on Windows. ## Why can't I see all my temperature sensors on WSL? -This is a [known limitation](./support/official.md#windows) with WSL. Due to how it works, hosts may not expose their +This is a known limitation with WSL. Due to how it works, hosts may not expose their temperature sensors and therefore, temperature sensors might be missing. ## Why does WSL2 not match Task Manager? -This is a [known limitation](./support/official.md#windows) with WSL2. Due to how WSL2 works, the two might not match +This is a known limitation with WSL2. Due to how WSL2 works, the two might not match up in terms of reported data. ## Why can't I see all my processes/process data on macOS? -This is a [known limitation](./support/official.md#macos), and you may have to run the program with elevated -privileges to work around it - for example: +You may have to run the program with elevated privileges to work around it - for example: ```bash sudo btm ``` -**Please note that you should be certain that you trust any software you grant root privileges.** +!!! Warning -There are measures taken to try to maximize the amount of information obtained without elevated privileges. For example, -one can modify the instructions found on the [htop wiki](https://github.com/hishamhm/htop/wiki/macOS:-run-without-sudo) -on how to run htop without sudo for bottom. However, **please** understand the potential security risks before doing so! + Please note that you should be certain that you trust any software you grant root privileges. + + There are measures taken to try to maximize the amount of information obtained without elevated privileges. For example, + one can modify the instructions found on the [htop wiki](https://github.com/hishamhm/htop/wiki/macOS:-run-without-sudo) + on how to run htop without sudo for bottom. However, **please** understand the potential security risks before doing so! ## My configuration file isn't working diff --git a/docs/hooks/nightly_redirect.py b/docs/hooks/nightly_redirect.py new file mode 100644 index 00000000..1e5140b6 --- /dev/null +++ b/docs/hooks/nightly_redirect.py @@ -0,0 +1,27 @@ +import mkdocs.plugins +import urllib.request +import json + + +# Based on https://github.com/squidfunk/mkdocs-material/discussions/3758#discussioncomment-4397373 + +@mkdocs.plugins.event_priority(-50) +def on_config(config): + print("Running nightly release redirect hook...") + try: + with urllib.request.urlopen("https://api.github.com/repos/ClementTsang/bottom/releases") as response: + raw_data = response.read() + data = json.loads(raw_data.decode('utf-8')) + + first_nightly = next(release for release in data if "nightly-" in release["tag_name"]) + nightly_tag_name = first_nightly["tag_name"] + + redirect_plugin = config.get('plugins', {}).get('redirects') + redirects = redirect_plugin.config.get('redirect_maps', {}) + + nightly_release_url = f"https://github.com/ClementTsang/bottom/releases/tag/{nightly_tag_name}" + + print(f"Updated nightly release redirect to point to {nightly_release_url}") + redirects["nightly-release.md"] = nightly_release_url + except Exception as e: + print(f"error adjusting redirect, falling back to general releases page: {e}") diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index da23e4f9..bc510de2 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -137,6 +137,9 @@ plugins: - git-revision-date-localized: type: date - privacy + - redirects: + redirect_maps: + nightly-release.md: "https://github.com/ClementTsang/bottom/releases" extra: # Versioning @@ -185,3 +188,6 @@ nav: - "Build Process": contribution/development/build_process.md - "Deploy Process": contribution/development/deploy_process.md - "Troubleshooting": troubleshooting.md + +hooks: + - ./hooks/nightly_redirect.py \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index f15b2fca..f643a247 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,4 +3,4 @@ mkdocs-material == 9.7.1 mdx_truly_sane_lists == 1.3 mike == 2.1.3 mkdocs-git-revision-date-localized-plugin == 1.4.5 - +mkdocs-redirects == 1.2.2 diff --git a/docs/serve.sh b/docs/serve.sh index c19c451c..bab5486b 100755 --- a/docs/serve.sh +++ b/docs/serve.sh @@ -2,21 +2,21 @@ set -e -VENV_PATH="./venv/" +VENV_PATH="./.venv/" PYTHON_CMD=${1:-python} if [ ! -d $VENV_PATH ]; then echo "venv not found, creating one using the command '${PYTHON_CMD}'..."; - $PYTHON_CMD -m venv venv; - source ./venv/bin/activate; + $PYTHON_CMD -m venv .venv; + source $VENV_PATH/bin/activate; pip install --upgrade pip; pip install -r requirements.txt; - ./venv/bin/mkdocs serve; + $VENV_PATH/bin/mkdocs serve; else echo "venv already found."; - source ./venv/bin/activate; + source $VENV_PATH/bin/activate; pip install --upgrade pip; pip install -r requirements.txt; - ./venv/bin/mkdocs serve; + $VENV_PATH/bin/mkdocs serve; fi;