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

WebUI Enhancements and network setup page #42

Open
wants to merge 31 commits into
base: dev
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ffd0ffc
initial api integration
Nov 2, 2023
acfe8ca
Update network page, now scan results don't stop the page from loading
Dec 19, 2023
525d30d
Merge pull request #1 from Orbitix/master
Orbitix Dec 19, 2023
8abc1d1
fix missing code
Dec 28, 2023
1c0ceed
Merge branch 'dev' of https://github.com/Orbitix/wlanpi-webui into dev
Dec 28, 2023
0618efa
fix merge again
Orbitix Dec 28, 2023
c347c5d
add form to connect to network and make it look nice
Orbitix Dec 29, 2023
4276ed1
add status pill on navbar, and add more options to the network form
Orbitix Jan 3, 2024
ddacf66
add network_status.html file (whoops)
Orbitix Jan 20, 2024
280936f
add missing extends template for htmx
joshschmelzle Jan 26, 2024
5237b09
add missing netscan_iframe.html
Orbitix Jan 26, 2024
cda247d
add network_setup
Orbitix Jan 27, 2024
0ee9cf7
fix merge
Orbitix Jan 28, 2024
67f1fef
remove mode adds
joshschmelzle Jan 31, 2024
a9b893f
remove redundant class on div
joshschmelzle Jan 31, 2024
f174363
add missing new wlan setup to offcanvas nav
joshschmelzle Jan 31, 2024
e7fa2ea
refactor network code into individual files
joshschmelzle Jan 31, 2024
97afb1a
tox -e format on app.py
joshschmelzle Jan 31, 2024
5c61ab9
no longer needed after network refactor
joshschmelzle Jan 31, 2024
915b783
remove broken SAE-PSK field
joshschmelzle Jan 31, 2024
8bbe720
Renames and migrate from wpa/wpa2 fields to key_mgmt
joshschmelzle Jan 31, 2024
86365f8
fix file extention for installing reqs
Orbitix Aug 31, 2024
8e60a0d
form changes
Orbitix Sep 1, 2024
4529e26
start moving to js for network setup
Orbitix Sep 1, 2024
53c80e7
not work
Orbitix Sep 1, 2024
7c7b482
oops
Orbitix Sep 1, 2024
28859d1
continue network setup
Orbitix Sep 3, 2024
2b948b9
re-enable interface scanning and netscan iframe
Orbitix Sep 14, 2024
a90f9c7
add supplicant checking with start stop button
Orbitix Sep 15, 2024
0473143
add reloading of page to set interface properly
Orbitix Sep 15, 2024
650651c
fix 500 error when var is not assigned, set to a default error message
Orbitix Oct 3, 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
9 changes: 9 additions & 0 deletions wlanpi_webui/network/network.py
Original file line number Diff line number Diff line change
@@ -103,8 +103,13 @@ def readlines(_file):
cdp = readlines(cdpneigh)
lldp = readlines(lldpneigh)

<<<<<<< HEAD
# netScan = get_wifi_scan('wlan0')
# netScan_html = json2html.convert(json=netScan)
=======
netScan = get_wifi_scan('wlan0')
netScan_html = json2html.convert(json=netScan)
>>>>>>> 525d30d8f699959fffd933019eb1a5c56e690dbb

script_results = dumpQueue(FPMS_QUEUE)
for result in script_results:
@@ -123,7 +128,11 @@ def readlines(_file):
"ipconfig": ipconfig,
"lldp": lldp,
"cdp": cdp,
<<<<<<< HEAD
# "scan": netScan_html,
=======
"scan": netScan_html,
>>>>>>> 525d30d8f699959fffd933019eb1a5c56e690dbb
}

if is_htmx(request):
32 changes: 32 additions & 0 deletions wlanpi_webui/utils.py
Original file line number Diff line number Diff line change
@@ -184,7 +184,39 @@ def get_wifi_scan(interface):
current_app.logger.exception("requests error")
return redirect(request.referrer)

def get_wifi_scan(interface):
"""
Starts or stops a service using wlanpi-core.
"""
headers = {
"accept": "application/json",
"content-type": "application/x-www-form-urlencoded",
}
params = {
"type": "active",
"interface": f"{interface}",
}

current_app.logger.info("calling network scan on inerface %s", interface)
try:
start_url = "http://127.0.0.1:31415/api/v1/network/network/scan"
response = requests.get(
start_url,
params=params,
headers=headers,
)
if response.status_code != 200:
current_app.logger.info(
"systemd_service_message: %s",
systemd_service_message("wlanpi-core"),
)
current_app.logger.info("%s generated %s response", start_url, response)
current_app.logger.info("%s generated %s response", start_url, response)
return json.dumps(response.json())
except requests.exceptions.RequestException:
current_app.logger.exception("requests error")
return redirect(request.referrer)

def package_installed(package):
version = get_apt_package_version(package)
if version == "":