From e61c05c10b847b4811125deed431a6fcbb1ae3d5 Mon Sep 17 00:00:00 2001 From: imebeh Date: Sat, 28 Mar 2020 14:51:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E6=98=BE=E7=A4=BApeer?= =?UTF-8?q?=E5=92=8Ctracker=E7=9A=84=E6=9B=B4=E5=A4=9A=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=20(#391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加 已连接用户的端口和UTP状态 * 增加 tracker服务器显示更多信息 * 更新 英文语言文件 --- src/tr-web-control/i18n/en.json | 12 +++++++++++- src/tr-web-control/i18n/zh_CN.json | 16 ++++++++++++++-- src/tr-web-control/i18n/zh_TW.json | 14 +++++++++++++- src/tr-web-control/script/system.js | 12 ++++++++++++ .../dialog-torrent-attribute-add-tracker.html | 8 +++++--- .../torrent-attribute-servers-fields.json | 4 +++- .../template/torrent-attribute-users-fields.json | 2 ++ 7 files changed, 60 insertions(+), 8 deletions(-) diff --git a/src/tr-web-control/i18n/en.json b/src/tr-web-control/i18n/en.json index a1d30e5..ef936ad 100644 --- a/src/tr-web-control/i18n/en.json +++ b/src/tr-web-control/i18n/en.json @@ -370,10 +370,20 @@ "lastAnnounceTime": "AnnounceTime", "lastAnnounceTimedOut": "TimedOut", "downloadCount": "Download count", - "nextAnnounceTime": "Next announce" + "nextAnnounceTime": "Next announce", + "leecherCount": "Leecher count", + "seederCount": "Seeder count", + "announceStateText": { + "0": "Inactive", + "1": "Waiting", + "2": "Queued", + "3": "Active" + } }, "peers-fields": { "address": "IP address", + "port": "Port", + "isUTP": "UTP enabled", "clientName": "Client", "flagStr": "Flag", "progress": "Progress", diff --git a/src/tr-web-control/i18n/zh_CN.json b/src/tr-web-control/i18n/zh_CN.json index 4418181..6081ed4 100644 --- a/src/tr-web-control/i18n/zh_CN.json +++ b/src/tr-web-control/i18n/zh_CN.json @@ -292,6 +292,8 @@ "newname": "新名称" }, "torrent-attribute-add-tracker": { + "button-search-best-ip": "精选(IP)", + "button-search-all-ip": "全部(IP)", "title": "增加 Tracker", "tip": "每行表示一个Tracker" }, @@ -368,11 +370,21 @@ "lastAnnounceSucceeded": "已连接", "lastAnnounceTime": "更新时间", "lastAnnounceTimedOut": "超时", - "downloadCount": "总下载数", - "nextAnnounceTime": "下次更新时间" + "downloadCount": "下载数", + "leecherCount": "吸血数", + "seederCount": "种子数", + "nextAnnounceTime": "下次更新时间", + "announceStateText": { + "0": "非活动", + "1": "待机", + "2": "队列中", + "3": "活动中" + } }, "peers-fields": { "address": "IP地址", + "port": "端口", + "isUTP": "UTP连接", "clientName": "客户端", "flagStr": "标记", "progress": "完成进度", diff --git a/src/tr-web-control/i18n/zh_TW.json b/src/tr-web-control/i18n/zh_TW.json index 3750a43..dbf557e 100644 --- a/src/tr-web-control/i18n/zh_TW.json +++ b/src/tr-web-control/i18n/zh_TW.json @@ -288,6 +288,8 @@ "newname": "新名稱" }, "torrent-attribute-add-tracker": { + "button-search-best-ip": "精選(IP)", + "button-search-all-ip": "全部(IP)", "title": "新增 Tracker", "tip": "每行一個 Tracker" }, @@ -354,10 +356,20 @@ "lastAnnounceTime": "更新時間", "lastAnnounceTimedOut": "超時", "downloadCount": "下載數", - "nextAnnounceTime": "下次更新時間" + "leecherCount": "吸血數", + "seederCount": "種子數", + "nextAnnounceTime": "下次更新時間", + "announceStateText": { + "0": "非活動", + "1": "待機", + "2": "佇列中", + "3": "活動中" + } }, "peers-fields": { "address": "IP 地址", + "port": "連接埠", + "isUTP": "UTP連接", "clientName": "用戶端", "flagStr": "標記", "progress": "進度", diff --git a/src/tr-web-control/script/system.js b/src/tr-web-control/script/system.js index 1d53604..799278b 100644 --- a/src/tr-web-control/script/system.js +++ b/src/tr-web-control/script/system.js @@ -2760,6 +2760,16 @@ var system = { var rowdata = {}; for (var key in stats) { switch (key) { + case "downloadCount": + case "leecherCount": + case "seederCount": + rowdata[key] = (stats[key] == -1 ? system.lang["public"]["text-unknown"] : stats[key]); + break; + + // state + case "announceState": + rowdata[key] = system.lang.torrent.attribute["servers-fields"]["announceStateText"][stats[key]]; + break; // Dates case "lastAnnounceTime": case "nextAnnounceTime": @@ -2797,6 +2807,8 @@ var system = { for (var key in item) { rowdata[key] = item[key]; } + // 使用同类已有的翻译文本 + rowdata.isUTP = system.lang.torrent.attribute["status"][item.isUTP]; var percentDone = parseFloat(item.progress * 100).toFixed(2); rowdata.progress = system.getTorrentProgressBar(percentDone, transmission._status.download) datas.push(rowdata); diff --git a/src/tr-web-control/template/dialog-torrent-attribute-add-tracker.html b/src/tr-web-control/template/dialog-torrent-attribute-add-tracker.html index cab2cd8..6e02712 100644 --- a/src/tr-web-control/template/dialog-torrent-attribute-add-tracker.html +++ b/src/tr-web-control/template/dialog-torrent-attribute-add-tracker.html @@ -28,9 +28,11 @@ background: "#e6e6e6" }); - title = "button-ok,button-cancel".split(","); + title = "button-search-best-ip,button-search-all-ip,button-ok,button-cancel".split(","); $.each(title, function (i, item) { thisDialog.find("#torrent-attribute-add-tracker-" + item).html(system.lang.dialog["public"][item]); + thisDialog.find("#torrent-attribute-add-tracker-" + item).html(system.lang.dialog[ + "torrent-attribute-add-tracker"][item]); }); thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]); @@ -83,14 +85,14 @@ thisDialog.find("#torrent-attribute-add-tracker-button-search-best-ip").click(function () { var trackersURL = "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt" $.get(trackersURL,function(data){ - $("#txtTrackers").html(data); + $("#txtTrackers").html(data.replace(/[\r\n]+/g,"\n")); }); }); thisDialog.find("#torrent-attribute-add-tracker-button-search-all-ip").click(function () { var trackersURL="https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_ip.txt" $.get(trackersURL,function(data){ - $("#txtTrackers").html(data); + $("#txtTrackers").html(data.replace(/[\r\n]+/g,"\n")); }); }); diff --git a/src/tr-web-control/template/torrent-attribute-servers-fields.json b/src/tr-web-control/template/torrent-attribute-servers-fields.json index b3f339a..8eb60ce 100644 --- a/src/tr-web-control/template/torrent-attribute-servers-fields.json +++ b/src/tr-web-control/template/torrent-attribute-servers-fields.json @@ -10,7 +10,9 @@ {"field":"announce","width":"300"} ,{"field":"announceState","width":"50"} ,{"field":"lastAnnounceResult","width":"180"} - ,{"field":"downloadCount","width":"70","align":"left"} + ,{"field":"downloadCount","width":"60","align":"left"} + ,{"field":"leecherCount","width":"60","align":"left"} + ,{"field":"seederCount","width":"60","align":"left"} ,{"field":"lastAnnounceSucceeded","width":"60","align":"center"} ,{"field":"lastAnnounceTime","width":"120","align":"center"} ,{"field":"lastAnnounceTimedOut","width":"60","align":"center"} diff --git a/src/tr-web-control/template/torrent-attribute-users-fields.json b/src/tr-web-control/template/torrent-attribute-users-fields.json index 0791fdc..355a340 100644 --- a/src/tr-web-control/template/torrent-attribute-users-fields.json +++ b/src/tr-web-control/template/torrent-attribute-users-fields.json @@ -7,6 +7,8 @@ } ,"fields":[ {"field":"address","width":"260"} + ,{"field":"port","width":"60"} + ,{"field":"isUTP","width":"60","align":"center"} ,{"field":"clientName","width":"120"} ,{"field":"flagStr","width":"60"} ,{"field":"progress","width":"70","align":"center"}