Skip to content

Commit

Permalink
feat(client,server): display sing-box version in status section
Browse files Browse the repository at this point in the history
Closes: #206
Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Nov 20, 2024
1 parent f28cb36 commit c7d4360
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ function getServiceStatus() {
});
}

function renderStatus(isRunning) {
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
function renderStatus(isRunning, version) {
var spanTemp = '<em><span style="color:%s"><strong>%s (sing-box v%s) %s</strong></span></em>';
var renderHTML;
if (isRunning)
renderHTML = spanTemp.format('green', _('HomeProxy'), _('RUNNING'));
renderHTML = spanTemp.format('green', _('HomeProxy'), version, _('RUNNING'));
else
renderHTML = spanTemp.format('red', _('HomeProxy'), _('NOT RUNNING'));
renderHTML = spanTemp.format('red', _('HomeProxy'), version, _('NOT RUNNING'));

return renderHTML;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ return view.extend({
poll.add(function () {
return L.resolveDefault(getServiceStatus()).then((res) => {
var view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
view.innerHTML = renderStatus(res, features.version);
});
});

Expand Down
10 changes: 5 additions & 5 deletions htdocs/luci-static/resources/view/homeproxy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ function getServiceStatus() {
});
}

function renderStatus(isRunning) {
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
function renderStatus(isRunning, version) {
var spanTemp = '<em><span style="color:%s"><strong>%s (sing-box v%s) %s</strong></span></em>';
var renderHTML;
if (isRunning)
renderHTML = spanTemp.format('green', _('HomeProxy Server'), _('RUNNING'));
renderHTML = spanTemp.format('green', _('HomeProxy Server'), version, _('RUNNING'));
else
renderHTML = spanTemp.format('red', _('HomeProxy Server'), _('NOT RUNNING'));
renderHTML = spanTemp.format('red', _('HomeProxy Server'), version, _('NOT RUNNING'));

return renderHTML;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ return view.extend({
poll.add(function () {
return L.resolveDefault(getServiceStatus()).then((res) => {
var view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
view.innerHTML = renderStatus(res, features.version);
});
});

Expand Down

0 comments on commit c7d4360

Please sign in to comment.