Compare commits
No commits in common. "develop" and "develop" have entirely different histories.
16 changed files with 128 additions and 682 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Name: AT Protocol Connector (Bluesky, Eurosky, Blacksky, ...)
|
||||
* Description: Post via AT Protocol, import timelines and feeds
|
||||
* Name: Bluesky Connector
|
||||
* Description: Post to Bluesky, import timelines and feeds
|
||||
* Version: 1.1
|
||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*
|
||||
|
|
@ -46,7 +46,6 @@ use Friendica\Protocol\Activity;
|
|||
use Friendica\Protocol\ATProtocol;
|
||||
use Friendica\Protocol\Relay;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
const BLUESKY_DEFAULT_POLL_INTERVAL = 10; // given in minutes
|
||||
|
|
@ -82,8 +81,6 @@ function bluesky_check_item_notification(array &$notification_data)
|
|||
return;
|
||||
}
|
||||
|
||||
DI::atProtocol()->setApiForUser($notification_data['uid']);
|
||||
|
||||
$did = DI::atProtocol()->getUserDid($notification_data['uid']);
|
||||
if (empty($did)) {
|
||||
return;
|
||||
|
|
@ -99,16 +96,24 @@ function bluesky_item_by_link(array &$hookData)
|
|||
return;
|
||||
}
|
||||
|
||||
DI::atProtocol()->setApiForUser($hookData['uid']);
|
||||
if (substr($hookData['uri'], 0, 5) != 'at://') {
|
||||
if (!preg_match('#^' . ATProtocol::WEB . '/profile/(.+)/post/(.+)#', $hookData['uri'], $matches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!str_starts_with($hookData['uri'], 'at://')) {
|
||||
$data = ParseUrl::getSiteinfoCached($hookData['uri']);
|
||||
$uri = $data['atprotocol']['uri'] ?? '';
|
||||
$did = DI::atProtocol()->getDid($matches[1]);
|
||||
if (empty($did)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::logger()->debug('Found bluesky post', ['uri' => $hookData['uri'], 'did' => $did, 'cid' => $matches[2]]);
|
||||
|
||||
$uri = 'at://' . $did . '/app.bsky.feed.post/' . $matches[2];
|
||||
} else {
|
||||
$uri = $hookData['uri'];
|
||||
}
|
||||
|
||||
$uri = DI::atpProcessor()->fetchMissingPost($uri, $hookData['uid'], Item::PR_FETCHED, 0, 0, '', false, Conversation::PARCEL_CONNECTOR);
|
||||
$uri = DI::atpProcessor()->fetchMissingPost($uri, $hookData['uid'], Item::PR_FETCHED, 0, 0);
|
||||
DI::logger()->debug('Got post', ['uri' => $uri]);
|
||||
if (!empty($uri)) {
|
||||
$item = Post::selectFirst(['id'], ['uri' => $uri, 'uid' => $hookData['uid']]);
|
||||
|
|
@ -120,22 +125,20 @@ function bluesky_item_by_link(array &$hookData)
|
|||
|
||||
function bluesky_support_follow(array &$data)
|
||||
{
|
||||
if ($data['protocol'] == Protocol::ATPROTO) {
|
||||
if ($data['protocol'] == Protocol::BLUESKY) {
|
||||
$data['result'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function bluesky_follow(array &$hook_data)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($hook_data['uid']);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($hook_data['uid']);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::logger()->debug('Check if contact is AT Protocol', ['data' => $hook_data]);
|
||||
$contact = DBA::selectFirst('contact', [], ['network' => Protocol::ATPROTO, 'nurl' => Strings::normaliseLink($hook_data['url']), 'uid' => [0, $hook_data['uid']]]);
|
||||
DI::logger()->debug('Check if contact is bluesky', ['data' => $hook_data]);
|
||||
$contact = DBA::selectFirst('contact', [], ['network' => Protocol::BLUESKY, 'nurl' => Strings::normaliseLink($hook_data['url']), 'uid' => [0, $hook_data['uid']]]);
|
||||
if (empty($contact)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -161,14 +164,12 @@ function bluesky_follow(array &$hook_data)
|
|||
|
||||
function bluesky_unfollow(array &$hook_data)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($hook_data['uid']);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($hook_data['uid']);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($hook_data['contact']['network'] != Protocol::ATPROTO) {
|
||||
if ($hook_data['contact']['network'] != Protocol::BLUESKY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -184,14 +185,12 @@ function bluesky_unfollow(array &$hook_data)
|
|||
|
||||
function bluesky_block(array &$hook_data)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($hook_data['uid']);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($hook_data['uid']);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($hook_data['contact']['network'] != Protocol::ATPROTO) {
|
||||
if ($hook_data['contact']['network'] != Protocol::BLUESKY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -219,14 +218,12 @@ function bluesky_block(array &$hook_data)
|
|||
|
||||
function bluesky_unblock(array &$hook_data)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($hook_data['uid']);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($hook_data['uid']);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($hook_data['contact']['network'] != Protocol::ATPROTO) {
|
||||
if ($hook_data['contact']['network'] != Protocol::BLUESKY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +243,7 @@ function bluesky_addon_admin(string &$o)
|
|||
|
||||
$o = Renderer::replaceMacros($t, [
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
'$friendica_handles' => ['friendica_handles', DI::l10n()->t('Allow your users to use your hostname for their AT Protocol handles'), DI::config()->get('bluesky', 'friendica_handles'), DI::l10n()->t('Before enabling this option, you have to setup a wildcard domain configuration and you have to enable wildcard requests in your webserver configuration. On Apache this is done by adding "ServerAlias *.%s" to your HTTP configuration. You don\'t need to change the HTTPS configuration.', DI::baseUrl()->getHost())],
|
||||
'$friendica_handles' => ['friendica_handles', DI::l10n()->t('Allow your users to use your hostname for their Bluesky handles'), DI::config()->get('bluesky', 'friendica_handles'), DI::l10n()->t('Before enabling this option, you have to setup a wildcard domain configuration and you have to enable wildcard requests in your webserver configuration. On Apache this is done by adding "ServerAlias *.%s" to your HTTP configuration. You don\'t need to change the HTTPS configuration.', DI::baseUrl()->getHost())],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -261,13 +258,10 @@ function bluesky_settings(array &$data)
|
|||
return;
|
||||
}
|
||||
|
||||
DI::atProtocol()->setApiForUser(DI::userSession()->getLocalUserId());
|
||||
|
||||
$enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post') ?? false;
|
||||
$def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default') ?? false;
|
||||
$pds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'pds');
|
||||
$handle = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'handle');
|
||||
$web = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'web');
|
||||
$did = DI::atProtocol()->getUserDid(DI::userSession()->getLocalUserId());
|
||||
$token = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'access_token');
|
||||
$import = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'import') ?? false;
|
||||
|
|
@ -278,7 +272,7 @@ function bluesky_settings(array &$data)
|
|||
if (DI::config()->get('bluesky', 'friendica_handles')) {
|
||||
$self = User::getById(DI::userSession()->getLocalUserId(), ['nickname']);
|
||||
$host_handle = $self['nickname'] . '.' . DI::baseUrl()->getHost();
|
||||
$friendica_handle = ['bluesky_friendica_handle', DI::l10n()->t('Allow to use %s as your AT Protocol handle.', $host_handle), $custom_handle, DI::l10n()->t('When enabled, you can use %s as your AT Protocol handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select "No DNS Panel". Then select "Verify Text File".', $host_handle, $host_handle)];
|
||||
$friendica_handle = ['bluesky_friendica_handle', DI::l10n()->t('Allow to use %s as your Bluesky handle.', $host_handle), $custom_handle, DI::l10n()->t('When enabled, you can use %s as your Bluesky handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select "No DNS Panel". Then select "Verify Text File".', $host_handle, $host_handle)];
|
||||
if ($custom_handle) {
|
||||
$handle = $host_handle;
|
||||
}
|
||||
|
|
@ -286,31 +280,25 @@ function bluesky_settings(array &$data)
|
|||
$friendica_handle = [];
|
||||
}
|
||||
|
||||
$web_frontend = ['' => 'System Default'];
|
||||
foreach (DI::config()->get('atprotocol', 'frontends') as $key => $frontend) {
|
||||
$web_frontend[$key] = $frontend[0];
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/bluesky/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$enable' => ['bluesky', DI::l10n()->t('Enable AT Protocol Addon'), $enabled],
|
||||
'$bydefault' => ['bluesky_bydefault', DI::l10n()->t('Post via AT Protocol by default'), $def_enabled],
|
||||
'$enable' => ['bluesky', DI::l10n()->t('Enable Bluesky Post Addon'), $enabled],
|
||||
'$bydefault' => ['bluesky_bydefault', DI::l10n()->t('Post to Bluesky by default'), $def_enabled],
|
||||
'$import' => ['bluesky_import', DI::l10n()->t('Import the remote timeline'), $import],
|
||||
'$import_feeds' => ['bluesky_import_feeds', DI::l10n()->t('Import the pinned feeds'), $import_feeds, DI::l10n()->t('When activated, Posts will be imported from all the feeds that you pinned in AT Protocol.')],
|
||||
'$import_feeds' => ['bluesky_import_feeds', DI::l10n()->t('Import the pinned feeds'), $import_feeds, DI::l10n()->t('When activated, Posts will be imported from all the feeds that you pinned in Bluesky.')],
|
||||
'$complete_threads' => ['bluesky_complete_threads', DI::l10n()->t('Complete the threads'), $complete_threads, DI::l10n()->t('When activated, the system fetches additional replies for the posts in the timeline. This leads to more complete threads.')],
|
||||
'$custom_handle' => $friendica_handle,
|
||||
'$pds' => ['bluesky_pds', DI::l10n()->t('Personal Data Server'), $pds, DI::l10n()->t('The personal data server (PDS) is the system that hosts your profile.'), '', 'readonly'],
|
||||
'$handle' => ['bluesky_handle', DI::l10n()->t('AT Protocol handle'), $handle, '', '', $custom_handle ? 'readonly' : ''],
|
||||
'$did' => ['bluesky_did', DI::l10n()->t('AT Protocol DID'), $did, DI::l10n()->t('This is the unique identifier. It will be fetched automatically, when the handle is entered.'), '', 'readonly'],
|
||||
'$password' => ['bluesky_password', DI::l10n()->t('AT Protocol app password'), '', DI::l10n()->t("Please don't add your real password here, but instead create a specific app password in the settings of your AT Protocol system.")],
|
||||
'$web' => ['bluesky_web', DI::l10n()->t('Web front end'), $web, DI::l10n()->t('Choose your preferred external web front end for displaying posts and profiles.'), $web_frontend, ''],
|
||||
'$handle' => ['bluesky_handle', DI::l10n()->t('Bluesky handle'), $handle, '', '', $custom_handle ? 'readonly' : ''],
|
||||
'$did' => ['bluesky_did', DI::l10n()->t('Bluesky DID'), $did, DI::l10n()->t('This is the unique identifier. It will be fetched automatically, when the handle is entered.'), '', 'readonly'],
|
||||
'$password' => ['bluesky_password', DI::l10n()->t('Bluesky app password'), '', DI::l10n()->t("Please don't add your real password here, but instead create a specific app password in the Bluesky settings.")],
|
||||
'$status' => bluesky_get_status($handle, $did, $pds, $token),
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'connector' => 'bluesky',
|
||||
'title' => DI::l10n()->t('AT Protocol (Bluesky, Eurosky, Blacksky, ...) Import/Export'),
|
||||
'image' => 'images/500px-AT_Protocol_logo.png',
|
||||
'title' => DI::l10n()->t('Bluesky Import/Export'),
|
||||
'image' => 'images/bluesky.jpg',
|
||||
'enabled' => $enabled,
|
||||
'html' => $html,
|
||||
];
|
||||
|
|
@ -340,7 +328,7 @@ function bluesky_get_status(string $handle = null, string $did = null, string $p
|
|||
|
||||
switch ($status) {
|
||||
case ATProtocol::STATUS_TOKEN_OK:
|
||||
return DI::l10n()->t("You are authenticated to the AT Protocol PDS. For security reasons the password isn't stored.");
|
||||
return DI::l10n()->t("You are authenticated to Bluesky. For security reasons the password isn't stored.");
|
||||
case ATProtocol::STATUS_SUCCESS:
|
||||
return DI::l10n()->t('The communication with the personal data server service (PDS) is established.');
|
||||
case ATProtocol::STATUS_API_FAIL;
|
||||
|
|
@ -362,8 +350,6 @@ function bluesky_settings_post(array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
DI::atProtocol()->setApiForUser(DI::userSession()->getLocalUserId());
|
||||
|
||||
$old_pds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'pds');
|
||||
$old_handle = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'handle');
|
||||
$old_did = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'did');
|
||||
|
|
@ -377,11 +363,6 @@ function bluesky_settings_post(array &$b)
|
|||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import_feeds', intval($_POST['bluesky_import_feeds']));
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'complete_threads', intval($_POST['bluesky_complete_threads']));
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'friendica_handle', intval($_POST['bluesky_friendica_handle'] ?? false));
|
||||
if ($_POST['bluesky_web'] <> '') {
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'web', $_POST['bluesky_web']);
|
||||
} else {
|
||||
DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'web');
|
||||
}
|
||||
|
||||
if (!empty($handle)) {
|
||||
$did = DI::atProtocol()->getUserDid(DI::userSession()->getLocalUserId(), empty($old_did) || $old_handle != $handle);
|
||||
|
|
@ -420,7 +401,7 @@ function bluesky_jot_nets(array &$jotnets_fields)
|
|||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'bluesky_enable',
|
||||
DI::l10n()->t('Post via the AT Protocol'),
|
||||
DI::l10n()->t('Post to Bluesky'),
|
||||
DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default')
|
||||
]
|
||||
];
|
||||
|
|
@ -454,8 +435,6 @@ function bluesky_cron()
|
|||
|
||||
$pconfigs = DBA::selectToArray('pconfig', [], ["`cat` = ? AND `k` IN (?, ?) AND `v`", 'bluesky', 'import', 'import_feeds']);
|
||||
foreach ($pconfigs as $pconfig) {
|
||||
DI::atProtocol()->setApiForUser($pconfig['uid']);
|
||||
|
||||
if (empty(DI::atProtocol()->getUserDid($pconfig['uid']))) {
|
||||
DI::logger()->debug('User has got no valid DID', ['uid' => $pconfig['uid']]);
|
||||
continue;
|
||||
|
|
@ -499,7 +478,7 @@ function bluesky_cron()
|
|||
$last_clean = DI::keyValue()->get('bluesky_last_clean');
|
||||
if (empty($last_clean) || ($last_clean + 86400 < time())) {
|
||||
DI::logger()->notice('Start contact cleanup');
|
||||
$contacts = DBA::select('account-user-view', ['id', 'pid'], ["`network` = ? AND `uid` != ? AND `rel` = ?", Protocol::ATPROTO, 0, Contact::NOTHING]);
|
||||
$contacts = DBA::select('account-user-view', ['id', 'pid'], ["`network` = ? AND `uid` != ? AND `rel` = ?", Protocol::BLUESKY, 0, Contact::NOTHING]);
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
Worker::add(Worker::PRIORITY_LOW, 'MergeContact', $contact['pid'], $contact['id'], 0);
|
||||
}
|
||||
|
|
@ -526,9 +505,9 @@ function bluesky_hook_fork(array &$b)
|
|||
}
|
||||
|
||||
if (DI::pConfig()->get($post['uid'], 'bluesky', 'import')) {
|
||||
// Don't post if it isn't a reply to an AT Protocol post
|
||||
if (($post['gravity'] != Item::GRAVITY_PARENT) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::ATPROTO])) {
|
||||
DI::logger()->notice('No AT Protocol parent found', ['item' => $post['id']]);
|
||||
// Don't post if it isn't a reply to a bluesky post
|
||||
if (($post['gravity'] != Item::GRAVITY_PARENT) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::BLUESKY])) {
|
||||
DI::logger()->notice('No bluesky parent found', ['item' => $post['id']]);
|
||||
$b['execute'] = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -570,8 +549,6 @@ function bluesky_post_local(array &$b)
|
|||
|
||||
function bluesky_send(array &$b)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($b['uid']);
|
||||
|
||||
if (($b['created'] !== $b['edited']) && !$b['deleted']) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -586,7 +563,7 @@ function bluesky_send(array &$b)
|
|||
if ($b['deleted']) {
|
||||
$uri = DI::atpProcessor()->getUriClass($b['uri']);
|
||||
if (empty($uri)) {
|
||||
DI::logger()->debug('Not an AT Protocol post', ['uri' => $b['uri']]);
|
||||
DI::logger()->debug('Not a bluesky post', ['uri' => $b['uri']]);
|
||||
return;
|
||||
}
|
||||
bluesky_delete_post($b['uri'], $b['uid']);
|
||||
|
|
@ -597,7 +574,7 @@ function bluesky_send(array &$b)
|
|||
$parent = DI::atpProcessor()->getUriClass($b['thr-parent']);
|
||||
|
||||
if (empty($root) || empty($parent)) {
|
||||
DI::logger()->debug('No AT Protocol post', ['parent' => $b['parent'], 'thr-parent' => $b['thr-parent']]);
|
||||
DI::logger()->debug('No bluesky post', ['parent' => $b['parent'], 'thr-parent' => $b['thr-parent']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -616,11 +593,9 @@ function bluesky_send(array &$b)
|
|||
bluesky_create_post($b);
|
||||
}
|
||||
|
||||
function bluesky_create_activity(array $item, ?stdClass $parent = null)
|
||||
function bluesky_create_activity(array $item, stdClass $parent = null)
|
||||
{
|
||||
$uid = $item['uid'];
|
||||
DI::atProtocol()->setApiForUser($uid);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($uid);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
|
|
@ -672,8 +647,6 @@ function bluesky_create_activity(array $item, ?stdClass $parent = null)
|
|||
function bluesky_create_post(array $item, stdClass $root = null, stdClass $parent = null)
|
||||
{
|
||||
$uid = $item['uid'];
|
||||
DI::atProtocol()->setApiForUser($uid);
|
||||
|
||||
$token = DI::atProtocol()->getUserToken($uid);
|
||||
if (empty($token)) {
|
||||
return;
|
||||
|
|
@ -708,7 +681,7 @@ function bluesky_create_post(array $item, stdClass $root = null, stdClass $paren
|
|||
$urls = bluesky_get_urls($item['body']);
|
||||
$item['body'] = $urls['body'];
|
||||
|
||||
$msg = Plaintext::getPost($item, 300, false, BBCode::ATPROTOCOL);
|
||||
$msg = Plaintext::getPost($item, 300, false, BBCode::BLUESKY);
|
||||
foreach ($msg['parts'] as $key => $part) {
|
||||
|
||||
$facets = bluesky_get_facets($part, $urls['urls']);
|
||||
|
|
@ -973,7 +946,7 @@ function bluesky_upload_blob(int $uid, array $photo): ?stdClass
|
|||
return null;
|
||||
}
|
||||
|
||||
Item::incrementOutbound(Protocol::ATPROTO);
|
||||
Item::incrementOutbound(Protocol::BLUESKY);
|
||||
DI::logger()->debug('Uploaded blob', ['return' => $data, 'uid' => $uid, 'retrial' => $retrial, 'height' => $new_height, 'width' => $new_width, 'size' => $new_size, 'orig-height' => $height, 'orig-width' => $width, 'orig-size' => $size]);
|
||||
return $data->blob;
|
||||
}
|
||||
|
|
@ -991,8 +964,6 @@ function bluesky_delete_post(string $uri, int $uid)
|
|||
|
||||
function bluesky_fetch_timeline(int $uid)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($uid);
|
||||
|
||||
$data = DI::atProtocol()->XRPCGet('app.bsky.feed.getTimeline', [], $uid);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
|
|
@ -1049,7 +1020,7 @@ function bluesky_process_reason(stdClass $reason, string $uri, int $uid)
|
|||
$contact = DI::atpActor()->getContactByDID($reason->by->did, $uid, 0);
|
||||
|
||||
$item = [
|
||||
'network' => Protocol::ATPROTO,
|
||||
'network' => Protocol::BLUESKY,
|
||||
'protocol' => Conversation::PARCEL_CONNECTOR,
|
||||
'uid' => $uid,
|
||||
'wall' => false,
|
||||
|
|
@ -1086,8 +1057,6 @@ function bluesky_process_reason(stdClass $reason, string $uri, int $uid)
|
|||
|
||||
function bluesky_fetch_notifications(int $uid)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($uid);
|
||||
|
||||
$data = DI::atProtocol()->XRPCGet('app.bsky.notification.listNotifications', [], $uid);
|
||||
if (empty($data->notifications)) {
|
||||
return;
|
||||
|
|
@ -1161,8 +1130,6 @@ function bluesky_fetch_notifications(int $uid)
|
|||
|
||||
function bluesky_fetch_feed(int $uid, string $feed)
|
||||
{
|
||||
DI::atProtocol()->setApiForUser($uid);
|
||||
|
||||
$data = DI::atProtocol()->XRPCGet('app.bsky.feed.getFeed', ['feed' => $feed], $uid);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-03-18 13:20+0000\n"
|
||||
"POT-Creation-Date: 2024-09-29 18:16+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,126 +17,117 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: bluesky.php:248
|
||||
#: bluesky.php:335
|
||||
msgid "Save Settings"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:249
|
||||
msgid "Allow your users to use your hostname for their AT Protocol handles"
|
||||
#: bluesky.php:336
|
||||
msgid "Allow your users to use your hostname for their Bluesky handles"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:249
|
||||
#: bluesky.php:336
|
||||
#, php-format
|
||||
msgid "Before enabling this option, you have to setup a wildcard domain configuration and you have to enable wildcard requests in your webserver configuration. On Apache this is done by adding \"ServerAlias *.%s\" to your HTTP configuration. You don't need to change the HTTPS configuration."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:281
|
||||
#: bluesky.php:365
|
||||
#, php-format
|
||||
msgid "Allow to use %s as your AT Protocol handle."
|
||||
msgid "Allow to use %s as your Bluesky handle."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:281
|
||||
#: bluesky.php:365
|
||||
#, php-format
|
||||
msgid "When enabled, you can use %s as your AT Protocol handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select \"No DNS Panel\". Then select \"Verify Text File\"."
|
||||
msgid "When enabled, you can use %s as your Bluesky handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select \"No DNS Panel\". Then select \"Verify Text File\"."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:298
|
||||
msgid "Enable AT Protocol Addon"
|
||||
#: bluesky.php:375
|
||||
msgid "Enable Bluesky Post Addon"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:299
|
||||
msgid "Post via AT Protocol by default"
|
||||
#: bluesky.php:376
|
||||
msgid "Post to Bluesky by default"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:300
|
||||
#: bluesky.php:377
|
||||
msgid "Import the remote timeline"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:301
|
||||
#: bluesky.php:378
|
||||
msgid "Import the pinned feeds"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:301
|
||||
msgid "When activated, Posts will be imported from all the feeds that you pinned in AT Protocol."
|
||||
#: bluesky.php:378
|
||||
msgid "When activated, Posts will be imported from all the feeds that you pinned in Bluesky."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:302
|
||||
#: bluesky.php:379
|
||||
msgid "Complete the threads"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:302
|
||||
#: bluesky.php:379
|
||||
msgid "When activated, the system fetches additional replies for the posts in the timeline. This leads to more complete threads."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:304
|
||||
#: bluesky.php:381
|
||||
msgid "Personal Data Server"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:304
|
||||
#: bluesky.php:381
|
||||
msgid "The personal data server (PDS) is the system that hosts your profile."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:305
|
||||
msgid "AT Protocol handle"
|
||||
#: bluesky.php:382
|
||||
msgid "Bluesky handle"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:306
|
||||
msgid "AT Protocol DID"
|
||||
#: bluesky.php:383
|
||||
msgid "Bluesky DID"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:306
|
||||
#: bluesky.php:383
|
||||
msgid "This is the unique identifier. It will be fetched automatically, when the handle is entered."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:307
|
||||
msgid "AT Protocol app password"
|
||||
#: bluesky.php:384
|
||||
msgid "Bluesky app password"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:307
|
||||
msgid "Please don't add your real password here, but instead create a specific app password in the settings of your AT Protocol system."
|
||||
#: bluesky.php:384
|
||||
msgid "Please don't add your real password here, but instead create a specific app password in the Bluesky settings."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:308
|
||||
msgid "Web front end"
|
||||
#: bluesky.php:390
|
||||
msgid "Bluesky Import/Export"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:308
|
||||
msgid "Choose your preferred external web front end for displaying posts and profiles."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:314
|
||||
msgid "AT Protocol (Bluesky, Eurosky, Blacksky, ...) Import/Export"
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:324
|
||||
#: bluesky.php:400
|
||||
msgid "You are not authenticated. Please enter your handle and the app password."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:345
|
||||
msgid "You are authenticated to the AT Protocol PDS. For security reasons the password isn't stored."
|
||||
#: bluesky.php:420
|
||||
msgid "You are authenticated to Bluesky. For security reasons the password isn't stored."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:347
|
||||
#: bluesky.php:422
|
||||
msgid "The communication with the personal data server service (PDS) is established."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:349
|
||||
#, php-format
|
||||
msgid "Communication issues with the personal data server service (PDS): %s"
|
||||
#: bluesky.php:424
|
||||
msgid "Communication issues with the personal data server service (PDS)."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:351
|
||||
#: bluesky.php:426
|
||||
msgid "The DID for the provided handle could not be detected. Please check if you entered the correct handle."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:353
|
||||
#: bluesky.php:428
|
||||
msgid "The personal data server service (PDS) could not be detected."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:355
|
||||
#: bluesky.php:430
|
||||
msgid "The authentication with the provided handle and password failed. Please check if you entered the correct password."
|
||||
msgstr ""
|
||||
|
||||
#: bluesky.php:425
|
||||
msgid "Post via the AT Protocol"
|
||||
#: bluesky.php:492
|
||||
msgid "Post to Bluesky"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -10,5 +10,4 @@
|
|||
{{include file="field_input.tpl" field=$pds}}
|
||||
{{include file="field_input.tpl" field=$handle}}
|
||||
{{include file="field_input.tpl" field=$did}}
|
||||
{{include file="field_input.tpl" field=$password}}
|
||||
{{include file="field_select.tpl" field=$web}}
|
||||
{{include file="field_input.tpl" field=$password}}
|
||||
|
|
@ -74,7 +74,6 @@ function irc_content()
|
|||
{
|
||||
$baseurl = DI::baseUrl() . '/addon/irc';
|
||||
$o = '';
|
||||
$usernick = '';
|
||||
|
||||
/* set the list of popular channels */
|
||||
if (DI::userSession()->getLocalUserId()) {
|
||||
|
|
@ -82,7 +81,6 @@ function irc_content()
|
|||
if (!$sitechats) {
|
||||
$sitechats = DI::config()->get('irc', 'sitechats');
|
||||
}
|
||||
$usernick = "nick=" . DI::userSession()->getLocalUserNickname() . "&";
|
||||
} else {
|
||||
$sitechats = DI::config()->get('irc','sitechats');
|
||||
}
|
||||
|
|
@ -119,7 +117,7 @@ function irc_content()
|
|||
$o .= <<< EOT
|
||||
<h2>IRC chat</h2>
|
||||
<p><a href="https://tldp.org/HOWTO/IRC/beginners.html" target="_blank" rel="noopener noreferrer">A beginner's guide to using IRC. [en]</a></p>
|
||||
<iframe src="//web.libera.chat?{$usernick}channels=$channels" style="width:100%; max-width:900px; height: 600px;"></iframe>
|
||||
<iframe src="//web.libera.chat?channels=$channels" style="width:100%; max-width:900px; height: 600px;"></iframe>
|
||||
EOT;
|
||||
|
||||
return $o;
|
||||
|
|
|
|||
|
|
@ -166,35 +166,7 @@ function mailstream_send_hook(array $data)
|
|||
return;
|
||||
}
|
||||
|
||||
$author = DBA::selectFirst('contact', ['nick', 'blocked', 'uri-id'], ['id' => $data['author-id'], 'self' => false]);
|
||||
if (!DBA::isResult($author)) {
|
||||
DI::logger()->error('could not find author', ['guid' => $item['guid'], 'author-id' => $data['author-id']]);
|
||||
return;
|
||||
}
|
||||
if ($author['blocked']) {
|
||||
DI::logger()->info('author is blocked', ['guid' => $item['guid'], 'author-id' => $data['author-id']]);
|
||||
return;
|
||||
}
|
||||
$collapsed = false;
|
||||
$user_contact = DBA::selectFirst('user-contact', ['cid', 'blocked', 'ignored', 'collapsed'], ['uid' => $item['uid'], 'uri-id' => $item['author-uri-id']]);
|
||||
if (!DBA::isResult($user_contact)) {
|
||||
$user_contact = DBA::selectFirst('user-contact', ['cid', 'blocked', 'ignored', 'collapsed'], ['uid' => $item['uid'], 'cid' => $item['author-id']]);
|
||||
}
|
||||
if (DBA::isResult($user_contact)) {
|
||||
if ($user_contact['blocked']) {
|
||||
DI::logger()->info('author is blocked', ['guid' => $item['guid'], 'cid' => $user_contact['cid']]);
|
||||
return;
|
||||
}
|
||||
if ($user_contact['ignored']) {
|
||||
DI::logger()->info('author is ignored', ['guid' => $item['guid'], 'cid' => $user_contact['cid']]);
|
||||
return;
|
||||
}
|
||||
if ($user_contact['collapsed']) {
|
||||
$collapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mailstream_send($data['message_id'], $item, $user, $collapsed)) {
|
||||
if (!mailstream_send($data['message_id'], $item, $user)) {
|
||||
DI::logger()->debug('send failed, will retry', $data);
|
||||
if (!Worker::defer()) {
|
||||
DI::logger()->error('failed and could not defer', $data);
|
||||
|
|
@ -248,7 +220,6 @@ function mailstream_post_hook(array &$item)
|
|||
$send_hook_data = [
|
||||
'uid' => $item['uid'],
|
||||
'contact-id' => $item['contact-id'],
|
||||
'author-id' => $item['author-id'],
|
||||
'uri' => $item['uri'],
|
||||
'message_id' => $message_id,
|
||||
'tries' => 0,
|
||||
|
|
@ -435,11 +406,10 @@ function mailstream_subject(array $item): string
|
|||
* @param string $message_id ID of the message (RFC 1036)
|
||||
* @param array $item content of the item
|
||||
* @param array $user results from the user table
|
||||
* @param bool $collapsed true if the content should be hidden
|
||||
*
|
||||
* @return bool True if this message has been completed. False if it should be retried.
|
||||
*/
|
||||
function mailstream_send(string $message_id, array $item, array $user, bool $collapsed): bool
|
||||
function mailstream_send(string $message_id, array $item, array $user): bool
|
||||
{
|
||||
if (!is_array($item)) {
|
||||
DI::logger()->error('item is empty', ['message_id' => $message_id]);
|
||||
|
|
@ -457,16 +427,10 @@ function mailstream_send(string $message_id, array $item, array $user, bool $col
|
|||
|
||||
require_once(dirname(__file__) . '/phpmailer/class.phpmailer.php');
|
||||
|
||||
if ($collapsed) {
|
||||
$item['body'] = DI::l10n()->t('Content from %s is collapsed', $item['author-name']);
|
||||
} else {
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
}
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
|
||||
$attachments = [];
|
||||
if (!$collapsed) {
|
||||
mailstream_do_images($item, $attachments);
|
||||
}
|
||||
mailstream_do_images($item, $attachments);
|
||||
$frommail = DI::config()->get('mailstream', 'frommail');
|
||||
if ($frommail == '') {
|
||||
$frommail = 'friendica@localhost.local';
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
# QuickPhoto Addon for Friendica
|
||||
|
||||
QuickPhoto is a Friendica addon that simplifies working with images in the editor. It automatically replaces long, cumbersome BBCode structures with a compact shorthand notation, without affecting functionality or compatibility.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **Automatic Simplification:** Converts "monster BBCodes" like `[url=...][img=...]...[/img][/url]` instantly into the handy format `[img]|filename description[/img]`.
|
||||
- **Intelligent Reconstruction:** Before submitting or previewing, the shorthand code is quickly converted back into the original, valid Friendica BBCode.
|
||||
- **Real-Time Processing:** Responds immediately to drag & drop, copy & paste, and inserting images via editor buttons.
|
||||
- **Focus Safety:** Cursor management ensures the focus remains stable during automatic conversion while typing.
|
||||
- **Maximum Compatibility:** Supports both the standard Jot editor and the Compose module, as well as reply fields.
|
||||
- **Local Cache:** Image data is securely stored in the browser's localStorage and automatically cleared after 12 hours.
|
||||
|
||||
---
|
||||
|
||||
## How It Works
|
||||
|
||||
The addon operates in a hybrid manner:
|
||||
|
||||
- **Frontend:** A JavaScript watcher scans textareas and simplifies complex image links for better readability while writing.
|
||||
- **Interface:** It integrates deeply with Friendica's jQuery functions to ensure that preview and save functions always receive the correct original data.
|
||||
- **Events:** By intercepting submit and preview clicks, it guarantees that shorthand codes are never sent to the server in a format it cannot interpret.
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
1. Create a folder named `quickphoto` in the `addon/` directory of your Friendica installation.
|
||||
2. Place the file `quickphoto.php` in this folder.
|
||||
3. Place the file `quickphoto.js` in the same folder.
|
||||
4. Enable the addon in the Friendica administration area under **Addons**.
|
||||
|
||||
---
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024-2026 Friendica Project & Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# ADDON quickphoto
|
||||
# Copyright (C)
|
||||
# This file is distributed under the same license as the Friendica quickphoto addon package.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-03-07 10:18+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: quickphoto.php:18
|
||||
msgid "Image description"
|
||||
msgstr ""
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
(function() {
|
||||
const monsterPattern = /\[url=(.*?)\]\[img=(.*?)\](.*?)\[\/img\]\[\/url\]/gi;
|
||||
let throttleTimer;
|
||||
|
||||
const i18nDesc = (window.qp_i18n && window.qp_i18n.imageDesc) ? window.qp_i18n.imageDesc : "Image description";
|
||||
|
||||
const cleanupOldEntries = () => {
|
||||
const now = Date.now();
|
||||
const twelveHours = 12 * 60 * 60 * 1000;
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i);
|
||||
if (key && key.startsWith('qp_')) {
|
||||
try {
|
||||
const data = JSON.parse(localStorage.getItem(key));
|
||||
if (data && data.timestamp && (now - data.timestamp > twelveHours)) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
} catch (e) { localStorage.removeItem(key); }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const simplify = (text) => {
|
||||
if (!text || !text.includes('[url=')) return text;
|
||||
return text.replace(monsterPattern, (match, urlPart, imgPart, existingDesc) => {
|
||||
const fileName = imgPart.split('/').pop();
|
||||
const storageKey = `qp_${fileName}`;
|
||||
|
||||
localStorage.setItem(storageKey, JSON.stringify({
|
||||
url: urlPart,
|
||||
img: imgPart,
|
||||
timestamp: Date.now()
|
||||
}));
|
||||
|
||||
let userDesc = existingDesc.trim() || i18nDesc;
|
||||
return `[img]${fileName}|${userDesc}[/img]`;
|
||||
});
|
||||
};
|
||||
|
||||
const reconstruct = (text) => {
|
||||
if (!text || !text.includes('[img]')) return text;
|
||||
return text.replace(/\[img\](.*?)\|(.*?)\[\/img\]/g, (match, fileName, desc) => {
|
||||
const data = localStorage.getItem(`qp_${fileName}`);
|
||||
if (data) {
|
||||
const parsed = JSON.parse(data);
|
||||
const finalDesc = (desc === i18nDesc) ? "" : desc;
|
||||
return `[url=${parsed.url}][img=${parsed.img}]${finalDesc}[/img][/url]`;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
};
|
||||
|
||||
const applySimplify = (textarea) => {
|
||||
if (!textarea || !textarea.value || !textarea.value.includes('[/img]')) return;
|
||||
|
||||
(window.requestIdleCallback || function(cb) { return setTimeout(cb, 1); })(() => {
|
||||
const current = textarea.value;
|
||||
const simple = simplify(current);
|
||||
if (current !== simple) {
|
||||
const start = textarea.selectionStart;
|
||||
const end = textarea.selectionEnd;
|
||||
textarea.value = simple;
|
||||
textarea.setSelectionRange(start, end);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (typeof jQuery !== 'undefined') {
|
||||
const originalVal = jQuery.fn.val;
|
||||
jQuery.fn.val = function(value) {
|
||||
if (arguments.length === 0 && this.is('textarea')) {
|
||||
return reconstruct(originalVal.call(this));
|
||||
}
|
||||
if (arguments.length > 0 && this.is('textarea')) {
|
||||
return originalVal.call(this, simplify(value));
|
||||
}
|
||||
return originalVal.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
document.addEventListener('drop', (e) => {
|
||||
if (e.target.tagName === 'TEXTAREA') {
|
||||
setTimeout(() => applySimplify(e.target), 150);
|
||||
}
|
||||
}, true);
|
||||
|
||||
document.addEventListener('input', (e) => {
|
||||
if (e.target.tagName === 'TEXTAREA') {
|
||||
clearTimeout(throttleTimer);
|
||||
throttleTimer = setTimeout(() => applySimplify(e.target), 500);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
const btn = e.target.closest(
|
||||
'#wall-submit-preview, #profile-jot-submit, #wall-submit-submit, #jot-submit, ' +
|
||||
'[id^="comment-edit-submit-"], [id^="comment-edit-preview-link-"]'
|
||||
);
|
||||
|
||||
if (btn) {
|
||||
const textareas = document.querySelectorAll('textarea');
|
||||
if (textareas.length > 0) {
|
||||
textareas.forEach(textarea => {
|
||||
textarea.value = reconstruct(textarea.value);
|
||||
if (btn.id.includes('preview')) {
|
||||
setTimeout(() => applySimplify(textarea), 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
setInterval(() => {
|
||||
if (document.hidden) return;
|
||||
const textareas = document.querySelectorAll('textarea');
|
||||
if (textareas.length === 0) return;
|
||||
|
||||
textareas.forEach(textarea => {
|
||||
if (textarea.offsetParent !== null) {
|
||||
applySimplify(textarea);
|
||||
}
|
||||
});
|
||||
}, 2500);
|
||||
|
||||
cleanupOldEntries();
|
||||
})();
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Name: QuickPhoto
|
||||
* Description: Replaces the BBCode for inserted images and provides a placeholder for image descriptions.
|
||||
* Version: 1.2
|
||||
* Author: Matthias Ebers <https://loma.ml/profile/feb>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
function quickphoto_install() {
|
||||
Hook::register('page_header', 'addon/quickphoto/quickphoto.php', 'quickphoto_header');
|
||||
Hook::register('post_post', 'addon/quickphoto/quickphoto.php', 'quickphoto_post_hook');
|
||||
}
|
||||
|
||||
function quickphoto_header(&$header) {
|
||||
$desc_label = DI::l10n()->t('Image description');
|
||||
|
||||
$js_label = addslashes($desc_label);
|
||||
|
||||
$header .= "\n" . '<script type="text/javascript">var qp_i18n = { imageDesc: "' . $js_label . '" };</script>';
|
||||
$header .= "\n" . '<script type="text/javascript" src="/addon/quickphoto/quickphoto.js?v=5.1"></script>' . "\n";
|
||||
}
|
||||
|
||||
function quickphoto_post_hook(&$item) {
|
||||
// Placeholder
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Name: Smileybutton
|
||||
* Description: Adds a smileybutton to the Inputbox
|
||||
* Version: 1.1
|
||||
* Version: 1.0
|
||||
* Author: Johannes Schwab <https://friendica.jschwab.org/profile/ddorian>
|
||||
* Maintainer: Hypolite Petovan <https://friendica.mrpetovan.com/profile/hypolite>
|
||||
*/
|
||||
|
|
@ -18,9 +18,14 @@ function smileybutton_install()
|
|||
|
||||
function smileybutton_jot_tool(string &$body)
|
||||
{
|
||||
// this plugin may have smilies mobile devices do not have, disable for mobile by uncommenting return below
|
||||
// Disable if theme is quattro
|
||||
if (DI::appHelper()->getCurrentTheme() == 'quattro') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable for mobile because they have a smiley key of their own
|
||||
if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
|
||||
$texts = [
|
||||
|
|
@ -80,12 +85,12 @@ function smileybutton_jot_tool(string &$body)
|
|||
Hook::callAll('smilie', $params);
|
||||
|
||||
//Generate html for smiley list
|
||||
$s = '<div class="smiley-preview">';
|
||||
$s = '<table class="smiley-preview"><tr>';
|
||||
for ($x = 0; $x < count($params['texts']); $x++) {
|
||||
$icon = $params['icons'][$x];
|
||||
$s .= '<span onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')">' . $icon . '</span>';
|
||||
$s .= '<td onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')">' . $icon . '</td>';
|
||||
if (($x + 1) % (floor(sqrt(count($params['texts']))) + 1) == 0) {
|
||||
$s .= '</div>';
|
||||
$s .= '</tr><tr>';
|
||||
}
|
||||
}
|
||||
$s .= '</tr></table>';
|
||||
|
|
@ -107,7 +112,7 @@ function smileybutton_jot_tool(string &$body)
|
|||
$image_url = DI::baseUrl() . '/' . $image;
|
||||
|
||||
//Add the hmtl and script to the page
|
||||
$body .= <<< EOT
|
||||
$body = <<< EOT
|
||||
<div id="profile-smiley-wrapper">
|
||||
<button type="button" class="btn btn-link smiley_button" onclick="toggle_smileybutton()"><img src="$image_url" alt="smiley"></button>
|
||||
<div id="smileybutton">
|
||||
|
|
|
|||
|
|
@ -1,14 +1,3 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
#profile-smiley-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
|
@ -22,36 +11,15 @@
|
|||
width: 18px;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
table.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
table.smiley-preview {
|
||||
border: 1px solid #AAAAAA;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
table.smiley-preview td {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#profile-smiley-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
|
@ -29,41 +17,21 @@
|
|||
background: none;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
table.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
table.smiley-preview {
|
||||
border: 1px solid #AAAAAA;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
left: auto;
|
||||
left: 285px;
|
||||
top: -36px;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
table.smiley-preview td {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,80 +1,29 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#profile-smiley-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#smileybutton {
|
||||
display: none;
|
||||
position: fixed;
|
||||
background-color: #FFF;
|
||||
width: auto;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
}
|
||||
.jotplugins #smileybutton {
|
||||
position: absolute;
|
||||
}
|
||||
/* image does not work with Frio schemes use icon font */
|
||||
.smiley_button {
|
||||
-webkit-box-shadow: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.smiley_button > img {
|
||||
display: none;
|
||||
}
|
||||
.smiley_button::before {
|
||||
content: '\f055';
|
||||
font-family: ForkAwesome;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
.smiley_button > img {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
table.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
border: none;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
table.smiley-preview {
|
||||
border: 1px solid #AAAAAA;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
table.smiley-preview td {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#profile-smiley-wrapper > .btn-link {
|
||||
position: relative;
|
||||
display: block;
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
#profile-smiley-wrapper {
|
||||
display: block;
|
||||
margin-bottom: -100px;
|
||||
}
|
||||
|
||||
#smileybutton {
|
||||
display: none;
|
||||
position: absolute;
|
||||
max-width: 770px;
|
||||
z-index: 99;
|
||||
background-color: white;
|
||||
}
|
||||
.smiley_button {
|
||||
height: 42px;
|
||||
}
|
||||
.smiley_button > img {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
border: 1px solid #AAAAAA;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
@ -1,80 +1,34 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
#profile-jot-plugin-wrapper {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#profile-smiley-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#smileybutton {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #FFF;
|
||||
width: auto;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
z-index: 99;
|
||||
-webkit-box-shadow: 0 0 5px rgba(0,0,0,.7);
|
||||
box-shadow: 0 0 5px rgba(0,0,0,.7);
|
||||
}
|
||||
.jotplugins #smileybutton {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.smiley_button > img {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
position: relative;
|
||||
left: 0px;
|
||||
left: -330px;
|
||||
margin: 4px;
|
||||
-moz-border-radius: 0px;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
table.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
border: none;
|
||||
table.smiley-preview {
|
||||
border: 1px solid #AAAAAA;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin: 5px;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
table.smiley-preview td {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
/* fix positioning if more than one jot tool */
|
||||
.jotplugins > div,
|
||||
#profile-jot-plugin-wrapper > div {
|
||||
float: left;
|
||||
}
|
||||
.jotplugins::after,
|
||||
#profile-jot-plugin-wrapper::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#profile-smiley-wrapper {
|
||||
float: left;
|
||||
margin-left: 15px;
|
||||
|
|
@ -45,37 +33,17 @@
|
|||
margin-right: 18px;
|
||||
}
|
||||
|
||||
div.smiley-preview {
|
||||
table.smiley-preview {
|
||||
background-color: #FFF;
|
||||
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.7);
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.smiley-preview img.smiley {
|
||||
table.smiley-preview img.smiley {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
cursor: pointer;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div.smiley-preview > span {
|
||||
table.smiley-preview td {
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.smiley-preview > span:hover,
|
||||
div.smiley-preview > span:focus {
|
||||
background-color: rgba(0,0,0,.1);
|
||||
}
|
||||
div.smiley-preview::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue