Skip to content

Commit

Permalink
修复多CPU在默认主题和AngelKanade下显示的问题,完善内网穿透本地化文本 (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
uubulb authored Aug 25, 2024
1 parent eb6dd28 commit 71508f8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 34 deletions.
9 changes: 9 additions & 0 deletions resource/l10n/en-US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ other = "Servers On World Map"
[NAT]
other = "NAT Traversal"

[LocalService]
other = "Local service"

[LocalServicePlaceholder]
other = "192.168.1.1:80 (with port)"

[BindHostname]
other = "Bind hostname"

[NetworkSpiterList]
other = "Network Monitor"

Expand Down
9 changes: 9 additions & 0 deletions resource/l10n/es-ES.toml
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ other = "Servidores en el mapa mundial"
[NAT]
other = "NAT traversal"

[LocalService]
other = "Servicio de red local"

[LocalServicePlaceholder]
other = "192.168.1.1:80 (con puerto)"

[BindHostname]
other = "Vincular nombre de host"

[NetworkSpiterList]
other = "Monitor de red"

Expand Down
9 changes: 9 additions & 0 deletions resource/l10n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ other = "服务器世界分布图"
[NAT]
other = "内网穿透"

[LocalService]
other = "内网服务"

[LocalServicePlaceholder]
other = "192.168.1.1:80(带端口)"

[BindHostname]
other = "绑定域名"

[NetworkSpiterList]
other = "网络监控"

Expand Down
11 changes: 10 additions & 1 deletion resource/l10n/zh-TW.toml
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,16 @@ other = "禁止前台切換主題"
other = "伺服器世界分布圖"

[NAT]
other = "NAT"
other = "NAT穿透"

[LocalService]
other = "內網服務"

[LocalServicePlaceholder]
other = "192.168.1.1:80(帶埠號)"

[BindHostname]
other = "綁定網域"

[NetworkSpiterList]
other = "網路監控"
Expand Down
6 changes: 3 additions & 3 deletions resource/template/component/nat.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<input type="number" name="ServerID" placeholder="1">
</div>
<div class="field">
<label>内网服务</label>
<input type="text" name="Host" placeholder="192.168.1.1:80(带端口)">
<label>{{tr "LocalService"}}</label>
<input type="text" name="Host" placeholder="{{tr "LocalServicePlaceholder"}}">
</div>
<div class="field">
<label>绑定域名</label>
<label>{{tr "BindHostname"}}</label>
<input type="text" name="Domain" placeholder="router.app.yourdomain.com">
</div>
</form>
Expand Down
4 changes: 2 additions & 2 deletions resource/template/dashboard-default/nat.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<th>ID</th>
<th>{{tr "Name"}}</th>
<th>Agent ID</th>
<th>内网服务</th>
<th>绑定域名</th>
<th>{{tr "LocalService"}}</th>
<th>{{tr "BindHostname"}}</th>
<th>{{tr "Administration"}}</th>
</tr>
</thead>
Expand Down
31 changes: 16 additions & 15 deletions resource/template/theme-angel-kanade/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,23 @@
const x = readableBytes(bs)
return x != "NaN undefined" ? x : '0B'
},
getCoreAndGHz(str){
if((str || []).hasOwnProperty(0) === false){
return '';
getCoreAndGHz(arr) {
if ((arr || []).length === 0) {
return '';
}
str = str[0];
let GHz = str.match(/(\d|\.)+GHz/g);
let Core = str.match(/(\d|\.)+ Physical/g);
GHz = GHz!==null?GHz.hasOwnProperty(0)===false?'':GHz[0]:''
Core = Core!==null?Core.hasOwnProperty(0)===false?'?':Core[0]:'?'
if(Core === '?'){
let Core = str.match(/(\d|\.)+ Virtual/g);
Core = Core!==null?Core.hasOwnProperty(0)===false?'?':Core[0]:'?'
return Core.replace('Virtual','Core')
}
return Core.replace('Physical','Core');

let totalCores = 0;
arr.forEach(str => {
let coreMatch = str.match(/(\d+(\.\d+)?) Physical/g);
let coreCount = 0;
if (coreMatch) {
coreCount = parseFloat(coreMatch[0]);
} else {
let coreMatch = str.match(/(\d+(\.\d+)?) Virtual/g);
coreCount = coreMatch ? parseFloat(coreMatch[0]) : 0;
}
totalCores += coreCount;
});
return `${totalCores} Cores`;
},
getByteToGB(bs){
return (bs/1024/1024/1024).toFixed(2) + 'GB'
Expand Down
28 changes: 15 additions & 13 deletions resource/template/theme-default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,21 +474,23 @@
const sizes = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"];
return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + sizes[i];
},
getCoreAndGHz(str){
if ((str || []).hasOwnProperty(0) === false) {
getCoreAndGHz(arr) {
if ((arr || []).length === 0) {
return '';
}
str = str[0];
let GHz = str.match(/(\d|\.)+GHz/g);
let Core = str.match(/(\d|\.)+ Physical/g);
GHz = GHz !== null ? GHz.hasOwnProperty(0) === false ? '' : GHz[0] : ''
Core = Core !== null ? Core.hasOwnProperty(0) === false ? '?' : Core[0] : '?'
if (Core === '?') {
let Core = str.match(/(\d|\.)+ Virtual/g);
Core = Core !== null ? Core.hasOwnProperty(0) === false ? '?' : Core[0] : '?'
return Core.replace('Virtual', 'Core')
}
return Core.replace('Physical', 'Core');
let totalCores = 0;
arr.forEach(str => {
let coreMatch = str.match(/(\d+(\.\d+)?) Physical/g);
let coreCount = 0;
if (coreMatch) {
coreCount = parseFloat(coreMatch[0]);
} else {
let coreMatch = str.match(/(\d+(\.\d+)?) Virtual/g);
coreCount = coreMatch ? parseFloat(coreMatch[0]) : 0;
}
totalCores += coreCount;
});
return `${totalCores} Cores`;
},
getK2Gb(bs){
bs = bs / 1024 / 1024 / 1024;
Expand Down

0 comments on commit 71508f8

Please sign in to comment.