Giter Club home page Giter Club logo

Comments (10)

billz avatar billz commented on June 5, 2024 1

Sure, totally open to a non-PHP approach. FastAPI is great, I've played with it a bit in the past.

from raspap-webgui.

NL-TCH avatar NL-TCH commented on June 5, 2024 1

quick update, i have the system info already implemented, moving on to wifi info:

(testing on local machine)
image

the following parts i cannot implement because of having zero knowledge about php:
button in webinterface enables a systemd service (which is already installed, but not running) that runs this API
field in webinterface to let the user input a API key (because the API needs to be exposed to the eth0 interface to be of any use)

i'll continue this weekend

from raspap-webgui.

billz avatar billz commented on June 5, 2024 1

That was quick 😅 Re: PHP or implementing API endpoints, generally, I'm happy to give advice and/or contribute code as needed.

from raspap-webgui.

billz avatar billz commented on June 5, 2024 1

Image built successfully. Started the container per usual. The raspap-api.service exited with a path error. Executing the following worked:

root@raspberrypi:/home/API# uvicorn main:app --host 0.0.0.0 --port 8081
insecure
INFO:     Started server process [1511]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8081 (Press CTRL+C to quit)
INFO:     192.168.0.101:50949 - "GET /docs HTTP/1.1" 200 OK
INFO:     192.168.0.101:50952 - "GET /openapi.json HTTP/1.1" 200 OK
INFO:     192.168.0.101:51188 - "GET /ap HTTP/1.1" 200 OK

Opening http://raspberrypi.local:8081/docs loads the interactive FastAPI docs (very nice).

Tried several endpoints - all the ones I tested worked as expected. eg.:

GET http://raspberrypi.local:8081/ap

{
  "driver": "nl80211",
  "ctrl_interface": "/var/run/hostapd",
  "ctrl_interface_group": "0",
  "auth_algs": "1",
  "wpa_key_mgmt": "WPA-PSK",
  "beacon_int": "100",
  "ssid": "raspi-webgui",
  "channel": "1",
  "hw_mode": "g",
  "ieee80211n": "1 # 802.11n support (Raspberry Pi 3)",
  "wpa_passphrase": "ChangeMe",
  "interface": "/var/run/hostapd",
  "wpa": "2",
  "wpa_pairwise": "CCMP",
  "country_code": "GB",
  "ignore_broadcast_ssid": ""
}

Amazing work!

from raspap-webgui.

NL-TCH avatar NL-TCH commented on June 5, 2024

this is quite a big feature, so idk if this is anything "we" should want

from raspap-webgui.

billz avatar billz commented on June 5, 2024

Agreed that the level of effort is somewhat non-trivial. However it's a frequently requested feature #1372 #602 #393 (probably more examples) and would indeed make RaspAP more useful for IoT / HA applications.

I've been gradually moving the project toward more PHP class definitions (see contents of /src/RaspAP) so it would make sense for an API to live here. Probably best to start with a few simple endpoints, eg., service status. We could also leverage an existing RESTful API framework, though my preference would be for something lean and minimal rather than a bloated 'kitchen sink' type framework.

from raspap-webgui.

NL-TCH avatar NL-TCH commented on June 5, 2024

cool!
Is it an idea, that i will try to create a PoC for an API with python (FastAPI)?
So we have a different script for the API on python than on the already existing webgui (on a different port).
Or do you want to have it per-sé integrated in the php code?

from raspap-webgui.

NL-TCH avatar NL-TCH commented on June 5, 2024

Hey @billz the API is progressing quite nicely, can i ask to get insider access?
i am implementing the wireguard api, and it would benefit to have API access to view the different configs imo.

what is your opinion on this?

the branch is quite cluttered, but if you're interested, here is the progress: https://github.com/NL-TCH/raspap-docker/tree/API-alpha

from raspap-webgui.

NL-TCH avatar NL-TCH commented on June 5, 2024

@billz can you give feedback on the branch?
all the GET requests are implemented, POST requests are only configured for the hostspot, and more are comming.

  • TCH

from raspap-webgui.

billz avatar billz commented on June 5, 2024

@NL-TCH great! I'll carve out some time and give it a round of testing.

from raspap-webgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.