Skip to content

Commit e7901ec

Browse files
author
Leonix
committed
Webasyst Framework v.2.9.8
* Improved the Webasyst 2 user interface. * Corrected access rights check in sending web push notifications. * Added authorization headers check in the API.
1 parent eb24eb1 commit e7901ec

File tree

20 files changed

+106
-42
lines changed

20 files changed

+106
-42
lines changed

wa-apps/installer/js/installer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ String.prototype.translate = function () {
574574
const startPosition = $this.offset();
575575

576576
const target_params = {
577-
top: targetPosition.top,
577+
top: 0,
578578
left: targetPosition.left
579579
};
580580

wa-apps/installer/lib/actions/settings/installerSettingsStaticID.controller.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected function getUrl()
7373
$params = [
7474
'hash' => $wa_installer->getHash(),
7575
'domain' => waRequest::server('HTTP_HOST'),
76+
'token' => $this->getStoreToken(),
7677
'beta_test_products' => 1,
7778
'locale' => wa()->getLocale(),
7879
];
@@ -81,6 +82,16 @@ protected function getUrl()
8182
return $url;
8283
}
8384

85+
protected function getStoreToken()
86+
{
87+
$token_data = (new waAppSettingsModel)->get('installer', 'token_data', false);
88+
if ($token_data) {
89+
$token_data = waUtils::jsonDecode($token_data, true);
90+
return $token_data && isset($token_data['token']) ? $token_data['token'] : null;
91+
}
92+
return null;
93+
}
94+
8495
protected function logException(Exception $e)
8596
{
8697
$message = join(PHP_EOL, [$e->getCode(), $e->getMessage(), $e->getTraceAsString()]);

wa-apps/installer/lib/config/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
'description' => 'Install new apps from the Webasyst Store',
55
'icon' => 'img/installer.svg',
66
'mobile' => false,
7-
'version' => '2.9.7',
8-
'critical' => '2.9.7',
7+
'version' => '2.9.8',
8+
'critical' => '2.9.8',
99
'system' => true,
1010
'vendor' => 'webasyst',
1111
'csrf' => true,

wa-content/js/jquery-wa/dashboard-mobile.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ const Page = ( function($, backend_url) {
553553

554554
/*TODO check vice versa case*/
555555
$widgetActivity.find('.activity-empty-today').remove();
556+
$widgetActivity.find('.activity-divider.hidden:first').removeClass('hidden');
556557

557558
that.storage.isActivityFilterLocked = false;
558559
});
@@ -620,7 +621,12 @@ const Page = ( function($, backend_url) {
620621
// Render
621622
$widgetActivity.find(".empty-activity-text").remove();
622623
$widgetActivity.find(".activity-item.activity-empty-today").remove();
623-
$wrapper.prepend(response);
624+
const $activity_divider = $wrapper.find('.activity-divider:first');
625+
if ($activity_divider.length) {
626+
$activity_divider.after(response)
627+
}else{
628+
$wrapper.prepend(response);
629+
}
624630
}
625631

626632
that.storage.isTopLazyLoadLocked = false;

wa-content/js/jquery-wa/dashboard.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@ const Page = ( function($, backend_url) {
14871487

14881488
/*TODO check vice versa case*/
14891489
$widgetActivity.find('.activity-empty-today').remove();
1490+
$widgetActivity.find('.activity-divider.hidden:first').removeClass('hidden');
14901491

14911492
that.storage.isActivityFilterLocked = false;
14921493
});
@@ -1608,6 +1609,17 @@ const Page = ( function($, backend_url) {
16081609

16091610
/*TODO check vice versa case*/
16101611
$widgetActivity.find('.activity-empty-today').remove();
1612+
1613+
const $activity_divider = $widgetActivity.find('.activity-divider');
1614+
let uniqueTexts = [];
1615+
$activity_divider.each(function() {
1616+
const text = $(this).text();
1617+
if ($.inArray(text, uniqueTexts) === -1) {
1618+
uniqueTexts.push(text);
1619+
} else {
1620+
$(this).remove();
1621+
}
1622+
});
16111623
});
16121624
}
16131625
}
@@ -1637,7 +1649,23 @@ const Page = ( function($, backend_url) {
16371649
// Render
16381650
$widgetActivity.find(".empty-activity-text").remove();
16391651
$widgetActivity.find(".activity-item.activity-empty-today").remove();
1640-
$wrapper.prepend(response);
1652+
const $today_divider = $widgetActivity.find('.activity-divider.today');
1653+
const $activity_divider = $widgetActivity.find('.activity-divider');
1654+
if ($today_divider.length) {
1655+
$today_divider.after(response)
1656+
}else{
1657+
$wrapper.prepend(response);
1658+
}
1659+
1660+
let uniqueTexts = [];
1661+
$activity_divider.each(function() {
1662+
const text = $(this).text();
1663+
if ($.inArray(text, uniqueTexts) === -1) {
1664+
uniqueTexts.push(text);
1665+
} else {
1666+
$(this).remove();
1667+
}
1668+
});
16411669
}
16421670

16431671
that.storage.isTopLazyLoadLocked = false;

wa-system/api/waAPIController.class.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,20 @@ protected function checkToken()
169169
$token = waRequest::server('HTTP_AUTHORIZATION', null, 'string');
170170
}
171171
if ($token) {
172-
$token = preg_replace('~^(Bearer\s)~ui', '', $token);
172+
$token = preg_replace('~^(\s*Bearer\s+)~ui', '', $token);
173+
$token = trim($token);
173174
}
174175
}
175176
if (!$token) {
176-
throw new waAPIException('invalid_request', 'Required parameter is missing: access_token', 400);
177+
throw new waAPIException('token_required', 'Access token is missing', 400);
177178
}
178179

179180
$tokens_model = new waApiTokensModel();
180181
$data = $tokens_model->getById($token);
181182
if (!$data || $data['token'] != $token) {
182-
throw new waAPIException('invalid_token', 'Invalid access token', 401);
183+
throw new waAPIException('invalid_token', 'Invalid access token', 401, [
184+
'sha256' => hash('sha256', $token),
185+
]);
183186
}
184187
if ($data['expires'] && (strtotime($data['expires']) < time())) {
185188
throw new waAPIException('invalid_token', 'Access token has expired', 401);

wa-system/captcha/phpcaptcha/templates/captcha.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<p>
88
<a href="#" class="wa-captcha-refresh">{$refresh}</a>
99
</p>
10-
<script type="text/javascript">
10+
<script>
1111
$(function () {
1212
$('div.{$wrapper_class} .wa-captcha-img').on('load', function () {
1313
$(window).trigger('wa_captcha_loaded');
@@ -31,4 +31,4 @@
3131
});
3232
});
3333
</script>
34-
</div>
34+
</div>

wa-system/captcha/phpcaptcha/templates/captcha2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</a>
1212
</div>
1313
</div>
14-
<script type="text/javascript">
14+
<script>
1515
$(function () {
1616
$('div.{$wrapper_class} .wa-captcha-img').on('load', function () {
1717
$(window).trigger('wa_captcha_loaded');
@@ -36,4 +36,4 @@
3636
});
3737
});
3838
</script>
39-
</div>
39+
</div>

wa-system/contact/waContactAddressField.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public function format($data, $format = null, $ignore_hidden = true)
5959
$tmp = trim($field->format($data['data'][$f_id], 'value', $data['data']));
6060
if ($tmp) {
6161
if (!in_array($f_id, array('country', 'region', 'zip', 'street', 'city'))) {
62+
if ($field instanceof waContactSelectField) {
63+
try {
64+
$tmp = $field->getOptions($tmp);
65+
} catch (Exception $e) {
66+
//
67+
}
68+
}
6269
$tmp = $field->getName().' '.$tmp;
6370
}
6471
$value[$f_id] = $tmp;
@@ -276,6 +283,13 @@ protected function getParts($data, $format = null)
276283
}
277284
$result['parts'][$id] = htmlspecialchars($result['parts'][$id]);
278285
if (!in_array($id, array('country', 'region', 'zip', 'street', 'city'))) {
286+
if ($field instanceof waContactSelectField) {
287+
try {
288+
$result['parts'][$id] = $field->getOptions($result['parts'][$id]);
289+
} catch (Exception $e) {
290+
//
291+
}
292+
}
279293
$result['parts'][$id] = '<span>'.$field->getName().'</span>' . ' ' . $result['parts'][$id];
280294
}
281295
}

wa-system/design/templates/Design.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ <h3 class="dialog-header">[s`Upload theme`]</h3>
248248
$theme_preview_link = $('.js-tabs-menu .wa-theme-preview'),
249249
$theme_edit_link = $('.js-tabs-menu li[data-action="edit"]');
250250

251-
const current_menu_id = sessionStorage.getItem('wa_design_menu_id') ?? null;
251+
var current_menu_id = sessionStorage.getItem('wa_design_menu_id') ?? null;
252252

253-
let $bottombar = $('.bottombar');
253+
var $bottombar = $('.bottombar');
254254

255255

256256
async function postData(url, data) {

0 commit comments

Comments
 (0)