forked from unimatrix/web
20 lines
1.7 KiB
PHP
20 lines
1.7 KiB
PHP
<?php
|
|
if(PHP_SAPI!=='cli'){http_response_code(404);exit;}
|
|
$raw=stream_get_contents(STDIN,4194305);if(strlen($raw)>4194304)throw new RuntimeException('Board publication input exceeds its bound');
|
|
$input=json_decode($raw,true,512,JSON_THROW_ON_ERROR);
|
|
if(($input['mode']??null)==='capabilities'){echo json_encode(['protocol'=>1,'template'=>'private-organisation','templateVersion'=>1,'kinds'=>['clan','company','politics']])."\n";exit;}
|
|
if(($input['mode']??null)==='inspect'){
|
|
define('IN_MYBB',1);if(!defined('NO_PLUGINS'))define('NO_PLUGINS',1);define('MYBB_ROOT',__DIR__.'/');
|
|
require MYBB_ROOT.'inc/init.php';require __DIR__.'/board-key-publication.php';
|
|
echo json_encode(['protocol'=>1,'groupsRevision'=>dune_board_group_fingerprint()],JSON_THROW_ON_ERROR)."\n";exit;
|
|
}
|
|
if(($input['mode']??null)!=='apply'||!is_array($input['records']??null))throw new RuntimeException('Board key publication required');
|
|
// Native code never accepts caller-supplied desired state as authority. Read
|
|
// the current leased BRD dossiers through the existing authenticated bridge.
|
|
require_once '/home/dunerealms/apps/integrations/bridge.php';
|
|
$verified=dune_bridge('board-keys',['records'=>$input['records']]);
|
|
if(!is_array($verified)||!is_array($verified['records']??null)||!is_array($verified['rejected']??null))throw new RuntimeException('Board key verification is unavailable');
|
|
define('IN_MYBB',1);if(!defined('NO_PLUGINS'))define('NO_PLUGINS',1);define('MYBB_ROOT',__DIR__.'/');
|
|
require MYBB_ROOT.'inc/init.php';require __DIR__.'/board-key-publication.php';
|
|
$result=dune_apply_board_keys($verified['records']);$result['records']=array_merge($result['records'],$verified['rejected']);
|
|
echo json_encode($result,JSON_THROW_ON_ERROR)."\n";
|

Staff