diff --git a/docker-compose.yml b/docker-compose.yml index 3ed63c9..d42d671 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,7 +49,7 @@ services: - DATABASE_URL=postgresql://artdag:artdag@postgres:5432/artdag - IPFS_API=/dns/ipfs/tcp/5001 - CACHE_DIR=/data/cache - # L2_SERVER and L2_DOMAIN from .env file + # L2_SERVER, L2_DOMAIN, IPFS_GATEWAY_URL from .env file volumes: - l1_cache:/data/cache depends_on: diff --git a/server.py b/server.py index 4a3d41d..2f8792b 100644 --- a/server.py +++ b/server.py @@ -40,6 +40,9 @@ L1_PUBLIC_URL = os.environ.get("L1_PUBLIC_URL", "http://localhost:8100") # Default L2 for login redirect when not logged in (user can login to any L2) DEFAULT_L2_SERVER = os.environ.get("DEFAULT_L2_SERVER", "http://localhost:8200") +# IPFS gateway URL for public access to IPFS content +IPFS_GATEWAY_URL = os.environ.get("IPFS_GATEWAY_URL", "") + # Cache directory (use /data/cache in Docker, ~/.artdag/cache locally) CACHE_DIR = Path(os.environ.get("CACHE_DIR", str(Path.home() / ".artdag" / "cache"))) CACHE_DIR.mkdir(parents=True, exist_ok=True) @@ -1778,6 +1781,30 @@ async def cache_detail(content_hash: str, request: Request): # Add IPFS section if we have a CID if ipfs_cid: + # Build gateway links - local gateway first if configured + gateway_links = [] + if IPFS_GATEWAY_URL: + gateway_links.append(f''' + + Local Gateway + ''') + gateway_links.extend([ + f''' + ipfs.io + ''', + f''' + dweb.link + ''', + f''' + Cloudflare + ''', + ]) + gateways_html = '\n'.join(gateway_links) + content += f'''