iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 552 forks source link

Saved keys aren't shared between http and https. #222

Closed tyrope closed 11 years ago

tyrope commented 11 years ago

Lately I've noticed most of my keys not loading properly, neither on the map or in the portal information panel.

Version information:

Windows 7 UK Profesional, Version 6.1.7601
Mozilla Firefox (Aurora channel), version 22.0a2 (2013-04-30)
Greasemonkey 1.8 (2013-04-15)
IITC versions:
Core: 0.11.2.20130426.033349
Keys: 0.1.0.20130424.020135
Keys on map: 0.1.0.20130424.020135
Xelio commented 11 years ago

Have you cleared the history of Firefox? This may include clearing cookie and would erase all data of IITC including keys data.

If not: Did the disappeared key reappear in next reload? Or disappear forever? Is the disappear of keys recurring or just happen one time?

Could you try to run following 2 statements in Web Console? Are they equal to the number of portals you have inputted keys?

Object.keys(window.plugin.keys.keys).length Object.keys(JSON.parse(localStorage['plugin-keys-data']).keys).length

tyrope commented 11 years ago

Strange thing is, it doesn't delete ALL keys, it resets to old data, as if the data got set to read-only after my Nth writing of the keys... after that as far as I can see, it's all the time.

As for executing the statements.. I have yet to ever work with javascript, so mind telling me how?

jonatkins commented 11 years ago

129 could be related

jonatkins commented 11 years ago

I wonder - is there a limit on the amount of data stored? approx how many keys have you entered? Are you seeing any errors in the javascript console?

to see the console:

the console is also where you can enter the two test commands above

tyrope commented 11 years ago

To count the amount of keys I opened the intel page today, being surprised by the data having changed to the more accurate one... results of the 2 commands:

[09:55:14.815] Object.keys(window.plugin.keys.keys).length
[09:55:14.816] 22
[09:55:17.767] Object.keys(JSON.parse(localStorage['plugin-keys-data']).keys).length
[09:55:17.768] 22

This is, as far as I can count, is accurate... if/when it fails again I'll execute the same commands (I can't believe I didn't notice the input box last night...)

tyrope commented 11 years ago

I found the problem, keys don't share between http (autocomplete) and https (bookmarks), so they're two sets of data...

Edited title to be more descriptive.

jonatkins commented 11 years ago

I don't know if it's possible for us to easily share the cookie between http and https - but, in the meantime, a workaround is to use the "force-https" plugin to ensure you always access the site the same way.

tyrope commented 11 years ago

Alright, thanks for the information, enabled force-https.

Xelio commented 11 years ago

http://stackoverflow.com/questions/10502469/is-there-any-workaround-to-make-use-of-html5-localstorage-on-both-http-and-https Seems not possible to implement in IITC.

tyrope commented 11 years ago

Sounds like this should be marked a wontfix then, @jonatkins. At least we figured out the problem. :)

jonatkins commented 11 years ago

I wonder if it's worth adding a cookie (which can be accessed on both http and https), just to tell the keys addon which protocol was last used for storage. That way, if the user visits over the other one, it can at least warn.

Alternatively, some external storage method would be the way to go - there's some suggestions here already mentioning dropbox and/or google docs

jonatkins commented 11 years ago

The new 'sync' plugin might actually fix this now, syncing to an external source should work just as well between http and https on one browser instance as it does between multiple browsers.