Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web server to portdunio linux version so the web gui can be served. Configuration doesn't need the CLI Interface anymore for the Linux Version #3265

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c0bd58d
Added WebServer/WebServices for Native Linux Meshtastic and web gui
marelab Feb 22, 2024
b9972b8
Fix bug in login functionality
marelab Feb 22, 2024
8e9af81
Added customized config of portdunio.ini with LovyannGFX from marelab…
marelab Feb 22, 2024
f6a978f
Compile Problem resolved with developer version of LovyanGFX.git
marelab Feb 22, 2024
7da107f
Compile against dev version
marelab Feb 22, 2024
f910e79
Fixes to fit into main branch
marelab Feb 22, 2024
39984e4
Merge branch 'meshtastic:master' into master
marelab Feb 22, 2024
354c1cf
Merge branch 'master' into master
thebentern Feb 23, 2024
a094d97
Update variant.h, main.cpp, .gitignore, WebServer.cpp, esp32s2.ini, W…
marelab Feb 23, 2024
93cd5ec
Added linux pi std /usr/include dir
marelab Feb 23, 2024
19d33b2
Adding /usr/innclude for Linux compile against native libs that are n…
marelab Feb 23, 2024
dbbd35e
Review log level changes & translation
marelab Feb 23, 2024
c52741f
Update Dockerfile
marelab Feb 24, 2024
18cf6cb
Merge branch 'master' into master
thebentern Feb 24, 2024
e637b46
Merge branch 'master' into master
caveman99 Feb 25, 2024
7cbde1a
Merge branch 'master' into master
jp-bennett Feb 25, 2024
0c5f68c
Merge branch 'master' into master
thebentern Feb 25, 2024
27c8241
Fix Typo & VFS ref. Part1
marelab Feb 26, 2024
5b626a7
Fix Typo & VFS ref.
marelab Feb 26, 2024
6361b6d
Merge pull request #2 from marelab:FixTypo-&-VFS-reference
marelab Feb 26, 2024
04312cd
Dev Version for ulfius web lib
marelab Feb 25, 2024
5028013
Update platformio.ini
marelab Feb 26, 2024
3256442
Free VFS path string
marelab Feb 26, 2024
16d3348
Merge branch 'master' into master
thebentern Feb 26, 2024
23d09f8
Merge branch 'master' into master
thebentern Feb 27, 2024
3efcf2f
Merge branch 'master' into master
thebentern Feb 28, 2024
fab61f2
Merge branch 'master' into master
thebentern Feb 29, 2024
839f280
Merge branch 'master' into master
thebentern Mar 3, 2024
3b90e10
Merge branch 'master' into master
thebentern Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .editorconfig
Empty file.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ venv/
release/
.vscode/extensions.json
/compile_commands.json
src/mesh/http/certificate.pem
src/mesh/http/private_key.pem
arch/portduino/portduino.ini
.vscode/extensions.json
marelab marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 5 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.cpptools",
"platformio.platformio-ide",
"trunk.io"
"platformio.platformio-ide"
],
}
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
caveman99 marked this conversation as resolved.
Show resolved Hide resolved
}
72 changes: 71 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "trunk.io",
"trunk.enableWindows": true
"trunk.enableWindows": true,
"files.associations": {
"string": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats probably ok, but i'd prefer this in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get corrected to orignal first

}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install build deps
USER root
RUN apt-get update && \
apt-get -y install wget python3 g++ zip python3-venv git vim ca-certificates libgpiod-dev libyaml-cpp-dev libbluetooth-dev
apt-get -y install wget python3 g++ zip python3-venv git vim ca-certificates libgpiod-dev libyaml-cpp-dev libbluetooth-dev libgpiod2

# create a non-priveleged user & group
RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh
Expand Down
6 changes: 4 additions & 2 deletions arch/portduino/portduino.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
[portduino_base]
;platform = https://github.com/marelab/platform-native.git
caveman99 marked this conversation as resolved.
Show resolved Hide resolved
platform = https://github.com/meshtastic/platform-native.git#a28dd5a9ccd5c48a9bede46037855ff83915d74b
framework = arduino

Expand All @@ -11,7 +12,7 @@ build_src_filter =
-<platform/stm32wl/>
-<platform/rp2040>
-<mesh/wifi/>
-<mesh/http/>
+<mesh/http/>
-<mesh/eth/>
-<modules/esp32>
-<modules/Telemetry/EnvironmentTelemetry.cpp>
Expand All @@ -23,7 +24,8 @@ lib_deps =
${env.lib_deps}
${networking_base.lib_deps}
rweather/Crypto@^0.4.0
lovyan03/LovyanGFX@^1.1.12
https://github.com/lovyan03/LovyanGFX.git#develop
;https://github.com/marelab/LovyanGFX.git

build_flags =
${arduino_base.build_flags}
Expand Down
4 changes: 4 additions & 0 deletions bin/config-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ Input:

Logging:
LogLevel: info # debug, info, warn, error

Webserver:
Port: 9001 # Port for Webserver & Webservices
RootPath: /home/user/web # Root Dir of WebServer
2 changes: 2 additions & 0 deletions bin/prepare-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo apt -y install openssl libssl-dev libsdl2-dev libulfius-dev liborcania-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be included in the CI builder scripts on github, or the builds will fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry didn't looked into the build pipline of Github. Then I first have to prepare a change for the build pipeline I guess. I think for native linux build the .github/actions/setup-base/action.yml would be the best place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's something we can do afterwards. i commented more like a todo item :-)

the runners are always picked up from master, you can't fix that here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these packages to the Pi builder now.

6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = tbeam
;default_envs = tbeam
marelab marked this conversation as resolved.
Show resolved Hide resolved
;default_envs = pico
;default_envs = tbeam-s3-core
;default_envs = tbeam0.7
Expand All @@ -21,7 +21,7 @@ default_envs = tbeam
;default_envs = t-echo
;default_envs = canaryone
;default_envs = nrf52840dk-geeksville
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
;default_envs = nano-g1
;default_envs = pca10059_diy_eink
;default_envs = meshtastic-diy-v1
Expand Down Expand Up @@ -129,4 +129,4 @@ lib_deps =
adafruit/Adafruit PM25 AQI Sensor@^1.0.6
adafruit/Adafruit MPU6050@^2.2.4
adafruit/Adafruit LIS3DH@^1.2.4
https://github.com/lewisxhe/BMA423_Library@^0.0.1
https://github.com/lewisxhe/BMA423_Library@^0.0.1
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ NRF52Bluetooth *nrf52Bluetooth;

#ifdef ARCH_PORTDUINO
#include "linux/LinuxHardwareI2C.h"
#include "mesh/http/PiWebServer.h"
#include "platform/portduino/PortduinoGlue.h"
#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -857,6 +858,7 @@ void setup()
#endif

#ifdef ARCH_PORTDUINO
piwebServerThread = new PiWebServerThread();
initApiServer(TCPPort);
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/mesh/http/ContentHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef PORTDUINO_LINUX_HARDWARE
marelab marked this conversation as resolved.
Show resolved Hide resolved
#include "NodeDB.h"
#include "PowerFSM.h"
#include "RadioLibInterface.h"
Expand Down Expand Up @@ -855,3 +856,4 @@ void handleScanNetworks(HTTPRequest *req, HTTPResponse *res)
res->print(value->Stringify().c_str());
delete value;
}
#endif
4 changes: 3 additions & 1 deletion src/mesh/http/ContentHandler.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef PORTDUINO_LINUX_HARDWARE
#pragma once
void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer);

Expand Down Expand Up @@ -33,4 +34,5 @@ class HttpAPI : public PhoneAPI
protected:
/// Check the current underlying physical link to see if the client is currently connected
virtual bool checkIsConnected() override { return true; } // FIXME, be smarter about this
};
};
#endif
2 changes: 2 additions & 0 deletions src/mesh/http/ContentHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef PORTDUINO_LINUX_HARDWARE
#include "mesh/http/ContentHelper.h"
// #include <Arduino.h>
// #include "main.h"
Expand All @@ -12,3 +13,4 @@ void replaceAll(std::string &str, const std::string &from, const std::string &to
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
}
}
#endif
Loading
Loading