mirror of
https://gitlab.com/octospacc/Snippets.git
synced 2025-04-17 00:37:21 +02:00
Auto-Backup $'Tue Nov 19 2024 12:03:51 GMT+0100 (Central European Standard Time)'
This commit is contained in:
parent
f85fdd6c17
commit
cf5165389d
@ -1,6 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
mkdir ./Res
|
mkdir -p ./Res
|
||||||
prefix=/Main/Server/www/Drive/Misc/Scripts
|
prefix=/Main/Server/www/Drive/Misc/Scripts
|
||||||
cp $prefix/* ./
|
cp $prefix/* ./
|
||||||
cp $prefix/Res/* ./Res/
|
cp $prefix/Res/* ./Res/
|
||||||
#cp "${prefix}/MemosViewer.php" "${prefix}/MemosYacyBridgeCreate.php" ./
|
|
||||||
|
@ -70,15 +70,16 @@ if ( !$id && !$uid ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$id ) {
|
// pre-v0.22.4
|
||||||
// as of writing this, there is no JSON API to get a memo by its uid
|
//if ( !$id ) {
|
||||||
// so, we first get the numeric id by sloppily parsing the GRPC API
|
// // as of writing this, there is no JSON API to get a memo by its uid
|
||||||
$id = explode( '%', urlencode(explode( 'memos/', file_get_contents( "{$instance}/memos.api.v1.MemoService/SearchMemos", false, stream_context_create([ 'http' => [
|
// // so, we first get the numeric id by sloppily parsing the GRPC API
|
||||||
'method' => 'POST',
|
// $id = explode( '%', urlencode(explode( 'memos/', file_get_contents( "{$instance}/memos.api.v1.MemoService/SearchMemos", false, stream_context_create([ 'http' => [
|
||||||
'header' => 'Content-Type: application/grpc-web+proto',
|
// 'method' => 'POST',
|
||||||
'content' => urldecode('%00%00%00%00!%0A%1Fuid%20%3D%3D%20%22' . $uid . '%22'),
|
// 'header' => 'Content-Type: application/grpc-web+proto',
|
||||||
]]) ) )[1]))[0];
|
// 'content' => urldecode('%00%00%00%00!%0A%1Fuid%20%3D%3D%20%22' . $uid . '%22'),
|
||||||
}
|
// ]]) ) )[1]))[0];
|
||||||
|
//}
|
||||||
|
|
||||||
$base = file_get_contents($instance);
|
$base = file_get_contents($instance);
|
||||||
|
|
||||||
@ -87,14 +88,18 @@ if ( $_GET['structure'] === 'original' ) {
|
|||||||
$warning = '<noscript><p class="warning">Please enable JavaScript for full functionality and perfect viewing.</p></noscript>';
|
$warning = '<noscript><p class="warning">Please enable JavaScript for full functionality and perfect viewing.</p></noscript>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$id ) {
|
// pre-v0.22.4
|
||||||
http_response_code(400);
|
//if ( !$id ) {
|
||||||
echo $base;
|
// http_response_code(400);
|
||||||
return;
|
// echo $base;
|
||||||
}
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
// we always use the numeric id to get memo data via the JSON API
|
// pre-v0.22.4: we always use the numeric id to get memo data via the JSON API
|
||||||
$memo = json_decode(file_get_contents("{$instance}/api/v1/memos/{$id}"));
|
//$memo = json_decode(file_get_contents("{$instance}/api/v1/memos/{$id}"));
|
||||||
|
|
||||||
|
$idoruidendpoint = ($uid ? "memos:by-uid/{$uid}" : "memos/{$id}");
|
||||||
|
$memo = json_decode(file_get_contents("{$instance}/api/v1/{$idoruidendpoint}")); // post-v0.22.4
|
||||||
$user = json_decode(file_get_contents("{$instance}/api/v1/{$memo->creator}"));
|
$user = json_decode(file_get_contents("{$instance}/api/v1/{$memo->creator}"));
|
||||||
|
|
||||||
// patch Markdown before parsing it, so output is quasi-consistent with Memos
|
// patch Markdown before parsing it, so output is quasi-consistent with Memos
|
||||||
@ -174,7 +179,7 @@ $body = "<div class=\"MemosViewer\">
|
|||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<b>{$nickname}</b> on <span><a href=\"{$instance}/m/{$uid}\">{$memo->displayTime}</a>
|
<b>{$nickname}</b> on <span><a href=\"{$instance}/m/{$uid}\">{$memo->displayTime}</a>
|
||||||
<small>[<a href=\"{$instance}/api/v1/memos/${id}\">JSON</a>]</small></span>
|
<small>[<a href=\"{$instance}/api/v1/${idoruidendpoint}\">JSON</a>]</small></span>
|
||||||
{$warning}
|
{$warning}
|
||||||
</header>
|
</header>
|
||||||
{$content}
|
{$content}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user