12 lines
1.0 KiB
PHP
12 lines
1.0 KiB
PHP
<?php
|
|
$settings=getenv('LEDGER_QA_SETTINGS');
|
|
$path=parse_url($_SERVER['REQUEST_URI']??'',PHP_URL_PATH);
|
|
if(str_starts_with($path??'','/build/')){
|
|
$state=json_decode(file_get_contents('C:/laragon/data/sgf-tempo/run/modular-regression-current.json'),true);$actual=realpath($settings);$private=realpath($state['root'].'/private');
|
|
if(!$actual||!$private||!str_starts_with($actual,$private.DIRECTORY_SEPARATOR)){http_response_code(404);exit;}
|
|
$s=json_decode(file_get_contents($actual),true);$base=realpath($s['sgf']['storage'].'/public/build');$file=realpath($s['sgf']['storage'].'/public'.$path);
|
|
if(!$base||!$file||!str_starts_with($file,$base.DIRECTORY_SEPARATOR)||!in_array(pathinfo($file,PATHINFO_EXTENSION),['js','css','woff2'],true)){http_response_code(404);exit;}
|
|
header('Content-Type: '.(['js'=>'application/javascript','css'=>'text/css','woff2'=>'font/woff2'][pathinfo($file,PATHINFO_EXTENSION)]));readfile($file);exit;
|
|
}
|
|
$argv=[__FILE__,$settings,'ledger-http'];require __DIR__.'/payable-history-sgf-proof.php';
|