From 0bd50579c4ff36fd0e7b75aff4627989f6d3f6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 8 Feb 2021 11:06:36 +0000 Subject: [PATCH 1/3] Fix link color in markdown preview --- customize.dist/src/less2/include/colortheme-dark.less | 1 + customize.dist/src/less2/include/colortheme.less | 1 + www/code/app-code.less | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index 75c51ef6c..4ca59b4b8 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -327,6 +327,7 @@ // Code @cp_preview-bg: @cryptpad_color_grey_900; @cp_preview-fg: @cryptpad_text_col; +@cp_preview-link: @cryptpad_color_brand_300; // Debug @cp_debug-hover: fade(@cryptpad_color_black, 10%); diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 92f0ab85c..6dab44aaa 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -327,6 +327,7 @@ // Code @cp_preview-bg: @cryptpad_color_white; @cp_preview-fg: @cryptpad_text_col; +@cp_preview-link: @cryptpad_color_brand; // Debug @cp_debug-hover: fade(@cryptpad_color_black, 10%); diff --git a/www/code/app-code.less b/www/code/app-code.less index 138741919..a6ccd864d 100644 --- a/www/code/app-code.less +++ b/www/code/app-code.less @@ -112,6 +112,10 @@ media-tag > * { margin-bottom: 1rem; } + a { + color: @cp_preview-link; + text-decoration: underline; + } } .cp-splitter { From 76ff4bfaecb6b7e76d8c4e8413a8c1d0720ddc5f Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 8 Feb 2021 12:22:04 +0100 Subject: [PATCH 2/3] Refresh admin panel stats --- www/admin/inner.js | 88 +++++++++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/www/admin/inner.js b/www/admin/inner.js index 35fbe404f..8b6bed1d9 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -53,6 +53,7 @@ define([ 'cp-admin-getlimits', ], 'stats': [ + 'cp-admin-refresh-stats', 'cp-admin-active-sessions', 'cp-admin-active-pads', 'cp-admin-open-files', @@ -466,49 +467,86 @@ define([ return $div; }; + var onRefreshStats = Util.mkEvent(); + + create['refresh-stats'] = function () { + var key = 'refresh-stats'; + var $div = $('
', {'class': 'cp-admin-' + key + ' cp-sidebarlayout-element'}); + var $btn = $(h('button.btn.btn-primary', Messages.oo_refresh)); + $btn.click(function () { + onRefreshStats.fire(); + }); + $div.append($btn); + return $div; + }; + create['active-sessions'] = function () { var key = 'active-sessions'; var $div = makeBlock(key); - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'ACTIVE_SESSIONS', - }, function (e, data) { - var total = data[0]; - var ips = data[1]; - $div.append(h('pre', total + ' (' + ips + ')')); - }); + var onRefresh = function () { + $div.find('pre').remove(); + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'ACTIVE_SESSIONS', + }, function (e, data) { + var total = data[0]; + var ips = data[1]; + $div.find('pre').remove(); + $div.append(h('pre', total + ' (' + ips + ')')); + }); + }; + onRefresh(); + onRefreshStats.reg(onRefresh); return $div; }; create['active-pads'] = function () { var key = 'active-pads'; var $div = makeBlock(key); - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'ACTIVE_PADS', - }, function (e, data) { - console.log(e, data); - $div.append(h('pre', String(data))); - }); + var onRefresh = function () { + $div.find('pre').remove(); + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'ACTIVE_PADS', + }, function (e, data) { + console.log(e, data); + $div.find('pre').remove(); + $div.append(h('pre', String(data))); + }); + }; + onRefresh(); + onRefreshStats.reg(onRefresh); return $div; }; create['open-files'] = function () { var key = 'open-files'; var $div = makeBlock(key); - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'GET_FILE_DESCRIPTOR_COUNT', - }, function (e, data) { - console.log(e, data); - $div.append(h('pre', String(data))); - }); + var onRefresh = function () { + $div.find('pre').remove(); + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'GET_FILE_DESCRIPTOR_COUNT', + }, function (e, data) { + console.log(e, data); + $div.find('pre').remove(); + $div.append(h('pre', String(data))); + }); + }; + onRefresh(); + onRefreshStats.reg(onRefresh); return $div; }; create['registered'] = function () { var key = 'registered'; var $div = makeBlock(key); - sFrameChan.query('Q_ADMIN_RPC', { - cmd: 'REGISTERED_USERS', - }, function (e, data) { - console.log(e, data); - $div.append(h('pre', String(data))); - }); + var onRefresh = function () { + $div.find('pre').remove(); + sFrameChan.query('Q_ADMIN_RPC', { + cmd: 'REGISTERED_USERS', + }, function (e, data) { + console.log(e, data); + $div.find('pre').remove(); + $div.append(h('pre', String(data))); + }); + }; + onRefresh(); + onRefreshStats.reg(onRefresh); return $div; }; create['disk-usage'] = function () { From 5f6c814bbced0176c0e1c265b0ac885d7c33a6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 8 Feb 2021 11:30:27 +0000 Subject: [PATCH 3/3] Fix text color in danger-alt buttons --- customize.dist/src/less2/include/colortheme-dark.less | 3 ++- customize.dist/src/less2/include/colortheme.less | 1 + customize.dist/src/less2/include/forms.less | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index 4ca59b4b8..f03fa428b 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -142,6 +142,7 @@ @cp_buttons-default-color: @cryptpad_text_col; @cp_buttons-default-border: @cryptpad_text_col; @cp_buttons-red: #E55236; +@cp_buttons-red-text: @cryptpad_color_light_red; @cp_buttons-red-color: #FFF; @cp_buttons-red-border: transparent; @cp_buttons-primary: @cryptpad_color_brand; @@ -159,7 +160,7 @@ @cp_sidebar-right-bg: @cryptpad_color_grey_900; @cp_sidebar-right-fg: @cryptpad_text_col; // XXX was black @cp_sidebar-left-active: @cp_sidebar-right-bg; -@cp_sidebar-hint: @cryptpad_color_hint_grey; +@cp_sidebar-hint: fade(@cryptpad_text_col, 80%); // Drive @cp_drive-bg: @cp_sidebar-right-bg; diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 6dab44aaa..2869703b2 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -142,6 +142,7 @@ @cp_buttons-default-color: @cryptpad_text_col; @cp_buttons-default-border: @cryptpad_text_col; @cp_buttons-red: #E55236; +@cp_buttons-red-text: @cp_buttons-red; @cp_buttons-red-color: #FFF; @cp_buttons-red-border: transparent; @cp_buttons-primary: @cryptpad_color_brand; diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 0f5a6193b..4962f3891 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -142,7 +142,7 @@ &.danger-alt, &.btn-danger-alt, &.btn-danger-outline { border-color: @cp_buttons-red; - color: @cp_buttons-red; + color: @cp_buttons-red-text; &:hover, &:not(:disabled):active, &:focus { border-color: @cp_buttons-red; color: @cp_buttons-red-color;