Merge pull request #7491 from AlexanderS/feature/share-linkding

Add sharing to linkding
This commit is contained in:
Jérémy Benoist 2024-05-23 09:10:07 +02:00 committed by GitHub
commit 29ccebb1c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 1 deletions

View file

@ -66,6 +66,14 @@ parameters:
name: shaarli_url name: shaarli_url
value: https://myshaarli.com value: https://myshaarli.com
section: entry section: entry
-
name: share_linkding
value: 1
section: entry
-
name: linkding_url
value: https://linkding.example.com
section: entry
- -
name: share_mail name: share_mail
value: 1 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%; 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 { &.shaarli::before {
background: url("../../_global/img/icons/shaarli.png") no-repeat center/80%; 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> </li>
</ul> </ul>
</li> </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"> <li class="bold">
<a class="waves-effect collapsible-header"> <a class="waves-effect collapsible-header">
<i class="material-icons small">share</i> <i class="material-icons small">share</i>
@ -190,6 +190,13 @@
</a> </a>
</li> </li>
{% endif %} {% 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') %} {% if craue_setting('share_mail') %}
<li> <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"> <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_shaarli: Enable sharing to Shaarli
share_twitter: Enable sharing to Twitter share_twitter: Enable sharing to Twitter
share_unmark: Enable sharing to Unmark.it share_unmark: Enable sharing to Unmark.it
share_linkding: Enable sharing to Linkding
show_printlink: Display a link to print content show_printlink: Display a link to print content
wallabag_support_url: Support URL for wallabag wallabag_support_url: Support URL for wallabag
entry: article entry: article