Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Dec 12, 2024
1 parent 779e309 commit f0dc45e
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 20 deletions.
17 changes: 11 additions & 6 deletions demo-web/src/InstallDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ import editorIcon from './icons/editor-icon-32.png';

navigator.serviceWorker.register(process.env.PUBLIC_URL + `/cgi-worker.js`);

setTimeout(() => {
if(!(navigator.serviceWorker && navigator.serviceWorker.controller))
{
window.location.reload()
}
}, 350);
const params = new URLSearchParams(window.location.search);

if(!params.has('no-service-worker'))
{
setTimeout(() => {
if(!(navigator.serviceWorker && navigator.serviceWorker.controller))
{
window.location.reload()
}
}, 350);
}

const sendMessage = sendMessageFor((`${window.location.origin}${process.env.PUBLIC_URL}/cgi-worker.mjs`))

Expand Down
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
6 changes: 3 additions & 3 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/php-wasm/static/css/main.9114cb59.css",
"main.js": "/php-wasm/static/js/main.8d0b254d.js",
"main.js": "/php-wasm/static/js/main.6e68d1a8.js",
"static/js/835.ba3f1ffc.chunk.js": "/php-wasm/static/js/835.ba3f1ffc.chunk.js",
"static/js/97.c6261c0f.chunk.js": "/php-wasm/static/js/97.c6261c0f.chunk.js",
"static/js/330.c76e5618.chunk.js": "/php-wasm/static/js/330.c76e5618.chunk.js",
Expand Down Expand Up @@ -503,12 +503,12 @@
"d.js": "/php-wasm/c98e74fc97b04fe8bf43dcdff549afcf.js",
"mode-text.js": "/php-wasm/0ffb18fb70c87335edee31a479f58a43.js",
"main.9114cb59.css.map": "/php-wasm/static/css/main.9114cb59.css.map",
"main.8d0b254d.js.map": "/php-wasm/static/js/main.8d0b254d.js.map",
"main.6e68d1a8.js.map": "/php-wasm/static/js/main.6e68d1a8.js.map",
"331.b658539f.chunk.js.map": "/php-wasm/static/js/331.b658539f.chunk.js.map",
"774.54b28235.chunk.js.map": "/php-wasm/static/js/774.54b28235.chunk.js.map"
},
"entrypoints": [
"static/css/main.9114cb59.css",
"static/js/main.8d0b254d.js"
"static/js/main.6e68d1a8.js"
]
}
2 changes: 1 addition & 1 deletion docs/code-editor.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
2 changes: 1 addition & 1 deletion docs/embedded-php.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
2 changes: 1 addition & 1 deletion docs/home.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
2 changes: 1 addition & 1 deletion docs/install-demo.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
2 changes: 1 addition & 1 deletion docs/select-framework.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.8d0b254d.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.6e68d1a8.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down

Large diffs are not rendered by default.

File renamed without changes.

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions docs/static/phpinfo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<html>
<body>
<script async type = "module" src = "https://cdn.jsdelivr.net/npm/php-wasm@0.0.9-alpha-20/php-tags.mjs"></script>
<script type = "text/php" data-stdout = "#output" data-stderr = "#error"
data-ini = '
allow_url_include = on
display_errors = off'
data-imports = '{
"https://cdn.jsdelivr.net/npm/@electric-sql/pglite/dist/index.js": ["PGlite"]
}'><?php
$pdo = new PDO('pgsql:');
$createTable = $pdo->prepare('
CREATE TABLE IF NOT EXISTS posts (
id SERIAL PRIMARY KEY,
userId INTEGER,
title TEXT,
body TEXT
)');

$createTable->execute();

$posts = json_decode(file_get_contents('https://jsonplaceholder.typicode.com/posts'));

$insertPost = $pdo->prepare('INSERT INTO posts (id, userId, title, body) VALUES (:id, :userId, :title, :body)');
foreach($posts as $post) {
$insertPost->execute((array)$post);
}

$selectPosts = $pdo->prepare('SELECT * FROM posts WHERE userId = ?');
$selectPosts->execute([ 4 ]);
$headers = false;

echo '<table id = "postgres">';
while ($row = $selectPosts->fetch(PDO::FETCH_ASSOC)) {
if (!$headers) {
echo '<tr>';
echo join('', array_map(fn($x) => "<th>$x</th>", array_keys($row)));
echo '</tr>';
$headers = true;
}
echo '<tr>';
echo join('', array_map(fn($x, $y) => "<td title = '$y'>$x</td>", $row, array_keys($row)));
echo '</tr>';
}
echo '</table>';

include "https://seanmorris.github.io/php-static-dev/phpinfo.php";
</script>

<h1>php-wasm & pglite in html</h1>
<p><a href = "https://github.com/seanmorris/php-wasm">https://github.com/seanmorris/php-wasm</a></p>
<pre id = "error"></pre>
<div id = "output"></div>
</body>
</html>

0 comments on commit f0dc45e

Please sign in to comment.