forked from swee/MeowNex
34 lines
879 B
Python
34 lines
879 B
Python
|
from flask import Flask
|
||
|
from flask import send_file
|
||
|
from flask import request
|
||
|
from flask import redirect
|
||
|
import os
|
||
|
from time import sleep as wait
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
return send_file("sweebot.html", mimetype='text/html')
|
||
|
@app.route('/run.txt')
|
||
|
def run():
|
||
|
wait(2)
|
||
|
return send_file("run.txt", mimetype='text/html')
|
||
|
@app.route('/block.txt')
|
||
|
def block():
|
||
|
wait(2)
|
||
|
return send_file("block.txt", mimetype='text/html')
|
||
|
@app.route('/script.js')
|
||
|
def script():
|
||
|
return send_file("script.js", mimetype='application/javascript')
|
||
|
@app.route('/reboot.run')
|
||
|
def reboot():
|
||
|
os.system("systemctl --user restart sweebot")
|
||
|
wait(1)
|
||
|
return "<i class=\"fas fa-check\"></i>"
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
|
||
|
# run() method of Flask class runs the application
|
||
|
# on the local development server.
|
||
|
app.run(host='0.0.0.0',port=2001)
|