Skip to content

馃憤[Solved] 馃槬 Where did my drafts go!?!?#9

Description

@coolaj86

If you happened to be using this during the very first week, when it was at https://bliss.coolaj86.com/, fear not!

Just go to https://bliss.coolaj86.com/, open up the inspector console, and you'll find all of your drafts under the application tab.

Here's what you need to export them and re-import them:

Backup the old Drafts from the 404 page

Open the inspector console https://bliss.coolaj86.com, and copy and paste this JavaScript snippet:

var all = [];
var i;
for (i = 0; i < localStorage.length; i += 1) {
  var key = localStorage.key(i);
  var value = localStorage.getItem(key);
  all.push({ key: key, value: value })
}
console.log(JSON.stringify(all));

Hit enter, and you will see a blob of JSON with all of your drafts.

Restore drafts to the new site

Open the inspector console on https://bliss.js.org

First paste the JSON into a new all object:

var all = // paste here
all.forEach(function (draft) {
  localStorage.setItem(draft.key, draft.value);
});

And then refresh your page. TADA! The drafts are restored.

Caveats

A few things I want to do for this

  • Note/Bug: Need to merge the all key in localStorage
  • convert old localStorage.getItem() to new format automagically
    localStorage.getItem(post.uuid + ".content")
    localStorage.getItem(post.uuid + ".updated")
    localStorage.getItem(post.uuid + ".created")
    localStorage.getItem(post.uuid + ".timezone") 

馃槑

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions