better urls for api stuff & fixed chart AR box position on mobile

master
Ondřej Hruška 8 years ago
parent f4a702ed0d
commit 42f869de61
  1. 2
      esp_meas.pro.user
  2. 2
      html/css/app.css
  3. 4
      html/js/all.js
  4. 2
      html/pages/about.tpl
  5. 2
      html/pages/fft.html
  6. 2
      html/pages/status.tpl
  7. 2
      html/pages/wfm.html
  8. 2
      html/pages/wifi.tpl
  9. 4
      html_src/_start.php
  10. 2
      html_src/css/app.css
  11. 2
      html_src/css/app.css.map
  12. 6
      html_src/js-src/page_status.js
  13. 2
      html_src/js-src/page_waveform.js
  14. 2
      html_src/js-src/page_wifi.js
  15. 4
      html_src/js/all.js
  16. 2
      html_src/sass/pages/_wfm.scss
  17. 10
      libesphttpd/util/cgiwifi.c
  18. 39
      user/routes.c

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.6.1, 2016-04-01T02:05:29. -->
<!-- Written by QtCreator 3.6.1, 2016-04-01T14:34:14. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -19,7 +19,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current Analyser</div>
<a href="/">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about" class="selected">About</a></nav>
<a href="/status">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about" class="selected">About</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

@ -19,7 +19,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current Analyser</div>
<a href="/">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft" class="selected">FFT</a><a href="/about">About</a></nav>
<a href="/status">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft" class="selected">FFT</a><a href="/about">About</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

@ -19,7 +19,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current Analyser</div>
<a href="/" class="selected">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<a href="/status" class="selected">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

@ -19,7 +19,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current Analyser</div>
<a href="/">Home</a><a href="/wifi">WiFi config</a><a href="/waveform" class="selected">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<a href="/status">Home</a><a href="/wifi">WiFi config</a><a href="/waveform" class="selected">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

@ -19,7 +19,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current Analyser</div>
<a href="/">Home</a><a href="/wifi" class="selected">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<a href="/status">Home</a><a href="/wifi" class="selected">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/about">About</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

