Add the network-extension wave to lib/net and the web ABI plugin:
- lib/net cookie_parse / multipart_parse host primitives (EN/ZH)
- plugins/web session store + /admin login gate + WebSocket client/server
- ext/web author surface (EN/ZH) for session, auth, ws
- form update flow and page-level validation echo tests
- fix string escapes: \xHH, \u{...}, unknown escapes kept verbatim
- map Chinese component slots (导航/侧栏/页脚) so sidebar renders
- resolve relative static/db paths against the entry script dir (entry_dir)
- new tutorial chapter 14, EN/ZH example sites, and gold tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2.2 KiB
title: web admin form-from-schema smoke description: Schema-derived admin forms share validate/submit (offline). import web:ext/web/web.mq.md import articles:web-fixtures/db/articles.mq.md import json:lib/json.mq.md
main
store = > web.db url="sqlite:web-fixtures/data/admin-smoke.db" schema = > articles.schema
store.init name=articles fields=schemastore.exec sql="DELETE FROM articles"store.exec sql="DELETE FROM sqlite_sequence WHERE name='articles'" url = > json.get value=storekey="url"
info = > web_db_table_info url=url table="articles"
cols = > json.get value=info key="columns"
n = > len value=cols
n>= 2
print text=schema-ok
print text=schema-fail
fnew = > web_form_from_schema url=url table="articles" action="insert"
fields = > json.get value=fnew key="fields"
nf = > len value=fields
nf>= 1
print text=new-form-ok
print text=new-form-fail
row =
| title | body |
|---|---|
| Admin create | via schema form |
sub = > web_form_submit form=fnew data=row url=url
sok = > json.get value=sub key="ok"
sok
print text=insert-ok
print text=insert-fail
got = > store.get table="articles" id=1
title = > json.get value=got key="title"
title== "Admin create"
print text=get-ok
print text=get-fail
fedit = > web_form_from_schema url=url table="articles" action="update" id=1
patch =
| title | body |
|---|---|
| Admin edited | body updated |
up = > web_form_submit form=fedit data=patch url=url
uok = > json.get value=up key="ok"
uok
print text=update-ok
print text=update-fail
got2 = > store.get table="articles" id=1
title2 = > json.get value=got2 key="title"
title2== "Admin edited"
print text=edit-ok
print text=edit-fail
empty =
| title | body |
|---|---|
bad = > web_form_submit form=fnew data=empty url=url
bok = > json.get value=bad key="ok"
bok
print text=required-should-fail
print text=required-ok
errs = > json.get value=bad key="errors"
nerr = > len value=errs
nerr>= 1
print text=errors-echoed-ok
print text=errors-echoed-fail