summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-07-01 17:14:07 +0800
committerLi Zhineng <[email protected]>2025-07-01 17:14:07 +0800
commit800abf2f8e901daaf63f9c0a8c583cbb669aafd1 (patch)
tree039b4d46d4e5e67318472dc30316de7df39a3d18
parent69a4de871d337f493fb2e3ad1cf3553bbc1d9aa6 (diff)
downloadserver-800abf2f8e901daaf63f9c0a8c583cbb669aafd1.tar.gz
server-800abf2f8e901daaf63f9c0a8c583cbb669aafd1.zip
docs
-rw-r--r--LICENSE.md21
-rw-r--r--README.md60
2 files changed, 81 insertions, 0 deletions
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..9658e25
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 Open AIRMX
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7375d43
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+# The mock server for AIRMX Pro
+
+This repository contains a mock server used to enable AIRMX Pro devices to
+communicate. The server allows devices to register themselves with an MQTT
+server, periodically synchronize the date and time, and facilitate device
+pairing.
+
+> [!WARNING]
+> Due to the lack of the authentication feature, the code is expected to be run
+> on your internal network.
+
+## Usage
+
+We’re keeping things simple at heart while building it; the server has zero
+dependencies, so we don’t need to install anything. All you need is to spin
+up the server with:
+
+```
+node server.mjs
+```
+
+You should see _Listening on 0.0.0.0:80_. To customize the listening host
+or port, you can use the following two environment variables:
+
+```
+HOSTNAME="127.0.0.1" PORT=8080 node server.mjs
+```
+
+## Endpoints
+
+<dl>
+ <dt>GET /gettime</dt>
+ <dd>
+ From time to time, your AIRMX Pro will hit this endpoint to update its
+ local datetime, and we’re simply returning the current timestamp in
+ seconds back to the device.
+ </dd>
+
+ <dt>GET /eagle</dt>
+ <dd>
+ During the pairing process, when the device receives the Wi-Fi credentials
+ you provide, it registers itself with this endpoint along with its MAC
+ address and encryption key, which is the token that allows you to control
+ your device remotely later. We store this device information in an
+ in-memory SQLite database and wait for you to exchange your device key at
+ the final stage of the pairing process.
+ </dd>
+
+ <dt>GET /exchange</dt>
+ <dd>
+ To streamline device pairing, we introduce an unofficial API that enables
+ you to directly retrieve your device key from the browser. However, it's
+ crucial to understand that this API lacks authentication and will exchange
+ your device encryption key based solely on the device ID.
+ </dd>
+</dl>
+
+## License
+
+The code is released under [the MIT license](LICENSE.md).