diff --git a/.gitignore b/.gitignore
index 0ee5b63..f9d527b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
index.html*
/mirrors
+/node_modules
# Byte-compiled / optimized / DLL files
__pycache__/
@@ -198,9 +199,9 @@ cython_debug/
.abstra/
# Visual Studio Code
-# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
+# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
-# and can be added to the global gitignore or merged into this file. However, if you prefer,
+# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
diff --git a/app.py b/app.py
index 90523f8..8032312 100755
--- a/app.py
+++ b/app.py
@@ -1,373 +1,239 @@
#!/usr/bin/env python3
-from flask import Flask, request, redirect, url_for, jsonify, render_template_string, abort
-import threading
from mirror_manager import (
load_mirrors,
add_mirror,
update_mirror,
+ MIRROR_ROOT,
LOG_ROOT,
)
+import subprocess
+import threading
+from pathlib import Path
+from flask import (
+ Flask,
+ request,
+ redirect,
+ url_for,
+ jsonify,
+ send_from_directory,
+ render_template_string
+)
+
+
+BASE = Path("/srv/www")
+STATIC_DIR = BASE / "static"
+STATIC_DIR.mkdir(exist_ok=True)
app = Flask(__name__)
-# --- background update helper ---
-
def _run_update_in_background(slug: str):
th = threading.Thread(target=update_mirror, args=(slug,), daemon=True)
th.start()
-# --- templates ---
+# -------------------- TEMPLATES --------------------
INDEX_TEMPLATE = r"""
-
+
Mirror Manager
-
+
-
-
-
-
-
Mirror Manager
-
Local archive of external sites, grouped by category.
+
+
+
+
+
+
Mirror Manager
+
Local offline mirrors of external sites, grouped by category.
+
+
+
+
+ Running locally
+
+
-
-
-
-
-
- Categories:
-
- {% for cat in categories %}
-
- {% endfor %}
+
+
+
+
+
+
+ Categories:
+
+ {% for cat in categories %}
+
+ {% endfor %}
+