non working experimental status

version-1
Marc Wäckerlin 9 years ago
parent d7bf59444e
commit 787eefc67c
  1. 5
      ChangeLog
  2. 2
      cordova/platforms/android/AndroidManifest.xml
  3. 21
      cordova/platforms/android/assets/www/cordova_plugins.js
  4. 9
      cordova/platforms/android/res/xml/config.xml
  5. 6
      html/login.php
  6. 15
      html/opendb.php
  7. 20
      html/safechat.js
  8. 2
      html/send.php
  9. 6
      test/makefile.am
  10. 29
      test/runtests.sh
  11. 4
      test/settings.wt

@ -1,3 +1,8 @@
2015-12-04 08:36 marc
* COPYING, ChangeLog, INSTALL, build-in-docker.conf,
build-in-docker.sh: distinguish by hw arch
2015-12-04 07:05 marc 2015-12-04 07:05 marc
* COPYING, ChangeLog, INSTALL, build-in-docker.conf, * COPYING, ChangeLog, INSTALL, build-in-docker.conf,

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="359" android:versionName="0.3.59" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android"> <manifest android:hardwareAccelerated="true" android:versionCode="361" android:versionName="0.3.61" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

@ -3,33 +3,30 @@ module.exports = [
{ {
"file": "plugins/cordova-plugin-whitelist/whitelist.js", "file": "plugins/cordova-plugin-whitelist/whitelist.js",
"id": "cordova-plugin-whitelist.whitelist", "id": "cordova-plugin-whitelist.whitelist",
"pluginId": "cordova-plugin-whitelist",
"runs": true "runs": true
}, },
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{ {
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js", "file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode", "id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
"pluginId": "de.appplant.cordova.plugin.background-mode",
"clobbers": [ "clobbers": [
"cordova.plugins.backgroundMode", "cordova.plugins.backgroundMode",
"plugin.backgroundMode" "plugin.backgroundMode"
] ]
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"clobbers": [
"device"
]
} }
]; ];
module.exports.metadata = module.exports.metadata =
// TOP OF METADATA // TOP OF METADATA
{ {
"cordova-plugin-whitelist": "1.0.0", "cordova-plugin-whitelist": "1.0.0",
"cordova-plugin-device": "1.1.0", "de.appplant.cordova.plugin.background-mode": "0.6.4",
"de.appplant.cordova.plugin.background-mode": "0.6.4" "cordova-plugin-device": "1.1.0"
} }
// BOTTOM OF METADATA // BOTTOM OF METADATA
}); });

@ -1,17 +1,10 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="ch.safechat" version="0.3.59" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="ch.safechat" version="0.3.61" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" /> <preference name="loglevel" value="DEBUG" />
<feature name="Whitelist"> <feature name="Whitelist">
<param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" /> <param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="BackgroundMode">
<param name="android-package" value="de.appplant.cordova.plugin.background.BackgroundMode" />
</feature>
<preference name="KeepRunning" value="true" />
<allow-intent href="market:*" /> <allow-intent href="market:*" />
<name>SafeChat</name> <name>SafeChat</name>
<description> <description>

