From 0264fb5a0624fa17b008bc904d50e3f2a1d4ac8e Mon Sep 17 00:00:00 2001 From: Patryk Kisielewski Date: Fri, 19 Apr 2024 22:02:21 +0200 Subject: [PATCH 1/5] Add LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4ed3852 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019-2024 Patryk Kisielewski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From e875d6fc370db8d5b918c23b74fde11a69e7919a Mon Sep 17 00:00:00 2001 From: Patryk Kisielewski Date: Fri, 19 Apr 2024 22:13:41 +0200 Subject: [PATCH 2/5] Migrate to .NET 8.0 --- SmartHome-Server/App.config | 6 +- SmartHome-Server/HttpServer.cs | 2 +- SmartHome-Server/Properties/AssemblyInfo.cs | 23 ------- SmartHome-Server/SmartHome-Server.csproj | 74 +++++---------------- SmartHome-Server/packages.config | 4 -- SmartHome.sln | 13 ++-- 6 files changed, 29 insertions(+), 93 deletions(-) delete mode 100644 SmartHome-Server/packages.config diff --git a/SmartHome-Server/App.config b/SmartHome-Server/App.config index 731f6de..4bfa005 100644 --- a/SmartHome-Server/App.config +++ b/SmartHome-Server/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/SmartHome-Server/HttpServer.cs b/SmartHome-Server/HttpServer.cs index f76a664..7fba640 100644 --- a/SmartHome-Server/HttpServer.cs +++ b/SmartHome-Server/HttpServer.cs @@ -95,7 +95,7 @@ private void NewRequest(object _context) if (File.Exists(path)) { responseBytes = File.ReadAllBytes(path); - response.ContentType = MimeMapping.GetMimeMapping(path); + //response.ContentType = MimeMapping.GetMimeMapping(path); } else { diff --git a/SmartHome-Server/Properties/AssemblyInfo.cs b/SmartHome-Server/Properties/AssemblyInfo.cs index 250343f..7e19123 100644 --- a/SmartHome-Server/Properties/AssemblyInfo.cs +++ b/SmartHome-Server/Properties/AssemblyInfo.cs @@ -1,16 +1,6 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - -// Ogólne informacje o zestawie są kontrolowane poprzez następujący -// zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje -// powiązane z zestawem. -[assembly: AssemblyTitle("SmartHome-Server")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SmartHome-Server")] -[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -21,16 +11,3 @@ // Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM [assembly: Guid("470cb9c4-98e0-481f-8b86-667a193d3afb")] - -// Informacje o wersji zestawu zawierają następujące cztery wartości: -// -// Wersja główna -// Wersja pomocnicza -// Numer kompilacji -// Rewizja -// -// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki -// przy użyciu symbolu „*”, tak jak pokazano poniżej: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SmartHome-Server/SmartHome-Server.csproj b/SmartHome-Server/SmartHome-Server.csproj index 4ea007e..1ea442b 100644 --- a/SmartHome-Server/SmartHome-Server.csproj +++ b/SmartHome-Server/SmartHome-Server.csproj @@ -1,65 +1,17 @@ - - - + - Debug - AnyCPU - {470CB9C4-98E0-481F-8B86-667A193D3AFB} Exe SmartHome_Server - SmartHome-Server - v4.6.1 - 512 - true - true - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + net8.0 + false + SmartHome-Server + SmartHome-Server + Copyright © 2019-2024 + 1.0.0.0 + 1.0.0.0 - - - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest @@ -86,5 +38,11 @@ PreserveNewest - + + + + + + + \ No newline at end of file diff --git a/SmartHome-Server/packages.config b/SmartHome-Server/packages.config deleted file mode 100644 index f56d39a..0000000 --- a/SmartHome-Server/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/SmartHome.sln b/SmartHome.sln index 55b41a3..916aa37 100644 --- a/SmartHome.sln +++ b/SmartHome.sln @@ -1,9 +1,14 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.329 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHome-Server", "SmartHome-Server\SmartHome-Server.csproj", "{470CB9C4-98E0-481F-8B86-667A193D3AFB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartHome-Server", "SmartHome-Server\SmartHome-Server.csproj", "{470CB9C4-98E0-481F-8B86-667A193D3AFB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elementy rozwiązania", "Elementy rozwiązania", "{3CFD0799-E60A-4376-8A85-6A830A9EA4FD}" + ProjectSection(SolutionItems) = preProject + LICENSE = LICENSE + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 793e43edc6795b87da26d7cab9692d8b7aa2dcc5 Mon Sep 17 00:00:00 2001 From: Patryk Kisielewski Date: Fri, 19 Apr 2024 22:19:10 +0200 Subject: [PATCH 3/5] Fix resolving content type after .net migration --- SmartHome-Server/HttpServer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SmartHome-Server/HttpServer.cs b/SmartHome-Server/HttpServer.cs index 7fba640..37a1e1f 100644 --- a/SmartHome-Server/HttpServer.cs +++ b/SmartHome-Server/HttpServer.cs @@ -5,6 +5,7 @@ using System.Net; using System.IO; using System.Web; +using Microsoft.AspNetCore.StaticFiles; namespace SmartHome_Server { @@ -95,7 +96,8 @@ private void NewRequest(object _context) if (File.Exists(path)) { responseBytes = File.ReadAllBytes(path); - //response.ContentType = MimeMapping.GetMimeMapping(path); + new FileExtensionContentTypeProvider().TryGetContentType(path, out string contentType); + response.ContentType = contentType; } else { From 3356d2cd26cab32e0bb35106b95bee7ba1d058d9 Mon Sep 17 00:00:00 2001 From: Patryk Kisielewski Date: Fri, 19 Apr 2024 22:22:55 +0200 Subject: [PATCH 4/5] Set plan as default page --- SmartHome-Server/HttpServer.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SmartHome-Server/HttpServer.cs b/SmartHome-Server/HttpServer.cs index 37a1e1f..6d9133c 100644 --- a/SmartHome-Server/HttpServer.cs +++ b/SmartHome-Server/HttpServer.cs @@ -58,8 +58,13 @@ private void NewRequest(object _context) string path = "files"+request.Url.AbsolutePath; if(request.Url.AbsolutePath == "/") { - path += "index.html"; - } else if(request.Url.AbsolutePath == "/plan") + path += "plan.html"; + } + else if (request.Url.AbsolutePath == "/dashboard") + { + path = "files/index.html"; + } + else if(request.Url.AbsolutePath == "/plan") { path += ".html"; } From 1f762ac45c9636832393954632cecb471579cd0f Mon Sep 17 00:00:00 2001 From: Patryk Kisielewski Date: Fri, 19 Apr 2024 22:24:27 +0200 Subject: [PATCH 5/5] Update info in index.html --- SmartHome-Server/files/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SmartHome-Server/files/index.html b/SmartHome-Server/files/index.html index 7e139e1..978f273 100644 --- a/SmartHome-Server/files/index.html +++ b/SmartHome-Server/files/index.html @@ -66,8 +66,8 @@ Patryk Kisielewski Uniwersytet Mikołaja Kopernika w Toruniu Wydział Matematyki i Informatyki - 19. Toruński Festiwal Nauki i Sztuki - Piątek, 26 kwietnia 2019 + 22. Toruński Festiwal Nauki i Sztuki + Niedziela, 21 kwietnia 2024