Skip to content
Merged
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
49 changes: 49 additions & 0 deletions Linkding/Linkding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\SupportedApps\Linkding;

class Linkding extends \App\SupportedApps implements \App\EnhancedApps
{
public $config;

public function __construct() {
}

public function test()
{
$test = parent::appTest($this->url('api/bookmarks?limit=1'), $this->getHeaders());
echo $test->status;
}

public function livestats()
{
$status = 'inactive';
$res = parent::execute($this->url('api/bookmarks?limit=1000'), $this->getHeaders());
$details = json_decode($res->getBody());

$data = [];
if ($details) {
$status = 'active';
$data = [
"bookmark_count" => $details->count,
];
}

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

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

private function getHeaders()
{
return [
"headers" => [
"Authorization" => "Token " . $this->config->access_token,
],
];
}
}
10 changes: 10 additions & 0 deletions Linkding/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appid": "1a039cf9812aee2944f3e2c472288fab189bc1a9",
"name": "Linkding",
"website": "https://linkding.link/",
"license": "MIT License",
"description": "A self-hosted bookmark manager designed to be minimal, fast, and easy to set up.",
"enhanced": true,
"tile_background": "dark",
"icon": "linkding.png"
}
15 changes: 15 additions & 0 deletions Linkding/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>Access Token</label>
{!! Form::text('config[access_token]', null, array('placeholder' => 'Access Token', 'data-config' => 'access_token', 'class' => 'form-control config-item')) !!}
</div>
<div class="input">
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
</div>
</div>

Binary file added Linkding/linkding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Linkding/livestats.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ul class="livestats">
<li>
<span class="title">Bookmarks</span>
@if ($bookmark_count >== 1000)
<strong>{!! $bookmark_count !!}</strong>
@else
<strong class="text-danger">1000+</strong>
@endif
</li>
</ul>