allow any type of attachments; fixed cordova build in docker

version-1
Marc Wäckerlin 9 years ago
parent a3288d4241
commit 3c87e6585b
  1. 21
      ChangeLog
  2. 3
      build-in-docker.conf
  3. 17
      build-in-docker.sh
  4. 58
      nodejs/public/images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg
  5. 26
      nodejs/public/javascripts/safechat.js
  6. 7
      nodejs/public/stylesheets/safechat.css
  7. 2
      nodejs/views/index.ejs

@ -1,3 +1,24 @@
2016-01-11 15:48 marc
* cordova/makefile.am: removed cordova plugin in makefile
2016-01-11 15:46 marc
* nodejs/public/javascripts/openpgp.js,
nodejs/public/javascripts/openpgp.worker.js,
nodejs/public/javascripts/safechat.js,
nodejs/public/stylesheets/safechat.css, nodejs/sockets/index.js,
nodejs/views/index.ejs: some fixes; asynchronous message
decryption to keep browser responsive
2016-01-11 10:48 marc
* ChangeLog, nodejs/package.json.in,
nodejs/public/javascripts/safechat.js,
nodejs/public/stylesheets/safechat.css, nodejs/routes/index.js,
nodejs/sockets/index.js, nodejs/views/index.ejs: some small
fixes: grey-out send button if not ready
2016-01-11 09:16 marc 2016-01-11 09:16 marc
* nodejs/makefile.am: added forgotten makefile * nodejs/makefile.am: added forgotten makefile

@ -11,6 +11,9 @@ if test -n "${ANDROID_HOME}"; then
commands+=("update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100") commands+=("update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100")
commands+=("wheezy:::curl https://www.npmjs.com/install.sh | sh") commands+=("wheezy:::curl https://www.npmjs.com/install.sh | sh")
commands+=("npm install -g cordova") commands+=("npm install -g cordova")
commands+=("npm install -g bplist-parser")
commands+=("npm install -g path-is-absolute")
commands+=("npm install -g inflight")
commands+=("chown $(id -u) ${HOME}") commands+=("chown $(id -u) ${HOME}")
commands+=("chown -R $(id -u) ${HOME}/.npm") commands+=("chown -R $(id -u) ${HOME}/.npm")
commands+=("useradd -d ${HOME} -u $(id -u) $(id -un)") commands+=("useradd -d ${HOME} -u $(id -u) $(id -un)")

