Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
64701e1b
IoTSharp
项目概览
IoTSharp
/
IoTSharp
8 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
64701e1b
编写于
2月 09, 2020
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for user create
上级
f6f5e307
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
9 addition
and
310 deletion
+9
-310
.gitignore
.gitignore
+2
-0
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
+0
-2
IoTSharp.Edges.sln
IoTSharp.Edges.sln
+0
-44
IoTSharp.Releases/GithubRelease.cs
IoTSharp.Releases/GithubRelease.cs
+0
-38
IoTSharp.Releases/IoTSharp.Releases.csproj
IoTSharp.Releases/IoTSharp.Releases.csproj
+0
-18
IoTSharp.Releases/LinkHeaderParser.cs
IoTSharp.Releases/LinkHeaderParser.cs
+0
-33
IoTSharp.Releases/ReleaseDownloader.cs
IoTSharp.Releases/ReleaseDownloader.cs
+0
-173
IoTSharp/Data/ApplicationDBInitializer.cs
IoTSharp/Data/ApplicationDBInitializer.cs
+4
-0
IoTSharp/Dockerfile
IoTSharp/Dockerfile
+1
-1
IoTSharp/IoTSharp.csproj
IoTSharp/IoTSharp.csproj
+1
-0
IoTSharp/appsettings.Development.json
IoTSharp/appsettings.Development.json
+1
-1
未找到文件。
.gitignore
浏览文件 @
64701e1b
...
...
@@ -333,3 +333,5 @@ ASALocalRun/
/Clients/MQTTClient/.vscode
/IoTSharp/ClientApp.rar
/IoTSharp/ClientApp/package-lock.json
/IoTSharp/healthchecksdb
/IoTSharp/healthchecksdb-shm
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
浏览文件 @
64701e1b
...
...
@@ -36,8 +36,6 @@
<ItemGroup>
<ProjectReference Include="..\IoTSharp.EdgeSdk.MQTT\IoTSharp.EdgeSdk.MQTT.csproj" />
<ProjectReference Include="..\IoTSharp.Extensions.AspNetCore\IoTSharp.Extensions.AspNetCore.csproj" />
<ProjectReference Include="..\IoTSharp.Extensions\IoTSharp.Extensions.csproj" />
</ItemGroup>
<ItemGroup>
...
...
IoTSharp.Edges.sln
浏览文件 @
64701e1b
...
...
@@ -22,10 +22,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.EdgeSdk.MQTT", "Io
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Edge.ModBus", "IoTSharp.Edge.ModBus\IoTSharp.Edge.ModBus.csproj", "{9267A0CE-ECBC-41E4-AD83-927117FD625E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Extensions", "IoTSharp.Extensions\IoTSharp.Extensions.csproj", "{551E62E3-51DA-4C1D-8DBB-7346A29EE817}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Extensions.AspNetCore", "IoTSharp.Extensions.AspNetCore\IoTSharp.Extensions.AspNetCore.csproj", "{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -146,46 +142,6 @@ Global
{9267A0CE-ECBC-41E4-AD83-927117FD625E}.Release|x64.Build.0 = Release|Any CPU
{9267A0CE-ECBC-41E4-AD83-927117FD625E}.Release|x86.ActiveCfg = Release|Any CPU
{9267A0CE-ECBC-41E4-AD83-927117FD625E}.Release|x86.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|Any CPU.Build.0 = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|ARM.ActiveCfg = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|ARM.Build.0 = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|ARM64.Build.0 = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|x64.ActiveCfg = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|x64.Build.0 = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|x86.ActiveCfg = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Debug|x86.Build.0 = Debug|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|Any CPU.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|Any CPU.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|ARM.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|ARM.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|ARM64.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|ARM64.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x64.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x64.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x86.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x86.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM64.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x64.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x64.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x86.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x86.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|Any CPU.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM64.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM64.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x64.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x64.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x86.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
IoTSharp.Releases/GithubRelease.cs
已删除
100644 → 0
浏览文件 @
f6f5e307
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
IoTSharp.Releases
{
public
class
GithubRelease
{
public
string
url
{
get
;
set
;
}
public
string
html_url
{
get
;
set
;
}
public
string
assets_url
{
get
;
set
;
}
public
string
upload_url
{
get
;
set
;
}
public
string
tarball_url
{
get
;
set
;
}
public
string
zipball_url
{
get
;
set
;
}
public
string
id
{
get
;
set
;
}
public
string
tag_name
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
string
body
{
get
;
set
;
}
public
ICollection
<
GithubReleaseAsset
>
assets
{
get
;
set
;
}
}
public
class
GithubReleaseAsset
{
public
string
url
{
get
;
set
;
}
public
string
browser_download_url
{
get
;
set
;
}
public
string
id
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
string
label
{
get
;
set
;
}
public
string
state
{
get
;
set
;
}
public
string
content_type
{
get
;
set
;
}
public
long
size
{
get
;
set
;
}
public
int
download_count
{
get
;
set
;
}
}
}
IoTSharp.Releases/IoTSharp.Releases.csproj
已删除
100644 → 0
浏览文件 @
f6f5e307
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net46</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description></Description>
<PackageProjectUrl>https://github.com/maikebing/GithubReleasesDownloader</PackageProjectUrl>
<RepositoryUrl>https://github.com/maikebing/GithubReleasesDownloader</RepositoryUrl>
<Authors>mwhitis;IoTSharp;maikebing</Authors>
<Company>mwhitis;IoTSharp;maikebing</Company>
<PackageTags>Github;Releases;Downloader;IoTSharp</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>
</Project>
IoTSharp.Releases/LinkHeaderParser.cs
已删除
100644 → 0
浏览文件 @
f6f5e307
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
IoTSharp.Releases
{
public
class
LinkHeaderParser
{
/*
<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next",
<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last"
*/
public
string
GetNextPageFromHeader
(
string
headerText
)
{
if
(
string
.
IsNullOrWhiteSpace
(
headerText
))
{
return
string
.
Empty
;
}
var
links
=
headerText
.
Split
(
','
);
foreach
(
var
link
in
links
.
Where
(
link
=>
link
.
Contains
(
"rel=\"next\""
)))
{
return
link
.
Split
(
';'
)[
0
].
Replace
(
"<"
,
""
).
Replace
(
">"
,
""
).
Trim
();
}
return
string
.
Empty
;
}
}
}
IoTSharp.Releases/ReleaseDownloader.cs
已删除
100644 → 0
浏览文件 @
f6f5e307
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Mime
;
using
System.Text
;
using
System.Threading.Tasks
;
using
Newtonsoft.Json
;
namespace
IoTSharp.Releases
{
public
class
ReleaseDownloader
{
private
readonly
string
_baseUri
;
private
readonly
string
_accessToken
;
private
readonly
string
_userAgent
;
private
readonly
string
_releaseUri
;
private
string
_user
;
private
string
_repo
;
private
string
_token
;
public
ReleaseDownloader
(
string
_url
,
string
accessToken
)
{
var
uri
=
new
Uri
(
_url
);
_baseUri
=
$"
{
GetBaseUri
(
uri
)}
/repos/
{
GetUserFromUri
(
uri
)}
/
{
GetRepoFromUri
(
uri
)}
"
;
_accessToken
=
accessToken
;
_userAgent
=
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1"
;
;
_releaseUri
=
GetReleaseUri
();
}
private
static
string
GetUserFromUri
(
Uri
uri
)
{
return
!
uri
.
LocalPath
.
Contains
(
"/"
)
?
string
.
Empty
:
uri
.
Segments
[
1
].
TrimEnd
(
'/'
);
}
private
static
string
GetRepoFromUri
(
Uri
uri
)
{
return
!
uri
.
LocalPath
.
Contains
(
"/"
)
?
string
.
Empty
:
uri
.
Segments
[
2
].
TrimEnd
(
'/'
);
}
private
static
string
GetBaseUri
(
Uri
uri
)
{
return
uri
.
Host
.
Equals
(
"github.com"
,
StringComparison
.
OrdinalIgnoreCase
)
?
"https://api.github.com"
:
$"
{
uri
.
Scheme
}
://
{
uri
.
Host
}
/api/v3"
;
}
public
ICollection
<
GithubRelease
>
GetDataForAllReleases
()
{
var
requestingUri
=
GetAccessTokenUri
(
_releaseUri
);
return
DownloadReleases
(
requestingUri
);
}
public
ICollection
<
GithubRelease
>
DownloadReleases
(
string
requestingUri
)
{
Console
.
WriteLine
(
"Requesting: {0}"
,
requestingUri
);
var
request
=
(
HttpWebRequest
)
WebRequest
.
Create
(
new
Uri
(
requestingUri
));
request
.
UserAgent
=
_userAgent
;
var
response
=
request
.
GetResponse
();
Console
.
WriteLine
(((
HttpWebResponse
)
response
).
StatusDescription
);
// Get the stream containing content returned by the server.
var
responseFromServer
=
ReadResponseFromServer
(
response
);
var
releases
=
JsonConvert
.
DeserializeObject
<
List
<
GithubRelease
>>(
responseFromServer
);
var
parser
=
new
LinkHeaderParser
();
var
linkHeader
=
response
.
Headers
[
"Link"
];
var
nextUrl
=
parser
.
GetNextPageFromHeader
(
linkHeader
);
if
(!
string
.
IsNullOrEmpty
(
nextUrl
))
{
releases
.
AddRange
(
DownloadReleases
(
nextUrl
));
}
// Clean up the streams and the response.
response
.
Close
();
return
releases
;
}
private
string
GetReleaseUri
()
{
var
releaseUri
=
$"
{
_baseUri
}
/releases"
;
return
releaseUri
;
}
private
static
string
ReadResponseFromServer
(
WebResponse
response
)
{
using
(
var
dataStream
=
response
.
GetResponseStream
())
{
// Open the stream using a StreamReader for easy access.
using
(
var
reader
=
new
StreamReader
(
dataStream
))
{
// Read the content.
return
reader
.
ReadToEnd
();
}
}
}
private
string
GetAssetsUriForId
(
string
id
)
{
var
assetUri
=
$"
{
_releaseUri
}
/assets/
{
id
}
"
;
return
assetUri
;
}
private
string
GetAccessTokenUri
(
string
uri
)
{
return
_accessToken
==
string
.
Empty
?
uri
:
uri
+=
$"?access_token=
{
_accessToken
}
"
;
}
public
bool
DownloadAsset
(
string
id
,
string
path
)
{
WebResponse
response
=
GetAssetResponse
(
id
);
GetBinaryResponseFromResponse
(
path
,
response
);
return
true
;
}
public
bool
DownloadAsset
(
string
id
,
out
byte
[]
assetdata
)
{
WebResponse
response
=
GetAssetResponse
(
id
);
assetdata
=
GetBinaryResponseFromResponse
(
response
);
return
true
;
}
private
WebResponse
GetAssetResponse
(
string
id
)
{
var
assetUri
=
GetAccessTokenUri
(
GetAssetsUriForId
(
id
));
var
request
=
(
HttpWebRequest
)
WebRequest
.
Create
(
new
Uri
(
assetUri
));
request
.
Accept
=
"application/octet-stream"
;
request
.
UserAgent
=
"mwhitis"
;
var
response
=
request
.
GetResponse
();
return
response
;
}
private
static
byte
[]
GetBinaryResponseFromResponse
(
WebResponse
response
)
{
byte
[]
result
=
null
;
long
received
=
0
;
byte
[]
buffer
=
new
byte
[
1024
];
using
(
var
ms
=
new
MemoryStream
()
)
{
using
(
var
input
=
response
.
GetResponseStream
())
{
int
size
=
input
.
Read
(
buffer
,
0
,
buffer
.
Length
);
while
(
size
>
0
)
{
ms
.
Write
(
buffer
,
0
,
size
);
received
+=
size
;
size
=
input
.
Read
(
buffer
,
0
,
buffer
.
Length
);
}
}
result
=
ms
.
ToArray
();
}
return
result
;
}
private
static
void
GetBinaryResponseFromResponse
(
string
path
,
WebResponse
response
)
{
System
.
IO
.
File
.
WriteAllBytes
(
path
,
GetBinaryResponseFromResponse
(
response
));
}
}
}
IoTSharp/Data/ApplicationDBInitializer.cs
浏览文件 @
64701e1b
...
...
@@ -93,6 +93,10 @@ namespace IoTSharp.Data
await
_signInManager
.
UserManager
.
AddToRoleAsync
(
user
,
nameof
(
UserRole
.
SystemAdmin
));
}
else
{
throw
new
Exception
(
string
.
Join
(
','
,
result
.
Errors
.
ToList
().
Select
(
ie
=>
$"code=
{
ie
.
Code
}
,msg=
{
ie
.
Description
}
"
)));
}
}
var
rship
=
new
Relationship
{
...
...
IoTSharp/Dockerfile
浏览文件 @
64701e1b
...
...
@@ -2,7 +2,7 @@
FROM
mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR
/app
EXPOSE
80
EXPOSE
2927
FROM
mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR
/src
...
...
IoTSharp/IoTSharp.csproj
浏览文件 @
64701e1b
...
...
@@ -83,6 +83,7 @@
<None Remove="Migrations\**" />
<Content Remove="appsettings.Production.json" />
<None Remove="healthchecksdb" />
<None Remove="healthchecksdb-shm" />
<None Include="..\docs\images\200x200.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
...
...
IoTSharp/appsettings.Development.json
浏览文件 @
64701e1b
...
...
@@ -7,7 +7,7 @@
}
},
"ConnectionStrings"
:
{
"IoTSharp"
:
"Server=
localhost
;Database=IoTSharp;Username=postgres;Password=future;"
"IoTSharp"
:
"Server=
host.docker.internal
;Database=IoTSharp;Username=postgres;Password=future;"
},
"JwtKey"
:
"kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme"
,
"JwtExpireHours"
:
24
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录