@ -24,12 +24,14 @@
function login($user, $pubkey) { function login($user, $pubkey) {
try { try {
require_once("opendb.php"); require_once("opendb.php");
if (!$db) error("database access failed");
if ($user=="safechat") error("username safechat is reserved for server"); if ($user=="safechat") error("username safechat is reserved for server");
$verify = gnupg_import($pgp, $pubkey); //$verify = gnupg_import($pgp, $pubkey);
if (!$verify) error("wrong identity"); //if (!$verify) error("wrong identity");
$user = $db->real_escape_string($user); $user = $db->real_escape_string($user);
$pubkey = $db->real_escape_string($pubkey); $pubkey = $db->real_escape_string($pubkey);
$q = $db->query("select * from user where name='$user' and pubkey='$pubkey';"); $q = $db->query("select * from user where name='$user' and pubkey='$pubkey';");
if (!$q) error("database query failed");
if ($q->num_rows==1) { if ($q->num_rows==1) {
success("user $user found on server"); success("user $user found on server");
} elseif ($q->num_rows==0) { } elseif ($q->num_rows==0) {

@ -11,6 +11,7 @@
mysqli_report(MYSQLI_REPORT_STRICT); mysqli_report(MYSQLI_REPORT_STRICT);
require_once("functions.php"); require_once("functions.php");
/*
try { try {
if (!isset($pgp)) { if (!isset($pgp)) {
$pgp = gnupg_init(); $pgp = gnupg_init();
@ -19,17 +20,23 @@ try {
} catch (Exception $e) { } catch (Exception $e) {
error('cannot start pgp on server'); error('cannot start pgp on server');
} }
*/
try { try {
if (!isset($db)) {
$db = new mysqli("mysql", "root", $_SERVER["MYSQL_ENV_MYSQL_ROOT_PASSWORD"]); $db = new mysqli("mysql", "root", $_SERVER["MYSQL_ENV_MYSQL_ROOT_PASSWORD"]);
if (!$db) error("database connection failed on server"); if (!$db) error("database connection failed on server");
$db->query("create database if not exists safechat;"); $db->query("create database if not exists safechat;");
if (!$db) error("cannot create database");
$db->select_db("safechat"); $db->select_db("safechat");
if (!$db) error("cannot create database for safechat"); if (!$db) error("cannot select database");
$db->query(file_get_contents("schema.sql")); $query = file_get_contents("schema.sql");
if (!$query) error("cannot load database schema");
foreach (split(";\n", $query) as $create) {
if ($create) {
$db->query($create);
if (!$db) error("cannot create database tables"); if (!$db) error("cannot create database tables");
} }
}
} catch (Exception $e) { } catch (Exception $e) {
error('database error on server'); error('database error on server: '+$e->getMessage());
} }
?> ?>

@ -294,7 +294,8 @@ function createkeypair(user, pwd) {
localStorage["privKey"] = keyPair.privateKeyArmored; localStorage["privKey"] = keyPair.privateKeyArmored;
login(); login();
}).catch(function(e) { }).catch(function(e) {
error(e); console.log(e.stack);
error("generating key pairs failed");
}); });
} }
@ -668,10 +669,26 @@ function newuser() {
}); });
} }
/// Check if local storage is available
function checkLocalStorage() {
var test = 'test';
try {
localStorage.setItem(test, test);
localStorage.removeItem(test);
return true;
} catch(e) {
status("<p>No access to local storage. Please allow "+window.location.hostname
+" to access localhost, i.e. do not block cookies.<p>");
error("local storage not available");
}
return false;
}
/// Initial Function: Startup /// Initial Function: Startup
/** Decide whether to login or to create a new user */ /** Decide whether to login or to create a new user */
function start() { function start() {
$("#menu").hide(); $("#menu").hide();
if (checkLocalStorage())
try { try {
status("Starting up ..."); status("Starting up ...");
if (!userid()) { if (!userid()) {
@ -680,6 +697,7 @@ function start() {
login(); login();
} }
} catch (m) { } catch (m) {
console.log(m.stack);
error(m); error(m);
} }
} }

@ -29,8 +29,10 @@ function send($user, $msg) {
if (strlen($_REQUEST['msg'])>100000) error("message is too long"); if (strlen($_REQUEST['msg'])>100000) error("message is too long");
$q = $db->query("select pubkey from user where name='$user';"); $q = $db->query("select pubkey from user where name='$user';");
if (!$q || $q->num_rows!=1) error("user not found on server"); if (!$q || $q->num_rows!=1) error("user not found on server");
/*
$pubkey = gnupg_import($pgp, $q->fetch_row()[0]); $pubkey = gnupg_import($pgp, $q->fetch_row()[0]);
if (!$pubkey) error("wrong identity"); if (!$pubkey) error("wrong identity");
*/
$q = $db->query("insert into message (user, msg) values ('$user', '$msg');"); $q = $db->query("insert into message (user, msg) values ('$user', '$msg');");
if (!$q) { if (!$q) {
error_log("Error storing message: ".$db->error); error_log("Error storing message: ".$db->error);

@ -8,8 +8,8 @@
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
dist_check_DATA = settings.wt testcase.wt
dist_check_SCRIPTS = runtests.sh
TESTS = TESTS = $(dist_check_SCRIPTS)
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in

@ -1,4 +1,4 @@
#!/bin/bash -e #!/bin/bash
#check for a text in a docker volume log #check for a text in a docker volume log
function check() { function check() {
@ -41,17 +41,24 @@ fi
# option checks # option checks
NEED_XVFB=0 NEED_XVFB=0
NEED_DOCKER=0 NEED_DOCKER=1
NEED_WEBTESTER=0 NEED_WEBTESTER=0
PORT=
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
(--help|-h) (--help|-h)
echo "$0 [OPTIONS] [PORTS <port>]" echo "$0 [OPTIONS]"
echo echo
echo "OPTIONS:" echo "OPTIONS:"
echo echo
echo " -p <PORT> don't run, just prepare test on port <PORT>"
echo
exit 0 exit 0
;; ;;
(-p|--port)
shift
PORT=$1
;;
(*) echo "**** ERROR: unknown option '$1', try --help"; exit 1;; (*) echo "**** ERROR: unknown option '$1', try --help"; exit 1;;
esac esac
if test $# -eq 0; then if test $# -eq 0; then
@ -120,6 +127,18 @@ set -x
# Add tests here # Add tests here
MYSQL=$(docker run -d -e MYSQL_ROOT_PASSWORD=TopSecretLOL mysql) MYSQL=$(docker run -d -e MYSQL_ROOT_PASSWORD=TopSecretLOL mysql)
PHP=$(docker run -d --volume $(pwd)/../html:/usr/share/nginx/html:ro --link ${MYSQL}:mysql mwaeckerlin/php-fpm) PHP=$(docker run -d --volume $(pwd)/../html:/usr/share/nginx/html:ro --link ${MYSQL}:mysql mwaeckerlin/php-fpm)
NGINX=$(docker run -d --volumes-from ${PHP} --link ${PHP}:php -p 8080:80 mwaeckerlin/nginx) if test -z "${PORT}"; then
NGINX=$(docker run -d --volumes-from ${PHP} --link ${PHP}:php mwaeckerlin/nginx)
trap "docker rm -f ${NGINX} ${PHP} ${MYSQL}" INT TERM EXIT
docker pull mwaeckerlin/webtester
set -e
countdown 10 20 wait_for_mysql ${MYSQL}
docker run --rm --link ${NGINX}:safechat -u $(id -u) -v $(pwd):/tests -e WEBRUNNER_SCRIPTS="settings.wt testcase.wt" mwaeckerlin/webtester
else
NGINX=$(docker run -d -p ${PORT}:80 --volumes-from ${PHP} --link ${PHP}:php mwaeckerlin/nginx)
trap "docker rm -f ${NGINX} ${PHP} ${MYSQL}" INT TERM EXIT trap "docker rm -f ${NGINX} ${PHP} ${MYSQL}" INT TERM EXIT
sleep 60 set +x
echo "Ready to test; press enter to end"
read
set -x
fi

@ -1 +1,3 @@
set SAFECHAT-URL=http://localhost:8080 set SAFECHAT-URL=http://safechat
set SAFECHAT-URL=http://localhost:8888
offline-storage-path /tmp/safechat-test
Loading…
Cancel
Save