summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authornasrlol <nsrddyn@gmail.com>2024-11-27 00:54:43 +0100
committernasrlol <nsrddyn@gmail.com>2024-11-27 00:54:43 +0100
commitdf6d2c51b15d55a30b8515de637aa7af490b2d95 (patch)
tree25afa36b2be61783997eb59633e9c7e4aff438b7 /public
parent4e86a2ee9f5578cbaae6cc7dd52616e3e3751764 (diff)
small modifications to the file system
Diffstat (limited to 'public')
-rw-r--r--public/api.py27
-rw-r--r--public/api_server.service15
-rw-r--r--public/index.html37
3 files changed, 79 insertions, 0 deletions
diff --git a/public/api.py b/public/api.py
new file mode 100644
index 0000000..b04ef77
--- /dev/null
+++ b/public/api.py
@@ -0,0 +1,27 @@
1from flask import Flask, request, jsonify, render_template
2
3app = Flask(__name__)
4
5
6@app.route("/")
7def index():
8 return render_template("index.html")
9
10
11@app.route("/api/run-script", methods=["POST"])
12def run_script():
13 data = request.json
14 if not data:
15 return jsonify({"error": "No data provided"}), 400
16
17 script_result = my_script_logic(data.get("input"))
18
19 return jsonify({"result": script_result})
20
21
22def my_script_logic(input_value):
23 return f"Processed input: {input_value}"
24
25
26if __name__ == "__main__":
27 app.run(host="0.0.0.0", port=5000, debug=True)
diff --git a/public/api_server.service b/public/api_server.service
new file mode 100644
index 0000000..b69c5e4
--- /dev/null
+++ b/public/api_server.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=REST API Server for RPI
3After=network.target
4
5[Service]
6ExecStart=/usr/bin/python3 /home/pi/I2C/bin/main.py
7WorkingDirectory=/home/pi/I2C
8User=nasr
9Group=pi
10Restart=always
11Environment="PYTHONUNBUFFERED=1"
12
13[Install]
14WantedBy=multi-user.target
15
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..5436dbd
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,37 @@
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>CONSOLE</title>
8 <link rel="stylesheet" href="static/styles.css">
9 <script src="static/main.mjs" defer></script>
10</head>
11
12<body>
13 <nav class="navigation">
14 <a href="index.html" class="home">HOME</a>
15 <h2>I2C MODES</h2>
16 <a href="https://www.github.com/nasrlol" target="_blank">GITHUB</a>
17 </nav>
18
19 <section class="controls">
20 <a href="page/overview.html" class="resources">Resources</a>
21 <a href="page/notes.html" class="speech_trans">Speech Transcriber</a>
22 <a href="page/recourses.html" class="notes">Display a Message</a>
23 <a href="page/speech.html" class="general">General Tools</a>
24 </section>
25 <section>
26 <p>This is the main control center for the I2C deivce. You can find
27 the main code and information about the project under my <a href="https://github.com/nasrlol">GITHUB</a></p>
28
29 </section>
30
31 <footer>
32 <p>Created by <a href="https://www.github.com/nasrlol" target="_blank">nsrddyn</a>. All rights reserved &copy;
33 2024.</p>
34 </footer>
35</body>
36
37</html>