ice-code-editor icon indicating copy to clipboard operation
ice-code-editor copied to clipboard

Getting HTTP localstorage to HTTPS

Open eee-c opened this issue 8 years ago • 5 comments

Ugh.

http://stackoverflow.com/questions/10502469/is-there-any-workaround-to-make-use-of-html5-localstorage-on-both-http-and-https

Current thinking is:

  1. Deploy https://www.gamingjs.com/ice (latest version of code)
  2. Deploy https://www.gamingjs.com/ice-transfer
  3. Deploy http://gamingjs.com/ice-recover
  4. *** GO LIVE ***
  5. 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):

  1. ~Access old http://gamingjs.com/ice~
  2. ~Appcache update event triggers message about update~
  3. ~After accepting, new appcache code is loaded~
  4. ~Data is transfered to HTTPS site~
  5. ~Bit is set in local storage indicating that transfer occurred~
  6. ~Upon completion, browser is redirected to HTTPS site~

Workflow (already transferred):

  1. ~Access old old http://gamingjs.com/ice~
  2. ~No new appache event~
  3. ~Detect already-tranferred bit, and redirect to HTTPS site.~

Workflow (visit HTTPS site before transferring existing data EDGE CASE):

  1. ~Previously edited code on old http://gamingjs.com/ice site~
  2. ~Visit new HTTPS site directly~
  3. ~Access old http://gamingjs.com/ice site~
  4. ~Tries to transfer because transfer bit is not set~
  5. ~Ice transfer frame detects existing data and refuses to overwrite~
  6. ~Log message to console and kids will have to debug in forums.~

Workflow (new kids):

  1. ~Access old old http://gamingjs.com/ice~
  2. ~Detect no data, and redirect to HTTPS site.~

Workflow (something went wrong):

  1. Access old data at http://gamingjs.com/ice-recover
  2. Click link to download import compatible file

eee-c avatar Jan 04 '17 21:01 eee-c

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?

terrasea avatar Jan 05 '17 15:01 terrasea

Next time around: there are a bunch of TODOs in the gamingjs ice-transfer code. But it seems to work :)

eee-c avatar Jan 13 '17 19:01 eee-c

Still have some network timeout work to do, but we're mostly(?) done.

eee-c avatar Jan 20 '17 19:01 eee-c

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"}"

eee-c avatar Jan 27 '17 19:01 eee-c

Just need to tidy up ice-recover (rename the download file), but we're in good shape here!

eee-c avatar Feb 03 '17 19:02 eee-c