Fix to make evopedia work inside Firefox OS simulator, when installed as an application

This commit is contained in:
mossroy 2013-03-11 20:25:54 +01:00
parent 469659f573
commit d4df088b7e
3 changed files with 14 additions and 4 deletions

View File

@ -51,8 +51,11 @@ License:
Current status : I have tested it with the <a href="http://evopedia.info/dumps/wikipedia_small_2010-08-14.torrent">small dump (2010-08-14)</a>, the <a href="http://evopedia.info/dumps/wikipedia_fr_2012-02-03.torrent">French dump (2012-02-03)</a> and the <a href="http://evopedia.info/dumps/wikipedia_frwiktionary_2011-03-16.torrent">French wiktionary dump (2011-03-16)</a>. <b>It does NOT work on the English dump for now</b> (I'm working on it)
<br />
<br />
On desktops, it works at least on Firefox 17 and Chrome 23. I tested it on the Firefos OS simulator : it works but requires (for now) to put the small dump files in the "Music" folder of your device. It looks for wikipedia_small_2010-08-14/titles.idx in it. So far, I could not test it on a real Firefox OS device.
<b>Update 2013-01-25 : </b> it's now broken on latest Firefox OS, because of more strict security policy on accessing the local data. You now need to have at least a privileged webapp to have this right. Cf <a href="https://docs.google.com/a/mozilla.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0">https://docs.google.com/a/mozilla.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0</a>
<ul>
<li>On desktops, it works at least on recent Firefox and Chrome</li>
<li>On the Firefos OS simulator, you have (for now) to put the small dump files in a "fake-sdcard" folder of your firefox profile (ex : ~/.mozilla/firefox/xxxx.default/extensions/r2d2b2g@mozilla.org/profile/fake-sdcard). It looks for wikipedia_small_2010-08-14/titles.idx in it. You also need to install the application from the dashboard of the simulator instead of accessing via the browser (due to security restrictions in Firefox OS : only certified webapps can access the sdcard)</li>
<li>I could not test it on a real Firefox OS device : if someone did, please let me know</li>
</ul>
<br />
It's only a proof of concept sor far : there are certainly many many ways this could be enhanced (suggestions and patche are welcome : the source code is on <a href="https://github.com/mossroy/evopedia-html5">github</a>). In particular, the performance can be optimized when reading an article, and the links inside an article do not work for now.
<br />

View File

@ -42,7 +42,7 @@ onKeyUpPrefix(e)
var storage = null;
if (typeof navigator.getDeviceStorage == "function") {
storage = navigator.getDeviceStorage('music');
storage = navigator.getDeviceStorage('sdcard');
}
if (storage != null) {

View File

@ -19,5 +19,12 @@
"description": "Lecteur Wikipedia hors-connexion"
}
},
"default_locale": "en"
"default_locale": "en",
"permissions": {
"device-storage:sdcard": {
"description": "Required to read wikipedia dumps",
"access": "readonly"
}
},
"type": "privileged"
}