From 001a8e23998b5ae8115e5a0a39c6430517c55d9c Mon Sep 17 00:00:00 2001 From: Fr4nzD13trich Date: Thu, 9 Oct 2025 15:45:21 +0200 Subject: [PATCH 1/5] dev and main separated --- assets/test/test.sh | 99 --------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100755 assets/test/test.sh diff --git a/assets/test/test.sh b/assets/test/test.sh deleted file mode 100755 index 1fb107a..0000000 --- a/assets/test/test.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -source assets/shell/shell_colors -### DEPENDENCY CHECK & INSTALLER - -pkgs="openssl nginx" - -echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n" - -### PRIVILEGES - -if (( $(id -u) == 0 )); then - echo -e "${GRN} Privilege check passed...${CRS}\n" - -else - echo -e "${RED} Privilege check failed... Please run script with sudo or as root!${CRS}\n" - exit 1 -fi - -### DEPENDENCIES - -if command -v "$pkgs" >/dev/null 2>&1; then - echo -e "${GRN} Dependency check passed...${CRS}\n" - -else - echo -e "${YEL} Dependencies not met.${CRS}\n" - - while true; do - echo -e " ${YEL}Do you wish to install via APT? (${GRN}Y${YEL}/${RED}n${YEL})${CRS}" - read -p " --> " install - echo "" - if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then - sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV - echo -e "\n${GRN} Dependencies installed. Proceeding...${CRS}\n" - break - - elif [[ "$install" == "n" || "$install" = "N" ]]; then - echo -e "\n${RED} Missing dependencies... Exiting!${CRS}\n" - exit 1 - - else - echo -e "\n${YEL} Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n " - fi - done -fi - -### NGINX SETUP & CONFIG - -###### CERTIFICATION - -while true; do - echo -e " ${YEL}Configure SSL and create a self signed cetrificate? (Y/n)${CRS}" - read -p " --> " installSSL - if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then - echo -e " ${YEL}Enter path to certificates folder${CRS}" - read -p " default = /etc/nginx/ssl --> " cert_path - if ! [ "$cert_path" ]; then - cert_path=/etc/nginx/ssl - elif [[ "$cert_path" = "." ]]; then - cert_path=$PWD - else - : - fi - echo "" - echo -e " ${YEL}Enter file name for certificate and key${CRS}" - read -p " default --> $HOSTNAME --> " cert_name - if ! [ "$cert_name" ]; then - cert_name=$HOSTNAME - else - : - fi - echo "" - sudo mkdir -p "$cert_path" - sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt - echo -e "\n${GRN} SSL certificate files ${YEL}$cert_name.crt ${GRN}and ${YEL}$cert_name.key ${GRN}created and stored in ${YEL}$cert_path${CRS}\n" - break - elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then - echo -e "\n${RED} No encryption established${CRS}\n" - break - else - echo -e "\n${YEL} Invalid response... Try again...\n\nY = (Yes, configure SSL certificate and continue)\nN = (No, leave unencrypted and continue)${CRS}\n " - fi - done - - -echo -e "${YEL} Your current hostname is ${CYN}$HOSTNAME${CRS} would you like to change it?${CRS}" - -# ask for network interface & get IP -# ask to change hostname in /etc/hosts & /etc/hostname - -### DEV STATUS - -#sudo cp -R assets/config/nginx/nginx.conf /etc/nginx/sites-enabled/ -## JEFF -# utilise sed to edit config -# test nginx config -# restart nginx -## JEFF END - -echo -e "${GRN}\nScript ran through...${CRS}" From b24c17cb46b7c2b8865d827b69f7cdf1e554a12b Mon Sep 17 00:00:00 2001 From: Fr4nzD13trich Date: Thu, 9 Oct 2025 17:58:12 +0200 Subject: [PATCH 2/5] code cleanup --- dev_env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_env_setup.sh b/dev_env_setup.sh index 2a5fd13..b8f257d 100755 --- a/dev_env_setup.sh +++ b/dev_env_setup.sh @@ -29,7 +29,7 @@ else read -p " --> " install echo "" if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then - sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV + sudo apt update && sudo apt install --install-suggests -y $pkgs echo -e "\n${GRN} Dependencies installed. Proceeding...${CRS}\n" break From c499dbe17207b88e6b01704379189a59464be605 Mon Sep 17 00:00:00 2001 From: fr4nz Date: Fri, 10 Oct 2025 15:20:14 +0200 Subject: [PATCH 3/5] Update README.md --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9f7da2b..0e9060a 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,16 @@ for now everything will be developed and tested on Raspberry Pi 3B and newer act ## Development Setup 1. Flash Raspberry Pi OS lite 64bit -2. Install dependencies: +2. Install git: ```bash -sudo apt install --install-suggests -y nginx python3-meshtastic python3-flask python3-requests +sudo apt install -y git ``` -3. Configure `nginx` the way you need | _or use the example config located [here](https://lab.c95.org/fr4nz/LoMeS/src/branch/main/assets/config/nginx/nginx.conf) edit at least lines 9 & 15 - 18 to your needs_ -4. Start developing \ No newline at end of file +3. Clone repository +```bash +git clone https://lab.c95.org/fr4nz/LoMeS.git && git switch dev-1 +``` +4. Run development environment setup +```bash +chmod +x dev_env_setup.sh && sudo ./dev_env_setup.sh +``` +5. Start developing \ No newline at end of file From e1ff33a39a82ee3e10562485056a11bca600165e Mon Sep 17 00:00:00 2001 From: fr4nz Date: Fri, 10 Oct 2025 15:20:53 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e9060a..fae4eb9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ sudo apt install -y git ``` 3. Clone repository ```bash -git clone https://lab.c95.org/fr4nz/LoMeS.git && git switch dev-1 +git clone https://lab.c95.org/fr4nz/LoMeS.git && cd LoMeS && git switch dev-1 ``` 4. Run development environment setup ```bash From f66835cb9ed0072bf67bf75c4bce9980325c8242 Mon Sep 17 00:00:00 2001 From: Fr4nz D13trich Date: Wed, 15 Oct 2025 08:21:42 +0200 Subject: [PATCH 5/5] Readme updated --- README.md | 29 ----------- assets/config/nginx/nginx.conf | 33 ------------- assets/images/Mesh_Logo_White.svg | 12 ----- assets/notes/FrontToBackend.md | 26 ---------- assets/notes/notes.md | 21 -------- assets/shell/shell_colors | 18 ------- assets/shell/template.sh | 3 -- dev_env_setup.sh | 82 ------------------------------- 8 files changed, 224 deletions(-) delete mode 100644 assets/config/nginx/nginx.conf delete mode 100644 assets/images/Mesh_Logo_White.svg delete mode 100644 assets/notes/FrontToBackend.md delete mode 100644 assets/notes/notes.md delete mode 100644 assets/shell/shell_colors delete mode 100644 assets/shell/template.sh delete mode 100755 dev_env_setup.sh diff --git a/README.md b/README.md index fae4eb9..6e581f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # LoMeS - - **LOcal MEshtastic Server** _in development_ Idea is to: @@ -12,30 +10,3 @@ Idea is to: - and **maybe** connect to mobile clients in the far future. - check progress [here](https://lab.c95.org/fr4nz/LoMeS/src/branch/main/assets/notes/notes.md) --- - -## Hardware - -for now everything will be developed and tested on Raspberry Pi 3B and newer acting as server and as LoRa Modules RAK WisBlock 4631 with RAK 19007 Board as well as Heltec V3 connected via USB/UART. - -## Hard & Firmware - -- Raspberry Pi 4B | _RPI OS lite (Debian 13 | Trixie)_ -- RAK Wisblock | _FW 2.6.11_ -- Heltec V3 | _FW 2.6.11_ - -## Development Setup - -1. Flash Raspberry Pi OS lite 64bit -2. Install git: -```bash -sudo apt install -y git -``` -3. Clone repository -```bash -git clone https://lab.c95.org/fr4nz/LoMeS.git && cd LoMeS && git switch dev-1 -``` -4. Run development environment setup -```bash -chmod +x dev_env_setup.sh && sudo ./dev_env_setup.sh -``` -5. Start developing \ No newline at end of file diff --git a/assets/config/nginx/nginx.conf b/assets/config/nginx/nginx.conf deleted file mode 100644 index b8d2141..0000000 --- a/assets/config/nginx/nginx.conf +++ /dev/null @@ -1,33 +0,0 @@ -########################################################### -### ### -### MESHPI NGINX CONFIG ### -### ### -########################################################### - -server { - listen 80; - server_name DOMAIN IPADDR; - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - server_name DOMAIN IPADDR; - - ssl_certificate /etc/nginx/ssl/CERTNAME.crt; - ssl_certificate_key /etc/nginx/ssl/CERTNAME.key; - - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers HIGH:!aNULL:!MD5; - - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 10m; - - add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; - - location / { - try_files $uri $uri/ =404; - root /var/www/html; - index index.html; - } -} diff --git a/assets/images/Mesh_Logo_White.svg b/assets/images/Mesh_Logo_White.svg deleted file mode 100644 index b1bcd57..0000000 --- a/assets/images/Mesh_Logo_White.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/assets/notes/FrontToBackend.md b/assets/notes/FrontToBackend.md deleted file mode 100644 index 84285ea..0000000 --- a/assets/notes/FrontToBackend.md +++ /dev/null @@ -1,26 +0,0 @@ -To send commands from a Python script to a web server, you can use HTTP requests. The requests library is a popular and user-friendly option for making HTTP calls in Python. - For example, you can send a POST request with data to a specific URL: - -import requests - -data = {"key": "value"} -response = requests.post("http://example.com/api", data=data) - -Alternatively, you can use the built-in urllib module, though requests is generally preferred for its simplicity and readability. - -For sending data from a Raspberry Pi to a web server, you can use tools like curl in a cron job to periodically send data from a Python script to a server endpoint. - For instance: - -curl -X POST -d "$(python /path/to/script.py)" http://example.com/receive.php - -This approach allows the script to output data, which is then sent to the server via HTTP POST. - -If you are building a web server in Python to receive commands, you can use the http.server module to create a simple server that handles incoming requests. - For example, a basic server can be started with: - -python3 -m http.server 8000 - -This starts a server on port 8000, accessible via http://localhost:8000. - You can extend this server to process incoming commands by defining custom request handlers using BaseHTTPRequestHandler. - -For more advanced use cases, frameworks like Flask or Django can be used to create robust web servers capable of handling complex command logic and data processing. \ No newline at end of file diff --git a/assets/notes/notes.md b/assets/notes/notes.md deleted file mode 100644 index 977af73..0000000 --- a/assets/notes/notes.md +++ /dev/null @@ -1,21 +0,0 @@ -# Notes -## To Do -1. [ ] define actions and plan -2. [ ] create simple web interface with flask and nginx -3. [ ] communicate with Meshtastic device via web interface - -## Follow up -### Backend -[meshtastic-cli-receive-text](https://github.com/brad28b/meshtastic-cli-receive-text) - -### Web app -[flask web app tutorial](https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3) - -[w3schools How to's](https://www.w3schools.com/howto/default.asp) - -## Timeline - -### Backend -- Environment setup script in development - -### Frontend \ No newline at end of file diff --git a/assets/shell/shell_colors b/assets/shell/shell_colors deleted file mode 100644 index 72f5d7d..0000000 --- a/assets/shell/shell_colors +++ /dev/null @@ -1,18 +0,0 @@ -## SOME COLOR -BLK="\e[0;30m" -RED="\e[0;31m" -GRN="\e[0;32m" -ORN="\e[0;33m" -BLU="\e[0;34m" -MGT="\e[0;35m" -CYN="\e[0;36m" -LGR="\e[0;37m" -DGR="\e[1;30m" -LRD="\e[1;31m" -LGN="\e[1;32m" -YEL="\e[1;33m" -LBL="\e[1;34m" -LPR="\e[1;35m" -LCY="\e[1;36m" -WHT="\e[1;37m" -CRS="\e[0m" \ No newline at end of file diff --git a/assets/shell/template.sh b/assets/shell/template.sh deleted file mode 100644 index 41439e3..0000000 --- a/assets/shell/template.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -### SHELL TEMPLATE diff --git a/dev_env_setup.sh b/dev_env_setup.sh deleted file mode 100755 index b8f257d..0000000 --- a/dev_env_setup.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -source assets/shell/shell_colors -### DEPENDENCY CHECK & INSTALLER - -pkgs="openssl nginx" - -echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n" - -### PRIVILEGES - -if (( $(id -u) == 0 )); then - echo -e "${GRN} Privilege check passed...${CRS}\n" - -else - echo -e "${RED} Privilege check failed... Please run script with sudo or as root!${CRS}\n" - exit 1 -fi - -### DEPENDENCIES - -if command -v "$pkgs" >/dev/null 2>&1; then - echo -e "${GRN} Dependency check passed...${CRS}\n" - -else - echo -e "${YEL} Dependencies not met.${CRS}\n" - - while true; do - echo -e " ${YEL}Do you wish to install via APT? (${GRN}Y${YEL}/${RED}n${YEL})${CRS}" - read -p " --> " install - echo "" - if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then - sudo apt update && sudo apt install --install-suggests -y $pkgs - echo -e "\n${GRN} Dependencies installed. Proceeding...${CRS}\n" - break - - elif [[ "$install" == "n" || "$install" = "N" ]]; then - echo -e "\n${RED} Missing dependencies... Exiting!${CRS}\n" - exit 1 - - else - echo -e "\n${YEL} Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n " - fi - done -fi - -### NGINX SETUP & CONFIG - -###### CERTIFICATION - -while true; do - echo -e " ${YEL}Configure SSL and create a self signed cetrificate? (Y/n)${CRS}" - read -p " --> " installSSL - if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then - echo -e " ${YEL}Enter path to certificates folder${CRS}" - read -p " default = /etc/nginx/ssl --> " cert_path - if ! [ "$cert_path" ]; then - cert_path=/etc/nginx/ssl - elif [[ "$cert_path" = "." ]]; then - cert_path=$PWD - else - : - fi - echo "" - echo -e " ${YEL}Enter file name for certificate and key${CRS}" - read -p " default --> $HOSTNAME --> " cert_name - if ! [ "$cert_name" ]; then - cert_name=$HOSTNAME - else - : - fi - echo "" - sudo mkdir -p "$cert_path" - sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt - echo -e "\n${GRN} SSL certificate files ${YEL}$cert_name.crt ${GRN}and ${YEL}$cert_name.key ${GRN}created and stored in ${YEL}$cert_path${CRS}\n" - break - elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then - echo -e "\n${RED} No encryption established${CRS}\n" - break - else - echo -e "\n${YEL} Invalid response... Try again...\n\nY = (Yes, configure SSL certificate and continue)\nN = (No, leave unencrypted and continue)${CRS}\n " - fi - done