mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-19 22:03:40 +00:00
Compare commits
No commits in common. "252f3e222a9aecd68c96b6388cdc3a597647d98c" and "27e362213f731eec93c47b1afc14de6f58cf112e" have entirely different histories.
252f3e222a
...
27e362213f
1 changed files with 7 additions and 11 deletions
|
@ -355,11 +355,8 @@ function bluesky_settings(array &$data)
|
||||||
|
|
||||||
if (DI::config()->get('bluesky', 'friendica_handles')) {
|
if (DI::config()->get('bluesky', 'friendica_handles')) {
|
||||||
$self = User::getById(DI::userSession()->getLocalUserId(), ['nickname']);
|
$self = User::getById(DI::userSession()->getLocalUserId(), ['nickname']);
|
||||||
$host_handle = $self['nickname'] . '.' . DI::baseUrl()->getHost();
|
$handle = $self['nickname'] . '.' . DI::baseUrl()->getHost();
|
||||||
$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)];
|
$friendica_handle = ['bluesky_friendica_handle', DI::l10n()->t('Allow to use %s as your Bluesky handle.', $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".', $handle, $handle)];
|
||||||
if ($custom_handle) {
|
|
||||||
$handle = $host_handle;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$friendica_handle = [];
|
$friendica_handle = [];
|
||||||
}
|
}
|
||||||
|
@ -372,7 +369,7 @@ function bluesky_settings(array &$data)
|
||||||
'$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.')],
|
'$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.')],
|
||||||
'$custom_handle' => $friendica_handle,
|
'$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'],
|
'$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('Bluesky handle'), $handle, '', '', $custom_handle ? 'readonly' : ''],
|
'$handle' => ['bluesky_handle', DI::l10n()->t('Bluesky handle'), $handle],
|
||||||
'$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'],
|
'$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.")],
|
'$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),
|
'$status' => bluesky_get_status($handle, $did, $pds, $token),
|
||||||
|
@ -443,7 +440,7 @@ function bluesky_settings_post(array &$b)
|
||||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'handle', $handle);
|
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'handle', $handle);
|
||||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import', intval($_POST['bluesky_import']));
|
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import', intval($_POST['bluesky_import']));
|
||||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import_feeds', intval($_POST['bluesky_import_feeds']));
|
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import_feeds', intval($_POST['bluesky_import_feeds']));
|
||||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'friendica_handle', intval($_POST['bluesky_friendica_handle'] ?? false));
|
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'friendica_handle', intval($_POST['bluesky_friendica_handle']));
|
||||||
|
|
||||||
if (!empty($handle)) {
|
if (!empty($handle)) {
|
||||||
$did = bluesky_get_user_did(DI::userSession()->getLocalUserId(), empty($old_did) || $old_handle != $handle);
|
$did = bluesky_get_user_did(DI::userSession()->getLocalUserId(), empty($old_did) || $old_handle != $handle);
|
||||||
|
@ -513,7 +510,7 @@ function bluesky_cron()
|
||||||
|
|
||||||
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$pconfigs = DBA::selectToArray('pconfig', [], ["`cat` = ? AND `k` IN (?, ?) AND `v`", 'bluesky', 'import', 'import_feeds']);
|
$pconfigs = DBA::selectToArray('pconfig', [], ['cat' => 'bluesky', 'k' => 'import', 'v' => true]);
|
||||||
foreach ($pconfigs as $pconfig) {
|
foreach ($pconfigs as $pconfig) {
|
||||||
if (empty(bluesky_get_user_did($pconfig['uid']))) {
|
if (empty(bluesky_get_user_did($pconfig['uid']))) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -530,9 +527,8 @@ function bluesky_cron()
|
||||||
bluesky_get_token($pconfig['uid']);
|
bluesky_get_token($pconfig['uid']);
|
||||||
|
|
||||||
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_notifications.php', $pconfig['uid'], $last);
|
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_notifications.php', $pconfig['uid'], $last);
|
||||||
if (DI::pConfig()->get($pconfig['uid'], 'bluesky', 'import')) {
|
|
||||||
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_timeline.php', $pconfig['uid'], $last);
|
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_timeline.php', $pconfig['uid'], $last);
|
||||||
}
|
|
||||||
if (DI::pConfig()->get($pconfig['uid'], 'bluesky', 'import_feeds')) {
|
if (DI::pConfig()->get($pconfig['uid'], 'bluesky', 'import_feeds')) {
|
||||||
$feeds = bluesky_get_feeds($pconfig['uid']);
|
$feeds = bluesky_get_feeds($pconfig['uid']);
|
||||||
foreach ($feeds as $feed) {
|
foreach ($feeds as $feed) {
|
||||||
|
|
Loading…
Reference in a new issue