@webqit/webflo 0.8.58-0 → 0.8.60
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/package.json +3 -2
- package/src/runtime/_URL.js +1 -1
- package/src/runtime/client/Http.js +3 -2
- package/src/runtime/client/Runtime.js +2 -10
- package/src/runtime/client/Storage.js +1 -1
- package/src/runtime/client/Url.js +2 -1
- package/src/runtime/client/Worker.js +30 -8
- package/src/runtime/client/WorkerClient.js +1 -1
- package/src/runtime/server/Router.js +2 -2
- package/src/runtime/server/Runtime.js +1 -1
- package/vm +3 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"vanila-javascript"
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://webqit.io/tooling/webflo",
|
|
15
|
-
"version": "0.8.
|
|
15
|
+
"version": "0.8.60",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"@octokit/webhooks": "^7.15.1",
|
|
39
39
|
"@webqit/backpack": "^0.0.37",
|
|
40
40
|
"@webqit/browser-pie": "^0.0.16",
|
|
41
|
-
"@webqit/
|
|
41
|
+
"@webqit/observer": "^1.7.5",
|
|
42
|
+
"@webqit/pseudo-browser": "^1.0.0",
|
|
42
43
|
"@webqit/util": "^0.8.7",
|
|
43
44
|
"client-sessions": "^0.8.0",
|
|
44
45
|
"cookie": "^0.4.1",
|
package/src/runtime/_URL.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
|
-
import { Observer } from '@webqit/pseudo-browser/index2.js';
|
|
6
5
|
import _isArray from '@webqit/util/js/isArray.js';
|
|
7
6
|
import _isObject from '@webqit/util/js/isObject.js';
|
|
8
7
|
import { wwwFormUnserialize, wwwFormSerialize } from './util.js';
|
|
@@ -70,6 +69,7 @@ const _URL = NativeURL => {
|
|
|
70
69
|
|
|
71
70
|
constructor() {
|
|
72
71
|
super(...arguments);
|
|
72
|
+
const { Observer } = WebQit;
|
|
73
73
|
Observer.accessorize(this, [
|
|
74
74
|
'protocol',
|
|
75
75
|
'username',
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
|
-
import { Observer } from '@webqit/pseudo-browser/index2.js';
|
|
6
5
|
import _before from '@webqit/util/str/before.js';
|
|
7
6
|
import _after from '@webqit/util/str/after.js';
|
|
8
7
|
import _toTitle from '@webqit/util/str/toTitle.js';
|
|
9
8
|
import _arrFrom from '@webqit/util/arr/from.js';
|
|
10
9
|
import { wwwFormUnserialize, wwwFormSet, wwwFormSerialize } from '../util.js';
|
|
11
10
|
import StdRequest from './StdRequest.js';
|
|
11
|
+
import { Observer } from './Runtime.js';
|
|
12
12
|
import Url from './Url.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -16,7 +16,7 @@ import Url from './Url.js';
|
|
|
16
16
|
* The Client class
|
|
17
17
|
* ---------------------------
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
export default class Http {
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -208,6 +208,7 @@ export default class Http {
|
|
|
208
208
|
}
|
|
209
209
|
}, {diff: false /* method might be the difference */});
|
|
210
210
|
// Startup route
|
|
211
|
+
|
|
211
212
|
handleResponse(await client.call(instance, createRequest(window.document.location.href, document.referrer)));
|
|
212
213
|
|
|
213
214
|
return instance;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
|
-
import { OOHTML, Observer } from '@webqit/pseudo-browser/index2.js';
|
|
6
5
|
import _isObject from '@webqit/util/js/isObject.js';
|
|
7
6
|
import _before from '@webqit/util/str/before.js';
|
|
8
7
|
import _unique from '@webqit/util/arr/unique.js';
|
|
@@ -13,20 +12,13 @@ import Storage from './Storage.js';
|
|
|
13
12
|
import Router from './Router.js';
|
|
14
13
|
import Http from './Http.js';
|
|
15
14
|
|
|
16
|
-
/**
|
|
17
|
-
* ---------------------------
|
|
18
|
-
* OOHTML
|
|
19
|
-
* ---------------------------
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
OOHTML.call(window);
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* ---------------------------
|
|
26
17
|
* The Client Initializer
|
|
27
18
|
* ---------------------------
|
|
28
19
|
*/
|
|
29
20
|
|
|
21
|
+
export const { Observer } = window.WebQit;
|
|
30
22
|
export default function(layout, params) {
|
|
31
23
|
|
|
32
24
|
const session = Storage();
|
|
@@ -162,7 +154,7 @@ export default function(layout, params) {
|
|
|
162
154
|
window.scroll({top: 0, left: 0});
|
|
163
155
|
setTimeout(() => {
|
|
164
156
|
document.documentElement.classList.remove('scroll-reset');
|
|
165
|
-
},
|
|
157
|
+
}, 50);
|
|
166
158
|
}
|
|
167
159
|
}, 0);
|
|
168
160
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
|
-
import { Observer } from '@webqit/pseudo-browser/index2.js';
|
|
6
5
|
import _isArray from '@webqit/util/js/isArray.js';
|
|
7
6
|
import _isObject from '@webqit/util/js/isObject.js';
|
|
8
7
|
import _isTypeObject from '@webqit/util/js/isTypeObject.js';
|
|
@@ -10,12 +9,14 @@ import _isString from '@webqit/util/js/isString.js';
|
|
|
10
9
|
import _isEmpty from '@webqit/util/js/isEmpty.js';
|
|
11
10
|
import _with from '@webqit/util/obj/with.js';
|
|
12
11
|
import { wwwFormUnserialize, wwwFormSerialize } from '../util.js';
|
|
12
|
+
import { Observer } from './Runtime.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* ---------------------------
|
|
16
16
|
* The Url class
|
|
17
17
|
* ---------------------------
|
|
18
18
|
*/
|
|
19
|
+
|
|
19
20
|
export default class Url {
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Router from './Router.js';
|
|
6
6
|
import _isGlobe from 'is-glob';
|
|
7
7
|
import Minimatch from 'minimatch';
|
|
8
|
-
import
|
|
8
|
+
import Observer from '@webqit/observer';
|
|
9
9
|
import _isArray from '@webqit/util/js/isArray.js';
|
|
10
10
|
import _afterLast from '@webqit/util/str/afterLast.js';
|
|
11
11
|
import _after from '@webqit/util/str/after.js';
|
|
@@ -19,7 +19,7 @@ import NavigationEvent from './NavigationEvent.js';
|
|
|
19
19
|
* The Worker Initializer
|
|
20
20
|
* ---------------------------
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
export default function(layout, params) {
|
|
24
24
|
|
|
25
25
|
// Copy...
|
|
@@ -133,7 +133,7 @@ export default function(layout, params) {
|
|
|
133
133
|
// Thus the origin server would still not be contacted by the self.fetch() below, leading to inconsistencies in responses.
|
|
134
134
|
// So, we detect this scenerio and avoid it.
|
|
135
135
|
if (evt.request.mode === 'navigate' && evt.request.cache === 'force-cache' && evt.request.destination === 'document') {
|
|
136
|
-
return cache_fetch(evt, true
|
|
136
|
+
return cache_fetch(evt, false, true);
|
|
137
137
|
}
|
|
138
138
|
if (_any((params.cache_first_url_list || []).map(c => c.trim()).filter(c => c), pattern => Minimatch.Minimatch(evt.request.url, pattern))) {
|
|
139
139
|
return cache_fetch(evt, true/** cacheRefresh */);
|
|
@@ -144,23 +144,45 @@ export default function(layout, params) {
|
|
|
144
144
|
return network_fetch(evt);
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
+
//evt.request.mode navigate evt.request.cache force-cache evt.request.destination document request.headers.get('Accept') text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
|
|
148
|
+
//evt.request.mode navigate evt.request.cache force-cache evt.request.destination document request.headers.get('Accept') text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
|
|
149
|
+
|
|
147
150
|
const getCacheName = request => request.headers.get('Accept') === 'application/json'
|
|
148
151
|
? params.cache_name + '_json'
|
|
149
152
|
: params.cache_name;
|
|
150
153
|
|
|
151
154
|
// Caching strategy: cache_first
|
|
152
|
-
const cache_fetch = (evt, cacheRefresh = false) => {
|
|
155
|
+
const cache_fetch = (evt, cacheRefresh = false, is_Navigate_ForceCache_Document = false) => {
|
|
153
156
|
|
|
154
157
|
return self.caches.open(getCacheName(evt.request)).then(cache => {
|
|
155
158
|
return cache.match(evt.request).then(response => {
|
|
159
|
+
const force_network_fetch = evt => {
|
|
160
|
+
let request = evt.request;
|
|
161
|
+
if (is_Navigate_ForceCache_Document) {
|
|
162
|
+
let url = new URL(request.url);
|
|
163
|
+
url.searchParams.set('$force-cache', '1');
|
|
164
|
+
request = new Request(url, {
|
|
165
|
+
method: request.method,
|
|
166
|
+
headers: request.headers,
|
|
167
|
+
body: request.body,
|
|
168
|
+
mode: request.mode,
|
|
169
|
+
credentials: request.credentials,
|
|
170
|
+
cache: request.cache,
|
|
171
|
+
redirect: request.redirect,
|
|
172
|
+
referrer: request.referrer,
|
|
173
|
+
integrity: request.integrity,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return self.fetch(request);
|
|
177
|
+
}
|
|
156
178
|
if (response) {
|
|
157
179
|
if (cacheRefresh) {
|
|
158
180
|
// Fetch, but return this immediately
|
|
159
|
-
|
|
181
|
+
force_network_fetch(evt).then(response => refreshCache(evt.request, response));
|
|
160
182
|
}
|
|
161
183
|
return response;
|
|
162
184
|
}
|
|
163
|
-
return
|
|
185
|
+
return force_network_fetch(evt).then(response => refreshCache(evt.request, response));
|
|
164
186
|
});
|
|
165
187
|
});
|
|
166
188
|
|
|
@@ -201,6 +223,8 @@ export default function(layout, params) {
|
|
|
201
223
|
return response;
|
|
202
224
|
};
|
|
203
225
|
|
|
226
|
+
// -----------------------------
|
|
227
|
+
|
|
204
228
|
const relay = function(evt, messageData) {
|
|
205
229
|
return self.clients.matchAll().then(clientList => {
|
|
206
230
|
clientList.forEach(client => {
|
|
@@ -211,8 +235,6 @@ export default function(layout, params) {
|
|
|
211
235
|
});
|
|
212
236
|
});
|
|
213
237
|
};
|
|
214
|
-
|
|
215
|
-
// -----------------------------
|
|
216
238
|
|
|
217
239
|
self.addEventListener('message', evt => {
|
|
218
240
|
|
|
@@ -88,7 +88,7 @@ export default class Router extends _Router {
|
|
|
88
88
|
|
|
89
89
|
// if the file is found, set Content-type and send data
|
|
90
90
|
const type = Mime.lookup(ext);
|
|
91
|
-
resolve(new event.Response(data, {
|
|
91
|
+
resolve( new event.Response(data, {
|
|
92
92
|
headers: {
|
|
93
93
|
contentType: type === 'application/javascript' ? 'text/javascript' : type,
|
|
94
94
|
contentLength: Buffer.byteLength(data),
|
|
@@ -98,7 +98,7 @@ export default class Router extends _Router {
|
|
|
98
98
|
static: true,
|
|
99
99
|
autoIndex,
|
|
100
100
|
}
|
|
101
|
-
}));
|
|
101
|
+
} ) );
|
|
102
102
|
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -341,7 +341,7 @@ export async function run(instanceSetup, hostSetup, request, response, Ui, flags
|
|
|
341
341
|
$context.response = await router.route([httpMethodName === 'delete' ? 'del' : httpMethodName, 'default'], serverNavigationEvent, null, async function(event) {
|
|
342
342
|
var file = await router.fetch(event);
|
|
343
343
|
// JSON request should ignore static files
|
|
344
|
-
if (file && !event.request.headers.accept.match(file.headers.contentType)) {
|
|
344
|
+
if (file && event.request.headers.get('Accept') && !event.request.headers.accept.match(file.headers.contentType)) {
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
347
|
// ----------------
|
package/vm
CHANGED
|
@@ -53,4 +53,6 @@ sudo certbot run -a webroot -i apache -w /home/webqit_io/www/neatly.fit/public -
|
|
|
53
53
|
certbot certonly --manual --preferred-challenges http -d neatly.fit --manual-auth-hook certbot-http-auth-hook --manual-cleanup-hook certbot-http-cleanup-hook --debug-challenges
|
|
54
54
|
|
|
55
55
|
An unexpected error occurred:
|
|
56
|
-
There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
|
|
56
|
+
There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
|
|
57
|
+
|
|
58
|
+
sudo launchctl list | grep postgres
|