From b089b8c0a8190e62fc23736921989f8dc3c6b47f Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sun, 26 Oct 2025 18:20:03 +1100 Subject: [PATCH] feat: Add new tools api route --- blueprints/api.py | 17 ++++++++++++++++- data/tools.json | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/blueprints/api.py b/blueprints/api.py index dc70b3e..942ab62 100644 --- a/blueprints/api.py +++ b/blueprints/api.py @@ -4,7 +4,7 @@ import datetime import requests import re from mail import sendEmail -from tools import getClientIP, getGitCommit, json_response, parse_date +from tools import getClientIP, getGitCommit, json_response, parse_date, get_tools_data from blueprints.sol import sol_bp from dateutil import parser as date_parser @@ -164,6 +164,21 @@ def project(): "status": HTTP_OK }) +@api_bp.route("/tools") +def tools(): + """Get a list of tools used by Nathan Woodburn.""" + try: + tools = get_tools_data() + except Exception as e: + print(f"Error getting tools data: {e}") + return json_response(request, "500 Internal Server Error", HTTP_SERVER_ERROR) + + # Remove demo and move demo_url to demo + for tool in tools: + if "demo_url" in tool: + tool["demo"] = tool.pop("demo_url") + + return json_response(request, {"tools": tools}, HTTP_OK) @api_bp.route("/page_date") def page_date(): diff --git a/data/tools.json b/data/tools.json index 32642f6..1d51384 100644 --- a/data/tools.json +++ b/data/tools.json @@ -34,42 +34,48 @@ "type": "terminal", "url": "https://fx.wtf/", "description": "A command-line JSON viewer and processor", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/4" }, { "name": "Zoxide", "type": "terminal", "url": "https://github.com/ajeetdsouza/zoxide", "description": "cd but with fuzzy matching and other cool features", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/5" }, { "name": "Atuin", "type": "terminal", "url": "https://atuin.sh/", "description": "A next-generation shell history manager", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/6" }, { "name": "Tmate", "type": "terminal", "url": "https://tmate.io/", "description": "Instant terminal sharing", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/7" }, { "name": "Eza", "type": "terminal", "url": "https://eza.rocks/", "description": "A modern replacement for 'ls'", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/8" }, { "name": "Bat", "type": "terminal", "url": "https://github.com/sharkdp/bat", "description": "A cat clone with syntax highlighting and Git integration", - "demo": "" + "demo": "", + "demo_url": "https://asciinema.c.woodburn.au/a/9" }, { "name": "Oh My Zsh",