mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-18 21:48:24 -04:00
expose types JSON-LD incl. configured expiration dates, resolves #1045
This commit is contained in:
+14
-4
@@ -425,10 +425,13 @@ class Controller
|
||||
*/
|
||||
private function _jsonld($type)
|
||||
{
|
||||
if (
|
||||
$type !== 'paste' && $type !== 'comment' &&
|
||||
$type !== 'pastemeta' && $type !== 'commentmeta'
|
||||
) {
|
||||
if (!in_array($type, array(
|
||||
'comment',
|
||||
'commentmeta',
|
||||
'paste',
|
||||
'pastemeta',
|
||||
'types',
|
||||
))) {
|
||||
$type = '';
|
||||
}
|
||||
$content = '{}';
|
||||
@@ -440,6 +443,13 @@ class Controller
|
||||
file_get_contents($file)
|
||||
);
|
||||
}
|
||||
if ($type === 'types') {
|
||||
$content = str_replace(
|
||||
'"' . implode('", "', array_keys($this->_conf->getDefaults()['expire_options'])) . '"',
|
||||
'"' . implode('", "', array_keys($this->_conf->getSection('expire_options'))) . '"',
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
header('Content-type: application/ld+json');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
Reference in New Issue
Block a user