Skip to content

Commit

Permalink
chore(view): minor style update
Browse files Browse the repository at this point in the history
  • Loading branch information
1715173329 authored Aug 16, 2023
1 parent 9230a49 commit 6a77c92
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
15 changes: 7 additions & 8 deletions htdocs/luci-static/resources/homeproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ return baseclass.extend({
if (padding)
str = str + Array(padding + 1).join('=');

return decodeURIComponent(Array.prototype.map.call(atob(str), (c) => {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return decodeURIComponent(Array.prototype.map.call(atob(str), (c) =>
'%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
).join(''));
},

getBuiltinFeatures: function() {
Expand All @@ -171,16 +171,16 @@ return baseclass.extend({

generateUUIDv4: function() {
/* Thanks to https://stackoverflow.com/a/2117523 */
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, (c) =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
},

loadDefaultLabel: function(uciconfig, ucisection) {
var label = uci.get(uciconfig, ucisection, 'label');
if (label)
if (label) {
return label;
else {
} else {
uci.set(uciconfig, ucisection, 'label', ucisection);
return ucisection;
}
Expand Down Expand Up @@ -226,9 +226,8 @@ return baseclass.extend({
return L.resolveDefault(callWriteCertificate(filename), {}).then((ret) => {
if (ret.result === true)
ui.addNotification(null, E('p', _('Your %s was successfully uploaded. Size: %sB.').format(type, res.size)));
else {
else
ui.addNotification(null, E('p', _('Failed to upload %s, error: %s.').format(type, ret.error)));
}
});
}, this, ev.target))
.catch((e) => { ui.addNotification(null, E('p', e.message)) });
Expand Down
5 changes: 2 additions & 3 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ function getServiceStatus() {
function renderStatus(isRunning) {
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
var renderHTML;
if (isRunning) {
if (isRunning)
renderHTML = spanTemp.format('green', _('HomeProxy'), _('RUNNING'));
} else {
else
renderHTML = spanTemp.format('red', _('HomeProxy'), _('NOT RUNNING'));
}

return renderHTML;
}
Expand Down
10 changes: 6 additions & 4 deletions htdocs/luci-static/resources/view/homeproxy/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ return view.extend({
.then(L.bind(this.map.reset, this.map))
.then(L.ui.hideModal)
.catch(function() {});
} else
} else {
return ui.hideModal();
}
})
}, [ _('Import') ])
])
Expand Down Expand Up @@ -996,8 +997,9 @@ return view.extend({
if (['hysteria', 'shadowtls'].includes(type)) {
tls.checked = true;
tls.disabled = true;
} else
} else {
tls.disabled = null;
}
}

return true;
Expand Down Expand Up @@ -1237,9 +1239,9 @@ return view.extend({
o.inputstyle = 'apply';
o.inputtitle = function(section_id) {
var sublist = uci.get(data[0], section_id, 'subscription_url') || [];
if (sublist.length > 0)
if (sublist.length > 0) {
return _('Update %s subscriptions').format(sublist.length);
else {
} else {
this.readonly = true;
return _('No subscription available')
}
Expand Down
8 changes: 4 additions & 4 deletions htdocs/luci-static/resources/view/homeproxy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ function getServiceStatus() {
function renderStatus(isRunning) {
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
var renderHTML;
if (isRunning) {
if (isRunning)
renderHTML = spanTemp.format('green', _('HomeProxy Server'), _('RUNNING'));
} else {
else
renderHTML = spanTemp.format('red', _('HomeProxy Server'), _('NOT RUNNING'));
}

return renderHTML;
}
Expand Down Expand Up @@ -362,8 +361,9 @@ return view.extend({
if (['hysteria'].includes(type)) {
tls.checked = true;
tls.disabled = true;
} else
} else {
tls.disabled = null;
}
}

return true;
Expand Down
22 changes: 11 additions & 11 deletions po/zh_Hans/homeproxy.po
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ msgstr "允许不安全连接"

#: htdocs/luci-static/resources/view/homeproxy/node.js:1018
msgid "Allow insecure connection at TLS client."
msgstr "允许 TLS 客户端侧的不安全连接"
msgstr "允许 TLS 客户端侧的不安全连接"

#: htdocs/luci-static/resources/view/homeproxy/node.js:1215
msgid "Allow insecure connection by default when add nodes from subscriptions."
Expand All @@ -108,11 +108,11 @@ msgstr "请求中允许的载荷大小。"

#: htdocs/luci-static/resources/view/homeproxy/status.js:94
msgid "Already at the latest version."
msgstr "已是最新版本"
msgstr "已是最新版本"

#: htdocs/luci-static/resources/view/homeproxy/status.js:91
msgid "Already in updating."
msgstr "已在更新中"
msgstr "已在更新中"

#: htdocs/luci-static/resources/view/homeproxy/node.js:750
#: htdocs/luci-static/resources/view/homeproxy/server.js:246
Expand Down Expand Up @@ -176,7 +176,7 @@ msgstr "自动更新"

#: htdocs/luci-static/resources/view/homeproxy/node.js:1169
msgid "Auto update subscriptions, GeoIP and GeoSite."
msgstr "自动更新订阅、GeoIP 和 GeoSite"
msgstr "自动更新订阅、GeoIP 和 GeoSite"

#: htdocs/luci-static/resources/view/homeproxy/status.js:193
msgid "BaiDu"
Expand Down Expand Up @@ -578,7 +578,7 @@ msgstr "启用 PQ 签名方案。"
#: htdocs/luci-static/resources/view/homeproxy/node.js:1145
#: htdocs/luci-static/resources/view/homeproxy/server.js:570
msgid "Enable UDP fragmentation."
msgstr "启用 UDP 分片"
msgstr "启用 UDP 分片"

#: htdocs/luci-static/resources/view/homeproxy/client.js:284
msgid "Enable endpoint-independent NAT"
Expand Down Expand Up @@ -1010,7 +1010,7 @@ msgstr "匹配进程名。"
#: htdocs/luci-static/resources/view/homeproxy/client.js:517
#: htdocs/luci-static/resources/view/homeproxy/client.js:780
msgid "Match process path."
msgstr "匹配进程路径"
msgstr "匹配进程路径"

#: htdocs/luci-static/resources/view/homeproxy/client.js:475
#: htdocs/luci-static/resources/view/homeproxy/client.js:742
Expand Down Expand Up @@ -1045,7 +1045,7 @@ msgstr "最大下载速度"
#: htdocs/luci-static/resources/view/homeproxy/node.js:591
#: htdocs/luci-static/resources/view/homeproxy/server.js:167
msgid "Max download speed in Mbps."
msgstr "最大下载速度(Mbps)"
msgstr "最大下载速度(Mbps)"

#: htdocs/luci-static/resources/view/homeproxy/server.js:507
msgid "Max time difference"
Expand All @@ -1059,7 +1059,7 @@ msgstr "最大上传速度"
#: htdocs/luci-static/resources/view/homeproxy/node.js:597
#: htdocs/luci-static/resources/view/homeproxy/server.js:173
msgid "Max upload speed in Mbps."
msgstr "最大上传速度(Mbps)"
msgstr "最大上传速度(Mbps)"

#: htdocs/luci-static/resources/view/homeproxy/node.js:1034
#: htdocs/luci-static/resources/view/homeproxy/server.js:392
Expand Down Expand Up @@ -1113,7 +1113,7 @@ msgstr "多路复用"

#: htdocs/luci-static/resources/view/homeproxy/node.js:949
msgid "Multiplex protocol."
msgstr "多路复用协议"
msgstr "多路复用协议"

#: htdocs/luci-static/resources/view/homeproxy/client.js:57
#: htdocs/luci-static/resources/view/homeproxy/server.js:39
Expand Down Expand Up @@ -1798,7 +1798,7 @@ msgid ""
msgstr ""
"默认规则使用以下匹配逻辑:<br/><code>(domain || domain_suffix || "
"domain_keyword || domain_regex || geosite || geoip || ip_cidr)</code> &&<br/"
"><code>(source_geoip || source_ip_cidr)</code> &&<br/><code>其他字段</code>."
"><code>(source_geoip || source_ip_cidr)</code> &&<br/><code>其他字段</code>"

#: htdocs/luci-static/resources/view/homeproxy/client.js:693
msgid ""
Expand All @@ -1809,7 +1809,7 @@ msgid ""
msgstr ""
"默认规则使用以下匹配逻辑:<br/><br/><code>(domain || domain_suffix || "
"domain_keyword || domain_regex || geosite || ip_cidr)</code> &&<br/"
"><code>(source_geoip || source_ip_cidr)</code> &&<br/><code>其他字段</code>."
"><code>(source_geoip || source_ip_cidr)</code> &&<br/><code>其他字段</code>"

#: htdocs/luci-static/resources/view/homeproxy/client.js:639
msgid ""
Expand Down

0 comments on commit 6a77c92

Please sign in to comment.