ice-code-editor
ice-code-editor copied to clipboard
Getting HTTP localstorage to HTTPS
Ugh.
http://stackoverflow.com/questions/10502469/is-there-any-workaround-to-make-use-of-html5-localstorage-on-both-http-and-https
Current thinking is:
- Deploy https://www.gamingjs.com/ice (latest version of code)
- Deploy https://www.gamingjs.com/ice-transfer
- Deploy http://gamingjs.com/ice-recover
- *** GO LIVE ***
- Deploy http://gamingjs.com/ice (transfer and redirect to HTTPS site)
Benefits:
- If something goes wrong, local storage is still accessible at ice-recover.
- One message to kids when migrating (see workflow for existing kids)
- Can transfer in background
Drawbacks:
- Now serving from www.gamingjs.com/ice (instead of naked gamingjs.com domain)
Workflow (existing kids):
- ~Access old http://gamingjs.com/ice~
- ~Appcache update event triggers message about update~
- ~After accepting, new appcache code is loaded~
- ~Data is transfered to HTTPS site~
- ~Bit is set in local storage indicating that transfer occurred~
- ~Upon completion, browser is redirected to HTTPS site~
Workflow (already transferred):
- ~Access old old http://gamingjs.com/ice~
- ~No new appache event~
- ~Detect already-tranferred bit, and redirect to HTTPS site.~
Workflow (visit HTTPS site before transferring existing data EDGE CASE):
- ~Previously edited code on old http://gamingjs.com/ice site~
- ~Visit new HTTPS site directly~
- ~Access old http://gamingjs.com/ice site~
- ~Tries to transfer because transfer bit is not set~
- ~Ice transfer frame detects existing data and refuses to overwrite~
- ~Log message to console and kids will have to debug in forums.~
Workflow (new kids):
- ~Access old old http://gamingjs.com/ice~
- ~Detect no data, and redirect to HTTPS site.~
Workflow (something went wrong):
- Access old data at http://gamingjs.com/ice-recover
- Click link to download import compatible file
Damn it. I wonder if we can use the iframe messaging system to extract the data from http and then store it in https, as a once only exercise, if they have unmigrated data in http?
Next time around: there are a bunch of TODOs in the gamingjs ice-transfer code. But it seems to work :)
Still have some network timeout work to do, but we're mostly(?) done.
Done with network timeout. Having an issue with extra postmesages.
// This is getting called twice. The first time works fine, but the
// second contains this:
// event = MessageEvent {isTrusted: true, data: Object, origin: "http://gamingjs.com", lastEventId: "", source: Window…
// the data object contains: "{"LPMessage":"gotFrameIdentity","requestID":1485544731325,"frameIdentity":"0:1"}"
Just need to tidy up ice-recover (rename the download file), but we're in good shape here!