mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 08:14:25 +02:00
Merge remote-tracking branch 'upstream/develop' into api
This commit is contained in:
commit
0364972242
11 changed files with 113 additions and 80 deletions
|
@ -79,7 +79,8 @@ class Summary extends BaseAdmin
|
|||
// Check if github.com/friendica/stable/VERSION is higher then
|
||||
// the local version of Friendica. Check is opt-in, source may be stable or develop branch
|
||||
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
$gitversion = DI::config()->get('system', 'git_friendica_version');
|
||||
$gitversion = DI::keyValue()->get('git_friendica_version') ?? '';
|
||||
|
||||
if (version_compare(App::VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion);
|
||||
}
|
||||
|
|
|
@ -71,17 +71,17 @@ class Statuses extends BaseApi
|
|||
}
|
||||
|
||||
// The imput is defined as text. So we can use Markdown for some enhancements
|
||||
$item = ['body' => Markdown::toBBCode($request['status']), 'app' => $this->getApp()];
|
||||
$item = ['body' => Markdown::toBBCode($request['status']), 'app' => $this->getApp(), 'title' => ''];
|
||||
|
||||
if (!empty($request['language'])) {
|
||||
$item['language'] = json_encode([$request['language'] => 1]);
|
||||
}
|
||||
|
||||
if (!empty($request['spoiler_text'])) {
|
||||
if ($request['in_reply_to_id'] != $post['uri-id']) {
|
||||
$item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];
|
||||
} else {
|
||||
if (($request['in_reply_to_id'] == $post['uri-id']) && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) {
|
||||
$item['title'] = $request['spoiler_text'];
|
||||
} else {
|
||||
$item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,7 @@ class Statuses extends BaseApi
|
|||
$item['verb'] = Activity::POST;
|
||||
$item['contact-id'] = $owner['id'];
|
||||
$item['author-id'] = $item['owner-id'] = Contact::getPublicIdByUserId($uid);
|
||||
$item['title'] = '';
|
||||
$item['body'] = $body;
|
||||
$item['app'] = $this->getApp();
|
||||
|
||||
|
@ -187,13 +188,19 @@ class Statuses extends BaseApi
|
|||
$item['thr-parent'] = $parent['uri'];
|
||||
$item['gravity'] = Item::GRAVITY_COMMENT;
|
||||
$item['object-type'] = Activity\ObjectType::COMMENT;
|
||||
$item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];
|
||||
} else {
|
||||
self::checkThrottleLimit();
|
||||
|
||||
$item['gravity'] = Item::GRAVITY_PARENT;
|
||||
$item['object-type'] = Activity\ObjectType::NOTE;
|
||||
$item['title'] = $request['spoiler_text'];
|
||||
}
|
||||
|
||||
if (!empty($request['spoiler_text'])) {
|
||||
if (!$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) {
|
||||
$item['title'] = $request['spoiler_text'];
|
||||
} else {
|
||||
$item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];
|
||||
}
|
||||
}
|
||||
|
||||
$item = DI::contentItem()->expandTags($item, $request['visibility'] == 'direct');
|
||||
|
|
|
@ -60,7 +60,7 @@ class Token extends BaseApi
|
|||
$authorization = $_SERVER['REDIRECT_REMOTE_USER'] ?? '';
|
||||
}
|
||||
|
||||
if (empty($request['client_id']) && substr($authorization, 0, 6) == 'Basic ') {
|
||||
if ((empty($request['client_id']) || empty($request['client_secret'])) && substr($authorization, 0, 6) == 'Basic ') {
|
||||
// Per RFC2617, usernames can't contain a colon but password can,
|
||||
// so we cut on the first colon to obtain the username and the password
|
||||
// @see https://www.rfc-editor.org/rfc/rfc2617#section-2
|
||||
|
|
|
@ -72,6 +72,7 @@ class Connectors extends BaseSettings
|
|||
$this->pconfig->set($this->session->getLocalUserId(), 'system', 'no_intelligent_shortening', !intval($request['enable_smart_shortening']));
|
||||
$this->pconfig->set($this->session->getLocalUserId(), 'system', 'simple_shortening', intval($request['simple_shortening']));
|
||||
$this->pconfig->set($this->session->getLocalUserId(), 'system', 'attach_link_title', intval($request['attach_link_title']));
|
||||
$this->pconfig->set($this->session->getLocalUserId(), 'system', 'api_spoiler_title', intval($request['api_spoiler_title']));
|
||||
$this->pconfig->set($this->session->getLocalUserId(), 'ostatus', 'legacy_contact', $request['legacy_contact']);
|
||||
} elseif (!empty($request['mail-submit']) && function_exists('imap_open') && !$this->config->get('system', 'imap_disabled')) {
|
||||
$mail_server = $request['mail_server'] ?? '';
|
||||
|
@ -134,6 +135,7 @@ class Connectors extends BaseSettings
|
|||
$enable_smart_shortening = !intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'no_intelligent_shortening'));
|
||||
$simple_shortening = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'simple_shortening'));
|
||||
$attach_link_title = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'attach_link_title'));
|
||||
$api_spoiler_title = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'api_spoiler_title', true));
|
||||
$legacy_contact = $this->pconfig->get($this->session->getLocalUserId(), 'ostatus', 'legacy_contact');
|
||||
|
||||
if (!empty($legacy_contact)) {
|
||||
|
@ -218,8 +220,8 @@ class Connectors extends BaseSettings
|
|||
'$enable_smart_shortening' => ['enable_smart_shortening', $this->t('Enable intelligent shortening'), $enable_smart_shortening, $this->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')],
|
||||
'$simple_shortening' => ['simple_shortening', $this->t('Enable simple text shortening'), $simple_shortening, $this->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')],
|
||||
'$attach_link_title' => ['attach_link_title', $this->t('Attach the link title'), $attach_link_title, $this->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')],
|
||||
'$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on standalone posts. When deactivated it will be used for spoiler text. For comments it will always be used for spoiler text.')],
|
||||
'$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')],
|
||||
|
||||
'$repair_ostatus_url' => 'ostatus/repair',
|
||||
'$repair_ostatus_text' => $this->t('Repair OStatus subscriptions'),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue