Commit 172d416c authored by Roque's avatar Roque

erp5_officejs_appstore_base: appstore service worker

parent eed0e738
<!DOCTYPE html> <!DOCTYPE html>
<html manifest="WebSection_renderOfficeJSRedirectAppCache"> <html manifest="WebSection_renderOfficeJSRedirectAppCache">
<body> <head>
<script language="JavaScript"> <meta charset="utf-8">
function redirect_version() { <meta name="viewport" content="width=device-width, initial-scale=1">
document.location.replace("${latest_version}/" + document.location.hash) <script src="rsvp.js"></script>
}; <script src="renderjs.js"></script>
<script src="officejs-redirect.js"></script>
<title>OfficeJS Redirect</title>
<script data-appconfig="latest_version" type="text/x-renderjs-configuration">${latest_version}</script>
</head>
var timeout_duration = 10000; <body>
try {
window.applicationCache.addEventListener('cached',redirect_version);
window.applicationCache.addEventListener('noupdate',redirect_version);
window.applicationCache.addEventListener('error',redirect_version);
window.applicationCache.addEventListener('updateready', function(){window.location.reload()});
} catch (e) {
timeout_duration = 1;
}
// XXX This is a hack for when the network is too slow, or if appcache is not supported anymore
window.setTimeout(redirect_version, timeout_duration);
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>984.41193.2075.29252</string> </value> <value> <string>996.46889.45254.33041</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1599639175.46</float> <float>1639062670.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, document, RSVP, rJS, navigator*/
/*jslint indent: 2, maxlen: 80, nomen: true*/
(function (window, document, RSVP, rJS, navigator) {
"use strict";
rJS(window)
.declareService(function () {
var latest_version = document.head.querySelector(
'script[data-appconfig="latest_version"]'
).textContent,
queue = new RSVP.Queue();
// Make this redirection compatible with no-service-worker browsers
if ('serviceWorker' in navigator) {
queue.push(function () {
return navigator.serviceWorker.register(
"gadget_erp5_serviceworker.js");
});
}
return queue
.push(function () {
document.location.replace(latest_version + "/" +
document.location.hash);
});
});
}(window, document, RSVP, rJS, navigator));
\ No newline at end of file
...@@ -144,6 +144,26 @@ ...@@ -144,6 +144,26 @@
<value> <string>string</string> </value> <value> <string>string</string> </value>
</item> </item>
</dictionary> </dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_latest_version</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_precache_manifest_script</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -176,7 +196,15 @@ ...@@ -176,7 +196,15 @@
</item> </item>
<item> <item>
<key> <string>configuration_content_security_policy</string> </key> <key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; script-src \'unsafe-inline\';</string> </value> <value> <string>default-src \'self\';</string> </value>
</item>
<item>
<key> <string>configuration_latest_version</string> </key>
<value> <string>development</string> </value>
</item>
<item>
<key> <string>configuration_precache_manifest_script</string> </key>
<value> <string>WebSection_getAppstorePrecacheManifest</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_x_frame_options</string> </key> <key> <string>configuration_x_frame_options</string> </key>
...@@ -425,7 +453,7 @@ ...@@ -425,7 +453,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.65259.47363.59801</string> </value> <value> <string>996.31313.30780.31453</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -443,7 +471,7 @@ ...@@ -443,7 +471,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1559055460.25</float> <float>1639493797.36</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
# minimum list of required files for appstore service worker
url_list = [
'./',
'rsvp.js',
'renderjs.js',
'officejs-redirect.js',
'favicon.ico'
]
return list(set(url_list))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Anonymous</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getAppstorePrecacheManifest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment