summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-06-16 01:29:43 +0100
committerNick White <git@njw.me.uk>2011-06-16 01:29:43 +0100
commit751f1159831bb0645e019b1fc5581f4cb1e9d9b4 (patch)
tree4a325361f69ebf6ac51fedca21e432e901e222b9
parent335cebf3653b037e43c3e9f28a31696f0b7f1813 (diff)
Basic firefox update support, minor css update
-rw-r--r--Makefile18
-rwxr-xr-xgecko/genpub.sh11
-rwxr-xr-xgecko/gensig.sh22
-rw-r--r--gecko/install.ttl4
-rw-r--r--gecko/updates.ttl20
-rwxr-xr-xsimplyread.js2
6 files changed, 73 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index a4c1629..c880959 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,21 @@
NAME = simplyread
-VERSION = 0.4
+VERSION = 0.5
WEBSITE = http://njw.me.uk/software/$(NAME)/
KEYFILE = private.pem
all: web/chromium-updates.xml web/index.html dist xpi crx
+# TODO: test makefile dependency is portable (and correct)
+web/gecko-updates.rdf: web/$(NAME)-$(VERSION).xpi
+ /tmp/uhura -o $@ -k $(KEYFILE) web/$(NAME)-$(VERSION).xpi $(WEBSITE)/$(NAME)-$(VERSION).xpi
+
+# gensig not working yet
+#web/gecko-updates.rdf: gecko/updates.ttl
+# sed -e "s/VERSION/$(VERSION)/g" \
+# -e "s/HASH/`sha1sum web/$(NAME)-$(VERSION).xpi|awk '{print $$1}'`/g" \
+# -e "s/SIG/`sh gecko/gensig.sh gecko/updates.ttl $(KEYFILE)`/g" \
+# < $< | rapper -i turtle -o rdfxml /dev/stdin 2>/dev/null > $@
+
web/chromium-updates.xml: chromium/updates.xml
sed "s/VERSION/$(VERSION)/g" < $< > $@
@@ -38,7 +49,10 @@ xpi:
cp gecko/chrome/content/simplyread.xul gecko-build/chrome/content/
cp simplyread.js gecko-build/chrome/content/
rsvg -w 22 -h 22 icon.svg gecko-build/chrome/content/icon.png
- sed "s/VERSION/$(VERSION)/g" < gecko/install.ttl | rapper -i turtle -o rdfxml /dev/stdin 2>/dev/null > gecko-build/install.rdf
+ #rsvg -w 64 -h 64 icon.svg gecko-build/icon.png
+ cp icon.svg gecko-build/icon.svg
+ sed -e "s/VERSION/$(VERSION)/g" -e "s/PUBKEY/`sh gecko/genpub.sh $(KEYFILE)`/g" \
+ < gecko/install.ttl | rapper -i turtle -o rdfxml /dev/stdin 2>/dev/null > gecko-build/install.rdf
cd gecko-build; zip -r ../web/$(NAME)-$(VERSION).xpi . 1>/dev/null
gpg -b < web/$(NAME)-$(VERSION).xpi > web/$(NAME)-$(VERSION).xpi.sig
rm -rf gecko-build
diff --git a/gecko/genpub.sh b/gecko/genpub.sh
new file mode 100755
index 0000000..12768dd
--- /dev/null
+++ b/gecko/genpub.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if test $# -ne 1; then
+ echo "Usage: $0 pem"
+ echo "Outputs a public key suitable for use in install.rdf"
+ exit 1
+fi
+
+openssl rsa -pubout -outform DER < "$1" 2>/dev/null \
+| openssl enc -e -a 2>/dev/null \
+| awk '{printf("%s", $0)}' | sed 's/\//\\\//g'
diff --git a/gecko/gensig.sh b/gecko/gensig.sh
new file mode 100755
index 0000000..13c0447
--- /dev/null
+++ b/gecko/gensig.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Currently not working - using uhura instead.
+
+if test $# -ne 2; then
+ echo "Usage: $0 update.rdf pem"
+ echo "Outputs a signature suitable for use in update.rdf"
+ exit 1
+fi
+
+# serialise all but the signature entry
+# in mccoy this is serializeResource(), in mexumgen it's ser()
+# exerything else seems to rewrite things, but we *might* get away with sed-ing away the bad line and outputting as rdfxml
+# sha512 hash
+# sign the hash
+# der encode & base64
+
+sed '/em:signature/d' < "$1" | rapper -i turtle -o rdfxml /dev/stdin 2>/dev/null \
+| sha512sum \
+| openssl sha1 -sha1 -binary -sign "$2" \
+| openssl enc -e -a 2>/dev/null \
+| awk '{printf("%s", $0)}' | sed 's/\//\\\//g'
diff --git a/gecko/install.ttl b/gecko/install.ttl
index 655f3d6..dc40853 100644
--- a/gecko/install.ttl
+++ b/gecko/install.ttl
@@ -13,5 +13,7 @@
em:name "SimplyRead";
em:description "Stop browsing, start reading. Press Ctrl-Alt-r or click the 'sr' icon in the status bar to toggle SimplyRead.";
em:creator "Nick White";
- em:homepageUrl "http://njw.me.uk/software/simplyread/";
+ em:homepageURL "http://njw.me.uk/software/simplyread/";
+ em:updateURL "http://njw.me.uk/software/simplyread/gecko-updates.rdf";
+ em:updateKey "PUBKEY";
<http://usefulinc.com/ns/doap#license> <http://www.gnu.org/licenses/agpl.html>.
diff --git a/gecko/updates.ttl b/gecko/updates.ttl
new file mode 100644
index 0000000..34325db
--- /dev/null
+++ b/gecko/updates.ttl
@@ -0,0 +1,20 @@
+# currently not used as uhura is generating it.
+
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
+@prefix em: <http://www.mozilla.org/2004/em-rdf#>.
+
+<urn:mozilla:extension:simplyread@njw.me.uk>
+ em:signature "SIG";
+ em:updates [ a rdf:Seq ;
+ rdf:li <:VERSION>;
+ ].
+
+<:VERSION>
+ em:version "VERSION";
+ em:targetApplication [
+ em:id "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
+ em:minVersion "3.0";
+ em:maxVersion "4.0.*";
+ em:updateLink "http://njw.me.uk/simplyread/simplyread-VERSION.xpi";
+ em:updateHash "sha1:HASH";
+ ].
diff --git a/simplyread.js b/simplyread.js
index cc3c730..f7e3d3e 100755
--- a/simplyread.js
+++ b/simplyread.js
@@ -64,7 +64,7 @@ function simplyread()
doc.body.innerHTML =
"<style type=\"text/css\"> p{margin:0ex auto;}" +
" p+p{text-indent:2em;} body {background-color:#cccccc}" +
- " img{float:right; padding-left:1em;}" +
+ " img{float:right; clear:right; padding-left:1em;}" +
" h1,h2,h3,h4 {font-weight:normal}</style>" +
"<div style=\"width:34em; padding:8em; padding-top:2em;" +
" background-color:white; margin:auto; line-height:1.4;" +