diff --git a/Memos/Memos.php b/Memos/Memos.php index 71fc9472c7..1c2a28a31e 100644 --- a/Memos/Memos.php +++ b/Memos/Memos.php @@ -2,6 +2,57 @@ namespace App\SupportedApps\Memos; -class Memos extends \App\SupportedApps +class Memos extends \App\SupportedApps implements \App\EnhancedApps { + public $config; + + public function __construct() { + } + + public function test() + { + $test = parent::appTest( + $this->url('api/v1/auth/sessions/current'), + $this->attrs() + ); + echo $test->status; + } + + public function livestats() + { + $status = 'inactive'; + $res = parent::execute( + $this->url('api/v1/memos'), + $this->attrs() + ); + $details = json_decode($res->getBody()); + + $data = []; + + if ($details) { + $status = 'active'; + $data['memo_count'] = count($details->memos); + } + + return parent::getLiveStats($status, $data); + } + + public function url($endpoint) + { + $api_url = parent::normaliseurl($this->config->url) . $endpoint; + return $api_url; + } + + + public function attrs() + { + $access_token = $this->config->access_token; + $attrs = [ + "headers" => [ + "content-type" => "application/json", + "Authorization" => "Bearer " . $access_token, + ], + ]; + return $attrs; + } } diff --git a/Memos/app.json b/Memos/app.json index 52d228a642..81a8f601e9 100644 --- a/Memos/app.json +++ b/Memos/app.json @@ -4,7 +4,7 @@ "website": "https://github.com/usememos/memos", "license": "MIT License", "description": "A privacy-first, lightweight note-taking service. Easily capture and share your great thoughts.", - "enhanced": false, + "enhanced": true, "tile_background": "light", "icon": "memos.png" } \ No newline at end of file diff --git a/Memos/config.blade.php b/Memos/config.blade.php new file mode 100644 index 0000000000..59969d7030 --- /dev/null +++ b/Memos/config.blade.php @@ -0,0 +1,15 @@ +