@ -10,6 +10,7 @@ dirs=("-v $(pwd):/workdir")
packages=() packages=()
targets="all check distcheck" targets="all check distcheck"
commands=() commands=()
wait=0
if test -e ./build-in-docker.conf; then if test -e ./build-in-docker.conf; then
# you can preconfigure the variables in file build-in-docker.conf # you can preconfigure the variables in file build-in-docker.conf
# if you do so, add the file to EXTRA_DIST in makefile.am # if you do so, add the file to EXTRA_DIST in makefile.am
@ -31,6 +32,7 @@ while test $# -gt 0; do
echo " -d, --dir <dir> access given directory read only" echo " -d, --dir <dir> access given directory read only"
echo " -p, --package <pkg> install extra debian packages" echo " -p, --package <pkg> install extra debian packages"
echo " -c, --cmd <command> execute commands as root in docker" echo " -c, --cmd <command> execute commands as root in docker"
echo " -w, --wait on error keep docker container and wait for enter"
echo echo
echo " The options -r -k -e -d -p -c can be repeated several times." echo " The options -r -k -e -d -p -c can be repeated several times."
echo echo
@ -82,6 +84,9 @@ while test $# -gt 0; do
(-c|--cmd) shift; (-c|--cmd) shift;
commands+=("$1") commands+=("$1")
;; ;;
(-w|--wait)
wait=1
;;
(*) (*)
echo "**** ERROR: unknown option '$1', try --help" 1>&2 echo "**** ERROR: unknown option '$1', try --help" 1>&2
exit 1 exit 1
@ -113,6 +118,12 @@ function traperror() {
fi fi
echo echo
fi fi
if [ "$wait" -eq 1 ]; then
echo " ... now you can access the docker container:"
echo " docker exec -it bash"
echo -n " ... press enter to cleanup: "
read
fi
echo -n " ... cleanup docker: " echo -n " ... cleanup docker: "
docker rm -f "${DOCKER_ID}" docker rm -f "${DOCKER_ID}"
echo "returning status: $e" echo "returning status: $e"
@ -120,6 +131,12 @@ function traperror() {
exit $e exit $e
fi fi
done done
if [ "$wait" -eq 1 ]; then
echo " ... now you can access the docker container:"
echo " docker exec -it bash"
echo -n " ... press enter to cleanup: "
read
fi
echo -n " SUCCESS ... cleanup docker: " echo -n " SUCCESS ... cleanup docker: "
docker rm -f "${DOCKER_ID}" docker rm -f "${DOCKER_ID}"
exit 0 exit 0

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="32px"
height="32px"
viewBox="0 0 32 32"
enable-background="new 0 0 32 32"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="document_sans.svg"><defs
id="defs3265" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview3263"
showgrid="false"
inkscape:zoom="7.375"
inkscape:cx="16"
inkscape:cy="16"
inkscape:window-x="53"
inkscape:window-y="24"
inkscape:window-maximized="0"
inkscape:current-layer="svg2" /><metadata
id="metadata3255"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>PICOL Icon</dc:title><dc:date>2009-03-15</dc:date><dc:creator><cc:Agent><dc:title>Melih Bilgil</dc:title></cc:Agent></dc:creator><dc:rights><cc:Agent><dc:title>Creative Commons BY-SA</dc:title></cc:Agent></dc:rights><dc:publisher><cc:Agent><dc:title>PICOL - Pictorial Communication Language</dc:title></cc:Agent></dc:publisher><dc:identifier>http://blog.picol.org</dc:identifier><dc:source>http://blog.picol.org</dc:source><dc:language>en</dc:language><dc:subject><rdf:Bag><rdf:li>PICOL</rdf:li><rdf:li>icon</rdf:li><rdf:li>icons</rdf:li><rdf:li>sign</rdf:li><rdf:li>GUI</rdf:li><rdf:li>vector</rdf:li><rdf:li>interface</rdf:li></rdf:Bag></dc:subject><dc:description>This is one icon out of all PICOL icons</dc:description><dc:contributor><cc:Agent><dc:title>Melih Bilgil (www.lonja.de), Christopher Adjei (www.boffer.net)</dc:title></cc:Agent></dc:contributor><cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /></cc:Work><cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><g
id="background"><rect
fill="none"
width="32"
height="32"
id="rect3258" /></g><path
id="path3261"
d="M 18.414,0 H 0 V 32 H 24 V 5.584 L 18.414,0 z M 17.998,2.413 21.586,6 H 17.998 V 2.413 z M 2,30 V 1.998 h 14 v 6.001 h 6 V 30 H 2 z" /></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -330,9 +330,19 @@ function clearmessage() {
/// Display Image Attachments /// Display Image Attachments
function attachments(files, id) { function attachments(files, id) {
if (files) files.forEach(function(file) { if (files) files.forEach(function(file) {
console.log(file);
var img = document.createElement('img'); var img = document.createElement('img');
img.title = file.name;
if (file.type.match('^image/')) {
img.src = file.content; img.src = file.content;
$(id).append(img); } else {
img.src = "images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg";
}
var a = document.createElement('a');
a.href = file.content;
a.target = '_blank';
a.appendChild(img);
$(id).append(a);
}); });
} }
@ -348,13 +358,13 @@ function fileupload(evt) {
return error("your browser does not support file upload", true); return error("your browser does not support file upload", true);
for (var i=0, f; f=evt.target.files[i]; ++i) { for (var i=0, f; f=evt.target.files[i]; ++i) {
var file = f; var file = f;
console.log(file);
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function(evt) { reader.onload = function(evt) {
if (evt.target.error) return error("error reading file", true); if (evt.target.error) return error("error reading file", true);
if (evt.target.readyState==0) return notice("waiting for data …"); if (evt.target.readyState==0) return notice("waiting for data …");
if (evt.target.readyState==1) return notice("loading data …"); if (evt.target.readyState==1) return notice("loading data …");
if (!file.type.match('^image/')) if (file.type.match('^image/')) {
return error(file.name+": not an image", true);
var img = document.createElement("img"); var img = document.createElement("img");
img.onload = function() { img.onload = function() {
var MAX = 400; var MAX = 400;
@ -374,13 +384,21 @@ function fileupload(evt) {
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height); ctx.drawImage(img, 0, 0, width, height);
img.onload = function() { img.onload = function() {
filecontent.push({type: file.type, content: img.src}); filecontent.push({name:file.name, type: file.type, content: img.src});
$("#preview").append(img); $("#preview").append(img);
success('image of type '+file.type+' is ready to be sent'); success('image of type '+file.type+' is ready to be sent');
} }
img.title = file.name;
img.src = canvas.toDataURL(file.type); img.src = canvas.toDataURL(file.type);
} }
img.src=evt.target.result; img.src=evt.target.result;
} else {
filecontent.push({name:file.name, type: file.type, content: evt.target.result});
var img = document.createElement("img");
img.src = "images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg";
img.title = file.name;
$("#preview").append(img);
}
} }
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }

@ -247,9 +247,12 @@ label[for=send] img {
float: left; float: left;
padding: .5ex 1ex .5ex 1ex; padding: .5ex 1ex .5ex 1ex;
} }
#msgs .msg img { #msgs .msg .text img {
border-radius: 2ex;
-moz-border-radius: 2ex;
-webkit-border-radius: 2ex;
display: block; display: block;
width: 99%; width: 100%;
} }
#preview img { #preview img {

@ -120,7 +120,6 @@
<label for="photo"><img src="images/photo.svg"/></label> <label for="photo"><img src="images/photo.svg"/></label>
<input autocomplete="off" type="file" accept="image/*" id="photo" multiple /> <input autocomplete="off" type="file" accept="image/*" id="photo" multiple />
</span> </span>
<!--
<span class="toolbutton"> <span class="toolbutton">
<label for="video"><img src="images/video.svg"/></label> <label for="video"><img src="images/video.svg"/></label>
<input autocomplete="off" type="file" accept="video/*" id="video"/> <input autocomplete="off" type="file" accept="video/*" id="video"/>
@ -133,7 +132,6 @@
<label for="file"><img src="images/attachment.svg"/></label> <label for="file"><img src="images/attachment.svg"/></label>
<input autocomplete="off" type="file" id="file"/> <input autocomplete="off" type="file" id="file"/>
</span> </span>
-->
<span class="toolbutton"> <span class="toolbutton">
<label for="send"><img src="images/send.svg"/></label> <label for="send"><img src="images/send.svg"/></label>
<input type="submit" id="send" disabled/> <input type="submit" id="send" disabled/>

Loading…
Cancel
Save