Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions Debian_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \

ARG WOLWEBPORT=8089
ARG WOLWEBVDIR=/wolweb
ARG WOLWEBHIDEAPIDOCS=false
ENV WOLWEBPORT=${WOLWEBPORT}
ENV WOLWEBVDIR=${WOLWEBVDIR}
ENV WOLWEBHIDEAPIDOCS=${WOLWEBHIDEAPIDOCS}

CMD ["/wolweb/wolweb"]

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ RUN apk add --no-cache curl

ARG WOLWEBPORT=8089
ARG WOLWEBVDIR=/wolweb
ARG WOLWEBHIDEAPIDOCS=false
ENV WOLWEBPORT=${WOLWEBPORT}
ENV WOLWEBVDIR=${WOLWEBVDIR}
ENV WOLWEBHIDEAPIDOCS=${WOLWEBHIDEAPIDOCS}

CMD ["/wolweb/wolweb"]

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The application will use the following default values if they are not explicitly
| Virtual Directory | A virtual directory to mount this application under | **/wolweb**
| Broadcast IP and Port | This is broadcast IP address and port for the local network. *Please include the port :9* | **192.168.1.255:9**
| Read Only | If set to true, the UI will be read only | **false**
| Hide API Docs | If set to true, the API documentation section is hidden on the web UI | **false**

You can override the default application configuration by using a config file or by setting environment variables. The application will first load values from config file and look for environment variables and overwrites values from the file with the values which were found in the environment.

Expand All @@ -62,7 +63,8 @@ You can override the default application configuration by using a config file or
"port": 8089,
"vdir":"/wolweb",
"bcastip":"192.168.1.255:9",
"read_only":false
"read_only":false,
"hide_api_docs":false
}
```
**Using Environment Variables:**
Expand All @@ -76,6 +78,7 @@ You can override the default application configuration by using a config file or
| WOLWEBVDIR | Override for default virtual directory
| WOLWEBBCASTIP | Override for broadcast IP address and port
| WOLWEBREADONLY | Override for read only mode of UI
| WOLWEBHIDEAPIDOCS | Override for hiding the API documentation section on the web UI

## Devices (targets) - devices.json format
```json
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"port": 8089,
"vdir": "/wolweb",
"bcastip": "192.168.1.255:9",
"read_only": false
"read_only": false,
"hide_api_docs": false
}
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ services:
WOLWEBPORT: "8089"
#WOLWEBVDIR: "/wolweb"
WOLWEBBCASTIP: "192.168.1.255:9"
#WOLWEBHIDEAPIDOCS: "false"
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ <h3>Devices</h3>
</div>
</div>
<div id="GridDevices"></div>
{{ if not .HideAPIDocs }}
<hr>
<div class="section-header">
<h3>Wake-up directly using HTTP Requests</h3>
Expand Down Expand Up @@ -99,6 +100,7 @@ <h6 style="margin-top: -4px; display: flex;">
</table>
</div>
<hr>
{{ end }}
<p style="font-size: 13px;">
<i class="bi bi-github" style="margin-right: 4px;"></i>
Project Page:&nbsp;<a href="https://github.com/sameerdhoot/wolweb">https://github.com/sameerdhoot/wolweb</a>
Expand All @@ -116,11 +118,13 @@ <h6 style="margin-top: -4px; display: flex;">
window.vDir = "{{$.VDir}}"
window.bCastIP = "{{$.BCastIP}}"

{{ if not .HideAPIDocs }}
$( "#code-element" ).load( "static/api-sample.txt" , function() {
hljs.highlightAll();
});

document.getElementById("app-vdir").innerHTML = window.vDir + "/wake/"
{{ end }}

Toast.setMaxCount(3);
Toast.enableQueue(true);
Expand Down
18 changes: 10 additions & 8 deletions pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ var indexHtml string
func renderHomePage(w http.ResponseWriter, r *http.Request) {

pageData := struct {
Devices []Device
VDir string
BCastIP string
ReadOnly bool
Devices []Device
VDir string
BCastIP string
ReadOnly bool
HideAPIDocs bool
}{
Devices: appData.Devices,
VDir: appConfig.VDir,
BCastIP: appConfig.BCastIP,
ReadOnly: appConfig.ReadOnly,
Devices: appData.Devices,
VDir: appConfig.VDir,
BCastIP: appConfig.BCastIP,
ReadOnly: appConfig.ReadOnly,
HideAPIDocs: appConfig.HideAPIDocs,
}
if appConfig.VDir == "/" {
pageData.VDir = ""
Expand Down
3 changes: 2 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ type AppConfig struct {
Port int `json:"port" env:"WOLWEBPORT" env-default:"8089"`
VDir string `json:"vdir" env:"WOLWEBVDIR" env-default:"/wolweb"`
BCastIP string `json:"bcastip" env:"WOLWEBBCASTIP" env-default:"192.168.1.255:9"`
ReadOnly bool `json:"read_only" env:"WOLWEBREADONLY" env-default:"false"`
ReadOnly bool `json:"read_only" env:"WOLWEBREADONLY" env-default:"false"`
HideAPIDocs bool `json:"hide_api_docs" env:"WOLWEBHIDEAPIDOCS" env-default:"false"`
}