feat: performance flags
This commit is contained in:
parent
9180fecdfb
commit
486dedb849
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -1,3 +1,4 @@
|
|||||||
[submodule "webrdp/rdp-rs"]
|
[submodule "webrdp/rdp-rs"]
|
||||||
path = webrdp/rdp-rs
|
path = webrdp/rdp-rs
|
||||||
url = https://github.com/qwqVictor/rdp-rs.git
|
url = https://github.com/qwqVictor/rdp-rs.git
|
||||||
|
branch = perfflags
|
9
assets/jquery-confirm.min.css
vendored
Normal file
9
assets/jquery-confirm.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10
assets/jquery-confirm.min.js
vendored
Normal file
10
assets/jquery-confirm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,12 +1,28 @@
|
|||||||
window.filegatewayUrl = "/filegw/"
|
function initFile(sessionId, filegateway) {
|
||||||
function initFile() {
|
window.fileSessionId = sessionId;
|
||||||
window.fileShareName = "drive_c$";
|
window.filegatewayUrl = filegateway.url
|
||||||
$('option').val(window.fileShareName).appendTo('#shares');
|
window.fileShareName = filegateway.shares[0];
|
||||||
|
var shares = [];
|
||||||
|
for (var i = 0; i < filegateway.shares.length; i++) {
|
||||||
|
shares.push($('<option></option>').val(filegateway.shares[i]).text(filegateway.shares[i]));
|
||||||
|
}
|
||||||
|
console.log("shares", shares);
|
||||||
|
$('#shares').append(shares);
|
||||||
window.currentPath = [];
|
window.currentPath = [];
|
||||||
updatePathText();
|
updatePathText();
|
||||||
listFile();
|
listFile();
|
||||||
setInterval(listFile, 20000);
|
setInterval(listFile, 20000);
|
||||||
}
|
}
|
||||||
|
function updateShareChoice(shareName, event) {
|
||||||
|
window.fileShareName = shareName;
|
||||||
|
window.currentPath = [];
|
||||||
|
updatePathText();
|
||||||
|
listFile();
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
function getCurrentPath() { return window.filegatewayUrl + window.fileSessionId + "/" + encodeURI(window.fileShareName) + "/" + encodeURI(window.currentPath.join("/")) + "/" }
|
function getCurrentPath() { return window.filegatewayUrl + window.fileSessionId + "/" + encodeURI(window.fileShareName) + "/" + encodeURI(window.currentPath.join("/")) + "/" }
|
||||||
function getSize(fileSize) {
|
function getSize(fileSize) {
|
||||||
var size = parseFloat(fileSize);
|
var size = parseFloat(fileSize);
|
||||||
@ -150,5 +166,5 @@ function onClickOpenDir(element) {
|
|||||||
listFile();
|
listFile();
|
||||||
}
|
}
|
||||||
function updatePathText() {
|
function updatePathText() {
|
||||||
$("#currentPath").text("/"+window.fileShareName+"/"+window.currentPath.join("/")+"/")
|
$("#currentPath").text("/"+window.fileShareName+"/"+window.currentPath.join("/")+(window.currentPath.length==0?"":"/"))
|
||||||
}
|
}
|
@ -56,21 +56,33 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="$('#rdp_container').hide();">
|
<body onload="$('#rdp_container').hide(); fetchWorkspaces()">
|
||||||
<div id="login_container">
|
<div id="login_container">
|
||||||
<form class="form-signin"
|
<img class="logo" src="./logo.svg"></img>
|
||||||
onsubmit="connect(this.elements['inputUser'].value, this.elements['inputPassword'].value, event);">
|
<form class="form-signin" id="workspace_select_form" onsubmit="useWorkspace(this, event)">
|
||||||
<img class="logo" src="./logo.svg">
|
<select class="form-control" id="workspace_select"></select>
|
||||||
|
<button class="btn btn-lg btn-primary btn-block" type="submit"
|
||||||
|
style="background-color: #34A6FF; border-color: #34A6FF">确定</button>
|
||||||
|
</form>
|
||||||
|
<form id="login_form" class="form-signin"
|
||||||
|
onsubmit="connect(this.elements['inputUser'].value, this.elements['inputPassword'].value, this.elements['inputDomain'].value, Array.from(this.getElementsByClassName('perfFlagsCheckbox')).map((x) => Number.parseInt(x.dataset.mask)).reduce((x, y) => x | y), event);">
|
||||||
<input type="text" id="inputUser" autocomplete="username" class="form-control" placeholder="用户名">
|
<input type="text" id="inputUser" autocomplete="username" class="form-control" placeholder="用户名">
|
||||||
<input type="password" id="inputPassword" autocomplete="current-password" class="form-control" placeholder="密码">
|
<input type="password" id="inputPassword" autocomplete="current-password" class="form-control" placeholder="密码">
|
||||||
|
<input type="text" id="inputDomain" class="form-control" placeholder="域">
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit"
|
<button class="btn btn-lg btn-primary btn-block" type="submit"
|
||||||
style="background-color: #34A6FF; border-color: #34A6FF">连接</button>
|
style="background-color: #34A6FF; border-color: #34A6FF">连接</button>
|
||||||
<p></p>
|
<p><details id="performanceFlags">
|
||||||
<!-- Begin Customization -->
|
<summary style="display: list-item">连接性能参数</summary>
|
||||||
<!--CUSTOMANCHOR-->
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000001" id="PERF_DISABLE_WALLPAPER" checked>禁用桌面背景</label>
|
||||||
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000002" id="PERF_DISABLE_FULLWINDOWDRAG" checked>禁用拖动时显示窗口内容</label>
|
||||||
<!-- End Customization -->
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000004" id="PERF_DISABLE_MENUANIMATIONS" checked>禁用菜单动画</label>
|
||||||
<p></p>
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000008" id="PERF_DISABLE_THEMING" checked>禁用主题</label>
|
||||||
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000020" id="PERF_DISABLE_CURSOR_SHADOW" checked>禁用鼠标阴影</label>
|
||||||
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000040" id="PERF_DISABLE_CURSORSETTINGS" checked>禁用鼠标闪烁</label>
|
||||||
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000080" id="PERF_ENABLE_FONT_SMOOTHING">启用字体平滑</label>
|
||||||
|
<label><input type="checkbox" class="perfFlagsCheckbox" data-mask="0x00000100" id="PERF_ENABLE_DESKTOP_COMPOSITION">启用桌面合成</label>
|
||||||
|
</details></p>
|
||||||
|
<div id="extraInfos"></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="rdp_container" style="height: 100%; margin: 0;">
|
<div id="rdp_container" style="height: 100%; margin: 0;">
|
||||||
@ -95,7 +107,7 @@
|
|||||||
<div id="filesharebox" class="vertical-centre">
|
<div id="filesharebox" class="vertical-centre">
|
||||||
<div style="position: relative; top: 50%; transform: translateY(-50%);">
|
<div style="position: relative; top: 50%; transform: translateY(-50%);">
|
||||||
<div>当前路径: <span id="currentPath"></span></div>
|
<div>当前路径: <span id="currentPath"></span></div>
|
||||||
<div>分享:<select id="shares">
|
<div>分享:<select id="shares" onchange="updateShareChoice(this.value, event)">
|
||||||
</select></div>
|
</select></div>
|
||||||
<table id="filesharelist">
|
<table id="filesharelist">
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,19 +1,64 @@
|
|||||||
function connect(user, password, event) {
|
function fetchWorkspaces() {
|
||||||
|
$("#login_form").hide();
|
||||||
|
$.ajax({
|
||||||
|
url: window.workspaceDefineUrl || '/workspace/index.json',
|
||||||
|
method: 'GET',
|
||||||
|
success: function (response) {
|
||||||
|
var data = response;
|
||||||
|
var workspaces = data.workspaces;
|
||||||
|
var domWorkspaceList = [];
|
||||||
|
for (var i = 0; i < workspaces.length; i++) {
|
||||||
|
var workspace = workspaces[i];
|
||||||
|
var workspaceName = workspace.name;
|
||||||
|
var workspaceInfo = JSON.stringify(workspace);
|
||||||
|
domWorkspaceList.push($("<option></option>").data("workspace", workspaceInfo).text(workspaceName));
|
||||||
|
}
|
||||||
|
$("#workspace_select").append(domWorkspaceList);
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
alert("获取工作区失败!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function useWorkspace() {
|
||||||
|
var workspaceInfo = $("#workspace_select option:selected").data("workspace");
|
||||||
|
var workspace = JSON.parse(workspaceInfo);
|
||||||
|
window.workspace = workspace;
|
||||||
|
if (workspace.domain) {
|
||||||
|
$("#inputDomain").val(workspace.domain);
|
||||||
|
}
|
||||||
|
if (workspace.domainImmutable) {
|
||||||
|
$("#inputDomain").attr("readonly", true).hide();
|
||||||
|
}
|
||||||
|
if (workspace.extraInfos) {
|
||||||
|
$("#extraInfos")[0].innerHTML = workspace.extraInfos;
|
||||||
|
}
|
||||||
|
$("#workspace_select_form").hide();
|
||||||
|
$("#login_form").show();
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function connect(user, password, domain, performanceFlag, event) {
|
||||||
jsExportedCredentials.user = user;
|
jsExportedCredentials.user = user;
|
||||||
jsExportedCredentials.password = password;
|
jsExportedCredentials.password = password;
|
||||||
|
jsExportedCredentials.domain = domain;
|
||||||
|
jsExportedCredentials.performanceFlag = performanceFlag;
|
||||||
|
jsExportedCredentials.wsurl = (window.workspace.websocketUrl.startsWith("wss://") || window.workspace.websocketUrl.startsWith("ws://")) ?
|
||||||
|
window.workspace.websocketUrl : (window.location.protocol == "https:" ? "wss://" : "ws://") + window.location.host + window.workspace.websocketUrl;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: window.filegatewayUrl,
|
url: window.workspace.filegateway.url,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
username: jsExportedCredentials.user,
|
username: user,
|
||||||
password: jsExportedCredentials.password,
|
password: password,
|
||||||
domain: jsExportedCredentials.domain
|
domain: domain
|
||||||
},
|
},
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
var data = response;
|
var data = response;
|
||||||
var sessionId = data.sessionId;
|
var sessionId = data.sessionId;
|
||||||
window.fileSessionId = sessionId;
|
initFile(sessionId, window.workspace.filegateway);
|
||||||
initFile();
|
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
alert("文件服务登录失败!");
|
alert("文件服务登录失败!");
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d1c0ebd70ad8d23e7400472ea35564e722835d96
|
Subproject commit 988b8a73b131e6c7a4597ae087cae0fdf021c146
|
@ -19,26 +19,14 @@ extern "C" {
|
|||||||
|
|
||||||
fn start_websocket() -> Result<(), JsValue> {
|
fn start_websocket() -> Result<(), JsValue> {
|
||||||
// connect
|
// connect
|
||||||
let url = format!(
|
let url = jsExportedCredentials("wsurl");
|
||||||
"{scheme}://{host}/websockify",
|
|
||||||
scheme = if web_sys::window()
|
|
||||||
.unwrap()
|
|
||||||
.location()
|
|
||||||
.protocol()?
|
|
||||||
.starts_with("https")
|
|
||||||
{
|
|
||||||
"wss"
|
|
||||||
} else {
|
|
||||||
"ws"
|
|
||||||
},
|
|
||||||
host = web_sys::window().unwrap().location().host()?
|
|
||||||
);
|
|
||||||
|
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
let username = jsExportedCredentials("user");
|
let username = jsExportedCredentials("user");
|
||||||
let password = jsExportedCredentials("password");
|
let password = jsExportedCredentials("password");
|
||||||
let domain = jsExportedCredentials("domain");
|
let domain = jsExportedCredentials("domain");
|
||||||
let mut rdp = Rdp::new(&url, &username, &password, &domain);
|
let performance_flags: u32 = jsExportedCredentials("performanceFlags").parse().unwrap();
|
||||||
|
let mut rdp = Rdp::new(&url, &username, &password, &domain, performance_flags);
|
||||||
if !rdp.start().await {
|
if !rdp.start().await {
|
||||||
wrongCredential();
|
wrongCredential();
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,13 @@ pub struct Rdp {
|
|||||||
username: String,
|
username: String,
|
||||||
password: String,
|
password: String,
|
||||||
domain: String,
|
domain: String,
|
||||||
|
performance_flags: u32,
|
||||||
screen: (u16, u16),
|
screen: (u16, u16),
|
||||||
rdp_client: Option<RdpClient<WsStream>>,
|
rdp_client: Option<RdpClient<WsStream>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Rdp {
|
impl Rdp {
|
||||||
pub fn new(url: &str, username: &str, password: &str, domain: &str) -> Self {
|
pub fn new(url: &str, username: &str, password: &str, domain: &str, performance_flags: u32) -> Self {
|
||||||
let body = web_sys::window()
|
let body = web_sys::window()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.document()
|
.document()
|
||||||
@ -38,6 +39,7 @@ impl Rdp {
|
|||||||
username: username.to_owned(),
|
username: username.to_owned(),
|
||||||
password: password.to_owned(),
|
password: password.to_owned(),
|
||||||
domain: domain.to_owned(),
|
domain: domain.to_owned(),
|
||||||
|
performance_flags: performance_flags,
|
||||||
rdp_client: None,
|
rdp_client: None,
|
||||||
screen: (width, height),
|
screen: (width, height),
|
||||||
}
|
}
|
||||||
@ -57,6 +59,7 @@ impl Rdp {
|
|||||||
.auto_logon(false)
|
.auto_logon(false)
|
||||||
.blank_creds(false)
|
.blank_creds(false)
|
||||||
.check_certificate(false)
|
.check_certificate(false)
|
||||||
|
.set_performance_flags(self.performance_flags)
|
||||||
.name(RDP_HOSTNAME.to_string())
|
.name(RDP_HOSTNAME.to_string())
|
||||||
.use_nla(true);
|
.use_nla(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user