66 lines
3.1 KiB
Python
66 lines
3.1 KiB
Python
import json, os, subprocess
|
||
from datetime import datetime
|
||
|
||
NAS_WEB_ROOT = "/volume1/web/legal/gis"
|
||
HTML_FILE = "/app/web_index.html"
|
||
|
||
def run():
|
||
# Получаем список папок на NAS через SSH
|
||
cmd = ["ssh", "matrixhasyou@192.168.10.105", f"ls -F {NAS_WEB_ROOT}/raw/"]
|
||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||
folders = [f.strip('/') for f in result.stdout.split('\n') if f.strip() and f.endswith('/')]
|
||
|
||
html = f"""<!DOCTYPE html>
|
||
<html lang='ru'>
|
||
<head>
|
||
<meta charset='UTF-8'>
|
||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||
<title>Жатва ГИС ЖКХ: LIVE</title>
|
||
<script src='https://cdn.tailwindcss.com'></script>
|
||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css'>
|
||
</head>
|
||
<body class='bg-slate-100 text-slate-900 pb-10'>
|
||
<header class='bg-blue-600 text-white py-12 px-4 shadow-xl mb-8'>
|
||
<div class='container mx-auto max-w-4xl text-center'>
|
||
<h1 class='text-4xl font-black mb-2 tracking-tighter'>🚀 ВЕЛИКАЯ ЖАТВА ГИС ЖКХ</h1>
|
||
<p class='opacity-80 italic font-semibold text-sm uppercase tracking-widest'>Скриншоты-улики и вложения в реальном времени</p>
|
||
</div>
|
||
</header>
|
||
<main class='container mx-auto max-w-4xl px-4'>
|
||
<div class='grid grid-cols-1 md:grid-cols-2 gap-6'>
|
||
"""
|
||
|
||
for f in folders:
|
||
html += f"""
|
||
<div class='bg-white rounded-3xl p-6 shadow-sm border border-slate-200 hover:shadow-md transition-all'>
|
||
<div class='flex items-center justify-between mb-4'>
|
||
<span class='bg-blue-100 text-blue-700 px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest'>Обращение</span>
|
||
<span class='text-slate-400 font-mono text-xs'>{f}</span>
|
||
</div>
|
||
<div class='space-y-3'>
|
||
<a href='archive_new/{f}/evidence.png' target='_blank' class='flex items-center gap-2 bg-slate-900 text-white p-3 rounded-2xl text-xs font-bold hover:bg-slate-800 shadow-lg shadow-slate-200'>
|
||
<i class='bi bi-camera-fill'></i> Скриншот-улика (Дата/Время)
|
||
</a>
|
||
<a href='archive_new/{f}/attachments.zip' target='_blank' class='flex items-center gap-2 bg-blue-600 text-white p-3 rounded-2xl text-xs font-bold hover:bg-blue-500 shadow-lg shadow-blue-100'>
|
||
<i class='bi bi-file-zip-fill'></i> Скачать все документы (ZIP)
|
||
</a>
|
||
</div>
|
||
</div>
|
||
"""
|
||
|
||
html += """
|
||
</div>
|
||
</main>
|
||
</body>
|
||
</html>"""
|
||
|
||
with open(HTML_FILE, 'w', encoding='utf-8') as f:
|
||
f.write(html)
|
||
|
||
# Пушим на Synology
|
||
with open(HTML_FILE, 'rb') as f:
|
||
subprocess.run(["ssh", "matrixhasyou@192.168.10.105", f"cat > {NAS_WEB_ROOT}/index.html"], stdin=f)
|
||
print("✅ Сайт /harvest/ успешно обновлен с 10 новыми папками!")
|
||
|
||
if __name__ == '__main__':
|
||
run()
|