Former-commit-id: d12e3900ebc81fb742951ddac8098968dfaf82e1
TangShanKaiPing
wanggang 6 years ago
parent be00adea50
commit ed91ae27e3

@ -28,10 +28,10 @@
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="@Url.Action("Index", "Account", new { area = "" })">@User.Identity.Name</a> <a href="@Url.Action("Index", "Account" , new { area="" })">@User.Identity.Name</a>
</li> </li>
<li> <li>
<a href="@Url.Action("Logout", "Account", new { area = "" })">退出</a> <a href="@Url.Action("Logout", "Account" , new { area="" })">退出</a>
</li> </li>
</ul> </ul>
} }
@ -40,10 +40,10 @@
{ {
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="@Url.Action("Register","Account",new { area=""})">注册</a> <a href="@Url.Action("Register","Account",new { area="" })">注册</a>
</li> </li>
<li> <li>
<a href="@Url.Action("Login","Account",new { area=""})">登录</a> <a href="@Url.Action("Login","Account",new { area="" })">登录</a>
</li> </li>
</ul> </ul>
} }
@ -82,10 +82,10 @@
@Html.Raw(cfg["copyright"].Replace("{now}", DateTime.Now.Year.ToString())) @Html.Raw(cfg["copyright"].Replace("{now}", DateTime.Now.Year.ToString()))
</div> </div>
<div class="pull-right hidden-xs"> <div class="pull-right hidden-xs">
<b>@Html.Raw(cfg["version"])</b> <span>版本:@Html.Raw(cfg["version"]) 设备Id@DeviceAttribute.DeviceId </span>
@if (User.Identity.IsAuthenticated) @if (User.Identity.IsAuthenticated)
{ {
<a href="@Url.Action("Index","Home",new { area="Admin"})">管理</a> <a href="@Url.Action("Index","Home",new { area="Admin" })">管理</a>
} }
</div> </div>
</div> </div>

@ -3,23 +3,22 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System;
namespace Infrastructure.Web namespace Infrastructure.Web
{ {
public class DeviceAttribute : ActionFilterAttribute public class DeviceAttribute : ActionFilterAttribute
{ {
private static string _id; public static string DeviceId { get; private set; }
static DeviceAttribute() static DeviceAttribute()
{ {
_id = Helper.Instance.GetCPUNumber(); DeviceId = Helper.Instance.GetCPUNumber();
} }
public override void OnResultExecuting(ResultExecutingContext context) public override void OnResultExecuting(ResultExecutingContext context)
{ {
var config = context.HttpContext.RequestServices.GetService<IConfiguration>(); var config = context.HttpContext.RequestServices.GetService<IConfiguration>();
if (config["id"] != _id.Md5().Base64UrlEncode().Md5()) if (config["id"] != DeviceId.Md5().Base64UrlEncode().Md5())
{ {
if (!context.HttpContext.Request.Path.Value.StartsWith("/App/")) if (!context.HttpContext.Request.Path.Value.StartsWith("/App/"))
{ {
@ -27,7 +26,7 @@ namespace Infrastructure.Web
} }
else else
{ {
context.Result = new JsonResult($"设备{_id}的授权码\"{config["id"]}\"异常"); context.Result = new JsonResult($"设备{DeviceId}的授权码\"{config["id"]}\"异常");
} }
} }
} }

@ -12,6 +12,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /> <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
<ProjectReference Include="..\IoT\IoT.Resources\IoT.Resources.csproj" />
<ProjectReference Include="..\IoT\IoT.Shared\IoT.Shared.csproj" /> <ProjectReference Include="..\IoT\IoT.Shared\IoT.Shared.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -6,18 +6,16 @@ rd /q/s "./dist/"
echo d|xcopy "./src/linux-x64/publish" "./dist/linux-x64/publish" /s /e /y /f echo d|xcopy "./src/linux-x64/publish" "./dist/linux-x64/publish" /s /e /y /f
echo d|xcopy "./src/linux-arm64/publish" "./dist/linux-arm64/publish" /s /e /y /f echo d|xcopy "./src/linux-arm64/publish" "./dist/linux-arm64/publish" /s /e /y /f
dotnet publish ../projects/UserCenter/UserCenter.csproj -c Release -r linux-x64 -o ../../publish/dist/linux-x64/publish/apps/UserCenter dotnet publish ../projects/UserCenter/UserCenter.csproj -c Release -o ../../publish/dist/linux-x64/publish/apps/UserCenter
dotnet publish ../projects/IoTCenter/IoTCenter.csproj -c Release -r linux-x64 -o ../../publish/dist/linux-x64/publish/apps/IoTCenter dotnet publish ../projects/IoTCenter/IoTCenter.csproj -c Release -o ../../publish/dist/linux-x64/publish/apps/IoTCenter
dotnet publish ../projects/UserCenter/UserCenter.csproj -c Release -r linux-arm64 -o ../../publish/dist/linux-arm64/publish/apps/UserCenter dotnet publish ../projects/IoT/IoTNode/IoTNode.csproj -c Release -o ../../../publish/dist/linux-arm64/publish/apps/IoTNode
dotnet publish ../projects/IoTCenter/IoTCenter.csproj -c Release -r linux-arm64 -o ../../publish/dist/linux-arm64/publish/apps/IoTCenter
dotnet publish ../projects/IoT/IoTNode/IoTNode.csproj -c Release -r linux-arm64 -o ../../../publish/dist/linux-arm64/publish/apps/IoTNode
dotnet publish ../projects/IoT/IoTServices/WinService/WinService.csproj -c Release -r win-x86 -o "../../../../publish/dist/win-x86/Program Files (x86)/WinService" dotnet publish ../projects/IoT/IoTServices/WinService/WinService.csproj -c Release -r win-x86 -o "../../../../publish/dist/win-x86/Program Files (x86)/WinService"
dotnet publish ../projects/IoT/IoTServices/APService/APService.csproj -c Release -r linux-arm64 -o ../../../../publish/dist/linux-arm64/publish/apps/APService dotnet publish ../projects/IoT/IoTServices/APService/APService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/APService
dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -r linux-x64 -o ../../../../publish/dist/linux-x64/publish/apps/ONVIFService dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -o ../../../../publish/dist/linux-x64/publish/apps/ONVIFService
dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -r linux-arm64 -o ../../../../publish/dist/linux-arm64/publish/apps/ONVIFService dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/ONVIFService
dotnet publish ../projects/IoT/IoTServices/SerialPortService/SerialPortService.csproj -c Release -r linux-arm64 -o ../../../../publish/dist/linux-arm64/publish/apps/SerialPortService dotnet publish ../projects/IoT/IoTServices/SerialPortService/SerialPortService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/SerialPortService
dotnet publish ../projects/IoT/IoTServices/LiChuangService/LiChuangService.csproj -c Release -r linux-arm64 -o ../../../../publish/dist/linux-arm64/publish/apps/LiChuangService dotnet publish ../projects/IoT/IoTServices/LiChuangService/LiChuangService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/LiChuangService
gradle build -p ../projects/IoT/IoTServices/NJWLService gradle build -p ../projects/IoT/IoTServices/NJWLService
set endtime=%time% set endtime=%time%

@ -1,22 +0,0 @@
@echo off
set startime=%time%
rd /q/s "./dist/"
echo d|xcopy "./src/linux-x64/publish" "./dist/linux-x64/publish" /s /e /y /f
echo d|xcopy "./src/linux-arm64/publish" "./dist/linux-arm64/publish" /s /e /y /f
dotnet publish ../projects/UserCenter/UserCenter.csproj -c Release -o ../../publish/dist/linux-x64/publish/apps/UserCenter
dotnet publish ../projects/IoTCenter/IoTCenter.csproj -c Release -o ../../publish/dist/linux-x64/publish/apps/IoTCenter
dotnet publish ../projects/IoT/IoTNode/IoTNode.csproj -c Release -o ../../../publish/dist/linux-arm64/publish/apps/IoTNode
dotnet publish ../projects/IoT/IoTServices/WinService/WinService.csproj -c Release -r win-x86 -o "../../../../publish/dist/win-x86/Program Files (x86)/WinService"
dotnet publish ../projects/IoT/IoTServices/APService/APService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/APService
dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -o ../../../../publish/dist/linux-x64/publish/apps/ONVIFService
dotnet publish ../projects/IoT/IoTServices/ONVIFService/ONVIFService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/ONVIFService
dotnet publish ../projects/IoT/IoTServices/SerialPortService/SerialPortService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/SerialPortService
dotnet publish ../projects/IoT/IoTServices/LiChuangService/LiChuangService.csproj -c Release -o ../../../../publish/dist/linux-arm64/publish/apps/LiChuangService
gradle build -p ../projects/IoT/IoTServices/NJWLService
set endtime=%time%
echo %startime% %endtime%

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
#set root password #set root password
sudo passwd root<<! sudo passwd root<<!
pi pi
@ -35,7 +36,8 @@ mkdir -p ~/.config/autostart
touch ~/.config/autostart/chromium.desktop touch ~/.config/autostart/chromium.desktop
echo ''>~/.config/autostart/chromium.desktop echo ''>~/.config/autostart/chromium.desktop
echo '[Desktop Entry]'>>~/.config/autostart/chromium.desktop echo '[Desktop Entry]'>>~/.config/autostart/chromium.desktop
echo 'Exec=bash -c "chromium-browser -kiosk --disable-session-crashed-bubble --disable-infobars -app=file:///home/pi/publish/apps/IoTNode/wwwroot/index.html"'>>~/.config/autostart/chromium.desktop #echo 'Exec=bash -c "chromium-browser -kiosk --disable-session-crashed-bubble --disable-infobars -app=file:///home/pi/publish/apps/IoTNode/wwwroot/index.html"'>>~/.config/autostart/chromium.desktop
echo 'Exec=bash -c "sleep 20&&chromium-browser -kiosk --disable-session-crashed-bubble --disable-infobars -app=http://localhost:8002/index.html"'>>~/.config/autostart/chromium.desktop
#config apps #config apps
sudo cp -f ~/publish/supervisord.conf /etc/supervisor/supervisord.conf sudo cp -f ~/publish/supervisord.conf /etc/supervisor/supervisord.conf

Loading…
Cancel
Save