refs #3971 Catalog & basket style fixes, version check/set fixes
gitea/hedera-web/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2022-11-11 15:20:48 +01:00
parent 5de1601348
commit f82ecaad91
8 changed files with 68 additions and 25 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (22.44.2) stable; urgency=low hedera-web (22.44.3) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -20,7 +20,7 @@
.basket .line { .basket .line {
display: flex; display: flex;
gap: 15px; gap: 12px;
margin: 24px 0; margin: 24px 0;
height: 65px; height: 65px;
} }
@ -29,7 +29,7 @@
} }
.basket .line > .delete { .basket .line > .delete {
align-self: center; align-self: center;
margin-right: -8px; margin: 0 -8px;
} }
.basket .line > .photo { .basket .line > .photo {
flex: none; flex: none;

View File

@ -213,7 +213,6 @@
flex-direction: column; flex-direction: column;
width: 260px; width: 260px;
height: 425px;
overflow: hidden; overflow: hidden;
} }
.grid-view .item-box:hover { .grid-view .item-box:hover {
@ -221,10 +220,11 @@
} }
.grid-view .item-info { .grid-view .item-info {
margin: 10px; margin: 10px;
height: 142px;
} }
.grid-view .item-box > .htk-image { .grid-view .item-box > .htk-image {
width: 260px; width: 100%;
height: 260px; min-height: 260px;
} }
.grid-view .item-box > .item-info { .grid-view .item-box > .item-info {
flex: auto; flex: auto;
@ -371,26 +371,30 @@
} }
@media (max-width: 960px) { @media (max-width: 960px) {
.catalog-actions > button.menu .catalog-actions > button.menu {
{
display: block; display: block;
} }
.right-panel .right-panel {
{
top: 0; top: 0;
right: -18em; right: -18em;
z-index: 20; z-index: 20;
transition: transform 200ms ease-out; transition: transform 200ms ease-out;
-webkit-transition: transform 200ms ease-out; -webkit-transition: transform 200ms ease-out;
} }
.right-panel.show .right-panel.show {
{
transform: translateZ(0) translateX(-18em); transform: translateZ(0) translateX(-18em);
-webkit-transform: translateZ(0) translateX(-18em); -webkit-transform: translateZ(0) translateX(-18em);
} }
.catalog .catalog {
{
margin-right: 0; margin-right: 0;
} }
} }
@media (max-width: 515px) {
.grid-view .item-box {
width: 100%;
max-width: 450px;
}
.grid-view .item-box > .htk-image {
min-height: initial;
}
}

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "22.44.2", "version": "22.44.3",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -66,7 +66,11 @@ class HtmlService extends Service {
// Setting the version // Setting the version
setcookie('vnVersion', $this->getVersion(), ['samesite' => 'Lax']); $domain = explode(':', $_SERVER['HTTP_HOST'])[0];
setcookie('vnVersion', $this->getVersion()->toString(), [
'samesite' => 'Lax',
'domain' => $domain
]);
// Loading the requested page // Loading the requested page

View File

@ -18,7 +18,7 @@ class JsonService extends RestService {
$this->init(); $this->init();
$this->startSession(); $this->startSession();
//$this->checkVersion(); $this->checkVersion();
$json = $this->loadMethod(__NAMESPACE__.'\JsonRequest'); $json = $this->loadMethod(__NAMESPACE__.'\JsonRequest');
$this->replyJson($json); $this->replyJson($json);

View File

@ -124,9 +124,11 @@ abstract class Service {
); );
if (isset($row['access'])) { if (isset($row['access'])) {
$domain = explode(':', $_SERVER['HTTP_HOST'])[0];
setcookie('vnVisit', $row['visit'], [ setcookie('vnVisit', $row['visit'], [
'expires' => time() + 31536000, // 1 Year 'expires' => time() + 31536000, // 1 Year
'samesite' => 'Lax' 'samesite' => 'Lax',
'domain' => $domain
]); ]);
$_SESSION['access'] = $row['access']; $_SESSION['access'] = $row['access'];
} else } else
@ -300,9 +302,9 @@ abstract class Service {
if (!$success) { if (!$success) {
if (file_exists('package.json')) { if (file_exists('package.json')) {
$package = json_decode(file_get_contents('package.json')); $package = json_decode(file_get_contents('package.json'));
$version = $package->version; $version = new Version($package->version);
} else } else
$version = '0.0.0'; $version = new Version();
apcu_store("$appName.version", $version); apcu_store("$appName.version", $version);
} }
@ -314,11 +316,12 @@ abstract class Service {
* Checks the client version. * Checks the client version.
*/ */
function checkVersion() { function checkVersion() {
if (!empty($_COOKIE['vnVersion'])) if (empty($_COOKIE['vnVersion'])) return;
$clientVersion = $_COOKIE['vnVersion'];
$client = new Version($_COOKIE['vnVersion']);
$last = $this->getVersion();
if (isset($clientVersion) if ($client->isLowerThan($last))
&& $clientVersion < $this->getVersion())
throw new OutdatedVersionException(); throw new OutdatedVersionException();
} }

32
web/version.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Vn\Web;
class Version {
function __construct($version = '') {
if (!empty($version) && preg_match('/^\d+\.\d+\.\d+$/', $version)) {
$numbers = explode('.', $version);
$this->major = (int) $numbers[0];
$this->minor = (int) $numbers[1];
$this->fixes = (int) $numbers[2];
} else {
$this->major = 0;
$this->minor = 0;
$this->fixes = 0;
}
}
function isLowerThan($version) {
if ($this->major == $version->major) {
if ($this->minor == $version->minor)
return $this->fixes < $version->fixes;
else
return $this->minor < $version->minor;
} else
return $this->major < $version->major;
}
function toString() {
return "$this->major.$this->minor.$this->fixes";
}
}