Updated serve extension, better troubleshooting
This commit is contained in:
parent
e9304d6d44
commit
dabdf94a3d
2 changed files with 10 additions and 9 deletions
|
@ -2,7 +2,7 @@
|
|||
// Serve extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/serve
|
||||
|
||||
class YellowServe {
|
||||
const VERSION = "0.8.19";
|
||||
const VERSION = "0.8.20";
|
||||
public $yellow; // access to API
|
||||
|
||||
// Handle initialisation
|
||||
|
@ -27,11 +27,11 @@ class YellowServe {
|
|||
// Process command to start built-in web server
|
||||
public function processCommandServe($command, $text) {
|
||||
list($url) = $this->yellow->toolbox->getTextArguments($text);
|
||||
if (empty($url)) $url = "http://localhost:8000";
|
||||
if (empty($url)) $url = "http://localhost:8000/";
|
||||
list($scheme, $address, $base) = $this->yellow->lookup->getUrlInformation($url);
|
||||
if ($scheme=="http" && !empty($address)) {
|
||||
if ($this->checkServerSettings()) {
|
||||
if (!preg_match("/\:\d+$/", $address)) $address .= ":8000";
|
||||
if ($scheme=="http" && !empty($address) && empty($base)) {
|
||||
if (!preg_match("/\:\d+$/", $address)) $address .= ":8000";
|
||||
if ($this->checkServerSettings("$scheme://$address/")) {
|
||||
echo "Starting built-in web server. Open a web browser and go to $scheme://$address/\n";
|
||||
echo "Press Ctrl+C to quit...\n";
|
||||
exec("php -S $address yellow.php 2>&1", $outputLines, $returnStatus);
|
||||
|
@ -54,7 +54,8 @@ class YellowServe {
|
|||
}
|
||||
|
||||
// Check server settings
|
||||
public function checkServerSettings() {
|
||||
return $this->yellow->system->get("coreServerUrl")=="auto";
|
||||
public function checkServerSettings($url) {
|
||||
return $this->yellow->system->get("coreServerUrl")=="auto" ||
|
||||
$this->yellow->system->get("coreServerUrl")==$url;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,11 +106,11 @@ Tag: feature
|
|||
system/extensions/meta.php: meta.php, create, update
|
||||
|
||||
Extension: Serve
|
||||
Version: 0.8.19
|
||||
Version: 0.8.20
|
||||
Description: Built-in web server.
|
||||
DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/serve
|
||||
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/serve.zip
|
||||
Published: 2022-04-16 21:28:27
|
||||
Published: 2022-04-17 11:12:47
|
||||
Developer: Datenstrom
|
||||
Tag: feature
|
||||
system/extensions/serve.php: serve.php, create, update
|
||||
|
|
Loading…
Add table
Reference in a new issue