From c489fe4be1c047aeb5248c73eb859bf680041c96 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 16 Apr 2024 18:56:53 +0300 Subject: [PATCH] add base url macros support in status tray --- composer.json | 2 +- config.json | 2 +- src/Entity/Tab/Page.php | 31 +++++++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 023926b..c9725bf 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "type": "project", "require": { "yggverse/gemini": "^0.9", - "yggverse/net": "^1.7" + "yggverse/net": "dev-main" }, "license": "MIT", "autoload": { diff --git a/config.json b/config.json index 43db735..2db3c62 100644 --- a/config.json +++ b/config.json @@ -141,7 +141,7 @@ { "open": { - "complete":"{TIME_C} | {RESPONSE_META} | {RESPONSE_LENGTH} bytes | {RESPONSE_SECONDS} seconds" + "complete":"{REQUEST_BASE_URL} | {TIME_C} | {RESPONSE_META} | {RESPONSE_LENGTH} bytes | {RESPONSE_SECONDS} seconds" } } } diff --git a/src/Entity/Tab/Page.php b/src/Entity/Tab/Page.php index 29002c0..8424298 100644 --- a/src/Entity/Tab/Page.php +++ b/src/Entity/Tab/Page.php @@ -339,6 +339,16 @@ class Page $this->status = new \GtkLabel; + $this->status->connect( + 'activate-link', + function ($label, $href) + { + $this->open( + $href + ); + } + ); + $this->footer->add( $this->status ); @@ -591,20 +601,33 @@ class Page $this->status->set_markup( str_replace( // Custom macros mask from config.json [ - '{NAVIGATION_ADDRESS}', '{TIME_C}', + '{REQUEST_BASE}', + '{REQUEST_BASE_URL}', '{RESPONSE_CODE}', '{RESPONSE_META}', '{RESPONSE_LENGTH}', '{RESPONSE_SECONDS}' ], [ - urlencode( - $url - ), date( 'c' ), + $origin->getHost(), + sprintf( + '%s', + $origin->get( + true, // scheme + true, // user + true, // pass + true, // host + true, // port + false, // path + false, // query + false // fragment + ), + $origin->getHost() + ), $response->getCode(), ($code ? sprintf('%d:', $code) : '') .