Merge pull request #6130 from annando/develop

Issue 6128: Websub could work now
This commit is contained in:
Hypolite Petovan 2018-11-13 18:46:17 -05:00 committed by GitHub
commit 6996a172e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -1649,6 +1649,7 @@ function api_statuses_home_timeline($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -1731,6 +1732,7 @@ function api_statuses_public_timeline($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -1787,6 +1789,7 @@ function api_statuses_networkpublic_timeline($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -2108,6 +2111,7 @@ function api_statuses_mentions($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -2188,6 +2192,7 @@ function api_statuses_user_timeline($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -2263,8 +2268,10 @@ function api_favorites_create_destroy($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break;
} }
return api_format_data("status", $type, $data); return api_format_data("status", $type, $data);
@ -2330,8 +2337,10 @@ function api_favorites($type)
$data = ['status' => $ret]; $data = ['status' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break;
} }
return api_format_data("statuses", $type, $data); return api_format_data("statuses", $type, $data);
@ -3145,6 +3154,7 @@ function api_lists_statuses($type)
$data = ['status' => $items]; $data = ['status' => $items];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break; break;
@ -3541,8 +3551,10 @@ function api_direct_messages_new($type)
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $sender); $data = api_rss_extra($a, $data, $sender);
break;
} }
return api_format_data("direct-messages", $type, $data); return api_format_data("direct-messages", $type, $data);
@ -3807,8 +3819,10 @@ function api_direct_messages_box($type, $box, $verbose)
$data = ['direct_message' => $ret]; $data = ['direct_message' => $ret];
switch ($type) { switch ($type) {
case "atom": case "atom":
break;
case "rss": case "rss":
$data = api_rss_extra($a, $data, $user_info); $data = api_rss_extra($a, $data, $user_info);
break;
} }
return api_format_data("direct-messages", $type, $data); return api_format_data("direct-messages", $type, $data);

View file

@ -65,7 +65,7 @@ function pubsubhubbub_init(App $a) {
// fetch user from database given the nickname // fetch user from database given the nickname
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]; $condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition); $owner = DBA::selectFirst('user', ['uid', 'hidewall', 'nickname'], $condition);
if (!DBA::isResult($owner)) { if (!DBA::isResult($owner)) {
Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback); Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
System::httpExit(404); System::httpExit(404);
@ -88,7 +88,9 @@ function pubsubhubbub_init(App $a) {
// sanity check that topic URLs are the same // sanity check that topic URLs are the same
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic); $hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll'])) { $self = System::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']); Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
System::httpExit(404); System::httpExit(404);
} }