diff --git a/Readme.md b/Readme.md index 3cadddc..77a2605 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ [![Build status](https://ci.appveyor.com/api/projects/status/ns9koh6l7l1nuv57?svg=true)](https://ci.appveyor.com/project/tparnell8/turbolinks-net) -Add [turbolink](https://github.com/rails/turbolinks) support to ~~ASP.NET 5~~ ASP.NET Core 1.0 applications +Add [turbolink](https://github.com/rails/turbolinks) ASP.NET core 2.1 applications This provides middlewear to add support for turbolinks. @@ -12,7 +12,3 @@ If you have an application that may not fit into an SPA, or just have a lot of c **Warning** This stops page loads thus `$(document).ready(function(){})` does not fire on new pages. - -## What about asp.net 4x? - -I am going to back port this to owin, and eventually more classic version of ASP.NET In the mean time, you can find an MVC action filter [here](https://github.com/kazimanzurrashid/aspnetmvcturbolinks) diff --git a/TurboLinks.Net.sln b/TurboLinks.Net.sln index a9adb45..480732d 100644 --- a/TurboLinks.Net.sln +++ b/TurboLinks.Net.sln @@ -1,18 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2010 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D0D99B75-30C7-485A-B978-3008D6908B7B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{40D6294D-197C-47C9-9C4F-26C0BAEF2A80}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TurboLinks.Net", "src\TurboLinks.Net\TurboLinks.Net.xproj", "{54979581-020C-4F8B-99B0-36C28FFBBADE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TurboLinks.Net", "src\TurboLinks.Net\TurboLinks.Net.csproj", "{54979581-020C-4F8B-99B0-36C28FFBBADE}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TurboLinksExample", "src\TurboLinksExample\TurboLinksExample.xproj", "{16DC6FE0-A511-45E0-BD49-28933EAD8A98}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TurboLinksExample", "src\TurboLinksExample\TurboLinksExample.csproj", "{16DC6FE0-A511-45E0-BD49-28933EAD8A98}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -36,4 +33,7 @@ Global {54979581-020C-4F8B-99B0-36C28FFBBADE} = {D0D99B75-30C7-485A-B978-3008D6908B7B} {16DC6FE0-A511-45E0-BD49-28933EAD8A98} = {D0D99B75-30C7-485A-B978-3008D6908B7B} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BBAAEACA-BCBF-4EE8-BECF-BA22FAE2BFC7} + EndGlobalSection EndGlobal diff --git a/appveyor.yml b/appveyor.yml index 2a147f9..cfa2ef6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,20 +1,23 @@ -configuration: Release -version: 0.1.{build} -nuget: - account_feed: true - project_feed: true - -init: - - git config --global core.autocrlf true - -before_build: -- ps: invoke-webrequest https://go.microsoft.com/fwlink/?LinkID=827524 -OutFile core.exe -- ps: .\core.exe /install /quiet /norestart -- ps: dotnet restore +image: Visual Studio 2017 +version: 1.0.{build} build_script: -- ps: dotnet build .\src\TurboLinks.Net -- ps: dotnet build .\src\TurboLinksExample - +- ps: >- + dotnet restore TurboLinks.Net.sln --source https://api.nuget.org/v3/index.json + dotnet build TurboLinks.Net.sln + if($env:APPVEYOR_REPO_TAG -eq "true") + { + dotnet pack src\TurboLinks.Net\TurboLinks.Net.csproj --configuration Release --output ..\..\output /p:Version=$env:APPVEYOR_REPO_TAG_NAME + } + else + { + dotnet pack src\TurboLinks.Net\TurboLinks.Net.csproj --configuration Release --output ..\..\output /p:Version=0.0.1-build-$env:APPVEYOR_BUILD_NUMBER + } artifacts: - - path: artifacts\bin\TurboLinks.Net\Release\*.nupkg \ No newline at end of file +- path: output\**.nupkg +deploy: +- provider: NuGet + api_key: + secure: //tKHlb2yqAtpxnR6p9IAtXwQNaq8UYYyIFSD0QVF3XnEasIxG2gTWdmWuG87fUX + on: + appveyor_repo_tag: true \ No newline at end of file diff --git a/global.json b/global.json deleted file mode 100644 index 0ac230b..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "test" ], - "sdk": { - "version": "1.0.0-preview2-003131" - } -} diff --git a/src/TurboLinks.Net/Properties/AssemblyInfo.cs b/src/TurboLinks.Net/Properties/AssemblyInfo.cs index 8deef2b..14a3918 100644 --- a/src/TurboLinks.Net/Properties/AssemblyInfo.cs +++ b/src/TurboLinks.Net/Properties/AssemblyInfo.cs @@ -5,12 +5,7 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("TurboLinks.Net")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TurboLinks.Net")] -[assembly: AssemblyCopyright("Copyright © 2016")] + [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/TurboLinks.Net/TurboLinks.Net.csproj b/src/TurboLinks.Net/TurboLinks.Net.csproj new file mode 100644 index 0000000..6560e8d --- /dev/null +++ b/src/TurboLinks.Net/TurboLinks.Net.csproj @@ -0,0 +1,30 @@ + + + + Add support for Turbolinks + Tommy Parnell + netstandard2.0 + TurboLinks.Net + TurboLinks.Net + TurboLinks Middlewear + https://github.com/terribledev/TurboLinks.Net + https://opensource.org/licenses/MIT + GitHub + + + + + + + + + + $(TargetsForTfmSpecificContentInPackage);IncludePDBsInPackage + + + + + + + + diff --git a/src/TurboLinks.Net/TurboLinks.Net.xproj b/src/TurboLinks.Net/TurboLinks.Net.xproj deleted file mode 100644 index 02ea6c9..0000000 --- a/src/TurboLinks.Net/TurboLinks.Net.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 54979581-020c-4f8b-99b0-36c28ffbbade - TurboLinks.Net - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - - 2.0 - - - diff --git a/src/TurboLinks.Net/TurboLinks.cs b/src/TurboLinks.Net/TurboLinks.cs index b0129e3..6b27387 100644 --- a/src/TurboLinks.Net/TurboLinks.cs +++ b/src/TurboLinks.Net/TurboLinks.cs @@ -24,13 +24,13 @@ namespace TurboLinks.Net var request = context.Request; var response = context.Response; - if(!string.IsNullOrWhiteSpace(request.Headers["X-XHR-Referer"])) + if (!string.IsNullOrWhiteSpace(request.Headers["X-XHR-Referer"])) { context.Response.Cookies.Append("request_method", request.Method, new CookieOptions { HttpOnly = false }); - if(context.Response.StatusCode == 301 || context.Response.StatusCode == 302) + if (context.Response.StatusCode == 301 || context.Response.StatusCode == 302) { var uri = new Uri(response.Headers["Location"]); - if(uri.Host.Equals(request.Host.Value)) + if (uri.Host.Equals(request.Host.Value)) { response.Headers["X-XHR-Redirected-To"] = response.Headers["Location"]; } @@ -45,9 +45,7 @@ namespace TurboLinks.Net public static class BuilderExtension { - public static void UseTurboLinks(this IApplicationBuilder app) - { - app.UseMiddleware(); - } + public static IApplicationBuilder UseTurboLinks(this IApplicationBuilder app) => app.UseMiddleware(); + } } \ No newline at end of file diff --git a/src/TurboLinks.Net/project.json b/src/TurboLinks.Net/project.json deleted file mode 100644 index ce76ffe..0000000 --- a/src/TurboLinks.Net/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "1.1.1", - "description": "Add support for Turbolinks", - "authors": [ "Tommy Parnell" ], - "packOptions": { - "tags": [ "TurboLinks Middlewear" ], - "projectUrl": "https://github.com/tparnell8/TurboLinks.Net", - "licenseUrl": "https://opensource.org/licenses/MIT" - }, - "dependencies": { - "NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Http.Abstractions": "1.0.0", - "Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0", - "Microsoft.AspNetCore.StaticFiles": "1.0.0" - }, - - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50" - } - } -} \ No newline at end of file diff --git a/src/TurboLinksExample/Project_Readme.html b/src/TurboLinksExample/Project_Readme.html deleted file mode 100644 index 1a0f5b5..0000000 --- a/src/TurboLinksExample/Project_Readme.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - Welcome to ASP.NET Core - - - - - - - - - - diff --git a/src/TurboLinksExample/Startup.cs b/src/TurboLinksExample/Startup.cs index 71295a2..803b96f 100644 --- a/src/TurboLinksExample/Startup.cs +++ b/src/TurboLinksExample/Startup.cs @@ -40,7 +40,6 @@ namespace TurboLinksExample if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseBrowserLink(); } else { diff --git a/src/TurboLinksExample/TurboLinksExample.csproj b/src/TurboLinksExample/TurboLinksExample.csproj new file mode 100644 index 0000000..6c5ee6f --- /dev/null +++ b/src/TurboLinksExample/TurboLinksExample.csproj @@ -0,0 +1,28 @@ + + + + netcoreapp2.1 + true + TurboLinksExample + + + + + PreserveNewest + + + + + + + + + + + + + + + + + diff --git a/src/TurboLinksExample/TurboLinksExample.xproj b/src/TurboLinksExample/TurboLinksExample.xproj deleted file mode 100644 index 6d1aa27..0000000 --- a/src/TurboLinksExample/TurboLinksExample.xproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 16dc6fe0-a511-45e0-bd49-28933ead8a98 - TurboLinksExample - .\obj - .\bin\ - v4.5.2 - - - 2.0 - - - - - - - diff --git a/src/TurboLinksExample/project.json b/src/TurboLinksExample/project.json deleted file mode 100644 index faf7152..0000000 --- a/src/TurboLinksExample/project.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.0.1", - "type": "platform" - }, - "Microsoft.AspNetCore.Diagnostics": "1.0.0", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Microsoft.AspNetCore.Razor.Tools": { - "version": "1.0.0-preview2-final", - "type": "build" - }, - "Microsoft.AspNetCore.Routing": "1.0.1", - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", - "Microsoft.AspNetCore.StaticFiles": "1.0.0", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", - "Microsoft.Extensions.Configuration.Json": "1.0.0", - "Microsoft.Extensions.Logging": "1.0.0", - "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.Extensions.Logging.Debug": "1.0.0", - "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", - "TurboLinks.Net": "1.1.1" - }, - - "tools": { - "BundlerMinifier.Core": "2.0.238", - "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", - "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" - }, - - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "dotnet5.6", - "portable-net45+win8" - ] - } - }, - - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - - "runtimeOptions": { - "configProperties": { - "System.GC.Server": true - } - }, - - "publishOptions": { - "include": [ - "wwwroot", - "**/*.cshtml", - "appsettings.json", - "web.config" - ] - }, - - "scripts": { - "prepublish": [ "bower install", "dotnet bundle" ], - "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] - } -}