@ -4,13 +4,13 @@
$root = $prod ? '' : 'http://192.168.1.13';
$menu = [
'home' => [ $prod ? '/' : '/page_status.php', 'Home' ],
'home' => [ $prod ? '/status' : '/page_status.php', 'Home' ],
'wifi' => [ $prod ? '/wifi' : '/page_wifi.php', 'WiFi config' ],
'waveform' => [ $prod ? '/waveform' : '/page_waveform.php', 'Waveform' ],
'fft' => [ $prod ? '/fft' : '/page_fft.php', 'FFT' ],
// 'spectrogram' => [ '/spectrogram', 'Spectrogram' ],
// 'transient' => [ '/transient', 'Power-on transient' ],
'about' => [ $prod ? '/about' : '/page_about.php', 'About' ],
'about' => [ $prod ? '/about' : '/page_about.php', 'About' ],
];
$appname = 'Current Analyser';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,14 +8,14 @@ var page_status = (function() {
st.trigReset = function() {
var modal_sel = '#reset-modal';
$().get(_root + '/reset.cgi', function(resp, status) {
$().get(_root + '/system/reset', function(resp, status) {
if (status == 200) {
modal.show(modal_sel);
updateInhibited = true;
var ping_i = setInterval(function() {
$().get(_root+'/ping.cgi', function(resp, code){
$().get(_root+'/system/ping', function(resp, code){
if (code == 200) {
// device is ready
modal.hide(modal_sel);
@ -77,7 +77,7 @@ var page_status = (function() {
}
function requestUpdate() {
$().get(_root+'/api/status.json', onUpdate);
$().get(_root+'/system/status', onUpdate);
}
st.init = function() {

@ -168,7 +168,7 @@ var page_waveform = (function () {
var n = $('#count').val();
var fs = $('#freq').val();
var url = _root+'/api/{fmt}.json?n={n}&fs={fs}'.format({
var url = _root+'/measure/{fmt}?n={n}&fs={fs}'.format({
fmt: dataFormat, // fft or raw
n: n,
fs: fs

@ -76,7 +76,7 @@ var page_wifi = (function () {
/** Ask the CGI what APs are visible (async) */
function scanAPs() {
$().get(_root+'/wifi/scan.cgi', onScan); // no cache, no jsonp
$().get(_root+'/wifi/scan', onScan); // no cache, no jsonp
}
function rescan(time) {

File diff suppressed because one or more lines are too long

@ -70,6 +70,8 @@
#stat-i-peak:after {content: "mA"}
#stat-i-rms:after {content: "mA"}
padding-bottom: 50px;
// auto reload box
.ar {
position: absolute;

@ -165,7 +165,7 @@ int ICACHE_FLASH_ATTR cgiWiFiScan(HttpdConnData *connData) {
}
httpdStartResponse(connData, 200);
httpdHeader(connData, "Content-Type", "text/json");
httpdHeader(connData, "Content-Type", "application/json");
httpdEndHeaders(connData);
if (cgiWifiAps.scanInProgress==1) {
@ -251,7 +251,7 @@ int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
httpdRedirect(connData, "/wifi");
#else
os_timer_arm(&reassTimer, 500, 0);
httpdRedirect(connData, "connecting.html"); // TODO custom page. Also diff. b/w sta & ap.
httpdRedirect(connData, "/wifi/connecting.html"); // TODO custom page. Also diff. b/w sta & ap.
#endif
return HTTPD_CGI_DONE;
}
@ -288,7 +288,7 @@ int ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData) {
struct ip_info info;
int st=wifi_station_get_connect_status();
httpdStartResponse(connData, 200);
httpdHeader(connData, "Content-Type", "text/json");
httpdHeader(connData, "Content-Type", "application/json");
httpdEndHeaders(connData);
if (connTryStatus==CONNTRY_IDLE) {
len=sprintf(buff, "{\"status\":\"idle\"}");
@ -332,9 +332,9 @@ int ICACHE_FLASH_ATTR tplWlan(HttpdConnData *connData, char *token, void **arg)
} else if (strcmp(token, "WiFiapwarn")==0) {
x=wifi_get_opmode();
if (x==2) {
strcpy(buff, "<b>Can't scan in this mode.</b> Click <a href=\"/wifi/setmode.cgi?mode=3\">here</a> to go to STA+AP mode.");
strcpy(buff, "<b>Can't scan in this mode.</b> Click <a href=\"/wifi/setmode?mode=3\">here</a> to go to STA+AP mode.");
} else {
strcpy(buff, "Click <a href=\"/wifi/setmode.cgi?mode=2\">here</a> to go to stand-alone AP mode.");
strcpy(buff, "Click <a href=\"/wifi/setmode?mode=2\">here</a> to go to stand-alone AP mode.");
}
}
httpdSend(connData, buff, -1);

@ -37,45 +37,36 @@ static int FLASH_FN myPassFn(HttpdConnData *connData, int no, char *user, int us
HttpdBuiltInUrl builtInUrls[] = {
ROUTE_CGI_ARG("*", cgiRedirectApClientToHostname, "esp8266.nonet"), // redirect func for the captive portal
// ! Templates in the JSON folder will have application/json content type !
// otherwise they're encoded the same like the HTML ones -> no heatshrink, no gzip
// --- System control ---
ROUTE_CGI("/system/reset", cgiResetDevice),
ROUTE_CGI("/system/ping", cgiPing),
ROUTE_TPL_FILE("/system/status", tplSystemStatus, "/json/status.tpl"),
// --- UI pages ---
ROUTE_CGI("/reset.cgi", cgiResetDevice),
ROUTE_CGI("/ping.cgi", cgiPing),
// --- Measurement ---
ROUTE_TPL_FILE("/measure/raw", tplWaveformJSON, "/json/samples.tpl"),
ROUTE_TPL_FILE("/measure/fft", tplFourierJSON, "/json/samples.tpl"),
// --- UI pages ---
// System Status page
ROUTE_TPL_FILE("/", tplSystemStatus, "/pages/status.tpl"),
ROUTE_TPL_FILE("/", tplSystemStatus, "/pages/status.tpl"),
ROUTE_TPL_FILE("/status", tplSystemStatus, "/pages/status.tpl"),
ROUTE_TPL_FILE("/api/status.json", tplSystemStatus, "/json/status.tpl"),
// About
ROUTE_TPL_FILE("/about", tplAbout, "/pages/about.tpl"),
// Waveform page
ROUTE_FILE("/waveform", "/pages/wfm.html"), // static file, html -> can use gzip
// FFT
ROUTE_FILE("/fft", "/pages/fft.html"), // static file, html -> can use gzip
ROUTE_TPL_FILE("/api/raw.json", tplWaveformJSON, "/json/samples.tpl"),
ROUTE_TPL_FILE("/api/fft.json", tplFourierJSON, "/json/samples.tpl"),
// --- WiFi config ---
#if WIFI_PROTECT
ROUTE_AUTH("/wifi/*", myPassFn),
ROUTE_AUTH("/wifi*", myPassFn),
#endif
ROUTE_REDIRECT("/wifi/", "/wifi"),
ROUTE_TPL_FILE("/wifi", tplWlan, "/pages/wifi.tpl"),
ROUTE_CGI("/wifi/scan.cgi", cgiWiFiScan),
ROUTE_CGI("/wifi/connect.cgi", cgiWiFiConnect),
ROUTE_CGI("/wifi/connstatus.cgi", cgiWiFiConnStatus),
ROUTE_CGI("/wifi/setmode.cgi", cgiWiFiSetMode),
ROUTE_CGI("/wifi/scan", cgiWiFiScan),
ROUTE_CGI("/wifi/connect", cgiWiFiConnect),
ROUTE_CGI("/wifi/connstatus", cgiWiFiConnStatus),
ROUTE_CGI("/wifi/setmode", cgiWiFiSetMode),
// --- FS ---
ROUTE_FS("*"), //Catch-all cgi function for the filesystem NOTE: unsafe, lets user read templates.
ROUTE_END()

Loading…
Cancel
Save