Commit f745e7b8 authored by Malcolm Blaney's avatar Malcolm Blaney

Return full url from media endpoint. Add basic support for twitter

as a syndication target. Remove checks for facebook syndication
as it's no longer supported.
parent ab175a15
Pipeline #38003431 passed with stage
in 1 minute and 16 seconds
......@@ -94,5 +94,7 @@ if (isset($result['error'])) {
exit;
}
$location = $user->config->Secure() ? 'https://' : 'http://';
$location .= $user->config->ServerName() . $result;
header('HTTP/1.1 201 Created');
header('Location: ' . $result);
header('Location: ' . $location);
......@@ -126,12 +126,19 @@ $user->page = $page;
// First check if this is a config request rather than creating a post.
if (isset($_GET['q'])) {
$query = $_GET['q'];
header('Content-Type: application/json');
if ($_GET['q'] === 'config') {
$media_endpoint = $this->user->config->Secure() ? 'https://' : 'http://';
$media_endpoint .= $this->user->config->ServerName();
if ($query === 'config') {
$media_endpoint = $user->config->Secure() ? 'https://' : 'http://';
$media_endpoint .= $user->config->ServerName();
$media_endpoint .= '/php/media_endpoint.php';
echo json_encode(['media-endpoint' => $media_endpoint]);
echo json_encode(['media-endpoint' => $media_endpoint,
'syndicate-to' => [['uid' => 'twitter',
'name' => 'Twitter']]]);
}
else if ($query === 'syndicate-to') {
echo json_encode(['syndicate-to' => [['uid' => 'twitter',
'name' => 'Twitter']]]);
}
else {
echo json_encode((object)[]);
......@@ -232,9 +239,6 @@ if ($content_type === 'application/json') {
if (isset($data['properties']['mp-syndicate-to'])) {
$mp_syndicate_to = $data['properties']['mp-syndicate-to'];
foreach (explode(',', $mp_syndicate_to) as $syndicate) {
if (stripos($syndicate, 'facebook') !== false) {
$content['facebook'] = 1;
}
if (stripos($syndicate, 'twitter') !== false) {
$content['twitter'] = 1;
}
......@@ -272,9 +276,6 @@ else {
}
if (isset($_POST['mp-syndicate-to'])) {
foreach (explode(',', $_POST['mp-syndicate-to']) as $syndicate) {
if (stripos($syndicate, 'facebook') !== false) {
$content['facebook'] = 1;
}
if (stripos($syndicate, 'twitter') !== false) {
$content['twitter'] = 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment