Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate comments from HTTP to HTTPS #134

Open
barmar opened this issue May 23, 2017 · 4 comments
Open

Migrate comments from HTTP to HTTPS #134

barmar opened this issue May 23, 2017 · 4 comments

Comments

@barmar
Copy link

barmar commented May 23, 2017

SE has switched all their sites from HTTP to HTTPS (https://stackoverflow.blog/2017/05/22/stack-overflow-flipped-switch-https/?cb=1). None of my saved comments are showing up now. It would be great if you could provide a way to copy all the comments over, or make the URL matching independent of this distinction.

Or just tell me where the comments are saved, I could probably update it by hand easily.

@Benjol
Copy link
Owner

Benjol commented May 23, 2017

Thanks for the heads-up!

I'm not sure that there's a way to do this automagically. It's cross-domain security stuff.

The comments are stored in localStorage, which you can access via the Developer plugin in Firefox (you have to edit the settings in the Developer plugin to show the Storage tab). BUT that doesn't help, because as far as I can tell, you can't see storage data for anything other than the current URL, and given that you can't navigate to the old URL...

So, this is the workaround that I've tested for Firefox (suggestions are welcome for other browsers). With apologies to non-technical people, as it's a bit heavy-going:

  • You are going to edit the Firefox SQLite file which contains the localStorage data
  • Download SQLiteStudio
  • Find the path to your Firefox profile (Help > Troubleshooting Information -> Profile Folder - Show Folder)
  • Shut Firefox
  • Make a copy of the file webappstore.sqlite, just in case
  • Open SQLiteStudio, then open the webasppstore.sqlite file (which is in your profile folder) from within SQLiteStudio
  • Tools > Open SQL Editor
  • The aim now is to replace all the http entries with https entries for AutoReviewComments info
  • First have a look at what is already present (note that the urls are stored backwards!):
    select * from webappsstore2 where instr(key, 'AutoReviewComment') == 1
  • IMPORTANT: if you've already opened AutoReviewComments on the new https site it will have created the default comments, so if you now update the http comments to https, that makes for duplicate keys, which SQLite will not like. You can prevent this by deleting the unwanted comments first: delete from webappsstore2 where instr(key, 'AutoReviewComments') == 1 AND instr(originKey, 'https:443') > 0 BUT you want to be careful NOT to delete comments that you want to keep from other sites. You can adjust the where clauses accordingly (sorry if that's too technical!)
  • Now for the update itself:
  • Paste in the following query, then run it:
update webappsstore2 set
    originKey = REPLACE(originKey, 'http:80', 'https:443'),
    scope = REPLACE(scope, 'http:80', 'https:443')
where instr(key, 'AutoReviewComments-') == 1
  • That should be all.

@barmar
Copy link
Author

barmar commented May 23, 2017

I'm using Chrome on OS X. https://superuser.com/questions/507536/where-does-google-chrome-save-localstorage-from-extensions explains where it stores local storage, I'll try to find this.

@barmar
Copy link
Author

barmar commented May 23, 2017

Chrome stores local storage in ~/Library/Application Support/Google/Chrome/Default/Local Storage/. Each domain has two files:

http_stackoverflow.com_0.localstorage
http_stackoverflow.com_0.localstorage-journal

I renamed all these to https_XXX, and now I've got my auto-comments back!

@Benjol
Copy link
Owner

Benjol commented May 23, 2017

@barmar, yes that's what I figured too, I'm not sure what the -journal file is.
Try it and let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants