Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
37b59a92
Commit
37b59a92
authored
Aug 22, 2016
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: add excluded and mapped paths in serviceworker
parent
11cf0995
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
54 deletions
+148
-54
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.js
...eItem/web_page_module/gadget_officejs_serviceworker_js.js
+127
-52
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.xml
...Item/web_page_module/gadget_officejs_serviceworker_js.xml
+21
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.js
View file @
37b59a92
...
...
@@ -121,6 +121,8 @@ var global = self,
'
Web Style
'
:
'
text/css
'
},
map_url2id_prefix
=
{},
map_url2url
=
{},
exclude_urls
=
[],
map_content_type2portal_type
=
{},
websections_url
=
[],
query_portal_types
=
""
,
...
...
@@ -138,6 +140,34 @@ var global = self,
}
return
'
text_content
'
;
},
is_excluded_url
=
function
(
url
)
{
var
prefix
,
i
;
for
(
i
=
0
;
i
<
exclude_urls
.
length
;
i
++
)
{
prefix
=
exclude_urls
[
i
];
if
(
url
===
prefix
)
{
return
true
;
}
if
(
url
.
startsWith
(
prefix
+
'
/
'
))
{
return
true
;
}
}
return
false
;
},
get_mapped_url
=
function
(
url
)
{
var
prefix
,
prefix_id
,
key
;
for
(
key
in
map_url2url
)
{
if
(
map_url2url
.
hasOwnProperty
(
key
))
{
if
(
url
===
key
)
{
return
map_url2url
[
key
];
}
if
(
url
.
startsWith
(
key
))
{
return
url
.
replace
(
key
,
map_url2url
[
key
]);
}
}
}
},
get_relative_url
=
function
(
url
)
{
var
prefix
,
relative_url
,
...
...
@@ -388,6 +418,13 @@ var global = self,
map_url2id_prefix
[
site_url
]
=
''
;
map_url2id_prefix
[
'
https:
'
]
=
''
;
exclude_urls
.
push
(
site_url
+
'
hateoas
'
);
exclude_urls
.
push
(
site_url
+
'
hateoasnoauth
'
);
map_url2url
[
site_url
+
'
rjsunsafe/ooffice/apps/
'
]
=
'
https://localhost/OfficeWebDeploy/apps/
'
;
map_url2url
[
site_url
+
'
rjsunsafe/ooffice/sdkjs/
'
]
=
'
https://localhost/OfficeWebDeploy/sdkjs/
'
;
map_url2url
[
site_url
+
'
rjsunsafe/ooffice/vendor/
'
]
=
'
https://localhost/OfficeWebDeploy/vendor/
'
;
(
function
()
{
var
url
;
for
(
url
in
map_url2id_prefix
)
{
...
...
@@ -513,11 +550,47 @@ var global = self,
self
.
jio_cache_fetch
=
function
(
event
)
{
var
url
=
event
.
request
.
url
,
mapped_url
,
relative_url
=
get_relative_url
(
url
),
specific_url
=
get_specific_url
(
url
)
||
relative_url
,
not_found_in_dev_storage
=
false
,
queue
;
if
(
is_excluded_url
(
url
))
{
queue
=
fetch
(
event
.
request
);
}
else
{
mapped_url
=
get_mapped_url
(
url
);
if
(
self
.
jio_cache
.
development_mode
&&
mapped_url
)
{
queue
=
fetch
(
mapped_url
)
.
then
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
console
.
log
(
url
+
'
,
'
+
specific_url
+
'
not found by
'
+
mapped_url
+
'
storage
'
);
return
get_from_storage
(
url
,
self
.
jio_erp5_cache_storage
);
}
else
{
throw
error
;
}
})
.
then
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
console
.
log
(
url
+
'
,
'
+
specific_url
+
'
not found in erp5 cache storage
'
);
return
get_from_cache_storage
(
url
);
}
else
{
throw
error
;
}
})
.
then
(
function
(
response
)
{
if
(
response
.
ok
)
{
save_in_dev_storage
(
url
,
response
.
clone
());
//console.log('returned: ' + url);
return
response
;
}
else
{
debugger
;
}
})
.
then
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
});
}
else
{
queue
=
Promise
.
resolve
()
.
then
(
function
()
{
if
(
self
.
jio_cache
.
development_mode
)
{
...
...
@@ -569,6 +642,8 @@ var global = self,
.
then
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
});
}
}
event
.
respondWith
(
queue
);
};
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.xml
View file @
37b59a92
...
...
@@ -87,6 +87,25 @@
<key>
<string>
language
</string>
</key>
<value>
<string>
en
</string>
</value>
</item>
<item>
<key>
<string>
modification_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1469184627.3
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Script
</string>
</value>
...
...
@@ -230,7 +249,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
2.23052.23734.23330
</string>
</value>
<value>
<string>
95
3.19783.2282.55313
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +267,7 @@
</tuple>
<state>
<tuple>
<float>
14
67787144.88
</float>
<float>
14
71734262.06
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment