Ai / app.py
kamiwork's picture
Create app.py
ff5fa8b verified
from flask import Flask
import datetime
import os
app = Flask(__name__)
@app.route('/')
def home():
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
owner = os.getenv('GH_OWNER', 'Not Set')
repo = os.getenv('GH_REPO', 'Not Set')
html = f"""
<html>
<head>
<title>GH Runner Status</title>
<style>
body {{ font-family: sans-serif; background-color: #0b0f19; color: white; text-align: center; padding-top: 50px; }}
.card {{ background: #161b22; border-radius: 10px; padding: 20px; display: inline-block; border: 1px solid #30363d; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }}
.status {{ color: #238636; font-weight: bold; font-size: 1.2em; }}
.info {{ color: #8b949e; margin-top: 10px; }}
.pulse {{ height: 10px; width: 10px; background-color: #238636; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px #238636; animation: pulse 1.5s infinite; }}
@keyframes pulse {{ 0% {{ opacity: 1; }} 50% {{ opacity: 0.3; }} 100% {{ opacity: 1; }} }}
</style>
</head>
<body>
<div class="card">
<h2><span class="pulse"></span> GitHub Runner is ONLINE</h2>
<p class="status">Listening for Jobs...</p>
<div class="info">
<p><strong>Owner:</strong> {owner}</p>
<p><strong>Repository:</strong> {repo}</p>
<p><strong>Last Heartbeat:</strong> {now}</p>
</div>
</div>
</body>
</html>
"""
return html
if __name__ == "__main__":
app.run(host='0.0.0.0', port=7860)