2017-03-03 17:04:06 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html manifest="webxoss.appcache">
|
|
|
|
<head>
|
|
|
|
<title>Migrate WEBXOSS data</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<iframe id="iframe" style="display: none;" src="about:blank"></iframe>
|
|
|
|
<script>
|
|
|
|
(function () {
|
2017-03-06 17:48:25 +01:00
|
|
|
if (location.protocol === 'https:') {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// migrated by the old way, buggy in safari
|
|
|
|
if (localStorage.getItem('migrated') === 'true') {
|
2017-03-07 03:31:02 +01:00
|
|
|
if (!window.safari) {
|
2017-03-06 17:48:25 +01:00
|
|
|
return location.replace(location.href.replace(/^http:/, 'https:'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// migrated by the new way
|
|
|
|
if (localStorage.getItem('migrated') === '2') {
|
|
|
|
return location.replace(location.href.replace(/^http:/, 'https:'))
|
|
|
|
}
|
2017-03-03 17:04:06 +01:00
|
|
|
function getStorage() {
|
|
|
|
var storage = {}
|
|
|
|
for (var i = 0; i < localStorage.length; i++) {
|
|
|
|
var key = localStorage.key(i)
|
|
|
|
storage[key] = localStorage.getItem(key)
|
|
|
|
}
|
|
|
|
return storage
|
|
|
|
}
|
2017-03-06 17:48:25 +01:00
|
|
|
var storage = getStorage()
|
|
|
|
localStorage.setItem('migrated', 2)
|
|
|
|
// pass localStorage via url hash, which is ignored in network request
|
|
|
|
var url = location.href.replace(/^http:/, 'https:') + '#storage=' + JSON.stringify(storage)
|
|
|
|
return location.replace(url)
|
2017-03-03 17:04:06 +01:00
|
|
|
})()
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|