commit dabdf94a3d8dfd9a28db577a3a5a10f3556492d2
parent e9304d6d449ec95e1a5671cb6fccee357ff93772
Author: markseu <mark2011@mayberg.se>
Date: Sun, 17 Apr 2022 11:19:22 +0200
Updated serve extension, better troubleshooting
Diffstat:
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/system/extensions/serve.php b/system/extensions/serve.php
@@ -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;
}
}
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -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