Cleaned up errors and added logging
parent
ae41a169b8
commit
b289bd5d30
|
@ -4,7 +4,7 @@
|
||||||
# ERRORS:
|
# ERRORS:
|
||||||
# 3: Bad usage
|
# 3: Bad usage
|
||||||
# 4: Missing config file
|
# 4: Missing config file
|
||||||
|
printf 'Request for dashboard_ssl.cgi received\n' >>"${LOGFILE}"
|
||||||
CONFIG_FILE='/etc/wgapi/config'
|
CONFIG_FILE='/etc/wgapi/config'
|
||||||
if ! [ -f "${CONFIG_FILE}" ]; then
|
if ! [ -f "${CONFIG_FILE}" ]; then
|
||||||
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >>"${LOGFILE}"
|
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >>"${LOGFILE}"
|
||||||
|
|
|
@ -8,8 +8,11 @@
|
||||||
# 4: Config file not found
|
# 4: Config file not found
|
||||||
# 5: Missing part of the querystring
|
# 5: Missing part of the querystring
|
||||||
# 6: Invalid extension
|
# 6: Invalid extension
|
||||||
# 7: SSL file missing
|
# 7: Failed to perform nslookup of ip
|
||||||
# 8: Failed to return SSL file
|
# 8: Failed to parse username from domain
|
||||||
|
# 9: Missing username or SSL_CONFIG_DIR
|
||||||
|
# 10: SSL file missing
|
||||||
|
# 11: Failed to return SSL file
|
||||||
|
|
||||||
CONFIG_FILE='/etc/wgapi/config'
|
CONFIG_FILE='/etc/wgapi/config'
|
||||||
if ! [ ${#} -eq 2 ]; then
|
if ! [ ${#} -eq 2 ]; then
|
||||||
|
@ -53,8 +56,8 @@ if ! username="$(<<<"${domain}" cut -d'.' -f2)"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! path="${SSL_CONFIG_DIR:?}/${username:?}/${file}"; then
|
if ! path="${SSL_CONFIG_DIR:?}/${username:?}/${file}"; then
|
||||||
printf 'ERROR! Username "${username}" or SSL_CONFIG_DIR "%s" missing!\n' >> "${LOGFILE}"
|
printf 'ERROR! Username "${username}" or SSL_CONFIG_DIR "%s" missing!\n' "${username}" "${SSL_CONFIG_DIR}" >> "${LOGFILE}"
|
||||||
printf 'Hostname or username or extension missing!\n' | "${LIB_DIR}/http_res" 400
|
"${LIB_DIR}/http_res" 500
|
||||||
exit 9
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<h2>Your peers</h2>
|
<h2>Your peers</h2>
|
||||||
<p data-bind="hidden:isLoaded"><code>Loading...</code></p>
|
<p data-bind="hidden:isLoaded"><code>Loading...</code></p>
|
||||||
<table data-bind="visible:isLoaded">
|
<table data-bind="visible:isLoaded" style="display:hidden">
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th>Host</th><th>SSL</th><th></th>
|
<th>Host</th><th>SSL</th><th></th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<h2>Add a peer</h2>
|
<h2>Add a peer</h2>
|
||||||
<p>To add a new peer, type in a hostname and click add. The hostname must be 3-10 lowercase letters and numbers <code>/[a-z0-9]{3,10}/</code>. Keep it short for your own sake!</p>
|
<p>To add a new peer, type in a hostname and click add. The hostname must be 3-10 lowercase letters and numbers <code>/[a-z0-9]{3,10}/</code>. Keep it short for your own sake!</p>
|
||||||
<p data-bind="hidden:isLoaded"><code>Loading...</code></p>
|
<p data-bind="hidden:isLoaded"><code>Loading...</code></p>
|
||||||
<div data-bind="visible:isLoaded">
|
<div data-bind="visible:isLoaded" style="display:hidden">
|
||||||
<input type="text" data-bind="textInput:newPeerName,event:{keypress:addKeyPress}" placeholder="mypc1"></input>
|
<input type="text" data-bind="textInput:newPeerName,event:{keypress:addKeyPress}" placeholder="mypc1"></input>
|
||||||
<button data-bind="click:addPeer,disable:isAdding,text:addText">Add</button>
|
<button data-bind="click:addPeer,disable:isAdding,text:addText">Add</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue