@webqit/webflo 0.11.61-0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +12 -0
- package/.github/workflows/publish.yml +48 -0
- package/.gitignore +9 -7
- package/LICENSE +21 -21
- package/README.md +100 -2074
- package/docker/Dockerfile +42 -42
- package/docker/README.md +91 -91
- package/docker/package.json +2 -2
- package/package.json +95 -81
- package/site/-/_.md +139 -0
- package/site/-/docs.old.md +2010 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url 2.js +93 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js 2.map +7 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
- package/site/.vitepress/cache/deps/_metadata 2.json +85 -0
- package/site/.vitepress/cache/deps/_metadata.json +85 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4 2.js +9 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK 2.js +9719 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7 2.js +12705 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape 2.js +30278 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent 2.js +4710 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js 2.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape.js +30278 -0
- package/site/.vitepress/cache/deps/cytoscape.js 2.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape.js.map +7 -0
- package/site/.vitepress/cache/deps/dayjs 2.js +285 -0
- package/site/.vitepress/cache/deps/dayjs.js +285 -0
- package/site/.vitepress/cache/deps/dayjs.js 2.map +7 -0
- package/site/.vitepress/cache/deps/dayjs.js.map +7 -0
- package/site/.vitepress/cache/deps/debug 2.js +453 -0
- package/site/.vitepress/cache/deps/debug.js +453 -0
- package/site/.vitepress/cache/deps/debug.js 2.map +7 -0
- package/site/.vitepress/cache/deps/debug.js.map +7 -0
- package/site/.vitepress/cache/deps/package 2.json +3 -0
- package/site/.vitepress/cache/deps/package.json +3 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api 2.js +4507 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core 2.js +584 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap 2.js +1166 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1166 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js 2.js +1667 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch 2.js +1815 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js +1815 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/site/.vitepress/cache/deps/vue 2.js +344 -0
- package/site/.vitepress/cache/deps/vue.js +344 -0
- package/site/.vitepress/cache/deps/vue.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vue.js.map +7 -0
- package/site/.vitepress/config.ts +147 -0
- package/site/.vitepress/theme/custom.css +50 -0
- package/site/.vitepress/theme/index.ts +6 -0
- package/site/api/webflo-fetch/FormData.md +0 -0
- package/site/api/webflo-fetch/Headers.md +0 -0
- package/site/api/webflo-fetch/LiveResponse.md +0 -0
- package/site/api/webflo-fetch/Request.md +0 -0
- package/site/api/webflo-fetch/Response.md +0 -0
- package/site/api/webflo-fetch/fetch.md +0 -0
- package/site/api/webflo-routing/HttpCookies.md +0 -0
- package/site/api/webflo-routing/HttpEvent/respondWith.md +1 -0
- package/site/api/webflo-routing/HttpEvent/waitUntil.md +1 -0
- package/site/api/webflo-routing/HttpEvent/waitUntilNavigate.md +1 -0
- package/site/api/webflo-routing/HttpEvent.md +30 -0
- package/site/api/webflo-routing/HttpSession.md +0 -0
- package/site/api/webflo-routing/HttpState.md +0 -0
- package/site/api/webflo-routing/HttpUser.md +0 -0
- package/site/api/webflo-routing/handler/fetch.md +42 -0
- package/site/api/webflo-routing/handler/next.md +54 -0
- package/site/api/webflo-routing/handler.md +119 -0
- package/site/api.md +26 -0
- package/site/contributing.md +16 -0
- package/site/docs/advanced/lifecycles.md +20 -0
- package/site/docs/advanced/redirects.md +0 -0
- package/site/docs/advanced/routing.md +1 -0
- package/site/docs/advanced.md +9 -0
- package/site/docs/concepts/realtime.md +637 -0
- package/site/docs/concepts/rendering.md +60 -0
- package/site/docs/concepts/request-response.md +47 -0
- package/site/docs/concepts/routing.md +656 -0
- package/site/docs/concepts/state.md +44 -0
- package/site/docs/concepts/templates.md +48 -0
- package/site/docs/concepts.md +97 -0
- package/site/docs/getting-started.md +378 -0
- package/site/docs/tech-stack.md +56 -0
- package/site/docs.md +100 -0
- package/site/examples/pwa.md +10 -0
- package/site/examples/web.md +11 -0
- package/site/examples.md +10 -0
- package/site/faq.md +13 -0
- package/site/guides/guide-auth.md +13 -0
- package/site/guides/guide-file-upload.md +11 -0
- package/site/guides/guide-service-worker.md +10 -0
- package/site/guides/tutorial-1-todo.md +24 -0
- package/site/guides.md +15 -0
- package/site/index.md +39 -0
- package/site/public/img/brand/logo-670x670.png +0 -0
- package/site/recipes/realtime.md +11 -0
- package/site/recipes/streaming.md +15 -0
- package/site/reference/cli.md +11 -0
- package/site/reference/config.md +13 -0
- package/site/reference/tools.md +9 -0
- package/src/Context.js +71 -79
- package/src/config-pi/deployment/Env.js +55 -68
- package/src/config-pi/deployment/Layout.js +71 -63
- package/src/config-pi/deployment/Origins.js +139 -139
- package/src/config-pi/deployment/Proxy.js +74 -74
- package/src/config-pi/deployment/index.js +17 -17
- package/src/config-pi/index.js +15 -15
- package/src/config-pi/runtime/Client.js +108 -98
- package/src/config-pi/runtime/Server.js +157 -125
- package/src/config-pi/runtime/client/Worker.js +111 -134
- package/src/config-pi/runtime/client/index.js +11 -11
- package/src/config-pi/runtime/index.js +17 -17
- package/src/config-pi/runtime/server/Headers.js +74 -74
- package/src/config-pi/runtime/server/Redirects.js +69 -69
- package/src/config-pi/runtime/server/index.js +13 -13
- package/src/config-pi/static/Init.js +57 -0
- package/src/config-pi/static/Manifest.js +319 -319
- package/src/config-pi/static/Ssg.js +49 -49
- package/src/config-pi/static/index.js +15 -13
- package/src/deployment-pi/index.js +10 -10
- package/src/deployment-pi/origins/index.js +216 -216
- package/src/deployment-pi/util.js +161 -0
- package/src/index.js +13 -19
- package/src/init-pi/index.js +117 -0
- package/src/init-pi/templates/pwa/app/handler.server.js +8 -0
- package/src/init-pi/templates/pwa/app/page.html +7 -0
- package/src/init-pi/templates/pwa/package.json +19 -0
- package/src/init-pi/templates/pwa/public/assets/app.css +16 -0
- package/src/init-pi/templates/pwa/public/index.html +39 -0
- package/src/init-pi/templates/pwa/public/manifest.json +29 -0
- package/src/init-pi/templates/web/app/handler.server.js +8 -0
- package/src/init-pi/templates/web/app/page.html +7 -0
- package/src/init-pi/templates/web/package.json +19 -0
- package/src/init-pi/templates/web/public/assets/app.css +16 -0
- package/src/init-pi/templates/web/public/index.html +39 -0
- package/src/runtime-pi/WebfloRuntime.js +350 -0
- package/src/runtime-pi/index.js +6 -13
- package/src/runtime-pi/webflo-client/ClientSideCookies.js +17 -0
- package/src/runtime-pi/webflo-client/ClientSideWorkport.js +63 -0
- package/src/runtime-pi/webflo-client/DeviceCapabilities.js +213 -0
- package/src/runtime-pi/webflo-client/WebfloClient.js +500 -0
- package/src/runtime-pi/webflo-client/WebfloRootClient1.js +206 -0
- package/src/runtime-pi/webflo-client/WebfloRootClient2.js +113 -0
- package/src/runtime-pi/webflo-client/WebfloSubClient.js +118 -0
- package/src/runtime-pi/webflo-client/index.js +17 -0
- package/src/runtime-pi/webflo-client/webflo-codegen.js +469 -0
- package/src/runtime-pi/webflo-client/webflo-devmode.js +243 -0
- package/src/runtime-pi/webflo-client/webflo-embedded.js +50 -0
- package/src/runtime-pi/webflo-fetch/LiveResponse.js +437 -0
- package/src/runtime-pi/webflo-fetch/cookies.js +10 -0
- package/src/runtime-pi/webflo-fetch/fetch.js +16 -0
- package/src/runtime-pi/webflo-fetch/formdata.js +54 -0
- package/src/runtime-pi/webflo-fetch/headers.js +151 -0
- package/src/runtime-pi/webflo-fetch/index.js +5 -0
- package/src/runtime-pi/webflo-fetch/message.js +49 -0
- package/src/runtime-pi/webflo-fetch/request.js +62 -0
- package/src/runtime-pi/webflo-fetch/response.js +110 -0
- package/src/runtime-pi/webflo-fetch/util.js +28 -0
- package/src/runtime-pi/webflo-messaging/WQBroadcastChannel.js +10 -0
- package/src/runtime-pi/webflo-messaging/WQMessageChannel.js +26 -0
- package/src/runtime-pi/webflo-messaging/WQMessageEvent.js +87 -0
- package/src/runtime-pi/webflo-messaging/WQMessagePort.js +38 -0
- package/src/runtime-pi/webflo-messaging/WQRelayPort.js +47 -0
- package/src/runtime-pi/webflo-messaging/WQSockPort.js +113 -0
- package/src/runtime-pi/webflo-messaging/WQStarPort.js +104 -0
- package/src/runtime-pi/webflo-messaging/wq-message-port.js +404 -0
- package/src/runtime-pi/webflo-routing/HttpCookies.js +42 -0
- package/src/runtime-pi/webflo-routing/HttpEvent.js +112 -0
- package/src/runtime-pi/webflo-routing/HttpSession.js +11 -0
- package/src/runtime-pi/webflo-routing/HttpState.js +153 -0
- package/src/runtime-pi/webflo-routing/HttpUser.js +54 -0
- package/src/runtime-pi/webflo-routing/WebfloRouter.js +245 -0
- package/src/runtime-pi/webflo-server/ServerSideCookies.js +19 -0
- package/src/runtime-pi/webflo-server/ServerSideSession.js +38 -0
- package/src/runtime-pi/webflo-server/WebfloServer.js +937 -0
- package/src/runtime-pi/webflo-server/index.js +11 -0
- package/src/runtime-pi/webflo-server/messaging/Client.js +27 -0
- package/src/runtime-pi/webflo-server/messaging/ClientRequestRealtime.js +50 -0
- package/src/runtime-pi/webflo-server/messaging/Clients.js +25 -0
- package/src/runtime-pi/webflo-server/webflo-devmode.js +326 -0
- package/src/runtime-pi/{client → webflo-url}/Url.js +155 -205
- package/src/runtime-pi/webflo-url/index.js +1 -0
- package/src/runtime-pi/webflo-url/urlpattern.js +38 -0
- package/src/runtime-pi/{util-url.js → webflo-url/util.js} +109 -147
- package/src/runtime-pi/webflo-url/xURL.js +94 -0
- package/src/runtime-pi/webflo-worker/WebfloWorker.js +234 -0
- package/src/runtime-pi/webflo-worker/WorkerSideCookies.js +19 -0
- package/src/runtime-pi/webflo-worker/WorkerSideWorkport.js +18 -0
- package/src/runtime-pi/webflo-worker/index.js +11 -0
- package/src/services-pi/cert/http-auth-hook.js +22 -22
- package/src/services-pi/cert/http-cleanup-hook.js +22 -22
- package/src/services-pi/cert/index.js +79 -79
- package/src/services-pi/index.js +10 -8
- package/src/services-pi/push/index.js +23 -0
- package/src/util.js +10 -0
- package/src/{webflo.js → webflo-cli.js} +30 -30
- package/test/index.test.js +26 -26
- package/test/site/package.json +9 -9
- package/test/site/public/bundle.html +5 -5
- package/test/site/public/bundle.html.json +3 -3
- package/test/site/public/bundle.js +2 -2
- package/test/site/public/bundle.webflo.js +15 -15
- package/test/site/public/index.html +29 -29
- package/test/site/public/index1.html +34 -34
- package/test/site/public/page-2/bundle.html +4 -4
- package/test/site/public/page-2/bundle.js +2 -2
- package/test/site/public/page-2/index.html +45 -45
- package/test/site/public/page-2/main.html +2 -2
- package/test/site/public/page-4/subpage/bundle.js +2 -2
- package/test/site/public/page-4/subpage/index.html +30 -30
- package/test/site/public/sparoots.json +4 -4
- package/test/site/public/worker.js +3 -3
- package/test/site/server/index.js +15 -15
- package/src/runtime-pi/Application.js +0 -29
- package/src/runtime-pi/Cookies.js +0 -82
- package/src/runtime-pi/HttpEvent.js +0 -107
- package/src/runtime-pi/Router.js +0 -130
- package/src/runtime-pi/Runtime.js +0 -21
- package/src/runtime-pi/client/Application.js +0 -100
- package/src/runtime-pi/client/Context.js +0 -7
- package/src/runtime-pi/client/Router.js +0 -48
- package/src/runtime-pi/client/Runtime.js +0 -332
- package/src/runtime-pi/client/Workport.js +0 -178
- package/src/runtime-pi/client/createStorage.js +0 -57
- package/src/runtime-pi/client/generate.js +0 -472
- package/src/runtime-pi/client/index.js +0 -21
- package/src/runtime-pi/client/oohtml/full.js +0 -7
- package/src/runtime-pi/client/oohtml/namespacing.js +0 -7
- package/src/runtime-pi/client/oohtml/scripting.js +0 -8
- package/src/runtime-pi/client/oohtml/templating.js +0 -8
- package/src/runtime-pi/client/worker/Application.js +0 -44
- package/src/runtime-pi/client/worker/Context.js +0 -7
- package/src/runtime-pi/client/worker/Runtime.js +0 -269
- package/src/runtime-pi/client/worker/Workport.js +0 -86
- package/src/runtime-pi/client/worker/index.js +0 -21
- package/src/runtime-pi/server/Application.js +0 -116
- package/src/runtime-pi/server/Context.js +0 -16
- package/src/runtime-pi/server/Router.js +0 -159
- package/src/runtime-pi/server/Runtime.js +0 -557
- package/src/runtime-pi/server/index.js +0 -21
- package/src/runtime-pi/util-http.js +0 -86
- package/src/runtime-pi/xFormData.js +0 -24
- package/src/runtime-pi/xHeaders.js +0 -146
- package/src/runtime-pi/xRequest.js +0 -46
- package/src/runtime-pi/xRequestHeaders.js +0 -109
- package/src/runtime-pi/xResponse.js +0 -33
- package/src/runtime-pi/xResponseHeaders.js +0 -117
- package/src/runtime-pi/xURL.js +0 -105
- package/src/runtime-pi/xfetch.js +0 -23
- package/src/runtime-pi/xxHttpMessage.js +0 -102
- package/src/static-pi/index.js +0 -11
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* imports
|
|
5
|
-
*/
|
|
6
|
-
import Fs from 'fs';
|
|
7
|
-
import Path from 'path';
|
|
8
|
-
import Layout from '../../config-pi/deployment/Layout.js';
|
|
9
|
-
|
|
10
|
-
// ------------------------------------------
|
|
11
|
-
|
|
12
|
-
const domain = process.env.CERTBOT_DOMAIN,
|
|
13
|
-
validation = process.env.CERTBOT_VALIDATION,
|
|
14
|
-
token = process.env.CERTBOT_TOKEN,
|
|
15
|
-
remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
|
|
16
|
-
allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
|
|
17
|
-
;
|
|
18
|
-
(async function() {
|
|
19
|
-
const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
|
|
20
|
-
const acmeDir = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/');
|
|
21
|
-
Fs.mkdirSync(acmeDir, {recursive:true});
|
|
22
|
-
Fs.writeFileSync(Path.join(acmeDir, token), validation);
|
|
23
|
-
})();
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* imports
|
|
5
|
+
*/
|
|
6
|
+
import Fs from 'fs';
|
|
7
|
+
import Path from 'path';
|
|
8
|
+
import Layout from '../../config-pi/deployment/Layout.js';
|
|
9
|
+
|
|
10
|
+
// ------------------------------------------
|
|
11
|
+
|
|
12
|
+
const domain = process.env.CERTBOT_DOMAIN,
|
|
13
|
+
validation = process.env.CERTBOT_VALIDATION,
|
|
14
|
+
token = process.env.CERTBOT_TOKEN,
|
|
15
|
+
remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
|
|
16
|
+
allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
|
|
17
|
+
;
|
|
18
|
+
(async function() {
|
|
19
|
+
const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
|
|
20
|
+
const acmeDir = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/');
|
|
21
|
+
Fs.mkdirSync(acmeDir, {recursive:true});
|
|
22
|
+
Fs.writeFileSync(Path.join(acmeDir, token), validation);
|
|
23
|
+
})();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* imports
|
|
5
|
-
*/
|
|
6
|
-
import Fs from 'fs';
|
|
7
|
-
import Path from 'path';
|
|
8
|
-
import Layout from '../../config-pi/deployment/Layout.js';
|
|
9
|
-
|
|
10
|
-
// ------------------------------------------
|
|
11
|
-
|
|
12
|
-
const domain = process.env.CERTBOT_DOMAIN,
|
|
13
|
-
validation = process.env.CERTBOT_VALIDATION,
|
|
14
|
-
token = process.env.CERTBOT_TOKEN,
|
|
15
|
-
authOutput = process.env.CERTBOT_AUTH_OUTPUT,
|
|
16
|
-
remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
|
|
17
|
-
allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
|
|
18
|
-
;
|
|
19
|
-
(async function() {
|
|
20
|
-
const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
|
|
21
|
-
const acmeFile = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/', token);
|
|
22
|
-
Fs.unlinkSync(acmeFile);
|
|
23
|
-
})();
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* imports
|
|
5
|
+
*/
|
|
6
|
+
import Fs from 'fs';
|
|
7
|
+
import Path from 'path';
|
|
8
|
+
import Layout from '../../config-pi/deployment/Layout.js';
|
|
9
|
+
|
|
10
|
+
// ------------------------------------------
|
|
11
|
+
|
|
12
|
+
const domain = process.env.CERTBOT_DOMAIN,
|
|
13
|
+
validation = process.env.CERTBOT_VALIDATION,
|
|
14
|
+
token = process.env.CERTBOT_TOKEN,
|
|
15
|
+
authOutput = process.env.CERTBOT_AUTH_OUTPUT,
|
|
16
|
+
remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
|
|
17
|
+
allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
|
|
18
|
+
;
|
|
19
|
+
(async function() {
|
|
20
|
+
const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
|
|
21
|
+
const acmeFile = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/', token);
|
|
22
|
+
Fs.unlinkSync(acmeFile);
|
|
23
|
+
})();
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import Fs from 'fs';
|
|
6
|
-
import { spawn } from 'child_process';
|
|
7
|
-
import { _from as _arrFrom } from '@webqit/util/arr/index.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @description
|
|
11
|
-
*/
|
|
12
|
-
export const desc = {
|
|
13
|
-
generate: 'Generate an SSL cert for a domain or list of domains.',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Reads SSL from file.
|
|
18
|
-
*
|
|
19
|
-
* @param string allDomains
|
|
20
|
-
*
|
|
21
|
-
* @return object
|
|
22
|
-
*/
|
|
23
|
-
export async function generate(allDomains) {
|
|
24
|
-
const cx = this || {};
|
|
25
|
-
if (!cx.config.runtime?.Server) {
|
|
26
|
-
throw new Error(`The Server configurator "config.runtime.Server" is required in context.`);
|
|
27
|
-
}
|
|
28
|
-
const domains = _arrFrom(allDomains).reduce((all, d) => all.concat(d.split(',')), []).filter(d => d.trim());
|
|
29
|
-
const args = [
|
|
30
|
-
'certonly',
|
|
31
|
-
'--manual',
|
|
32
|
-
'--preferred-challenges', 'http',
|
|
33
|
-
].concat(domains.reduce((all, d) => all.concat('-d', d), []))
|
|
34
|
-
.concat([
|
|
35
|
-
'--manual-auth-hook', 'webflo-certbot-http-auth-hook',
|
|
36
|
-
'--manual-cleanup-hook', 'webflo-certbot-http-cleanup-hook',
|
|
37
|
-
'--debug-challenges',
|
|
38
|
-
'--force-interactive',
|
|
39
|
-
]);
|
|
40
|
-
const child = spawn('certbot', args);
|
|
41
|
-
process.stdin.pipe(child.stdin);
|
|
42
|
-
|
|
43
|
-
child.stdout.on('data', data => {
|
|
44
|
-
if (cx.logger) {
|
|
45
|
-
cx.logger.log('[' + cx.logger.style.keyword('CERTBOT') + '][' + cx.logger.style.var('OUT') + ']:', data + '');
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
child.stderr.on('data', data => {
|
|
50
|
-
if (cx.logger) {
|
|
51
|
-
cx.logger.log('[' + cx.logger.style.keyword('CERTBOT') + '][' + cx.logger.style.err('ERR') + ']:', (data + '').trim());
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
child.on('error', data => {
|
|
56
|
-
cx.logger && cx.logger.error(data);
|
|
57
|
-
process.exit();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
child.on('exit', async exitCode => {
|
|
61
|
-
const serverConfig = new cx.config.runtime.Server(cx);
|
|
62
|
-
const server = await serverConfig.read();
|
|
63
|
-
const domain = domains[0], certDir = `/etc/letsencrypt/live/${domain}`;
|
|
64
|
-
if (!exitCode && cx.flags && (cx.flags['auto-config'] || cx.flags.c)) {
|
|
65
|
-
if (Fs.existsSync(certDir)) {
|
|
66
|
-
cx.logger && cx.logger.log('Automatically configuring the server with the generated cert.');
|
|
67
|
-
if (!server.https) {
|
|
68
|
-
server.https = {};
|
|
69
|
-
}
|
|
70
|
-
server.https.keyfile = `${certDir}/privkey.pem`;
|
|
71
|
-
server.https.certfile = `${certDir}/fullchain.pem`;
|
|
72
|
-
await serverConfig.write(server);
|
|
73
|
-
} else {
|
|
74
|
-
cx.logger && cx.logger.log(`Generated cert files not found in ${certDir}; be sure to configure the server with the valid cert files.`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
process.exit();
|
|
78
|
-
});
|
|
79
|
-
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* imports
|
|
4
|
+
*/
|
|
5
|
+
import Fs from 'fs';
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import { _from as _arrFrom } from '@webqit/util/arr/index.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
*/
|
|
12
|
+
export const desc = {
|
|
13
|
+
generate: 'Generate an SSL cert for a domain or list of domains.',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Reads SSL from file.
|
|
18
|
+
*
|
|
19
|
+
* @param string allDomains
|
|
20
|
+
*
|
|
21
|
+
* @return object
|
|
22
|
+
*/
|
|
23
|
+
export async function generate(allDomains) {
|
|
24
|
+
const cx = this || {};
|
|
25
|
+
if (!cx.config.runtime?.Server) {
|
|
26
|
+
throw new Error(`The Server configurator "config.runtime.Server" is required in context.`);
|
|
27
|
+
}
|
|
28
|
+
const domains = _arrFrom(allDomains).reduce((all, d) => all.concat(d.split(',')), []).filter(d => d.trim());
|
|
29
|
+
const args = [
|
|
30
|
+
'certonly',
|
|
31
|
+
'--manual',
|
|
32
|
+
'--preferred-challenges', 'http',
|
|
33
|
+
].concat(domains.reduce((all, d) => all.concat('-d', d), []))
|
|
34
|
+
.concat([
|
|
35
|
+
'--manual-auth-hook', 'webflo-certbot-http-auth-hook',
|
|
36
|
+
'--manual-cleanup-hook', 'webflo-certbot-http-cleanup-hook',
|
|
37
|
+
'--debug-challenges',
|
|
38
|
+
'--force-interactive',
|
|
39
|
+
]);
|
|
40
|
+
const child = spawn('certbot', args);
|
|
41
|
+
process.stdin.pipe(child.stdin);
|
|
42
|
+
|
|
43
|
+
child.stdout.on('data', data => {
|
|
44
|
+
if (cx.logger) {
|
|
45
|
+
cx.logger.log('[' + cx.logger.style.keyword('CERTBOT') + '][' + cx.logger.style.var('OUT') + ']:', data + '');
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
child.stderr.on('data', data => {
|
|
50
|
+
if (cx.logger) {
|
|
51
|
+
cx.logger.log('[' + cx.logger.style.keyword('CERTBOT') + '][' + cx.logger.style.err('ERR') + ']:', (data + '').trim());
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
child.on('error', data => {
|
|
56
|
+
cx.logger && cx.logger.error(data);
|
|
57
|
+
process.exit();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
child.on('exit', async exitCode => {
|
|
61
|
+
const serverConfig = new cx.config.runtime.Server(cx);
|
|
62
|
+
const server = await serverConfig.read();
|
|
63
|
+
const domain = domains[0], certDir = `/etc/letsencrypt/live/${domain}`;
|
|
64
|
+
if (!exitCode && cx.flags && (cx.flags['auto-config'] || cx.flags.c)) {
|
|
65
|
+
if (Fs.existsSync(certDir)) {
|
|
66
|
+
cx.logger && cx.logger.log('Automatically configuring the server with the generated cert.');
|
|
67
|
+
if (!server.https) {
|
|
68
|
+
server.https = {};
|
|
69
|
+
}
|
|
70
|
+
server.https.keyfile = `${certDir}/privkey.pem`;
|
|
71
|
+
server.https.certfile = `${certDir}/fullchain.pem`;
|
|
72
|
+
await serverConfig.write(server);
|
|
73
|
+
} else {
|
|
74
|
+
cx.logger && cx.logger.log(`Generated cert files not found in ${certDir}; be sure to configure the server with the valid cert files.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
process.exit();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
80
|
}
|
package/src/services-pi/index.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* imports
|
|
4
|
+
*/
|
|
5
|
+
import webpush from 'web-push';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description
|
|
9
|
+
*/
|
|
10
|
+
export const desc = {
|
|
11
|
+
generate: 'Generate a set of VAPID keys for push notifications.',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Reads SSL from file.
|
|
16
|
+
*
|
|
17
|
+
* @return object
|
|
18
|
+
*/
|
|
19
|
+
export async function generate() {
|
|
20
|
+
const cx = this || {};
|
|
21
|
+
const vapidKeys = webpush.generateVAPIDKeys();
|
|
22
|
+
cx.logger.log(vapidKeys);
|
|
23
|
+
}
|
package/src/util.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { _wq as __wq } from '@webqit/util/js/index.js';
|
|
2
|
+
|
|
3
|
+
export const _wq = (target, ...args) => __wq(target, 'webflo', ...args);
|
|
4
|
+
|
|
5
|
+
export const _await = (value, callback) => {
|
|
6
|
+
if (value instanceof Promise) {
|
|
7
|
+
return value.then(callback);
|
|
8
|
+
}
|
|
9
|
+
return callback(value);
|
|
10
|
+
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @imports
|
|
5
|
-
*/
|
|
6
|
-
import Url from 'url';
|
|
7
|
-
import Path from 'path';
|
|
8
|
-
import { jsonFile } from '@webqit/backpack/src/dotfile/index.js';
|
|
9
|
-
import { Logger, Cli } from '@webqit/backpack';
|
|
10
|
-
import * as WebfloPI from './index.js';
|
|
11
|
-
|
|
12
|
-
const dirSelf = Path.dirname(Url.fileURLToPath(import.meta.url));
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @cx
|
|
18
|
-
*/
|
|
19
|
-
const cx = WebfloPI.Context.create({
|
|
20
|
-
meta: { title:
|
|
21
|
-
|
|
22
|
-
logger: Logger,
|
|
23
|
-
config: WebfloPI.config,
|
|
24
|
-
middlewares: [ WebfloPI.deployment.origins.webhook ],
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @cli
|
|
29
|
-
*/
|
|
30
|
-
const cli = new Cli(WebfloPI);
|
|
31
|
-
await cli.exec(cx);
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @imports
|
|
5
|
+
*/
|
|
6
|
+
import Url from 'url';
|
|
7
|
+
import Path from 'path';
|
|
8
|
+
import { jsonFile } from '@webqit/backpack/src/dotfile/index.js';
|
|
9
|
+
import { Logger, Cli } from '@webqit/backpack';
|
|
10
|
+
import * as WebfloPI from './index.js';
|
|
11
|
+
|
|
12
|
+
const dirSelf = Path.dirname(Url.fileURLToPath(import.meta.url));
|
|
13
|
+
const webfloMeta = jsonFile.read(Path.join(dirSelf, '../package.json'));
|
|
14
|
+
const appMeta = jsonFile.read('./package.json');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @cx
|
|
18
|
+
*/
|
|
19
|
+
const cx = WebfloPI.Context.create({
|
|
20
|
+
meta: { title: webfloMeta.title, version: webfloMeta.version },
|
|
21
|
+
appMeta: { ...appMeta },
|
|
22
|
+
logger: Logger,
|
|
23
|
+
config: WebfloPI.config,
|
|
24
|
+
middlewares: [ WebfloPI.deployment.origins.webhook ],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @cli
|
|
29
|
+
*/
|
|
30
|
+
const cli = new Cli(WebfloPI);
|
|
31
|
+
await cli.exec(cx);
|
package/test/index.test.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @imports
|
|
4
|
-
*/
|
|
5
|
-
import { config, runtime, Context } from '../src/index.js';
|
|
6
|
-
|
|
7
|
-
let client = {
|
|
8
|
-
handle: function( httpEvent ) {
|
|
9
|
-
return new httpEvent.Response({ abcd: '1234' }, {
|
|
10
|
-
status: 302,
|
|
11
|
-
headers: {
|
|
12
|
-
//location: '/dddd',
|
|
13
|
-
cookies: {
|
|
14
|
-
cookie1: { value: 'value1' },
|
|
15
|
-
cookie2: { value: 'value2' },
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const cx = Context.create( { config: config, } );
|
|
23
|
-
const clientCallback = ( _cx, hostName, defaultClientCallback ) => client;
|
|
24
|
-
const app = await runtime.server.start.call( cx, clientCallback );
|
|
25
|
-
|
|
26
|
-
const response = await app.go( 'http://localhost/', { headers: { range: 'bytes=0-5, 6' } } );
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @imports
|
|
4
|
+
*/
|
|
5
|
+
import { config, runtime, Context } from '../src/index.js';
|
|
6
|
+
|
|
7
|
+
let client = {
|
|
8
|
+
handle: function( httpEvent ) {
|
|
9
|
+
return new httpEvent.Response({ abcd: '1234' }, {
|
|
10
|
+
status: 302,
|
|
11
|
+
headers: {
|
|
12
|
+
//location: '/dddd',
|
|
13
|
+
cookies: {
|
|
14
|
+
cookie1: { value: 'value1' },
|
|
15
|
+
cookie2: { value: 'value2' },
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const cx = Context.create( { config: config, } );
|
|
23
|
+
const clientCallback = ( _cx, hostName, defaultClientCallback ) => client;
|
|
24
|
+
const app = await runtime.server.start.call( cx, clientCallback );
|
|
25
|
+
|
|
26
|
+
const response = await app.go( 'http://localhost/', { headers: { range: 'bytes=0-5, 6' } } );
|
package/test/site/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "Webflo Test",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"generate": "webflo generate::client --recursive --compression --auto-embed",
|
|
6
|
-
"bundle": "cd public && oohtml bundle --recursive --auto-embed=routes",
|
|
7
|
-
"build": "npm run generate && npm run bundle"
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"title": "Webflo Test",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"generate": "webflo generate::client --recursive --compression --auto-embed",
|
|
6
|
+
"bundle": "cd public && oohtml bundle --recursive --auto-embed=routes",
|
|
7
|
+
"build": "npm run generate && npm run bundle"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
<template
|
|
3
|
-
<img src="/
|
|
4
|
-
</template>
|
|
5
|
-
<template
|
|
1
|
+
|
|
2
|
+
<template def="page-3">
|
|
3
|
+
<img src="/logo-130x130.png" def="logo-130x130.png" />
|
|
4
|
+
</template>
|
|
5
|
+
<template def="page-4">
|
|
6
6
|
</template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"page-3": {},
|
|
3
|
-
"page-4": {}
|
|
1
|
+
{
|
|
2
|
+
"page-3": {},
|
|
3
|
+
"page-4": {}
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** @webqit/webflo */
|
|
2
|
-
var{start:e}=WebQit.Webflo,r={},o={bundle_filename:"bundle.js",public_base_url:"/",spa_routing:!0,oohtml_support:"full",service_worker_support:!0,worker_scope:"/",worker_filename:"worker.js",routing:{root:"/",subroots:["/page-2","/page-4/subpage"],targets:2}};e.call({layout:r,params:o});
|
|
1
|
+
/** @webqit/webflo */
|
|
2
|
+
var{start:e}=WebQit.Webflo,r={},o={bundle_filename:"bundle.js",public_base_url:"/",spa_routing:!0,oohtml_support:"full",service_worker_support:!0,worker_scope:"/",worker_filename:"worker.js",routing:{root:"/",subroots:["/page-2","/page-4/subpage"],targets:2}};e.call({layout:r,params:o});
|