20190520_jeffrey - silenceuncrio/diary GitHub Wiki
0905
review
web 做得差不多的時候需要幫 jweb api 整理一下文件
讓後續接手的人能快速的對 web 架構有一定程度的認識
尤其是 whoAmI 如何跟前端的 javascript 做搭配的部分要寫清楚
也可以透過這份 wiki 讓別人了解自己做了什麼
0950
M300 目前打開 index.html 載入全部 module 的 javascript 檔案以及 css 都沒有問題
https 有沒有問題
預設開啟的 status page 一切正常
此時開啟 System > Time and Date
會因為沒有 cookie 的關係導致
/cgi-bin/sntp.cgi?act=config
回應 401
而讓前端的 angular route 到 login page
輸入帳密後會發出 POST /api/login
lighttpd 的 URL rewrite 因為以下的 config 所以會 rewrite 至 /cgi-bin/api.cgi?act=login
url.rewrite-once = (
"^/api/([a-zA-Z]+)[0-9a-zA-Z=.?]*$" => "/cgi-bin/api.cgi?act=$1",
)
該 cgi 處理後的 200 response 的 header 帶著 Set-Cookie
對 browser 設定 cookie 讓後續 browser 發出的 request 都能帶上該 cookie
這時 browser 再發出 /cgi-bin/sntp.cgi?act=config
request 就能得到回應了
1150
先幫 status.cgi 套上 jweb.access.filter
commit 3ed31968d6437e380d3ee6101ca38e02d5f83f53
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Mon May 20 11:51:30 2019 +0800
use jweb.access.filter in status.cgi
proscend/prosrc/webcgi/status.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
1305
來做 /api/logout
lighttpd 會 rewrite 至 /cgi-bin/api.cgi?act=logout
commit 0ace5676dc8bcfad27eec63d8edc0e65fdcdb991
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Mon May 20 13:33:54 2019 +0800
implement jweb.api.logout()
proscend/prosrc/webcgi/api.c | 4 ++++
proscend/prosrc/webcgi/jweb.c | 21 +++++++++++++++++++++
proscend/prosrc/webcgi/jweb.h | 1 +
3 files changed, 26 insertions(+)
1335
開始掃台 - System > COM Ports
相關的 request 有
- icos.com.config()
- cgi-bin/com.cgi?act=config
- icos.vcom.config()
- cgi-bin/com.cgi?act=apply
- icos.vcom.apply()
- cgi-bin/vcom.cgi?act=config
- icos.com.apply()
- cgi-bin/vcom.cgi?act=apply
commit f8d91e52c9f7892bce4669d16e7228539e529390
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Mon May 20 13:50:56 2019 +0800
finish 'System > COM Ports':
- use jweb.access.filter in com.cgi
- use jweb.access.filter in vcom.cgi
- modify jweb.access.filter
proscend/prosrc/webcgi/com.c | 267 +++++++++++++++++++------------------
proscend/prosrc/webcgi/jweb.c | 6 -
proscend/prosrc/webcgi/sntp.c | 2 +-
proscend/prosrc/webcgi/vcom.c | 298 +++++++++++++++++++++---------------------
4 files changed, 293 insertions(+), 280 deletions(-)
1350
再來是 - System > Logging
相關的 request 與 access level 為
- icos.syslog.config()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/syslog.cgi?act=config'
- icos.syslog.apply()
- ATTVAL_SYSTEM_LEVEL2; cgi-bin/syslog.cgi?act=apply
- icos.syslog.clear_log()
- ATTVAL_SYSTEM_LEVEL2; cgi-bin/syslog.cgi?act=clear_log
- icos.syslog.gen_log()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/syslog.cgi?act=gen_log
cgi-bin/syslog.cgi?act=gen_log
會產生 500 error 和以下的訊息
{fail: true, info: "Failed to parse the log"}
這應該是 ParseSyslog.sh
執行失敗所導致
該 script 所在位置在 /usr/sbin/icos/ParseSyslog.sh
其中的 PATH environment variable
我們的 lighttpd 版本為 1.4.36 (ssl)
root@Cellular Router:/www/cgi-bin# lighttpd -v
lighttpd/1.4.36 (ssl) - a light and fast webserver
Build-Date: Apr 16 2019 05:47:09
需使用 setenv.add-environment
setenv.add-environment = ( "PATH" => "/sbin:/usr/sbin:/usr/sbin/icos" )
目前 System > Logging
page 已正常使用中
commit 4cc33b801a9736a394c1ecf47f2d668eb4f89f4a
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Mon May 20 14:58:49 2019 +0800
finish 'System > Logging':
- use jweb.access.filter in syslog.cgi
- Specify a PATH for CGI scripts
.../rootfs/home/factory/icos/lighttpd/lighttpd.conf | 5 +++++
proscend/prosrc/webcgi/syslog.c | 17 +++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
1600
M360 UI 需要幫忙
先拉一版最新的 branch release/v1.01
commit 3318830925d98c7bb56135b0c41483fc9fe96d02
Refs: [release/v1.01], {origin/release/v1.01}
Author: jeffrey <[email protected]>
Date: Mon May 20 16:35:29 2019 +0800
- change wording 'PCIs' to 'PCI', also the online manul
- chnage hint at 'LTE > Dual APN'
proscend/prosrc/www/app/feature/dualSim_2apn.html | 4 +++-
proscend/prosrc/www/app/locale-en.json | 9 +++++----
proscend/prosrc/www/app/locale-fr.json | 5 +++--
proscend/prosrc/www/app/locale-zh-tw.json | 5 +++--
proscend/prosrc/www/src/manual/lte_lock_pcis.h.html | 11 ++++-------
proscend/prosrc/www/src/manual/sidebar.h.html | 2 +-
6 files changed, 19 insertions(+), 17 deletions(-)
1640
回到 M300 - feature/lighttpd
再來是 - System > Alarm
相關的 request 與 access level 為
- icos.alarm.get_users()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=users
- icos.alarm.add_user()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=user
- icos.alarm.delete_users()
- ATTVAL_SYSTEM_LEVEL2; cgi-bin/alarm.cgi?act=delete_users
- icos.alarm.get_groups()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=groups
- icos.alarm.add_group()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=group
- icos.alarm.delete_group()
- ATTVAL_SYSTEM_LEVEL2; cgi-bin/alarm.cgi?act=delete_group
- icos.alarm.get_schedules()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=schedules
- icos.alarm.get_config()
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=config
- icos.alarm.apply_config()
- ATTVAL_SYSTEM_LEVEL2; cgi-bin/alarm.cgi?act=apply
- icos.alarm.get_sms = function() {
- ATTVAL_SYSTEM_LEVEL1; cgi-bin/alarm.cgi?act=sms
上 code
commit 018cd0b63f737a3c6e6db1fd4beeaea7592c48a8
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Mon May 20 17:03:30 2019 +0800
finish 'System > Alarm':
- use jweb.access.filter in alarm.cgi
proscend/prosrc/webcgi/alarm.c | 78 +++++++++++++++++++++++++++++++++++-------
1 file changed, 66 insertions(+), 12 deletions(-)