Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -99,7 +99,52 @@ def home():
|
|
99 |
return render_template_string('''
|
100 |
<!DOCTYPE html>
|
101 |
<html>
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
</html>
|
104 |
''', next_run=next_run)
|
105 |
|
|
|
99 |
return render_template_string('''
|
100 |
<!DOCTYPE html>
|
101 |
<html>
|
102 |
+
<head>
|
103 |
+
<title>Script Scheduler</title>
|
104 |
+
<script>
|
105 |
+
function fetchLogs() {
|
106 |
+
fetch('/logs')
|
107 |
+
.then(response => response.json())
|
108 |
+
.then(data => {
|
109 |
+
let logBox = document.getElementById("log-box");
|
110 |
+
logBox.innerHTML = "";
|
111 |
+
data.logs.forEach(log => {
|
112 |
+
let logEntry = "<div class='timestamp'>" + log.time + "</div>";
|
113 |
+
if (log.output) logEntry += "<div class='output'>" + log.output + "</div>";
|
114 |
+
if (log.error) logEntry += "<div class='error'>" + log.error + "</div>";
|
115 |
+
logEntry += "<hr>";
|
116 |
+
logBox.innerHTML += logEntry;
|
117 |
+
});
|
118 |
+
logBox.scrollTop = logBox.scrollHeight;
|
119 |
+
});
|
120 |
+
}
|
121 |
+
setInterval(fetchLogs, 2000);
|
122 |
+
window.onload = fetchLogs;
|
123 |
+
</script>
|
124 |
+
<style>
|
125 |
+
body { font-family: Arial, sans-serif; padding: 20px; }
|
126 |
+
.log-box {
|
127 |
+
background: #000;
|
128 |
+
color: #0f0;
|
129 |
+
padding: 15px;
|
130 |
+
border-radius: 5px;
|
131 |
+
margin-top: 20px;
|
132 |
+
white-space: pre-wrap;
|
133 |
+
max-height: 400px;
|
134 |
+
overflow-y: auto;
|
135 |
+
}
|
136 |
+
.timestamp { color: #888; margin-bottom: 10px; }
|
137 |
+
.error { color: #ff4444; }
|
138 |
+
</style>
|
139 |
+
</head>
|
140 |
+
<body>
|
141 |
+
<h1>Script Scheduler</h1>
|
142 |
+
<p>Next run: {{ next_run }}</p>
|
143 |
+
<h2>Latest Execution Logs</h2>
|
144 |
+
<div id="log-box" class="log-box"></div>
|
145 |
+
<p><a href="/force-run">Trigger Manual Run</a></p>
|
146 |
+
<p><a href="/run-check">Check Scheduler Status</a></p>
|
147 |
+
</body>
|
148 |
</html>
|
149 |
''', next_run=next_run)
|
150 |
|