From eb5c81dea5a60bc65d3ec607daf5ad81fd709928 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 30 Sep 2014 23:13:49 +0200 Subject: store client name and last use time for tokens. show them in token management --- controller/apicontroller.php | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'controller/apicontroller.php') diff --git a/controller/apicontroller.php b/controller/apicontroller.php index ee16f80..688d0b0 100644 --- a/controller/apicontroller.php +++ b/controller/apicontroller.php @@ -16,6 +16,7 @@ namespace OCA\Grauphel\Controller; use \OCP\AppFramework\Controller; use \OCP\AppFramework\Http\JSONResponse; +use \OCA\Grauphel\Lib\Client; use \OCA\Grauphel\Lib\NoteStorage; use \OCA\Grauphel\Lib\OAuth; use \OCA\Grauphel\Lib\OAuthException; @@ -105,10 +106,10 @@ class ApiController extends Controller 'api-version' => '1.0', ); - $client = $this->getClient(); + $cl = new Client(); + $client = $cl->getClient(); if ($client !== false) { - $data['oauth_authorize_url'] .= '?client=' - . urlencode($this->getNiceClientName($client)); + $data['oauth_authorize_url'] .= '?client=' . urlencode($client); } if ($authenticated) { @@ -333,31 +334,6 @@ class ApiController extends Controller return new JSONResponse($note); } - protected function getClient() - { - if (isset($_SERVER['HTTP_X_TOMBOY_CLIENT'])) { - $client = $_SERVER['HTTP_X_TOMBOY_CLIENT']; - $doublepos = strpos($client, ', org.tomdroid'); - if ($doublepos !== false) { - //https://bugs.launchpad.net/tomdroid/+bug/1375436 - //X-Tomboy-Client header is sent twice - $client = substr($client, 0, $doublepos); - } - return $client; - } - - return false; - } - - protected function getNiceClientName($client) - { - if (substr($client, 0, 12) == 'org.tomdroid') { - //org.tomdroid v0.7.5, build 14, Android v4.4.2, innotek GmbH/VirtualBox - return 'Tomdroid'; - } - return $client; - } - /** * Checks if the given user is authorized (by oauth token or normal login) * -- cgit v1.2.3