api preparations for rework

This commit is contained in:
Chris 2025-01-13 15:42:44 +00:00
parent f54d35c312
commit 028a4b54f4
2 changed files with 7 additions and 35 deletions

View File

@ -20,4 +20,4 @@ chromedriver --port=4444 &
chmod 777 ${WORKSPACE_PATH}/cache chmod 777 ${WORKSPACE_PATH}/cache
chmod 777 ${WORKSPACE_PATH}/logs chmod 777 ${WORKSPACE_PATH}/logs
caddy run --config /etc/caddy/Caddyfile caddy start --config /etc/caddy/Caddyfile

View File

@ -19,13 +19,12 @@ if(php_sapi_name()=='cli-server' && file_exists(ROOT.DS.'web'.DS.implode('/',$ur
switch($url[0]) switch($url[0])
{ {
case 'test': case 'api':
$target = $_GET['url']; $target = substr($_SERVER['REQUEST_URI'],5);
$type = $_GET['type']; if(!$target)
$timeout = $_GET['timeout']; $target = $_REQUEST['url'];
$viewport = $_GET['viewport']; $viewport = $_REQUEST['viewport'];
$js = $_GET['js']=='false'?false:true; $js = $_REQUEST['js']=='false'?false:true;
$resizewidth = $_GET['width'];
$serverUrl = 'http://localhost:4444'; $serverUrl = 'http://localhost:4444';
$options = new \Facebook\WebDriver\Chrome\ChromeOptions(); $options = new \Facebook\WebDriver\Chrome\ChromeOptions();
@ -38,8 +37,6 @@ switch($url[0])
if(!$js) if(!$js)
$capabilities->setCapability('javascriptEnabled', false); $capabilities->setCapability('javascriptEnabled', false);
$driver = RemoteWebDriver::create($serverUrl, $capabilities); $driver = RemoteWebDriver::create($serverUrl, $capabilities);
$driver->get($target); $driver->get($target);
@ -66,31 +63,6 @@ switch($url[0])
echo $driver->takeScreenshot(); echo $driver->takeScreenshot();
break; break;
case 'api':
$url = $_GET['url'];
$type = $_GET['type'];
$timeout = $_GET['timeout'];
$viewport = $_GET['viewport'];
$js = $_GET['js'];
$resizewidth = $_GET['width'];
$cache = $_GET['cache'];
$onfail = rawurldecode($_GET['onfail']);
$params = array('url'=>trim($url),
'type'=>$type,
'timeout'=>$timeout,
'viewport'=>$viewport,
'js'=>$js,
'resizewidth'=>$resizewidth,
'cache'=>$cache,
'onfail'=>$onfail);
$http2pic = new http2pic($params);
break;
case 'img':
break;
default: default:
echo renderTemplate('index.html.php'); echo renderTemplate('index.html.php');
break; break;