Skip to content

Commit 8364cf1

Browse files
committed
Release 0.1.2
1 parent 0066489 commit 8364cf1

6 files changed

Lines changed: 93 additions & 6 deletions

File tree

.github/workflows/main-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
uses: docker/build-push-action@v6
4949
with:
5050
context: .
51-
platforms: linux/amd64,linux/arm/v7,linux/arm64
51+
platforms: linux/amd64,linux/i386,linux/arm/v6,linux/arm/v7,linux/arm64
5252
push: true
5353
tags: |
5454
${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest

README.md

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ GET /api/all
9292
```
9393
Returns all data about saved addresses in `json`.
9494
<details>
95-
<summary>Response example for 1 address</summary>
95+
<summary>Response example</summary>
9696

9797
```json
9898
{
@@ -107,7 +107,94 @@ Returns all data about saved addresses in `json`.
107107
},
108108
}
109109
```
110-
</details>
110+
</details><br>
111+
112+
```http
113+
GET /api/history
114+
```
115+
All history data from memory.
116+
<details>
117+
<summary>Response example</summary>
118+
119+
```json
120+
{
121+
"192.168.2.3:8849": {
122+
"Name": "OS",
123+
"Addr": "192.168.2.3",
124+
"Port": 8849,
125+
"PortName": "MiniBoard",
126+
"State": [
127+
{
128+
"Date": "2024-06-28 22:42:45",
129+
"State": true
130+
},
131+
{
132+
"Date": "2024-06-28 22:52:45",
133+
"State": true
134+
}
135+
],
136+
"NowState": true
137+
},
138+
}
139+
```
140+
</details><br>
141+
142+
```http
143+
GET /api/port/:addr
144+
```
145+
Returns current PortMap for `addr`.
146+
<details>
147+
<summary>Request example</summary>
148+
149+
```bash
150+
curl http://0.0.0.0:8853/api/port/192.168.2.2
151+
```
152+
</details>
153+
<details>
154+
<summary>Response example</summary>
155+
156+
```json
157+
{
158+
"8850": {
159+
"Name": "node-bootstrap",
160+
"Port": 8850,
161+
"State": true,
162+
"Watch": true
163+
},
164+
"8851": {
165+
"Name": "Exercise Diary",
166+
"Port": 8851,
167+
"State": true,
168+
"Watch": true
169+
},
170+
171+
}
172+
```
173+
</details><br>
174+
175+
```http
176+
GET /api/port/:addr/:port
177+
```
178+
Gets state of one port
179+
<details>
180+
<summary>Request example</summary>
181+
182+
```bash
183+
curl http://0.0.0.0:8853/api/port/192.168.2.2/8844
184+
```
185+
</details>
186+
<details>
187+
<summary>Response example</summary>
188+
189+
```json
190+
{
191+
"Name": "git-syr",
192+
"Port": 8844,
193+
"State": true,
194+
"Watch": true
195+
}
196+
```
197+
</details><br>
111198

112199
## Thanks
113200
- All go packages listed in [dependencies](https://github.com/aceberg/watchyourports/network/dependencies)

assets/Screenshot01.png

36.4 KB
Loading

assets/Screenshot1.png

640 Bytes
Loading

internal/web/public/js/scan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async function loadSavedPorts() {
111111

112112
addr = document.getElementById("pageAddr").value;
113113

114-
let url = '/api/addr/'+addr;
114+
let url = '/api/port/'+addr;
115115
portMap = await (await fetch(url)).json();
116116
if (portMap != null) {
117117
portArray = Object.values(portMap);

internal/web/webgui.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func Gui(dirPath, nodePath string) {
5050
router.StaticFS("/fs/", http.FS(pubFS)) // public
5151

5252
router.GET("/api/all", apiAllAddrs) // api-port.go
53-
router.GET("/api/addr/:addr/", apiAddrPortMap) // api-port.go
54-
router.GET("/api/port/:addr/:port", apiPortScan) // api-port.go
5553
router.GET("/api/history", apiHistory) // api-port.go
54+
router.GET("/api/port/:addr", apiAddrPortMap) // api-port.go
55+
router.GET("/api/port/:addr/:port", apiPortScan) // api-port.go
5656

5757
router.GET("/", indexHandler) // index.go
5858
router.GET("/config/", configHandler) // config.go

0 commit comments

Comments
 (0)