-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
5,579 additions
and
4,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<name>JavaScript XMPP Chat</name> | ||
<summary>Facebook-like chat</summary> | ||
<description>Facebook-like chat with end-to-end encrypted conversation, video calls, multi-user rooms, XMPP and internal server backend.</description> | ||
<version>3.1.1</version> | ||
<version>3.2.0-beta.1</version> | ||
<licence>agpl</licence> | ||
<author mail="[email protected]">Klaus Herberth</author> | ||
<author>Tobia De Koninck</author> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
header('Content-Type: application/json; charset=utf-8'); | ||
|
||
$config = \OC::$server->getConfig(); | ||
$apiSecret = $config->getAppValue('ojsxc', 'apiSecret'); | ||
|
||
function abort($msg) { | ||
http_response_code(500); | ||
|
||
\OCP\Util::writeLog('ojsxc', 'ExAPI: Abort with message: '.$msg, \OCP\Util::WARN ); | ||
|
||
die(json_encode(array( | ||
'result' => 'error', | ||
'data' => array( | ||
'msg' => $msg | ||
), | ||
))); | ||
} | ||
|
||
function checkPassword() { | ||
$currentUser = null; | ||
|
||
\OCP\Util::writeLog('ojsxc', 'ExAPI: Check password for user: '.$_POST['username'], \OCP\Util::INFO ); | ||
|
||
if(!empty($_POST['password']) && !empty($_POST['username'])) { | ||
$currentUser = \OC::$server->getUserManager()->checkPassword($_POST['username'], $_POST['password']); | ||
} | ||
|
||
if (!$currentUser) { | ||
echo json_encode(array( | ||
'result' => 'noauth', | ||
)); | ||
exit(); | ||
} | ||
|
||
$data = array(); | ||
$data ['uid'] = $currentUser->getUID(); | ||
|
||
echo json_encode(array( | ||
'result' => 'success', | ||
'data' => $data, | ||
)); | ||
} | ||
|
||
// check if we have a signature | ||
if ( ! isset( $_SERVER[ 'HTTP_X_JSXC_SIGNATURE' ] ) ) | ||
abort( 'HTTP header "X-JSXC-Signature" is missing.' ); | ||
else if ( ! extension_loaded( 'hash' ) ) | ||
abort( 'Missing "hash" extension to check the secret code validity.' ); | ||
else if ( ! $apiSecret) | ||
abort( 'Missing secret.' ); | ||
|
||
// check if the algo is supported | ||
list( $algo, $hash ) = explode( '=', $_SERVER[ 'HTTP_X_JSXC_SIGNATURE' ], 2 ) + array( '', '' ); | ||
if ( ! in_array( $algo, hash_algos(), TRUE ) ) | ||
abort( "Hash algorithm '$algo' is not supported." ); | ||
|
||
// check if the key is valid | ||
$rawPost = file_get_contents( 'php://input' ); | ||
if ( $hash !== hash_hmac( $algo, $rawPost, $apiSecret ) ) | ||
abort( 'Signature does not match.' ); | ||
|
||
switch($_POST['operation']) { | ||
case 'auth': | ||
checkPassword(); | ||
break; | ||
default: | ||
abort( "Unsupported operation." ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
* Released under the MIT license | ||
* @author Klaus Herberth <[email protected]> | ||
*/ | ||
OCP\App::registerAdmin ( 'ojsxc', 'settings' ); | ||
\OCP\App::registerAdmin ( 'ojsxc', 'settings/admin' ); | ||
\OCP\App::registerPersonal('ojsxc', 'settings/personal'); | ||
|
||
$jsxc_root = (defined('JSXC_ENV') && JSXC_ENV === 'dev')? 'jsxc/dev/' : 'jsxc/'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<name>JavaScript XMPP Chat</name> | ||
<summary>Facebook-like chat</summary> | ||
<description>Facebook-like chat with end-to-end encrypted conversation, video calls, multi-user rooms, XMPP and internal server backend.</description> | ||
<version>3.1.1</version> | ||
<version>3.2.0-beta.1</version> | ||
<licence>agpl</licence> | ||
<author mail="[email protected]">Klaus Herberth</author> | ||
<author>Tobia De Koninck</author> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.