getting closer to full port of web app starter
This commit is contained in:
@@ -7,12 +7,12 @@ RENDER(Request& context)
|
||||
<link rel="stylesheet" href='style.css'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
call_file()
|
||||
unit_call()
|
||||
</h1>
|
||||
<pre><?
|
||||
call_file("call_file_funcs.uce", "test_func");
|
||||
unit_call("call_file_funcs.uce", "test_func");
|
||||
print("\n");
|
||||
render_file("call_file_funcs.uce", context);
|
||||
unit_render("call_file_funcs.uce", context);
|
||||
?></pre>
|
||||
<pre><?= var_dump(context.params) ?></pre>
|
||||
</>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Minimal exported helper used by the `call_file()` demo page.
|
||||
// Minimal exported helper used by the `unit_call()` demo page.
|
||||
|
||||
EXPORT void test_func()
|
||||
EXPORT DTree* test_func(DTree* call_param)
|
||||
{
|
||||
print("HELLO FROM TEST FUNCTION");
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ RENDER(Request& context)
|
||||
<?: component("components/card", card_props, context) ?>
|
||||
</div>
|
||||
<h2>Named Component</h2>
|
||||
<? render_component("components/card:BODY", named_props, context); ?>
|
||||
<? component_render("components/card:BODY", named_props, context); ?>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ COMPONENT(Request& context)
|
||||
{
|
||||
<>
|
||||
<section style="border:1px solid #ccc;padding:1em;margin:1em 0;">
|
||||
<? render_component(":TITLE", context.call, context); ?>
|
||||
<? render_component(":BODY", context.call, context); ?>
|
||||
<? component_render(":TITLE", context.call, context); ?>
|
||||
<? component_render(":BODY", context.call, context); ?>
|
||||
</section>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ RENDER(Request& context)
|
||||
if(context.get["cmd"] == "clear")
|
||||
file_put_contents("/tmp/test.txt", "");
|
||||
|
||||
file_append("/tmp/test.txt", context.server->request_count, "\thello world\t", 2, "\t", time(), "\t", microtime(), "\n");
|
||||
file_append("/tmp/test.txt", context.server->request_count, "\thello world\t", 2, "\t", time(), "\t", time_precise(), "\n");
|
||||
|
||||
print(file_get_contents("/tmp/test.txt"));
|
||||
|
||||
|
||||
+68
-44
@@ -1,57 +1,81 @@
|
||||
|
||||
|
||||
void render_card(String url, String title, String desc)
|
||||
{
|
||||
<><a class="test-card" href="<?= url ?>">
|
||||
<strong><?= title ?></strong>
|
||||
<span><?= desc ?></span>
|
||||
</a></>
|
||||
}
|
||||
|
||||
RENDER(Request& context)
|
||||
{
|
||||
DTree p;
|
||||
p.set(context.params);
|
||||
|
||||
<>
|
||||
<><html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
|
||||
<link rel="stylesheet" href='style.css?v=<?= time() ?>'></link>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
Index
|
||||
<a href="index.uce">UCE Test Suite</a>
|
||||
<a class="docs-link" href="../doc/index.uce">API Docs →</a>
|
||||
</h1>
|
||||
<ul>
|
||||
<li><a href="../doc/index.uce">Help Docs</a></li>
|
||||
<li><a href="hello.uce">Hello</a></li>
|
||||
<li><a href="post.uce">Form Post</a></li>
|
||||
<li><a href="post-multipart.uce">Form Multipart Post</a></li>
|
||||
<li><a href="working-dir.uce">Working Directory</a></li>
|
||||
<li><a href="uri.uce">URI</a></li>
|
||||
<li><a href="cookie.uce">Cookies</a></li>
|
||||
<li><a href="session.uce">Session</a></li>
|
||||
<li><a href="str_replace.uce">String replace</a></li>
|
||||
<li><a href="dtree.uce">DTree</a></li>
|
||||
<li><a href="json.uce">JSON</a></li>
|
||||
<li><a href="memcached.uce">Memcached</a></li>
|
||||
<li><a href="mysql.uce">MySQL Connector</a></li>
|
||||
<li><a href="fileio.uce">File I/O</a></li>
|
||||
<li><a href="shell.uce">Shell</a></li>
|
||||
<li><a href="file_append.uce">File Append</a></li>
|
||||
<li><a href="random.uce">RNG/Noise</a></li>
|
||||
<li><a href="task.uce">Task</a></li>
|
||||
<li><a href="task_repeat.uce">Task repeat</a></li>
|
||||
<li><a href="utf8.uce">UTF-8</a></li>
|
||||
<li><a href="call_file.uce">call_file()</a></li>
|
||||
<li><a href="parse_time.uce">parse_time()</a></li>
|
||||
<li><a href="header.uce">header</a></li>
|
||||
<li><a href="components.uce">Components</a></li>
|
||||
<li><a href="markdown.uce">Markdown</a></li>
|
||||
<li><a href="error-reporting.uce">Error reporting</a></li>
|
||||
<li><a href="websockets.ws.uce">WebSockets</a></li>
|
||||
</ul>
|
||||
<pre><?
|
||||
print("Worker PID: ", my_pid, "\n");
|
||||
print("Parent PID: ", parent_pid, " \n");
|
||||
print("Output buffer size: ", context.ob->str().length(), " \n");
|
||||
print("Request #", context.server->request_count, "\n");
|
||||
?></pre>
|
||||
<pre><?= (var_dump(p)) ?></pre>
|
||||
<div><?
|
||||
print("Output buffer size: ", context.ob->str().length(), " \n");
|
||||
?></div>
|
||||
</>
|
||||
<div class="test-grid">
|
||||
<div class="grid-heading">Basics</div>
|
||||
<? render_card("hello.uce", "Hello World", "Basic output and server time"); ?>
|
||||
<? render_card("working-dir.uce", "Working Directory", "Server paths and cwd"); ?>
|
||||
<? render_card("header.uce", "Headers", "HTTP response headers"); ?>
|
||||
<? render_card("error-reporting.uce", "Error Reporting", "Error handling and output"); ?>
|
||||
|
||||
//context.flags.log_request = false;
|
||||
<div class="grid-heading">Data Types & Parsing</div>
|
||||
<? render_card("dtree.uce", "DTree", "Dynamic hierarchical data tree"); ?>
|
||||
<? render_card("json.uce", "JSON", "Parse and encode JSON data"); ?>
|
||||
<? render_card("string.uce", "String", "String operations"); ?>
|
||||
<? render_card("str_replace.uce", "String Replace", "Search and replace in strings"); ?>
|
||||
<? render_card("utf8.uce", "UTF-8", "Unicode string handling"); ?>
|
||||
<? render_card("random.uce", "RNG / Noise", "Random generation and noise"); ?>
|
||||
<? render_card("parse_time.uce", "time_parse()", "Date and time parsing"); ?>
|
||||
|
||||
<div class="grid-heading">HTTP & Forms</div>
|
||||
<? render_card("post.uce", "Form POST", "URL-encoded form submission"); ?>
|
||||
<? render_card("post-multipart.uce", "Multipart POST", "File upload and multipart forms"); ?>
|
||||
<? render_card("uri.uce", "URI", "URI encoding and decoding"); ?>
|
||||
<? render_card("cookie.uce", "Cookies", "Read and write browser cookies"); ?>
|
||||
<? render_card("session.uce", "Session", "Server-side session state"); ?>
|
||||
|
||||
<div class="grid-heading">Storage & I/O</div>
|
||||
<? render_card("fileio.uce", "File I/O", "Read and write files"); ?>
|
||||
<? render_card("file_append.uce", "File Append", "Append data to files"); ?>
|
||||
<? render_card("shell.uce", "Shell", "Execute shell commands"); ?>
|
||||
<? render_card("memcached.uce", "Memcached", "Memcached key-value store"); ?>
|
||||
<? render_card("mysql.uce", "MySQL", "MySQL database connector"); ?>
|
||||
|
||||
<div class="grid-heading">Advanced</div>
|
||||
<? render_card("call_file.uce", "unit_call()", "Dynamic file inclusion"); ?>
|
||||
<? render_card("components.uce", "Components", "Reusable component system"); ?>
|
||||
<? render_card("markdown.uce", "Markdown", "Markdown parsing with components"); ?>
|
||||
<? render_card("script.uce", "Script", "UCE script integration"); ?>
|
||||
<? render_card("task.uce", "Task", "Background task execution"); ?>
|
||||
<? render_card("task_repeat.uce", "Task Repeat", "Recurring task scheduling"); ?>
|
||||
<? render_card("websockets.ws.uce", "WebSockets", "Real-time WebSocket chat"); ?>
|
||||
</div>
|
||||
<div class="system-info">
|
||||
<h3>System Info</h3>
|
||||
<pre><?
|
||||
print("Worker PID: ", my_pid, "\n");
|
||||
print("Parent PID: ", parent_pid, "\n");
|
||||
print("Output buffer size: ", context.ob->str().length(), "\n");
|
||||
print("Request #", context.server->request_count, "\n");
|
||||
?></pre>
|
||||
</div>
|
||||
<details>
|
||||
<summary>Request Parameters</summary>
|
||||
<pre><?= (var_dump(p)) ?></pre>
|
||||
</details>
|
||||
</body>
|
||||
</html></>
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ RENDER(Request& context)
|
||||
<link rel="stylesheet" href='style.css'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
parse_time
|
||||
time_parse
|
||||
</h1>
|
||||
<form action="?" method="post">
|
||||
<div>
|
||||
@@ -21,7 +21,7 @@ RENDER(Request& context)
|
||||
</form>
|
||||
<pre><?
|
||||
|
||||
print(date("%Y-%m-%d %H:%M", parse_time(raw)));
|
||||
print(time_format_local("%Y-%m-%d %H:%M", time_parse(raw)));
|
||||
|
||||
?></pre>
|
||||
<pre><?= var_dump(context.params) ?></pre>
|
||||
|
||||
@@ -22,7 +22,7 @@ RENDER(Request& context)
|
||||
}
|
||||
else if(action == "store")
|
||||
{
|
||||
context.session["stored-value"] = make_session_id();
|
||||
context.session["stored-value"] = session_id_create();
|
||||
print("action: storing value "+context.session["stored-value"]);
|
||||
}
|
||||
else if(action == "destroy")
|
||||
|
||||
+346
-46
@@ -1,82 +1,382 @@
|
||||
/* UCE Test Suite — Theme
|
||||
Color palette: #139 deep-blue base · white text · yellow accents */
|
||||
|
||||
:root {
|
||||
--bg: #113399;
|
||||
--bg-surface: rgba(255, 255, 255, 0.065);
|
||||
--bg-surface-hover: rgba(255, 255, 255, 0.11);
|
||||
--bg-inset: rgba(0, 0, 0, 0.22);
|
||||
--bg-code: rgba(0, 0, 0, 0.28);
|
||||
--text: #e8ecf4;
|
||||
--text-dim: rgba(255, 255, 255, 0.55);
|
||||
--text-muted: rgba(255, 255, 255, 0.35);
|
||||
--accent: #ffd644;
|
||||
--accent-dim: rgba(255, 214, 68, 0.1);
|
||||
--accent-hover: #ffe680;
|
||||
--border: rgba(255, 255, 255, 0.08);
|
||||
--border-strong: rgba(255, 255, 255, 0.18);
|
||||
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
||||
--font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
||||
--radius: 8px;
|
||||
--radius-lg: 14px;
|
||||
--ease: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* ── Reset ── */
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
box-sizing: inherit;
|
||||
color: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
a {
|
||||
color: yellow;
|
||||
}
|
||||
/* ── Base ── */
|
||||
|
||||
h1 {
|
||||
font-size: 200%;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
font-family: monospace;
|
||||
html {
|
||||
font-size: 15px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 1024px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
font-family: Tahoma, Helvetica, Arial;
|
||||
font-size: 1.2em;
|
||||
box-sizing: border-box;
|
||||
background: #139;
|
||||
color: white;
|
||||
line-height: 150%;
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 0 24px 64px;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 1rem;
|
||||
line-height: 1.65;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
body > * {
|
||||
background: rgba(255,255,255,0.1);
|
||||
padding: 32px;
|
||||
margin: 16px;
|
||||
/* ── Typography ── */
|
||||
|
||||
h1 {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 1.6rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
padding: 28px 0 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
h1 a {
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
transition: color 150ms var(--ease);
|
||||
}
|
||||
|
||||
h1 a:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
margin: 24px 0 16px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--text-dim);
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
transition: color 150ms var(--ease);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--accent-hover);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ── Page sections ── */
|
||||
|
||||
body > section,
|
||||
body > div:not(.test-grid):not(.system-info):not(.grid-heading),
|
||||
body > p {
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 20px 24px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* ── Test Card Grid ── */
|
||||
|
||||
.test-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 10px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.test-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 16px 20px;
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
transition: all 150ms var(--ease);
|
||||
}
|
||||
|
||||
.test-card:hover {
|
||||
background: var(--bg-surface-hover);
|
||||
border-color: var(--border-strong);
|
||||
text-decoration: none;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.test-card strong {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.92rem;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.test-card span {
|
||||
font-size: 0.82rem;
|
||||
color: var(--text-dim);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.grid-heading {
|
||||
grid-column: 1 / -1;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
padding: 14px 0 2px;
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.grid-heading:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.docs-link {
|
||||
float: right;
|
||||
font-size: 0.55em;
|
||||
font-weight: 400;
|
||||
opacity: 0.5;
|
||||
transition: opacity 150ms var(--ease);
|
||||
}
|
||||
|
||||
.docs-link:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.dim {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
/* ── Forms ── */
|
||||
|
||||
form > div, label {
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
background: rgba(0,0,0,0.2);
|
||||
border: 2px solid rgba(255,255,255,0.2);
|
||||
label {
|
||||
font-size: 0.88rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
input[type=submit], button {
|
||||
padding: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input[type=submit]:hover, button:hover {
|
||||
color: yellow;
|
||||
background: rgba(0,0,0,0.5);
|
||||
input, textarea, select {
|
||||
background: var(--bg-inset);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 6px;
|
||||
color: var(--text);
|
||||
font-family: var(--font-sans);
|
||||
transition: border-color 150ms var(--ease), background 150ms var(--ease);
|
||||
}
|
||||
|
||||
input[type=text], textarea {
|
||||
padding: 8px;
|
||||
padding: 10px 14px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type=text]:hover, textarea:hover {
|
||||
background: rgba(0,0,0,0.25);
|
||||
input[type=text]:hover, textarea:hover,
|
||||
input[type=text]:focus, textarea:focus {
|
||||
border-color: var(--accent);
|
||||
outline: none;
|
||||
background: rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
input[type=submit], button {
|
||||
padding: 10px 20px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
background: var(--accent-dim);
|
||||
border: 1px solid rgba(255, 214, 68, 0.25);
|
||||
color: var(--accent);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
input[type=submit]:hover, button:hover {
|
||||
background: rgba(255, 214, 68, 0.2);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
textarea {
|
||||
height: 20%;
|
||||
min-height: 120px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/* ── Code / Output ── */
|
||||
|
||||
pre {
|
||||
height: 20%;
|
||||
padding: 16px 20px;
|
||||
overflow: auto;
|
||||
padding: 8px;
|
||||
border: 2px solid rgba(0,0,0,0.2);
|
||||
background: rgba(255,255,255,0.1);
|
||||
font-family: monospace;
|
||||
background: var(--bg-code);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.55;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.9em;
|
||||
padding: 2px 6px;
|
||||
background: var(--bg-inset);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
pre code {
|
||||
padding: 0;
|
||||
background: none;
|
||||
}
|
||||
|
||||
/* ── Lists ── */
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
li a {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
/* ── System Info ── */
|
||||
|
||||
.system-info {
|
||||
margin-top: 32px;
|
||||
padding: 16px 20px;
|
||||
background: var(--bg-code);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.system-info h3 {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.system-info pre {
|
||||
border: none;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
margin: 0;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
/* ── Details / Summary ── */
|
||||
|
||||
details {
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 14px 20px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
user-select: none;
|
||||
transition: color 150ms var(--ease);
|
||||
}
|
||||
|
||||
summary:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
details[open] summary {
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
details pre {
|
||||
border: none;
|
||||
border-radius: 0 0 var(--radius) var(--radius);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ── Sections (markdown, etc.) ── */
|
||||
|
||||
section {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
section h2 {
|
||||
border-bottom: none;
|
||||
margin: 0 0 12px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ── Scrollbar ── */
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
RENDER(Request& context)
|
||||
{
|
||||
print("Sub-Invoke Working dir: ", get_cwd(), "\n");
|
||||
print("Sub-Invoke Working dir: ", cwd_get(), "\n");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
RENDER(Request& context)
|
||||
{
|
||||
DTree payload;
|
||||
|
||||
if(context.get["compile"] != "")
|
||||
payload["compile_ok"].set_bool(unit_compile(context.get["compile"]));
|
||||
|
||||
payload["current"] = unit_info();
|
||||
|
||||
DTree units;
|
||||
units.set_array();
|
||||
for(auto& unit_path : units_list())
|
||||
{
|
||||
DTree item;
|
||||
item = unit_path;
|
||||
units.push(item);
|
||||
}
|
||||
payload["units"] = units;
|
||||
|
||||
context.header["Content-Type"] = "application/json; charset=utf-8";
|
||||
print(json_encode(payload));
|
||||
}
|
||||
@@ -16,7 +16,7 @@ DTree chat_event(Request& context, String type, String body)
|
||||
event["connection_id"] = ws_connection_id();
|
||||
event["scope"] = first(context.params["DOCUMENT_URI"], ws_scope());
|
||||
event["online"] = (f64)ws_connection_count();
|
||||
event["at"] = gmdate("%H:%M:%S");
|
||||
event["at"] = time_format_utc("%H:%M:%S");
|
||||
event["name"] = context.connection["name"].to_string();
|
||||
event["message_count"] = context.connection["message_count"];
|
||||
return(event);
|
||||
@@ -171,7 +171,7 @@ WS(Request& context)
|
||||
|
||||
if(type == "join")
|
||||
{
|
||||
context.connection["joined_at"] = gmdate("%Y-%m-%d %H:%M:%S");
|
||||
context.connection["joined_at"] = time_format_utc("%Y-%m-%d %H:%M:%S");
|
||||
context.connection["last_type"] = type;
|
||||
ws_send(json_encode(chat_event(context, "join", name + " joined the room")));
|
||||
return;
|
||||
|
||||
@@ -10,8 +10,8 @@ RENDER(Request& context)
|
||||
Working Directory
|
||||
</h1>
|
||||
<pre><?
|
||||
print("Base WD: " + get_cwd() + "\n");
|
||||
render_file("test2/working-dir-test.uce", context);
|
||||
print("Base WD: " + cwd_get() + "\n");
|
||||
unit_render("test2/working-dir-test.uce", context);
|
||||
?></pre>
|
||||
<pre><?= var_dump(context.params) ?></pre>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user