提交 d45c3d6c 编写于 作者: 麦壳饼's avatar 麦壳饼

remove vue

上级 8c4014a2
......@@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>
......
using IoTSharp.Data;
using IoTSharp.Dtos;
using IoTSharp.Extensions;
using IoTSharp.Releases;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
......@@ -94,50 +93,7 @@ namespace IoTSharp.Controllers
}
return actionResult;
}
[AllowAnonymous]
[HttpPost]
public ActionResult<InstanceDto> Upgrade([FromHeader(Name ="Authorization")] string token, [FromHeader(Name ="Source")] string source , [FromHeader(Name = "AssetName")] string assetname )
{
ActionResult<InstanceDto> actionResult = NoContent();
try
{
var githubDownloader = new ReleaseDownloader(source, token);
var releases = githubDownloader.GetDataForAllReleases();
var asset = releases.FirstOrDefault()?.assets?.FirstOrDefault(at => at.name == assetname);
if (asset != null)
{
if (githubDownloader.DownloadAsset(asset.id, out byte[] assetbinary))
{
using (var ms = new MemoryStream(assetbinary))
{
using (var zip = new System.IO.Compression.ZipArchive(ms))
{
foreach (ZipArchiveEntry item in zip.Entries)
{
var file = new System.IO.FileInfo(System.IO.Path.Combine(AppContext.BaseDirectory, item.FullName));
item.ExtractToFile(file.FullName, true);
}
}
}
actionResult = Ok(asset);
}
else
{
actionResult = BadRequest(new ApiResult(ApiCode.Exception, "Can't download asset!"));
}
}
else
{
actionResult = NotFound(new ApiResult(ApiCode.Exception, "Can't found asset!"));
}
}
catch (Exception ex)
{
actionResult = this.ExceptionRequest(ApiCode.Exception, ex.Message, ex);
}
return actionResult;
}
public class InstanceDto
{
public string Version { get; internal set; }
......
......@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<Company>IoT#</Company>
<Product>IoTSharp</Product>
<Authors>IoT#</Authors>
......@@ -14,21 +14,12 @@
<Description>Open-source IoT Platform - Device management, data collection, processing and visualization.</Description>
<PackageId>IoTSharp</PackageId>
<UserSecretsId>18970590-05bf-4a1f-a70b-3c8a120d12cb</UserSecretsId>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>false</BuildServerSideRenderer>
<Version>0.1.99</Version>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageTags>IoT</PackageTags>
<PackageIcon>https://avatars2.githubusercontent.com/u/44353254?s=200&amp;v=4</PackageIcon>
<ApplicationIcon>Resources\Logo.ico</ApplicationIcon>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
......@@ -37,39 +28,35 @@
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="maikebing.AspNetCore.SpaServices.Extensions.VueCli " Version="1.0.5" />
<PackageReference Include="IoTSharp.X509Extensions" Version="1.3.3" />
<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="LiteDB" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" />
<PackageReference Include="MQTTnet" Version="3.0.8" />
<PackageReference Include="MQTTnet.AspNetCore" Version="3.0.8" />
<PackageReference Include="MQTTnet.Extensions.Rpc" Version="3.0.8" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="NSwag.AspNetCore" Version="13.1.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.1" />
<PackageReference Include="NSwag.AspNetCore" Version="13.2.2" />
<PackageReference Include="QuartzHostedServiceEx" Version="0.0.7" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.6.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
<PackageReference Include="CoAP.NET.Core" Version="1.1.0" />
<PackageReference Include="CrystalQuartz.AspNetCore" Version="6.8.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.1.1" />
<PackageReference Include="MQTTnet.AspNetCoreEx" Version="3.0.8" />
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="3.0.8" />
......@@ -86,54 +73,8 @@
</None>
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties appsettings_1Development_1json__JSONSchema="http://json.schemastore.org/bungee-plugin" />
</VisualStudio>
</ProjectExtensions>
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<Folder Include="Jobs\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IoTSharp.Extensions.AspNetCore\IoTSharp.Extensions.AspNetCore.csproj" />
<ProjectReference Include="..\IoTSharp.Extensions\IoTSharp.Extensions.csproj" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install " />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install -g @vue/cli " />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install " />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:prod" />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
<DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>
......@@ -14,8 +14,6 @@ using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.SpaServices.VueCli;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
......@@ -92,11 +90,7 @@ namespace IoTSharp
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JwtKey"]))
};
});
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
services.AddLogging(loggingBuilder => loggingBuilder.AddConsole());
......@@ -178,25 +172,8 @@ namespace IoTSharp
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseResponseCompression(); // No need if you use IIS, but really something good for Kestrel!
// Idea: https://code.msdn.microsoft.com/How-to-fix-the-routing-225ac90f
// This avoid having a real mvc view. You have other way of doing, but this one works
// properly.
app.UseSpaStaticFiles();
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
spa.Options.StartupTimeout = TimeSpan.FromSeconds(80);
if (env.IsDevelopment())
{
spa.UseVueCliServer(npmScript: "dev");
}
});
app.UseIotSharpSelfCollecting();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册