diff --git a/ScreenCast.Win/Services/WinClipboardService.cs b/ScreenCast.Win/Services/WinClipboardService.cs index a05cbd52..f1ea91cf 100644 --- a/ScreenCast.Win/Services/WinClipboardService.cs +++ b/ScreenCast.Win/Services/WinClipboardService.cs @@ -69,14 +69,20 @@ namespace Remotely.ScreenCast.Win.Services { try { - if (clipboardText is null) - { - return; - } - var thread = new Thread(() => { - Clipboard.SetText(clipboardText); + try + { + if (string.IsNullOrWhiteSpace(clipboardText)) + { + Clipboard.Clear(); + } + else + { + Clipboard.SetText(clipboardText); + } + } + catch { } }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); diff --git a/Server/Areas/Identity/Pages/Account/Manage/Organization.cshtml.cs b/Server/Areas/Identity/Pages/Account/Manage/Organization.cshtml.cs index 0442b1db..f3505ab8 100644 --- a/Server/Areas/Identity/Pages/Account/Manage/Organization.cshtml.cs +++ b/Server/Areas/Identity/Pages/Account/Manage/Organization.cshtml.cs @@ -111,15 +111,8 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage var result = await UserManager.CreateAsync(user); if (result.Succeeded) { - //if (!DataService.SetNewUserProperties(user.UserName, currentUser.OrganizationID, Input.IsAdmin)) - //{ - // ModelState.AddModelError("OrgID", "Failed to set organization ID."); - // return Page(); - //} - user = await UserManager.FindByEmailAsync(Input.UserEmail); - await UserManager.ConfirmEmailAsync(user, await UserManager.GenerateEmailConfirmationTokenAsync(user)); StatusMessage = "User account created."; diff --git a/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml b/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml index 93e6eaed..5cf00258 100644 --- a/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml +++ b/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml @@ -12,7 +12,7 @@
-
+

Application Settings

@@ -56,7 +56,10 @@

- +
@@ -167,7 +170,10 @@

- +
@@ -227,7 +233,10 @@

- +
@@ -240,13 +249,20 @@
- +
+ } else diff --git a/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml.cs b/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml.cs index 914ee484..cb0a57fb 100644 --- a/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml.cs +++ b/Server/Areas/Identity/Pages/Account/Manage/ServerConfig.cshtml.cs @@ -1,11 +1,3 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Dynamic; -using System.Linq; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -14,38 +6,54 @@ using Microsoft.Extensions.Configuration; using Remotely.Server.Services; using Remotely.Shared.Enums; using Remotely.Shared.Models; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; namespace Remotely.Server.Areas.Identity.Pages.Account.Manage { public class ServerConfigModel : PageModel { - public ServerConfigModel(IConfiguration configuration, IWebHostEnvironment hostEnv, UserManager userManager) + public ServerConfigModel(IConfiguration configuration, + IWebHostEnvironment hostEnv, + UserManager userManager, + DataService dataService) { Configuration = configuration; HostEnv = hostEnv; UserManager = userManager; + DataService = dataService; } - - public IConfiguration Configuration { get; } - public IWebHostEnvironment HostEnv { get; } + public enum DBProviders + { + PostgreSQL, + SQLite, + SQLServer + } [BindProperty] public AppSettingsModel AppSettingsInput { get; set; } = new AppSettingsModel(); - [BindProperty] - [Display(Name = "Server Admins")] - public List ServerAdmins { get; set; } = new List(); - [BindProperty] public ConnectionStringsModel ConnectionStrings { get; set; } = new ConnectionStringsModel(); public bool IsServerAdmin { get; set; } + [BindProperty] + [Display(Name = "Server Admins")] + public List ServerAdmins { get; set; } = new List(); + [TempData] public string StatusMessage { get; set; } - public UserManager UserManager { get; } + private IConfiguration Configuration { get; } + private DataService DataService { get; } + private IWebHostEnvironment HostEnv { get; } + private UserManager UserManager { get; } + public async Task OnGet() { IsServerAdmin = (await UserManager.GetUserAsync(User)).IsServerAdmin; @@ -56,9 +64,11 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage Configuration.Bind("ApplicationOptions", AppSettingsInput); Configuration.Bind("ConnectionStrings", ConnectionStrings); + ServerAdmins = DataService.GetServerAdmins(); return Page(); } + public async Task OnPost() { IsServerAdmin = (await UserManager.GetUserAsync(User)).IsServerAdmin; @@ -72,10 +82,20 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage return Page(); } + var configReloaded = false; + Configuration.GetReloadToken().RegisterChangeCallback((e) => + { + configReloaded = true; + }, null); + await SaveAppSettings(); - return RedirectToPage(); + while (!configReloaded) + { + await Task.Delay(10); + } + return RedirectToPage(); } private async Task SaveAppSettings() @@ -103,10 +123,9 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage await System.IO.File.WriteAllTextAsync(savePath, JsonSerializer.Serialize(settingsJson, new JsonSerializerOptions() { WriteIndented = true })); - // TODO: Save server admins. + await DataService.UpdateServerAdmins(ServerAdmins, User.Identity.Name); } - public class AppSettingsModel { [Display(Name = "Allow API Login")] @@ -130,6 +149,7 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage [Display(Name = "Max Organizations")] public int MaxOrganizationCount { get; set; } + [Display(Name = "Record Remote Control Sessions")] public bool RecordRemoteControlSessions { get; set; } @@ -189,17 +209,8 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage [Display(Name = "SQLite")] public string SQLite { get; set; } - [Display(Name = "SQL Server")] public string SQLServer { get; set; } - - } - - public enum DBProviders - { - PostgreSQL, - SQLite, - SQLServer } } -} +} \ No newline at end of file diff --git a/Server/Areas/Identity/Pages/Account/Register.cshtml.cs b/Server/Areas/Identity/Pages/Account/Register.cshtml.cs index 235b2ab8..6ae4abef 100644 --- a/Server/Areas/Identity/Pages/Account/Register.cshtml.cs +++ b/Server/Areas/Identity/Pages/Account/Register.cshtml.cs @@ -88,13 +88,7 @@ namespace Remotely.Server.Areas.Identity.Pages.Account ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { - var user = new RemotelyUser - { - UserName = Input.Email, - Email = Input.Email , - IsServerAdmin = organizationCount == 0 - }; - var result = await _userManager.CreateAsync(user, Input.Password); + var (result, user) = await _dataService.CreateUser(Input.Email, Input.Password, true); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); diff --git a/Server/Installers/c9e1760f-9ccb-4f37-8347-7e5f304af915/Windows/2020.03.01.1355/Remotely_Installer.exe b/Server/Installers/c9e1760f-9ccb-4f37-8347-7e5f304af915/Windows/2020.03.01.1355/Remotely_Installer.exe deleted file mode 100644 index a44d7a97..00000000 Binary files a/Server/Installers/c9e1760f-9ccb-4f37-8347-7e5f304af915/Windows/2020.03.01.1355/Remotely_Installer.exe and /dev/null differ diff --git a/Server/Services/DataService.cs b/Server/Services/DataService.cs index 4b012b68..483366e6 100644 --- a/Server/Services/DataService.cs +++ b/Server/Services/DataService.cs @@ -64,6 +64,14 @@ namespace Remotely.Server.Services return true; } + public List GetServerAdmins() + { + return RemotelyContext.Users + .Where(x => x.IsServerAdmin) + .Select(x => x.UserName) + .ToList(); + } + public InviteLink AddInvite(string orgID, Invite invite) { invite.InvitedUser = invite.InvitedUser.ToLower(); @@ -101,6 +109,7 @@ namespace Remotely.Server.Services RemotelyContext.SaveChanges(); } + public bool AddOrUpdateDevice(Device device, out Device updatedDevice) { var existingDevice = RemotelyContext.Devices.Find(device.ID); @@ -152,6 +161,31 @@ namespace Remotely.Server.Services return true; } + public async Task UpdateServerAdmins(List serverAdmins, string callerUserName) + { + var currentAdmins = RemotelyContext.Users.Where(x => x.IsServerAdmin).ToList(); + + var removeAdmins = currentAdmins.Where(currentAdmin => + !serverAdmins.Contains(currentAdmin.UserName.Trim().ToLower()) && + currentAdmin.UserName.Trim().ToLower() != callerUserName.Trim().ToLower()); + + foreach (var removeAdmin in removeAdmins) + { + removeAdmin.IsServerAdmin = false; + } + + var newAdmins = RemotelyContext.Users.Where(user => + serverAdmins.Contains(user.UserName.Trim().ToLower()) && + !user.IsServerAdmin); + + foreach (var newAdmin in newAdmins) + { + newAdmin.IsServerAdmin = true; + } + + await RemotelyContext.SaveChangesAsync(); + } + public string AddSharedFile(IFormFile file, string organizationID) { var expirationDate = DateTimeOffset.Now.AddDays(-AppConfig.DataRetentionInDays); @@ -233,6 +267,21 @@ namespace Remotely.Server.Services return newToken; } + + public async Task<(IdentityResult, RemotelyUser)> CreateUser(string email, string password, bool isOrgAdmin) + { + var user = new RemotelyUser + { + UserName = email, + Email = email, + IsServerAdmin = RemotelyContext.Organizations.Count() == 0, + IsAdministrator = isOrgAdmin + }; + var result = await UserManager.CreateAsync(user, password); + + return (result, user); + } + public async Task DeleteApiToken(string userName, string tokenId) { var user = RemotelyContext.Users.FirstOrDefault(x => x.UserName == userName); @@ -720,17 +769,6 @@ namespace Remotely.Server.Services } } - public bool SetNewUserProperties(string targetName, string organizationID, bool isAdmin) - { - var targetUser = GetUserByName(targetName); - - targetUser.OrganizationID = organizationID; - targetUser.IsAdministrator = isAdmin; - - RemotelyContext.SaveChanges(); - - return true; - } public void SetServerVerificationToken(string deviceID, string verificationToken) { var device = RemotelyContext.Devices.Find(deviceID); diff --git a/Server/wwwroot/css/site.css b/Server/wwwroot/css/site.css index 11ef6445..63fdc32b 100644 --- a/Server/wwwroot/css/site.css +++ b/Server/wwwroot/css/site.css @@ -19,12 +19,6 @@ h6 { font-size: 1rem !important; } -input[type='checkbox'] { - width: 25px; - height: 25px; -} - - .container { max-width: 95vw !important; } diff --git a/Server/wwwroot/scripts/Pages/ServerConfig.js b/Server/wwwroot/scripts/Pages/ServerConfig.js index c8edd70b..778a3682 100644 --- a/Server/wwwroot/scripts/Pages/ServerConfig.js +++ b/Server/wwwroot/scripts/Pages/ServerConfig.js @@ -1,3 +1,5 @@ +var serverConfigForm = document.getElementById("serverConfigForm"); +var serverConfigSaveButton = document.getElementById("serverConfigSaveButton"); var trustedCorsAddButton = document.getElementById("trustedCorsAddButton"); var trustedCorsRemoveButton = document.getElementById("trustedCorsRemoveButton"); var trustedCorsInput = document.getElementById("trustedCorsInput"); @@ -10,6 +12,18 @@ var serverAdminsAddButton = document.getElementById("serverAdminsAddButton"); var serverAdminsRemoveButton = document.getElementById("serverAdminsRemoveButton"); var serverAdminsInput = document.getElementById("serverAdminsInput"); var serverAdminsSelect = document.getElementById("serverAdminsSelect"); +serverConfigSaveButton.addEventListener("click", e => { + for (var i = 0; i < trustedCorsSelect.options.length; i++) { + trustedCorsSelect.options[i].selected = true; + } + for (var i = 0; i < knownProxiesSelect.options.length; i++) { + knownProxiesSelect.options[i].selected = true; + } + for (var i = 0; i < serverAdminsSelect.options.length; i++) { + serverAdminsSelect.options[i].selected = true; + } + serverConfigForm.submit(); +}); trustedCorsAddButton.addEventListener("click", ev => { if (trustedCorsInput.value.length > 0) { var option = document.createElement("option"); diff --git a/Server/wwwroot/scripts/Pages/ServerConfig.js.map b/Server/wwwroot/scripts/Pages/ServerConfig.js.map index 5f283b95..da3b920f 100644 --- a/Server/wwwroot/scripts/Pages/ServerConfig.js.map +++ b/Server/wwwroot/scripts/Pages/ServerConfig.js.map @@ -1 +1 @@ -{"version":3,"file":"ServerConfig.js","sourceRoot":"","sources":["ServerConfig.ts"],"names":[],"mappings":"AAAA,IAAI,oBAAoB,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAsB,CAAC;AAChG,IAAI,uBAAuB,GAAG,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAsB,CAAC;AACtG,IAAI,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAqB,CAAC;AACvF,IAAI,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,mBAAmB,CAAsB,CAAC;AAE1F,IAAI,qBAAqB,GAAG,QAAQ,CAAC,cAAc,CAAC,uBAAuB,CAAsB,CAAC;AAClG,IAAI,wBAAwB,GAAG,QA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AAC;AAEH,iBAAiB,CAAC,gBAAgB,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE;IAChD,IAAI,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,OAAO,EAAE;QACjC,EAAE,CAAC,cAAc,EAAE,CAAC;QACpB,EAAE,CAAC,eAAe,EAAE,CAAC;QACrB,qBAAqB,CAAC,KAAK,EAAE,CAAC;KACjC;AACL,CAAC,CAAC,CAAA;AAEF,wBAAwB,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE;IACpD,OAAO,kBAAkB,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;QAClD,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAClD;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/Server/wwwroot/scripts/Pages/ServerConfig.ts b/Server/wwwroot/scripts/Pages/ServerConfig.ts index e5eafc65..5dcd5f67 100644 --- a/Server/wwwroot/scripts/Pages/ServerConfig.ts +++ b/Server/wwwroot/scripts/Pages/ServerConfig.ts @@ -1,4 +1,7 @@ -var trustedCorsAddButton = document.getElementById("trustedCorsAddButton") as HTMLButtonElement; +var serverConfigForm = document.getElementById("serverConfigForm") as HTMLFormElement; +var serverConfigSaveButton = document.getElementById("serverConfigSaveButton") as HTMLButtonElement; + +var trustedCorsAddButton = document.getElementById("trustedCorsAddButton") as HTMLButtonElement; var trustedCorsRemoveButton = document.getElementById("trustedCorsRemoveButton") as HTMLButtonElement; var trustedCorsInput = document.getElementById("trustedCorsInput") as HTMLInputElement; var trustedCorsSelect = document.getElementById("trustedCorsSelect") as HTMLSelectElement; @@ -13,7 +16,19 @@ var serverAdminsRemoveButton = document.getElementById("serverAdminsRemoveButton var serverAdminsInput = document.getElementById("serverAdminsInput") as HTMLInputElement; var serverAdminsSelect = document.getElementById("serverAdminsSelect") as HTMLSelectElement; +serverConfigSaveButton.addEventListener("click", e => { + for (var i = 0; i < trustedCorsSelect.options.length; i++) { + trustedCorsSelect.options[i].selected = true; + } + for (var i = 0; i < knownProxiesSelect.options.length; i++) { + knownProxiesSelect.options[i].selected = true; + } + for (var i = 0; i < serverAdminsSelect.options.length; i++) { + serverAdminsSelect.options[i].selected = true; + } + serverConfigForm.submit(); +}); trustedCorsAddButton.addEventListener("click", ev => { if (trustedCorsInput.value.length > 0) {