post-W7 cleanup

This commit is contained in:
root
2026-06-15 12:00:46 +00:00
parent 75bccb778c
commit 1a5c6547b9
28 changed files with 896 additions and 301 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ RENDER(Request& context)
<? render_card("once-init.uce", "ONCE / INIT", "Unit lifecycle hooks for worker load and request entry"); ?>
<? render_card("markdown.uce", "Markdown", "Markdown parsing with components"); ?>
<? render_card("script.uce", "Script", "UCE script integration"); ?>
<? render_card("websockets.ws.uce", "WebSockets", "Real-time WebSocket chat"); ?>
<? render_card("websockets.ws.uce", "WebSockets", "Live WebSocket chat"); ?>
<? render_card("unit-browser.uce", "Unit Browser", "units_list(), unit_info(), unit_compile()"); ?>
<? if(allow_server_demos) { render_card("task.uce", "Task", "Background task execution"); } ?>
<? if(allow_server_demos) { render_card("task_repeat.uce", "Task Repeat", "Recurring task scheduling"); } ?>
+1 -1
View File
@@ -1,6 +1,6 @@
# Markdown Demo
This page exercises **strong**, *emphasis*, ~~strikethrough~~, `code spans`, and a bare URL: https://uce.openfu.com/doc/index.uce
This page exercises **strong**, *emphasis*, ~~strikethrough~~, `code spans`, and a bare URL: https://example.com/doc/index.uce
## Task List
+2 -2
View File
@@ -12,9 +12,9 @@ WS(Request& context)
>1_RENDER
:content
Defines the WebSocket message handler for the current `.ws.uce` page.
Defines the WebSocket message handler for the current `.uce` page.
The same page may expose both `RENDER(Request& context)` and `WS(Request& context)`. `RENDER(Request& context)` serves the initial HTTP response, while `WS(Request& context)` is called whenever a complete WebSocket message arrives for that page.
Any `.uce` unit may expose both `RENDER(Request& context)` and `WS(Request& context)`. `RENDER(Request& context)` serves the initial HTTP response, while `WS(Request& context)` is called whenever a complete WebSocket message arrives for that page. Configure nginx/Apache to route WebSocket upgrade requests for `.uce` paths to the runtime's HTTP/WebSocket listener.
UCE reassembles fragmented messages before calling `WS(Request& context)`. Text and binary frames are both delivered. The current payload is available directly on `context.in`, message metadata is mirrored into `context.params["WS_..."]`, and connection-local state lives on `context.connection`.
+1 -1
View File
@@ -8,7 +8,7 @@ path : the new working directory
>sys
:content
Sets the host worker process current directory. In wasm this is a real hostcall, so restore the previous directory when using it inside request code.
Sets the host worker process current directory. In wasm this is a hostcall, so restore the previous directory when using it inside request code.
## Related Concepts
+1 -1
View File
@@ -12,7 +12,7 @@ Returns the runtime's scope identifier for the current WebSocket endpoint.
This is the same default scope used by `ws_send()`, `ws_connections()`, and `ws_connection_count()` when no explicit scope is supplied.
In the current runtime implementation this scope is the page's internal endpoint identifier, typically the absolute `SCRIPT_FILENAME` of the `.ws.uce` file.
In the current runtime implementation this scope is the page's internal endpoint identifier, typically the absolute `SCRIPT_FILENAME` of the `.uce` file that accepted the WebSocket upgrade.
Related:
+1 -1
View File
@@ -1,7 +1,7 @@
// Example page_compiling handler. Enable in /etc/uce/settings.cfg:
// page_compiling=site/errors/compiling.uce
// Served with status 503 while the requested unit is being (re)built; the
// page refreshes itself until the build finishes and the real page renders.
// page refreshes itself until the build finishes and the requested page renders.
RENDER(Request& context)
{
@@ -548,7 +548,7 @@ howl.updateEffectsChain(); <span class="code-comment">// Apply changes</span>
<div class="api-section">
<h3>Frequency Analysis</h3>
<div class="api-description">
<strong>enableEQ(bands, callback, boost)</strong> - Enable real-time frequency analysis<br>
<strong>enableEQ(bands, callback, boost)</strong> - Enable live frequency analysis<br>
• bands: Number of frequency bands (default: 16)<br>
• callback: Function called with frequency data array<br>
• boost: Gain multiplier for visualization (default: 4.0)<br><br>
@@ -25,7 +25,7 @@ COMPONENT(Request& context)
<div class="callback-result success">
<div class="result-icon">✓</div>
<h2>Authentication Successful</h2>
<p>OAuth callback received successfully! Demo mode is active until real provider credentials are configured.</p>
<p>OAuth callback received successfully! Demo mode is active until provider credentials are configured.</p>
<div class="callback-details">
<p><strong>Service:</strong> <?= first(context.session["oauth_service"], "unknown") ?></p>
<p><strong>Code:</strong> <?= code.substr(0, std::min((u64)20, (u64)code.length())) ?>...</p>
@@ -102,7 +102,7 @@ COMPONENT(Request& context)
DValue empty_props;
empty_props["icon_class"] = "fas fa-clock-rotate-left";
empty_props["title"] = "No live stream wired yet";
empty_props["text"] = "The shell is generic. Add your own websocket, polling, or event-driven runtime behind it when a real product needs one.";
empty_props["text"] = "The shell is generic. Add your own websocket, polling, or event-driven runtime behind it when a product needs one.";
empty_props["action_html"] = "<a class=\"ws-primary-btn\" href=\"" + app_link("dashboard", context) + "\">Open dashboard demo</a>";
main_body += component("../../components/workspace/primitives:EMPTY_STATE", empty_props, context);
}
+16 -16
View File
@@ -29,7 +29,7 @@ void render_link_card(String href, String title, String body, String meta)
</a></>
}
void render_code_example(Request& context, String eyebrow, String title, String summary, String code, String note, String language = "uce")
DValue code_example_props(String eyebrow, String title, String summary, String code, String note, String language = "uce")
{
DValue props;
props["eyebrow"] = eyebrow;
@@ -38,7 +38,7 @@ void render_code_example(Request& context, String eyebrow, String title, String
props["code"] = code;
props["note"] = note;
props["language"] = language;
<><?: component("components/code_example", props, context) ?></>
return(props);
}
RENDER(Request& context)
@@ -123,7 +123,7 @@ RENDER(Request& context)
"}\n";
String snippet_nginx =
"location ~ \\.ws\\.uce$ {\n"
"location ~ \\.uce$ {\n"
"\terror_page 418 = @uce_websocket;\n"
"\tif ($http_upgrade = \"websocket\") { return 418; }\n"
"\tinclude fastcgi_params;\n"
@@ -212,7 +212,7 @@ RENDER(Request& context)
<div class="feature-grid">
<? render_feature_card("templating", "Inline markup without framework tax", "UCE templates live directly inside handler code with escaped and raw output modes, so rendering stays local to the request logic that owns it."); ?>
<? render_feature_card("composition", "Components and sub-rendering", "Components are just .uce files. Props flow through context.props. Full pages can call other units without inventing a second application runtime."); ?>
<? render_feature_card("transport", "FastCGI for pages, HTTP for sockets", "Normal page renders stay on the FastCGI socket. Real WebSocket upgrades on .ws.uce endpoints are proxied to the built-in HTTP listener."); ?>
<? render_feature_card("transport", "FastCGI for pages, HTTP for sockets", "Normal page renders stay on the FastCGI socket. WebSocket upgrades for .uce endpoints are proxied to the built-in HTTP listener."); ?>
<? render_feature_card("operations", "nginx in front, systemd behind", "Static files stay static, nginx does the edge work, and the runtime handles compilation, request execution, and socket fan-out."); ?>
</div>
</section>
@@ -248,12 +248,12 @@ RENDER(Request& context)
</p>
</div>
<div class="code-grid">
<? render_code_example(context, "templating", "A page with request data", "Drop from C++ into markup, escape output by default, and keep request handling next to the HTML it controls.", snippet_minimal, "See the live demos for forms, headers, sessions, JSON, markdown, and more."); ?>
<? render_code_example(context, "forms", "POST + session flash", "Old-school dynamic websites still matter. UCE keeps form handling and page rendering in one file when that is the simplest thing.", snippet_forms, "Request data lives on context.get, context.post, context.cookies, and context.session."); ?>
<? render_code_example(context, "components", "Reusable UI without a second framework", "Components are ordinary .uce files. Pass props through context.props and choose when to render or return markup.", snippet_components, "Named handlers and component_render() are also available for direct output flows."); ?>
<? render_code_example(context, "content", "Markdown when you want it", "UCE also ships a markdown module, so content-heavy pages do not need an external rendering stack.", snippet_markdown, "The runtime supports markdown_to_ast() and markdown_to_html() for content pipelines and component hooks."); ?>
<? render_code_example(context, "realtime", "WebSockets with broker-owned state", "A .ws.uce page can render HTML and also accept live socket messages. Connection-local state lives on context.connection.", snippet_websocket, "The published demo includes a full chat example with reconnect logic and per-connection metadata."); ?>
<? render_code_example(context, "deploy", "nginx wiring", "Use FastCGI for ordinary requests and only send actual websocket upgrades to the runtime's built-in HTTP listener.", snippet_nginx, "Match .ws.uce before the generic .uce location so normal page loads and upgrades split correctly.", "nginx"); ?>
<?: component("components/code_example", code_example_props("templating", "A page with request data", "Drop from C++ into markup, escape output by default, and keep request handling next to the HTML it controls.", snippet_minimal, "See the live demos for forms, headers, sessions, JSON, markdown, and more."), context) ?>
<?: component("components/code_example", code_example_props("forms", "POST + session flash", "Old-school dynamic websites still matter. UCE keeps form handling and page rendering in one file when that is the simplest thing.", snippet_forms, "Request data lives on context.get, context.post, context.cookies, and context.session."), context) ?>
<?: component("components/code_example", code_example_props("components", "Reusable UI without a second framework", "Components are ordinary .uce files. Pass props through context.props and choose when to render or return markup.", snippet_components, "Named handlers and component_render() are also available for direct output flows."), context) ?>
<?: component("components/code_example", code_example_props("content", "Markdown when you want it", "UCE also ships a markdown module, so content-heavy pages do not need an external rendering stack.", snippet_markdown, "The runtime supports markdown_to_ast() and markdown_to_html() for content pipelines and component hooks."), context) ?>
<?: component("components/code_example", code_example_props("realtime", "WebSockets with broker-owned state", "Any .uce page can render HTML and also accept live socket messages with WS(Request& context). Connection-local state lives on context.connection.", snippet_websocket, "Route WebSocket upgrade requests for .uce paths to the runtime HTTP listener."), context) ?>
<?: component("components/code_example", code_example_props("deploy", "nginx wiring", "Use FastCGI for ordinary requests and send websocket upgrades to the runtime's built-in HTTP listener.", snippet_nginx, "Route upgrade requests for .uce paths to HTTP_PORT; plain page loads stay on FastCGI.", "nginx"), context) ?>
</div>
</section>
@@ -266,9 +266,9 @@ RENDER(Request& context)
<div class="deploy-card">
<h3>The intended shape</h3>
<ul>
<li>nginx serves static files directly from `site/`</li>
<li>ordinary `.uce` and plain `.ws.uce` page loads go through FastCGI</li>
<li>real websocket upgrade traffic goes to the built-in HTTP listener</li>
<li>nginx serves static files directly from `/var/www/html`</li>
<li>ordinary `.uce` page loads go through FastCGI</li>
<li>websocket upgrade traffic for `.uce` paths goes to the built-in HTTP listener</li>
<li>systemd manages the runtime binary and restart policy</li>
</ul>
</div>
@@ -276,9 +276,9 @@ RENDER(Request& context)
<h3>The practical settings</h3>
<ul>
<li>`FCGI_SOCKET_PATH=/run/uce/fastcgi.sock` for normal requests</li>
<li>`HTTP_PORT=8080` for `.ws.uce` websocket upgrades</li>
<li>`HTTP_PORT=8080` for `.uce` websocket upgrades</li>
<li>`scripts/systemd/manage-uce-service.sh` for build and service control</li>
<li>published root should be `site/`, not the repo root</li>
<li>published root should be `/var/www/html`, not the repo root</li>
</ul>
</div>
</div>
@@ -291,7 +291,7 @@ RENDER(Request& context)
</div>
<div class="link-grid">
<? render_link_card("../demo/index.uce", "Demo Area", "Open the published UCE demo pages for strings, forms, sessions, JSON, components, markdown, and runtime behavior.", "Try things"); ?>
<? render_link_card("../demo/websockets.ws.uce", "WebSocket Demo", "See the built-in broker model in a real page that renders HTML, upgrades the same route, and broadcasts chat events.", "Realtime"); ?>
<? render_link_card("../demo/websockets.ws.uce", "WebSocket Demo", "See the built-in broker model in a page that renders HTML, upgrades the same route, and broadcasts chat events.", "Realtime"); ?>
<? render_link_card("../doc/index.uce", "Reference Docs", "Browse the manual-style function and concept docs for the current runtime surface.", "Manual"); ?>
<? render_link_card("../doc/singlepage.uce", "Single-Page Docs", "Read the reference as one long page if you want the PHP-manual energy without the clicking.", "Reference"); ?>
<? render_link_card("../examples/uce-starter/index.uce", "UCE Starter", "Browse the larger example app built in UCE using components, themes, views, and richer page composition.", "Starter"); ?>
+1 -1
View File
@@ -548,7 +548,7 @@ howl.updateEffectsChain(); <span class="code-comment">// Apply changes</span>
<div class="api-section">
<h3>Frequency Analysis</h3>
<div class="api-description">
<strong>enableEQ(bands, callback, boost)</strong> - Enable real-time frequency analysis<br>
<strong>enableEQ(bands, callback, boost)</strong> - Enable live frequency analysis<br>
• bands: Number of frequency bands (default: 16)<br>
• callback: Function called with frequency data array<br>
• boost: Gain multiplier for visualization (default: 4.0)<br><br>
+1 -1
View File
@@ -25,7 +25,7 @@ RENDER(Request& context)
SQLite* db = sqlite_connect(db_path);
check("sqlite_connect()", db && db->connection != 0 && sqlite_error(db) == "connected", sqlite_error(db));
sqlite_query(db, "create table users(id integer primary key autoincrement, email text not null unique, visits integer not null, rating real not null)");
sqlite_query(db, "create table users(id integer primary key autoincrement, email text not null unique, visits integer not null, rating numeric not null)");
check("sqlite create table", sqlite_error(db) == "ok", sqlite_error(db));
sqlite_query(db, "create table dropped(id integer); insert into dropped values(1);");