Add sharing to linkding

This commit is contained in:
Alexander Sulfrian 2024-05-21 15:46:45 +02:00
parent 21a6a66337
commit 2c8702954d
6 changed files with 64 additions and 1 deletions

View File

@ -66,6 +66,14 @@ parameters:
name: shaarli_url
value: https://myshaarli.com
section: entry
-
name: share_linkding
value: 1
section: entry
-
name: linkding_url
value: https://linkding.example.com
section: entry
-
name: share_mail
value: 1

View File

@ -0,0 +1 @@
<svg clip-rule="evenodd" fill-rule="evenodd" height="512" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><circle cx="255.0164" cy="254.9236" fill="#5856e0" r="224.78528" stroke-width="1.18"/><g fill="none" stroke="#fff" stroke-width="31.25"><path d="m1244.39 1293.95v199.64s-.81 67.89 74.9 68.88c75.98.99 74.88-68.88 74.88-68.88v-199.64" transform="matrix(.70710678 .70710678 -.70710678 .70710678 284.139117 -1684.198509)"/><path d="m1244.39 1293.95v199.64s-.81 67.89 74.9 68.88c75.98.99 74.88-68.88 74.88-68.88v-199.64" transform="matrix(-.70957074 -.70463421 .70463421 -.70957074 235.113139 2195.434643)"/></g></svg>

After

Width:  |  Height:  |  Size: 688 B

View File

@ -132,6 +132,11 @@ a.icon-image {
background: url("../../_global/img/icons/unmark-icon--black.png") no-repeat center/80%;
}
&.linkding::before {
background: url("../../_global/img/icons/linkding.svg") no-repeat center/80%;
filter: grayscale(1);
}
&.shaarli::before {
background: url("../../_global/img/icons/shaarli.png") no-repeat center/80%;
}

View File

@ -0,0 +1,41 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\Doctrine\WallabagMigration;
/**
* Added the internal setting to share articles to linkding.
*/
final class Version20240521152037 extends WallabagMigration
{
public function up(Schema $schema): void
{
$share = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'share_linkding'");
if (false === $share) {
$this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('share_linkding', 0, 'entry')");
}
$linkding = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url'");
if (false === $linkding) {
$this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('linkding_url', 'https://linkding.example.com', 'entry')");
}
$this->skipIf(false !== $share && false !== $linkding, 'It seems that you already played this migration.');
}
public function down(Schema $schema): void
{
$this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'share_linkding';");
$this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url';");
}
}

View File

@ -138,7 +138,7 @@
</li>
</ul>
</li>
{% if craue_setting('share_public') or craue_setting('share_twitter') or craue_setting('share_shaarli') or craue_setting('share_diaspora') or craue_setting('share_unmark') or craue_setting('share_mail') %}
{% if craue_setting('share_public') or craue_setting('share_twitter') or craue_setting('share_shaarli') or craue_setting('share_diaspora') or craue_setting('share_unmark') or craue_setting('share_linkding') or craue_setting('share_mail') %}
<li class="bold">
<a class="waves-effect collapsible-header">
<i class="material-icons small">share</i>
@ -190,6 +190,13 @@
</a>
</li>
{% endif %}
{% if craue_setting('share_linkding') %}
<li>
<a href="{{ craue_setting('linkding_url') }}/bookmarks/new?url={{ entry.url|url_encode }}" target="_blank" rel="noopener" class="tool icon-image linkding" title="linkding">
<span>linkding</span>
</a>
</li>
{% endif %}
{% if craue_setting('share_mail') %}
<li>
<a href="mailto:?subject={{ entry.title|striptags|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool icon">

View File

@ -16,6 +16,7 @@ share_mail: Enable share by e-mail
share_shaarli: Enable sharing to Shaarli
share_twitter: Enable sharing to Twitter
share_unmark: Enable sharing to Unmark.it
share_linkding: Enable sharing to Linkding
show_printlink: Display a link to print content
wallabag_support_url: Support URL for wallabag
entry: article