new homepage map temporary
authorShane Jaroch <chown_tee@proton.me>
Mon, 19 Jan 2026 07:45:08 +0000 (02:45 -0500)
committerShane Jaroch <chown_tee@proton.me>
Mon, 19 Jan 2026 07:45:08 +0000 (02:45 -0500)
Makefile
etc/nginx/conf.d/default.conf
scripts/deploy.sh
scripts/gen_services_map.py
scripts/gitweb-simplefrontend/homepage.html [new file with mode: 0644]
scripts/homepage.html [new file with mode: 0644]

index 3b3e3ac95532d1626de559600cb372972fea8ba0..3e0d556c1f1504462d7a2d89777c68ab19f64cbc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,7 @@ stage/nginx: ##H @Remote Stage files on the remote VPS
        scp -q etc/gitweb.conf $(VPS):~/.nginx-staging/etc/gitweb.conf
        scp -q -r scripts/gitweb-simplefrontend/* $(VPS):~/.nginx-staging/scripts/gitweb-simplefrontend/
        scp -q scripts/deploy.sh $(VPS):~/.nginx-staging/scripts/deploy.sh
+       scp -q scripts/gen_services_map.py $(VPS):~/.nginx-staging/scripts/gen_services_map.py
 
 .PHONY: diff/nginx
 diff/nginx: ##H @Remote Show diff between local and remote
index 1836a113dfd287b548ddce05fd5c962eade4e480..b866859d1d0401b49bd3f7eb22b618b59e1bfb9f 100644 (file)
@@ -1,5 +1,6 @@
 # API
 server {
+  # Service: API | https://api.dev.nutra.tk
   server_name api-dev.nutra.tk api.dev.nutra.tk;
   #listen 80;
   listen 443 ssl;
@@ -35,6 +36,7 @@ server {
 
 # Store Front (MedusaJS)
 server {
+  # Service: Store | https://store.nutra.tk
   server_name store.nutra.tk;
   #listen 80;
   listen 443 ssl;
@@ -50,6 +52,7 @@ server {
 
 # Store [Admin UI] (MedusaJS)
 server {
+  # Service: Store Admin | https://store-admin-8b56411b.nutra.tk
   server_name store-api.nutra.tk store-admin-8b56411b.nutra.tk;
   #listen 80;
   listen 443 ssl;
@@ -92,12 +95,10 @@ server {
   #ssl_stapling on;
   #ssl_stapling_verify on;
 
-  # React app (base URL)
+  # Services Map (Homepage)
   location / {
-    #return 302 https://$host/api$request_uri;
-    root /var/www/app;
-    index index.html;
-    #try_files $uri $uri/ /index.html =404;
+    alias /var/www/homepage.html;
+    default_type text/html;
   }
 
 #  # Blog / Sphinx
@@ -171,6 +172,7 @@ server {
   server_name matrix.nutra.tk chat.nutra.tk;
 
   location / {
+    # Service: Matrix Chat | https://chat.nutra.tk
     proxy_pass http://127.0.0.1:8008;
     proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
     proxy_set_header X-Forwarded-For $remote_addr;
index 90873c6e66177c307bf8b99f9c1ce09d077a7f1d..3c78b7e8a37ef7ebe4944c372adc94f7e0d638d3 100755 (executable)
@@ -106,11 +106,24 @@ if sudo nginx -t; then
 
     # Deploy Gitweb frontend assets
     if [ -d "$REPO_ROOT/scripts/gitweb-simplefrontend" ]; then
+        echo "Generating services map..."
+        if [ -f "$REPO_ROOT/scripts/gen_services_map.py" ]; then
+             python3 "$REPO_ROOT/scripts/gen_services_map.py"
+        fi
+        
         echo "Deploying Gitweb frontend..."
         sudo cp -r "$REPO_ROOT/scripts/gitweb-simplefrontend/"* /srv/git/
         sudo chown -R www-data:www-data /srv/git/
     fi
 
+    # Deploy Homepage
+    if [ -f "$REPO_ROOT/scripts/homepage.html" ]; then
+        echo "Deploying Homepage..."
+        sudo mkdir -p /var/www
+        sudo cp "$REPO_ROOT/scripts/homepage.html" /var/www/homepage.html
+        sudo chown www-data:www-data /var/www/homepage.html
+    fi
+
     echo "✓ Deployment successful."
 else
     echo "✗ Configuration failed validation! Rolling back..."
index 17de848182dcad9efaed2c03b83c3c7de9388df8..ca62bb25f530970c0333008b2f17ca24e26ca569 100755 (executable)
@@ -35,33 +35,43 @@ HTML_TEMPLATE = """<!DOCTYPE html>
 </html>"""
 
 
-def parse_nginx_config():
-    services = []
 
-    if not NGINX_CONF.exists():
-        print(f"Error: Could not find config at {NGINX_CONF}")
-        return []
-
-    # Regex to find "Version X: Description" lines
-    # Matches: # Version 1: Original Gitweb (Standard)
-    version_pattern = re.compile(r"^\s*#\s*Version\s+(\w+):\s*(.+)$", re.MULTILINE)
-
-    with open(NGINX_CONF, "r") as f:
+def parse_file(path, pattern, is_version=False):
+    if not path.exists():
+         print(f"Warning: Could not find config at {path}")
+         return []
+    
+    with open(path, "r") as f:
         content = f.read()
 
-        matches = version_pattern.findall(content)
-        for version_id, description in matches:
+    items = []
+    matches = pattern.findall(content)
+    for m in matches:
+        if is_version:
+            version_id, description = m
             # Clean up version ID (e.g., '1' -> 'v1')
             if not version_id.startswith("v"):
                 vid = f"v{version_id}"
             else:
                 vid = version_id
+            items.append({"id": vid, "url": f"/{vid}", "description": description.strip()})
+        else:
+            name, url = m
+            items.append({"id": name.strip(), "url": url.strip(), "description": name.strip()})
+    return items
+
+
+def get_all_services():
+    # Regex to find "Version X: Description" lines
+    version_pattern = re.compile(r"^\s*#\s*Version\s+(\w+):\s*(.+)$", re.MULTILINE)
+    service_pattern = re.compile(r"^\s*#\s*Service:\s*(.+?)\s*\|\s*(.+)$", re.MULTILINE)
 
-            services.append(
-                {"id": vid, "url": f"/{vid}", "description": description.strip()}
-            )
+    services_git = parse_file(NGINX_CONF, version_pattern, is_version=True)
+    
+    DEFAULT_CONF = REPO_ROOT / "etc/nginx/conf.d/default.conf"
+    services_other = parse_file(DEFAULT_CONF, service_pattern, is_version=False)
 
-    return services
+    return services_git, services_other
 
 
 def generate_html(services):
@@ -78,22 +88,26 @@ def generate_html(services):
 
 
 def main():
-    print(f"Reading config from: {NGINX_CONF}")
-    services = parse_nginx_config()
-
-    if not services:
-        print("No services found!")
-        return
-
-    print(f"Found {len(services)} services: {[s['id'] for s in services]}")
-
-    html_content = generate_html(services)
+    print(f"Reading configs...")
+    services_git, services_other = get_all_services()
 
+    # Output 1: Git Services Only
+    print(f"Generating Git Services map with {len(services_git)} items...")
+    git_html = generate_html(services_git)
     os.makedirs(OUTPUT_HTML.parent, exist_ok=True)
     with open(OUTPUT_HTML, "w") as f:
-        f.write(html_content)
-
-    print(f"Generated site map at: {OUTPUT_HTML}")
+        f.write(git_html)
+    print(f"Generated Git map at: {OUTPUT_HTML}")
+
+    # Output 2: Homepage (All Services)
+    # Save to scripts/homepage.html to keep it separate from gitweb assets
+    OUTPUT_HTML_HOME = REPO_ROOT / "scripts/homepage.html"
+    services_all = services_git + services_other
+    print(f"Generating Homepage map with {len(services_all)} items...")
+    home_html = generate_html(services_all)
+    with open(OUTPUT_HTML_HOME, "w") as f:
+        f.write(home_html)
+    print(f"Generated Homepage map at: {OUTPUT_HTML_HOME}")
 
 
 if __name__ == "__main__":
diff --git a/scripts/gitweb-simplefrontend/homepage.html b/scripts/gitweb-simplefrontend/homepage.html
new file mode 100644 (file)
index 0000000..b5e27c0
--- /dev/null
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>NutraTech Git Services</title>
+    <style>
+        body { font-family: sans-serif; max-width: 800px; margin: 2rem auto; line-height: 1.6; padding: 0 1rem; color: #333; }
+        h1 { border-bottom: 2px solid #eee; padding-bottom: 0.5rem; }
+        .service { margin-bottom: 1.5rem; padding: 1.5rem; border: 1px solid #ddd; border-radius: 8px; background: #f9f9f9; }
+        .service:hover { background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border-color: #ccc; }
+        .service h2 { margin-top: 0; margin-bottom: 0.5rem; }
+        .service a { text-decoration: none; color: #0066cc; }
+        .service a:hover { text-decoration: underline; }
+        .desc { margin-bottom: 0.5rem; }
+        .meta { font-size: 0.85em; color: #666; }
+        .tag { display: inline-block; padding: 2px 8px; background: #e0e0e0; border-radius: 12px; font-size: 0.8em; margin-right: 0.5rem; color: #444; }
+    </style>
+</head>
+<body>
+    <h1>Git Services Map</h1>
+    <p class="meta">Generated automatically from Nginx configuration.</p>
+
+    
+    <div class="service">
+        <h2><a href="/v1">/v1</a></h2>
+        <div class="desc">Original Gitweb (Basic)</div>
+    </div>
+    <div class="service">
+        <h2><a href="/v2">/v2</a></h2>
+        <div class="desc">Styled Frontend (Theme, Static)</div>
+    </div>
+    <div class="service">
+        <h2><a href="/v3">/v3</a></h2>
+        <div class="desc">Gitea (Full Server with Backend, Main)</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://api.dev.nutra.tk">https://api.dev.nutra.tk</a></h2>
+        <div class="desc">API</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://store.nutra.tk">https://store.nutra.tk</a></h2>
+        <div class="desc">Store</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://store-admin-8b56411b.nutra.tk">https://store-admin-8b56411b.nutra.tk</a></h2>
+        <div class="desc">Store Admin</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://chat.nutra.tk">https://chat.nutra.tk</a></h2>
+        <div class="desc">Matrix Chat</div>
+    </div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/scripts/homepage.html b/scripts/homepage.html
new file mode 100644 (file)
index 0000000..b5e27c0
--- /dev/null
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>NutraTech Git Services</title>
+    <style>
+        body { font-family: sans-serif; max-width: 800px; margin: 2rem auto; line-height: 1.6; padding: 0 1rem; color: #333; }
+        h1 { border-bottom: 2px solid #eee; padding-bottom: 0.5rem; }
+        .service { margin-bottom: 1.5rem; padding: 1.5rem; border: 1px solid #ddd; border-radius: 8px; background: #f9f9f9; }
+        .service:hover { background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border-color: #ccc; }
+        .service h2 { margin-top: 0; margin-bottom: 0.5rem; }
+        .service a { text-decoration: none; color: #0066cc; }
+        .service a:hover { text-decoration: underline; }
+        .desc { margin-bottom: 0.5rem; }
+        .meta { font-size: 0.85em; color: #666; }
+        .tag { display: inline-block; padding: 2px 8px; background: #e0e0e0; border-radius: 12px; font-size: 0.8em; margin-right: 0.5rem; color: #444; }
+    </style>
+</head>
+<body>
+    <h1>Git Services Map</h1>
+    <p class="meta">Generated automatically from Nginx configuration.</p>
+
+    
+    <div class="service">
+        <h2><a href="/v1">/v1</a></h2>
+        <div class="desc">Original Gitweb (Basic)</div>
+    </div>
+    <div class="service">
+        <h2><a href="/v2">/v2</a></h2>
+        <div class="desc">Styled Frontend (Theme, Static)</div>
+    </div>
+    <div class="service">
+        <h2><a href="/v3">/v3</a></h2>
+        <div class="desc">Gitea (Full Server with Backend, Main)</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://api.dev.nutra.tk">https://api.dev.nutra.tk</a></h2>
+        <div class="desc">API</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://store.nutra.tk">https://store.nutra.tk</a></h2>
+        <div class="desc">Store</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://store-admin-8b56411b.nutra.tk">https://store-admin-8b56411b.nutra.tk</a></h2>
+        <div class="desc">Store Admin</div>
+    </div>
+    <div class="service">
+        <h2><a href="https://chat.nutra.tk">https://chat.nutra.tk</a></h2>
+        <div class="desc">Matrix Chat</div>
+    </div>
+
+</body>
+</html>
\ No newline at end of file