Merge branch 'rustdesk:master' into master

This commit is contained in:
Arash Hatami
2021-11-14 18:52:51 +03:30
committed by GitHub
21 changed files with 443 additions and 109 deletions

View File

@@ -257,6 +257,10 @@ handler.msgbox = function(type, title, text, callback=null, height=180, width=50
self.timer(150ms, function() { msgbox(type, title, text, callback, height, width, retry); });
}
handler.block_msgbox = function(type, title, text, callback=null, height=180, width=500, retry=0) {
msgbox(type, title, text, callback, height, width, retry);
}
var reconnectTimeout = 1;
handler.msgbox_retry = function(type, title, text, hasRetry, callback=null, height=180, width=500) {
handler.msgbox(type, title, text, callback, height, width, hasRetry ? reconnectTimeout : 0);

View File

@@ -30,6 +30,7 @@ table > thead {
}
table > tbody {
behavior: select-multiple;
overflow-y: scroll-indicator;
size: *;
background: white;
@@ -85,6 +86,15 @@ table.has_current tr:current /* current row */
background-color: color(accent);
}
table.has_current tbody tr:checked
{
background-color: color(accent);
}
table.has_current tbody tr:checked td {
color: highlighttext;
}
table td
{
padding: 4px;

View File

@@ -374,7 +374,7 @@ class FolderView : Reactor.Component {
path = this.joinPath(entry.name);
}
var tm = entry.time ? new Date(entry.time.toFloat() * 1000.).toLocaleString() : 0;
return <tr>
return <tr role="option">
<td type={entry.type} filename={path}></td>
<td>{entry.name}</td>
<td value={entry.time || 0}>{tm || ""}</td>
@@ -401,20 +401,31 @@ class FolderView : Reactor.Component {
}
event click $(.trash) () {
var row = this.getCurrentRow();
if (!row) return;
var path = row[0];
var type = row[1];
var new_history = [];
for (var i = 0; i < this.history.length; ++i) {
var h = this.history[i];
if ((h + this.sep()).indexOf(path + this.sep()) == -1) new_history.push(h);
var rows = this.getCurrentRows();
if (!rows || rows.length == 0) return;
var delete_dirs = new Array();
for (var i = 0; i < rows.length; ++i) {
var row = rows[i];
var path = row[0];
var type = row[1];
var new_history = [];
for (var j = 0; j < this.history.length; ++j) {
var h = this.history[j];
if ((h + this.sep()).indexOf(path + this.sep()) == -1) new_history.push(h);
}
this.history = new_history;
if (type == 1) {
delete_dirs.push(path);
} else {
confirmDelete(path, this.is_remote);
}
}
this.history = new_history;
if (type == 1) {
file_transfer.job_table.addDelDir(path, this.is_remote);
} else {
confirmDelete(path, this.is_remote);
for (var i = 0; i < delete_dirs.length; ++i) {
file_transfer.job_table.addDelDir(delete_dirs[i], this.is_remote);
}
}
@@ -463,10 +474,28 @@ class FolderView : Reactor.Component {
return [this.joinPath(name), type];
}
function getCurrentRows() {
var rows = this.table.getCurrentRows();
if (!rows || rows.length== 0) return;
var records = new Array();
for (var i = 0; i < rows.length; ++i) {
var name = rows[i][1].text;
if (!name || name == "..") continue;
var type = rows[i][0].attributes["type"];
records.push([this.joinPath(name), type]);
}
return records;
}
event click $(.send) () {
var cur = this.getCurrentRow();
if (!cur) return;
file_transfer.job_table.send(cur[0], this.is_remote);
var rows = this.getCurrentRows();
if (!rows || rows.length == 0) return;
for (var i = 0; i < rows.length; ++i) {
file_transfer.job_table.send(rows[i][0], this.is_remote);
}
}
event change $(.select-dir) (_, el) {
@@ -570,7 +599,7 @@ var deleting_single_file_jobs = {};
var create_dir_jobs = {}
function confirmDelete(path, is_remote) {
handler.msgbox("custom-skip", "Confirm Delete", "<div .form> \
handler.block_msgbox("custom-skip", "Confirm Delete", "<div .form> \
<div>Are you sure you want to delete this file?</div> \
<div.ellipsis style=\"font-weight: bold;\">" + path + "</div> \
</div>", function(res=null) {
@@ -590,7 +619,7 @@ handler.confirmDeleteFiles = function(id, i, name) {
if (i >= n) return;
var file_path = job.path;
if (name) file_path += handler.get_path_sep(job.is_remote) + name;
handler.msgbox("custom-skip", "Confirm Delete", "<div .form> \
handler.block_msgbox("custom-skip", "Confirm Delete", "<div .form> \
<div>Deleting #" + (i + 1) + " of " + n + " files.</div> \
<div>Are you sure you want to delete this file?</div> \
<div.ellipsis style=\"font-weight: bold;\" .text>" + name + "</div> \

View File

@@ -24,6 +24,11 @@ class Grid: Behavior {
{
return this.$(tbody>tr:current);
}
function getCurrentRows()
{
return this.$$(tbody>tr:checked);
}
function getCurrentColumn()
{

View File

@@ -40,9 +40,7 @@ class ConnectStatus: Reactor.Component {
}
event click $(.connect-status .link) () {
var options = handler.get_options();
options["stop-service"] = "";
handler.set_options(options);
handler.set_option("stop-service", "");
}
}
@@ -138,7 +136,6 @@ function createNewConnect(id, type) {
var myIdMenu;
var audioInputMenu;
var configOptions = {};
class AudioInputs: Reactor.Component {
function this() {
audioInputMenu = this;
@@ -167,7 +164,7 @@ class AudioInputs: Reactor.Component {
}
function get_value() {
return configOptions["audio-input"] || this.get_default();
return handler.get_option("audio-input") || this.get_default();
}
function toggleMenuState() {
@@ -182,8 +179,7 @@ class AudioInputs: Reactor.Component {
var v = me.id;
if (v == this.get_value()) return;
if (v == this.get_default()) v = "";
configOptions["audio-input"] = v;
handler.set_options(configOptions);
handler.set_option("audio-input", v);
this.toggleMenuState();
}
}
@@ -223,7 +219,6 @@ class MyIdMenu: Reactor.Component {
event click $(svg#menu) (_, me) {
audioInputMenu.update({ show: true });
configOptions = handler.get_options();
this.toggleMenuState();
var menu = $(menu#config-options);
me.popup(menu);
@@ -232,7 +227,7 @@ class MyIdMenu: Reactor.Component {
function toggleMenuState() {
for (var el in $$(menu#config-options>li)) {
if (el.id && el.id.indexOf("enable-") == 0) {
var enabled = configOptions[el.id] != "N";
var enabled = handler.get_option(el.id) != "N";
el.attributes.toggleClass("selected", enabled);
el.attributes.toggleClass("line-through", !enabled);
}
@@ -241,11 +236,10 @@ class MyIdMenu: Reactor.Component {
event click $(menu#config-options>li) (_, me) {
if (me.id && me.id.indexOf("enable-") == 0) {
configOptions[me.id] = configOptions[me.id] == "N" ? "" : "N";
handler.set_options(configOptions);
handler.set_option(me.id, handler.get_option(me.id) == "N" ? "" : "N");
}
if (me.id == "whitelist") {
var old_value = (configOptions["whitelist"] || "").split(",").join("\n");
var old_value = handler.get_option("whitelist").split(",").join("\n");
handler.msgbox("custom-whitelist", "IP Whitelisting", "<div .form> \
<textarea spellcheck=\"false\" name=\"text\" novalue=\"0.0.0.0\" style=\"overflow: scroll-indicator; height: 160px; font-size: 1.2em; padding: 0.5em;\">" + old_value + "</textarea>\
</div> \
@@ -253,7 +247,7 @@ class MyIdMenu: Reactor.Component {
if (!res) return;
var value = (res.text || "").trim();
if (value) {
var values = value.split(/[\s,;]+/g);
var values = value.split(/[\s,;\n]+/g);
for (var ip in values) {
if (!ip.match(/^\d+\.\d+\.\d+\.\d+$/)) {
return "Invalid ip: " + ip;
@@ -262,11 +256,11 @@ class MyIdMenu: Reactor.Component {
value = values.join("\n");
}
if (value == old_value) return;
configOptions["whitelist"] = value.replace("\n", ",");
stdout.println("whitelist updated");
handler.set_options(configOptions);
handler.set_option("whitelist", value.replace("\n", ","));
}, 300);
} else if (me.id == "custom-server") {
var configOptions = handler.get_options();
var old_relay = configOptions["relay-server"] || "";
var old_id = configOptions["custom-rendezvous-server"] || "";
handler.msgbox("custom-server", "ID/Relay Server", "<div .form> \
@@ -293,8 +287,7 @@ class MyIdMenu: Reactor.Component {
} else if (me.id == "forum") {
handler.open_url("https:://forum.rustdesk.com");
} else if (me.id == "stop-service") {
configOptions["stop-service"] = service_stopped ? "" : "Y";
handler.set_options(configOptions);
handler.set_option("stop-service", service_stopped ? "" : "Y");
} else if (me.id == "about") {
var name = handler.get_app_name();
handler.msgbox("custom-nocancel-nook-hasclose", "About " + name, "<div style='line-height: 2em'> \