diff options
| author | eunhhu <[email protected]> | 2026-09-29 18:04:58 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-29 18:04:58 +0100 |
| commit | ac975237e07f61d5969586ea0fc4f0b1f918a778 (patch) | |
| tree | 7a4ad70958c681e00ca5c6eca1eb7d4ad05ee2c5 /serve/serve.c | |
| parent | 8fe9ce66573be53ff56fe2a8afc693dabeae9585 (diff) | |
| download | pure-ac975237e07f61d5969586ea0fc4f0b1f918a778.tar.gz pure-ac975237e07f61d5969586ea0fc4f0b1f918a778.zip | |
Serve documents when a module keeps a collection, not by its inputs' names
pure-serve took a module with an input named show or edit for a
document app and refused it unless both were keyed messages: an app with
a plain message named edit compiled and then would not start (review
004, an earlier P2). Documents are what a module keeps in a keyed
collection; now the host serves them when the module declares one, and
inputs named show and edit are otherwise messages as any other.
check.py's server_plain_edit starts such an app and posts to edit.
Diffstat (limited to 'serve/serve.c')
| -rw-r--r-- | serve/serve.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/serve/serve.c b/serve/serve.c index 96e1b1d..e8b3ec3 100644 --- a/serve/serve.c +++ b/serve/serve.c @@ -2131,9 +2131,11 @@ static bool load_module(PureModule *m, const char *path, bool *documents, uint32 fprintf(stderr, "Module: %s\n", error); return false; } - /* Documents are served when the module has show and edit, as keyed messages. */ + /* Documents are served when the module keeps a keyed collection: its keyed + * messages show and edit read and write one by key. Without one, inputs + * named show and edit are messages as any other. */ int show = pure_module_input(m, "show"), edit = pure_module_input(m, "edit"); - *documents = show >= 0 || edit >= 0; + *documents = m->collections > 0; if (*documents && (show < 0 || edit < 0 || m->input[show].kind != PURE_KIND_MESSAGE || !m->input[show].keyed || m->input[edit].kind != PURE_KIND_MESSAGE || !m->input[edit].keyed)) { fputs("Module: documents need keyed messages named show and edit\n", stderr); |
