diff options
| author | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-24 12:41:38 +0100 |
|---|---|---|
| committer | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-24 12:41:38 +0100 |
| commit | 3a6928a0189bfe8d481c7eeac7a3d3df5dd9cdc0 (patch) | |
| tree | 86a00bcd10dae82ac566e68c2c525fa71a44607a | |
| parent | 567787eabe414592d005c727868091bcba2bf6fe (diff) | |
updates to the web gui
| -rw-r--r-- | .vscode/settings.json | 25 | ||||
| -rw-r--r-- | README.md | 20 | ||||
| -rw-r--r-- | api_server.service | 15 | ||||
| -rw-r--r-- | templates/api.py | 27 | ||||
| -rw-r--r-- | templates/index.html (renamed from webGUI/index.html) | 20 | ||||
| -rw-r--r-- | templates/live_preview.py | 14 | ||||
| -rw-r--r-- | templates/page/notes.html (renamed from webGUI/pages/notes.html) | 5 | ||||
| -rw-r--r-- | templates/page/overview.html (renamed from webGUI/pages/general.html) | 5 | ||||
| -rw-r--r-- | templates/page/recourses.html | 29 | ||||
| -rw-r--r-- | templates/page/speech.html (renamed from webGUI/pages/speech.html) | 5 | ||||
| -rw-r--r-- | templates/static/main.mjs (renamed from webGUI/main.mjs) | 0 | ||||
| -rw-r--r-- | templates/static/styles.css (renamed from webGUI/styles.css) | 17 | ||||
| -rw-r--r-- | webGUI/pages/cpuinfo.html | 30 | ||||
| -rw-r--r-- | webGUI/pages/main.js | 0 | ||||
| -rw-r--r-- | webGUI/pages/recourses.html | 30 |
15 files changed, 157 insertions, 85 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 66f540e..dd10108 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json | |||
| @@ -1,5 +1,22 @@ | |||
| 1 | { | 1 | { |
| 2 | "python.testing.pytestArgs": ["I2C"], | 2 | "workbench.colorCustomizations": { |
| 3 | "python.testing.unittestEnabled": false, | 3 | "activityBar.activeBackground": "#1a1a1a", |
| 4 | "python.testing.pytestEnabled": true | 4 | "activityBar.background": "#1a1a1a", |
| 5 | } | 5 | "activityBar.foreground": "#e7e7e7", |
| 6 | "activityBar.inactiveForeground": "#e7e7e799", | ||
| 7 | "activityBarBadge.background": "#606020", | ||
| 8 | "activityBarBadge.foreground": "#e7e7e7", | ||
| 9 | "commandCenter.border": "#e7e7e799", | ||
| 10 | "sash.hoverBorder": "#1a1a1a", | ||
| 11 | "statusBar.background": "#000000", | ||
| 12 | "statusBar.foreground": "#e7e7e7", | ||
| 13 | "statusBarItem.hoverBackground": "#1a1a1a", | ||
| 14 | "statusBarItem.remoteBackground": "#000000", | ||
| 15 | "statusBarItem.remoteForeground": "#e7e7e7", | ||
| 16 | "titleBar.activeBackground": "#000000", | ||
| 17 | "titleBar.activeForeground": "#e7e7e7", | ||
| 18 | "titleBar.inactiveBackground": "#00000099", | ||
| 19 | "titleBar.inactiveForeground": "#e7e7e799" | ||
| 20 | }, | ||
| 21 | "peacock.color": "black" | ||
| 22 | } \ No newline at end of file | ||
| @@ -8,3 +8,23 @@ This is a starter project with the goal of expanded everything later on to let's | |||
| 8 | 18/11/2024 migrating to C for the main code | 8 | 18/11/2024 migrating to C for the main code |
| 9 | 9 | ||
| 10 | The program is Multi-platform and even supports a web-console | 10 | The program is Multi-platform and even supports a web-console |
| 11 | |||
| 12 | MAIN USE OF THE PROGRAM : | ||
| 13 | |||
| 14 | the main feature of the program is the ability to control and I2C display really extensivly and be abel to do alot of things with it | ||
| 15 | |||
| 16 | CURRENT FEATURES -> | ||
| 17 | |||
| 18 | * weather display | ||
| 19 | * random generated greeting quote ( still dont know what to really do about that, could add a joke of the day system or something like that) | ||
| 20 | * a button powered button pomodore timer | ||
| 21 | * some sort of clock mechanisme that adds an alarm clock, timer and stopwatch | ||
| 22 | * system monitor dashbord ( cpu , ram , disk , temp , ... ) | ||
| 23 | * speech command center | ||
| 24 | * generative AI model that uses meta's llama | ||
| 25 | * current playing audio | ||
| 26 | * voice based notes | ||
| 27 | * to do list integration based on the personal calender | ||
| 28 | |||
| 29 | |||
| 30 | A nice idea is to make it somehting easily installabled and configurable in the future without to much tinkering need | ||
diff --git a/api_server.service b/api_server.service new file mode 100644 index 0000000..b69c5e4 --- /dev/null +++ b/api_server.service | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=REST API Server for RPI | ||
| 3 | After=network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | ExecStart=/usr/bin/python3 /home/pi/I2C/bin/main.py | ||
| 7 | WorkingDirectory=/home/pi/I2C | ||
| 8 | User=nasr | ||
| 9 | Group=pi | ||
| 10 | Restart=always | ||
| 11 | Environment="PYTHONUNBUFFERED=1" | ||
| 12 | |||
| 13 | [Install] | ||
| 14 | WantedBy=multi-user.target | ||
| 15 | |||
diff --git a/templates/api.py b/templates/api.py new file mode 100644 index 0000000..b04ef77 --- /dev/null +++ b/templates/api.py | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | from flask import Flask, request, jsonify, render_template | ||
| 2 | |||
| 3 | app = Flask(__name__) | ||
| 4 | |||
| 5 | |||
| 6 | @app.route("/") | ||
| 7 | def index(): | ||
| 8 | return render_template("index.html") | ||
| 9 | |||
| 10 | |||
| 11 | @app.route("/api/run-script", methods=["POST"]) | ||
| 12 | def 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 | |||
| 22 | def my_script_logic(input_value): | ||
| 23 | return f"Processed input: {input_value}" | ||
| 24 | |||
| 25 | |||
| 26 | if __name__ == "__main__": | ||
| 27 | app.run(host="0.0.0.0", port=5000, debug=True) | ||
diff --git a/webGUI/index.html b/templates/index.html index 28665f8..5436dbd 100644 --- a/webGUI/index.html +++ b/templates/index.html | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | <title>CONSOLE</title> | 7 | <title>CONSOLE</title> |
| 8 | <link rel="stylesheet" href="styles.css"> | 8 | <link rel="stylesheet" href="static/styles.css"> |
| 9 | <script src="main.js" defer></script> | 9 | <script src="static/main.mjs" defer></script> |
| 10 | </head> | 10 | </head> |
| 11 | 11 | ||
| 12 | <body> | 12 | <body> |
| @@ -17,11 +17,15 @@ | |||
| 17 | </nav> | 17 | </nav> |
| 18 | 18 | ||
| 19 | <section class="controls"> | 19 | <section class="controls"> |
| 20 | <a href="pages/cpuinfo.html" class="CPU_INFO">CPU Information</a> | 20 | <a href="page/overview.html" class="resources">Resources</a> |
| 21 | <a href="pages/general.html" class="resources">Resources</a> | 21 | <a href="page/notes.html" class="speech_trans">Speech Transcriber</a> |
| 22 | <a href="pages/notes.html" class="speech_trans">Speech Transcriber</a> | 22 | <a href="page/recourses.html" class="notes">Display a Message</a> |
| 23 | <a href="pages/recourses.html" class="notes">Display a Message</a> | 23 | <a href="page/speech.html" class="general">General Tools</a> |
| 24 | <a href="pages/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 | |||
| 25 | </section> | 29 | </section> |
| 26 | 30 | ||
| 27 | <footer> | 31 | <footer> |
| @@ -30,4 +34,4 @@ | |||
| 30 | </footer> | 34 | </footer> |
| 31 | </body> | 35 | </body> |
| 32 | 36 | ||
| 33 | </html> \ No newline at end of file | 37 | </html> |
diff --git a/templates/live_preview.py b/templates/live_preview.py new file mode 100644 index 0000000..e753fc6 --- /dev/null +++ b/templates/live_preview.py | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | from livereload import Server | ||
| 2 | |||
| 3 | server = Server() | ||
| 4 | # Watch HTML file | ||
| 5 | server.watch('index.html') | ||
| 6 | # Watch CSS files | ||
| 7 | server.watch('static/styles.css') | ||
| 8 | # Watch JavaScript files | ||
| 9 | server.watch('static/main.mjs') | ||
| 10 | # Watch other files if needed | ||
| 11 | server.watch('page/*') # Watch everything in the page folder | ||
| 12 | |||
| 13 | # Serve the current directory | ||
| 14 | server.serve(root='.') | ||
diff --git a/webGUI/pages/notes.html b/templates/page/notes.html index ea870d7..3f24816 100644 --- a/webGUI/pages/notes.html +++ b/templates/page/notes.html | |||
| @@ -5,9 +5,8 @@ | |||
| 5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | <title>Display a Message</title> | 7 | <title>Display a Message</title> |
| 8 | <link rel="stylesheet" href="../styles.css"> | 8 | <link rel="stylesheet" href="../static/styles.css"> |
| 9 | <script src="main.js" defer></script> | 9 | <script src="../static/main.mjs" defer></script> |
| 10 | |||
| 11 | </head> | 10 | </head> |
| 12 | 11 | ||
| 13 | <body> | 12 | <body> |
diff --git a/webGUI/pages/general.html b/templates/page/overview.html index 087afbc..123bf39 100644 --- a/webGUI/pages/general.html +++ b/templates/page/overview.html | |||
| @@ -5,9 +5,8 @@ | |||
| 5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | <title>General Tools</title> | 7 | <title>General Tools</title> |
| 8 | <link rel="stylesheet" href="../styles.css"> | 8 | <link rel="stylesheet" href="../static/styles.css"> |
| 9 | <script src="main.js" defer></script> | 9 | <script src="../static/main.mjs" defer></script> |
| 10 | |||
| 11 | </head> | 10 | </head> |
| 12 | 11 | ||
| 13 | <body> | 12 | <body> |
diff --git a/templates/page/recourses.html b/templates/page/recourses.html new file mode 100644 index 0000000..992e44e --- /dev/null +++ b/templates/page/recourses.html | |||
| @@ -0,0 +1,29 @@ | |||
| 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>Resources</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>Resources</h2> | ||
| 16 | <a href="https://www.github.com/nasrlol" target="_blank">GITHUB</a> | ||
| 17 | </nav> | ||
| 18 | |||
| 19 | <section class="content"> | ||
| 20 | <h1>Resources</h1> | ||
| 21 | </section> | ||
| 22 | |||
| 23 | <footer> | ||
| 24 | <p>Created by <a href="https://www.github.com/nasrlol" target="_blank">nsrddyn</a>. All rights reserved © | ||
| 25 | 2024.</p> | ||
| 26 | </footer> | ||
| 27 | </body> | ||
| 28 | |||
| 29 | </html> \ No newline at end of file | ||
diff --git a/webGUI/pages/speech.html b/templates/page/speech.html index 2c1a848..1b345ba 100644 --- a/webGUI/pages/speech.html +++ b/templates/page/speech.html | |||
| @@ -5,9 +5,8 @@ | |||
| 5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | <title>Speech Transcriber</title> | 7 | <title>Speech Transcriber</title> |
| 8 | <link rel="stylesheet" href="../styles.css"> | 8 | <link rel="stylesheet" href="../static/styles.css"> |
| 9 | <script src="main.js" defer></script> | 9 | <script src="../static/main.mjs" defer></script> |
| 10 | |||
| 11 | </head> | 10 | </head> |
| 12 | 11 | ||
| 13 | <body> | 12 | <body> |
diff --git a/webGUI/main.mjs b/templates/static/main.mjs index 7e48f65..7e48f65 100644 --- a/webGUI/main.mjs +++ b/templates/static/main.mjs | |||
diff --git a/webGUI/styles.css b/templates/static/styles.css index 03b0256..d43f592 100644 --- a/webGUI/styles.css +++ b/templates/static/styles.css | |||
| @@ -9,6 +9,15 @@ body { | |||
| 9 | padding: 0; | 9 | padding: 0; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | p { | ||
| 13 | text-align: center; | ||
| 14 | |||
| 15 | } | ||
| 16 | |||
| 17 | h1 { | ||
| 18 | text-align: center; | ||
| 19 | } | ||
| 20 | |||
| 12 | a { | 21 | a { |
| 13 | text-decoration: none; | 22 | text-decoration: none; |
| 14 | color: wheat; | 23 | color: wheat; |
| @@ -22,7 +31,7 @@ a:hover { | |||
| 22 | .navigation { | 31 | .navigation { |
| 23 | display: flex; | 32 | display: flex; |
| 24 | justify-content: space-between; | 33 | justify-content: space-between; |
| 25 | align-items: center; | 34 | align-items: center; |
| 26 | padding: 20px 10%; | 35 | padding: 20px 10%; |
| 27 | background-color: rgba(0, 0, 0, 0.8); | 36 | background-color: rgba(0, 0, 0, 0.8); |
| 28 | border-bottom: 2px solid white; | 37 | border-bottom: 2px solid white; |
| @@ -44,10 +53,10 @@ a:hover { | |||
| 44 | 53 | ||
| 45 | .controls { | 54 | .controls { |
| 46 | display: flex; | 55 | display: flex; |
| 47 | flex-wrap: wrap; | 56 | flex-direction: row; |
| 48 | justify-content: center; | 57 | justify-content: center; |
| 49 | gap: 20px; | 58 | gap: 20px; |
| 50 | padding: 50px 10%; | 59 | padding: 20px 10%; |
| 51 | } | 60 | } |
| 52 | 61 | ||
| 53 | .controls a { | 62 | .controls a { |
diff --git a/webGUI/pages/cpuinfo.html b/webGUI/pages/cpuinfo.html deleted file mode 100644 index 99579cb..0000000 --- a/webGUI/pages/cpuinfo.html +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 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>CPU Information</title> | ||
| 8 | <link rel="stylesheet" href="../styles.css"> | ||
| 9 | <script src="main.js" defer></script> | ||
| 10 | |||
| 11 | </head> | ||
| 12 | |||
| 13 | <body> | ||
| 14 | <nav class="navigation"> | ||
| 15 | <a href="../index.html" class="home">HOME</a> | ||
| 16 | <h2>CPU Information</h2> | ||
| 17 | <a href="https://www.github.com/nasrlol" target="_blank">GITHUB</a> | ||
| 18 | </nav> | ||
| 19 | |||
| 20 | <section class="content"> | ||
| 21 | <h1>CPU Information</h1> | ||
| 22 | </section> | ||
| 23 | |||
| 24 | <footer> | ||
| 25 | <p>Created by <a href="https://www.github.com/nasrlol" target="_blank">nsrddyn</a>. All rights reserved © | ||
| 26 | 2024.</p> | ||
| 27 | </footer> | ||
| 28 | </body> | ||
| 29 | |||
| 30 | </html> \ No newline at end of file | ||
diff --git a/webGUI/pages/main.js b/webGUI/pages/main.js deleted file mode 100644 index e69de29..0000000 --- a/webGUI/pages/main.js +++ /dev/null | |||
diff --git a/webGUI/pages/recourses.html b/webGUI/pages/recourses.html deleted file mode 100644 index 890ab73..0000000 --- a/webGUI/pages/recourses.html +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 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>Resources</title> | ||
| 8 | <link rel="stylesheet" href="../styles.css"> | ||
| 9 | <script src="main.js" defer></script> | ||
| 10 | |||
| 11 | </head> | ||
| 12 | |||
| 13 | <body> | ||
| 14 | <nav class="navigation"> | ||
| 15 | <a href="../index.html" class="home">HOME</a> | ||
| 16 | <h2>Resources</h2> | ||
| 17 | <a href="https://www.github.com/nasrlol" target="_blank">GITHUB</a> | ||
| 18 | </nav> | ||
| 19 | |||
| 20 | <section class="content"> | ||
| 21 | <h1>Resources</h1> | ||
| 22 | </section> | ||
| 23 | |||
| 24 | <footer> | ||
| 25 | <p>Created by <a href="https://www.github.com/nasrlol" target="_blank">nsrddyn</a>. All rights reserved © | ||
| 26 | 2024.</p> | ||
| 27 | </footer> | ||
| 28 | </body> | ||
| 29 | |||
| 30 | </html> \ No newline at end of file | ||
