allow any type of attachments; fixed cordova build in docker

version-1
Marc Wäckerlin 8 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. 72
      nodejs/public/javascripts/safechat.js
  6. 7
      nodejs/public/stylesheets/safechat.css
  7. 26
      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
* 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+=("wheezy:::curl https://www.npmjs.com/install.sh | sh")
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 -R $(id -u) ${HOME}/.npm")
commands+=("useradd -d ${HOME} -u $(id -u) $(id -un)")

@ -10,6 +10,7 @@ dirs=("-v $(pwd):/workdir")
packages=()
targets="all check distcheck"
commands=()
wait=0
if test -e ./build-in-docker.conf; then
# you can preconfigure the variables in file build-in-docker.conf
# 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 " -p, --package <pkg> install extra debian packages"
echo " -c, --cmd <command> execute commands as root in docker"
echo " -w, --wait on error keep docker container and wait for enter"
echo
echo " The options -r -k -e -d -p -c can be repeated several times."
echo
@ -82,6 +84,9 @@ while test $# -gt 0; do
(-c|--cmd) shift;
commands+=("$1")
;;
(-w|--wait)
wait=1
;;
(*)
echo "**** ERROR: unknown option '$1', try --help" 1>&2
exit 1
@ -113,6 +118,12 @@ function traperror() {
fi
echo
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: "
docker rm -f "${DOCKER_ID}"
echo "returning status: $e"
@ -120,6 +131,12 @@ function traperror() {
exit $e
fi
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: "
docker rm -f "${DOCKER_ID}"
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
function attachments(files, id) {
if (files) files.forEach(function(file) {
console.log(file);
var img = document.createElement('img');
img.src = file.content;
$(id).append(img);
img.title = file.name;
if (file.type.match('^image/')) {
img.src = file.content;
} 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,39 +358,47 @@ function fileupload(evt) {
return error("your browser does not support file upload", true);
for (var i=0, f; f=evt.target.files[i]; ++i) {
var file = f;
console.log(file);
var reader = new FileReader();
reader.onload = function(evt) {
if (evt.target.error) return error("error reading file", true);
if (evt.target.readyState==0) return notice("waiting for data …");
if (evt.target.readyState==1) return notice("loading data …");
if (!file.type.match('^image/'))
return error(file.name+": not an image", true);
var img = document.createElement("img");
img.onload = function() {
var MAX = 400;
var width = img.width;
var height = img.height;
if (width > MAX) {
height *= MAX / width;
width = MAX;
}
if (height > MAX) {
width *= MAX / height;
height = MAX;
}
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
if (file.type.match('^image/')) {
var img = document.createElement("img");
img.onload = function() {
filecontent.push({type: file.type, content: img.src});
$("#preview").append(img);
success('image of type '+file.type+' is ready to be sent');
var MAX = 400;
var width = img.width;
var height = img.height;
if (width > MAX) {
height *= MAX / width;
width = MAX;
}
if (height > MAX) {
width *= MAX / height;
height = MAX;
}
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
img.onload = function() {
filecontent.push({name:file.name, type: file.type, content: img.src});
$("#preview").append(img);
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;
} 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);
}
img.src=evt.target.result;
}
reader.readAsDataURL(file);
}

@ -247,9 +247,12 @@ label[for=send] img {
float: left;
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;
width: 99%;
width: 100%;
}
#preview img {

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

Loading…
Cancel
Save