Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Readeck/Readeck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace App\SupportedApps\Readeck;

class Readeck extends \App\SupportedApps implements \App\EnhancedApps
{

public $config;

//protected $login_first = true; // Uncomment if api requests need to be authed first
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST

public function __construct()
{
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
}

public function test()
{
$test = parent::appTest($this->url("api/contacts"));
echo $test->status;
}

public function livestats()
{
$status = 'inactive';
$res = parent::execute(
$this->url('api/bookmarks?is_archived=false'),
$this->attrs()
);

$details = json_decode($res->getBody());

$data = [];

if ($details) {
$status = 'active';
$data["bookmarks_count"] = count($details);
}

return parent::getLiveStats($status, $data);
}

public function url($endpoint)
{
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
return $api_url;
}

public function attrs()
{
$apikey = $this->config->apikey;
$attrs = [
"headers" => [
"content-type" => "application/json",
"Authorization" => "Bearer " . $apikey,
],
];
return $attrs;
}
}
10 changes: 10 additions & 0 deletions Readeck/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appid": "9ebfa3a7bc09302c2d7c55713d121bf073c9cc63",
"name": "Readeck",
"website": "https://readeck.org/",
"license": "GNU Affero General Public License v3.0",
"description": "Readeck is a simple web application that lets you save the precious readable content of web pages you like and want to keep forever.\r\nSee it as a bookmark manager and a read later tool.",
"enhanced": true,
"tile_background": "dark",
"icon": "readeck.png"
}
15 changes: 15 additions & 0 deletions Readeck/config.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
<div class="items">
<div class="input">
<label>{{ strtoupper(__('app.url')) }}</label>
{!! Form::text('config[override_url]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
</div>
<div class="input">
<label>{{ __('app.apps.apikey') }}</label>
{!! Form::text('config[apikey]', null, array('placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item')) !!}
</div>
<div class="input">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div>

6 changes: 6 additions & 0 deletions Readeck/livestats.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ul class="livestats">
<li>
<span class="title">Bookmarks</span>
<strong>{!! $bookmarks_count !!}</strong>
</li>
</ul>
Binary file added Readeck/readeck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.