mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 04:15:12 +00:00
modernise zot_probe
This commit is contained in:
parent
c817e925f8
commit
000ed1d779
2 changed files with 26 additions and 16 deletions
|
@ -11,30 +11,30 @@ class Zot_probe extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
$o .= '<h3>Zot6 Probe Diagnostic</h3>';
|
$o = replace_macros(get_markup_template('zot_probe.tpl'), [
|
||||||
|
'$page_title' => t('Zot6 Probe Diagnostic'),
|
||||||
|
'$resource' => [ 'resource', t('Object URL') , $_REQUEST['resource'], EMPTY_STR ],
|
||||||
|
'$authf' => [ 'authf', t('Authenticated fetch'), $_REQUEST['authf'], EMPTY_STR, [ t('No'), t('Yes') ] ],
|
||||||
|
'$submit' => t('Submit')
|
||||||
|
]);
|
||||||
|
|
||||||
$o .= '<form action="zot_probe" method="get">';
|
|
||||||
$o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" /><br>';
|
|
||||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
|
||||||
|
|
||||||
$o .= '<br><br>';
|
if(x($_GET,'resource')) {
|
||||||
|
$resource = $_GET['resource'];
|
||||||
|
$channel = (($_GET['authf']) ? \App::get_channel() : null);
|
||||||
|
|
||||||
if(x($_GET,'addr')) {
|
if(strpos($resource,'x-zot:') === 0) {
|
||||||
$addr = $_GET['addr'];
|
$x = ZotURL::fetch($resource,$channel);
|
||||||
$channel = (($_GET['auth']) ? \App::get_channel() : null);
|
|
||||||
|
|
||||||
if(strpos($addr,'x-zot:') === 0) {
|
|
||||||
$x = ZotURL::fetch($addr,$channel);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$x = Zotfinger::exec($addr,$channel);
|
$x = Zotfinger::exec($resource,$channel);
|
||||||
|
|
||||||
$o .= '<pre>' . htmlspecialchars(print_array($x)) . '</pre>';
|
$o .= '<pre>' . htmlspecialchars(print_array($x)) . '</pre>';
|
||||||
|
|
||||||
$headers = 'Accept: application/x-zot+json, application/jrd+json, application/json';
|
$headers = 'Accept: application/x-zot+json, application/jrd+json, application/json';
|
||||||
|
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]);
|
$x = z_fetch_url($resource,true,$redirects, [ 'headers' => [ $headers ]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($x['success']) {
|
if($x['success']) {
|
||||||
|
|
10
view/tpl/zot_probe.tpl
Normal file
10
view/tpl/zot_probe.tpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<h3>{{$page_title}}</h3>
|
||||||
|
|
||||||
|
<form action="zot_probe" method="get">
|
||||||
|
{{include file="field_input.tpl" field=$resource}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$authf}}
|
||||||
|
<input type="submit" name="submit" value="{{$submit}}" >
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
Loading…
Reference in a new issue