Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ctacke committed Aug 29, 2023
2 parents a15a99d + e403926 commit dcc28fc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Meadow.CLI.Core/CloudServices/DeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public DeviceService(IConfiguration config, IdentityManager identityManager) : b
{
_config = config;
}

public async Task<(bool isSuccess, string message)> AddDevice(string orgId, string id, string publicKey, string collectionId, string name, string host, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(host))
Expand All @@ -38,8 +38,9 @@ public DeviceService(IConfiguration config, IdentityManager identityManager) : b
var json = JsonSerializer.Serialize<dynamic>(payload);

var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync($"{host}/api/devices", content, cancellationToken);

var response = await httpClient.PostAsync($"{host}/api/devices", content, cancellationToken);

if (response.IsSuccessStatusCode)
{
return (response.IsSuccessStatusCode, string.Empty);
Expand All @@ -49,7 +50,6 @@ public DeviceService(IConfiguration config, IdentityManager identityManager) : b
var message = await response.Content.ReadAsStringAsync();
return (false, message);
}

}
}
}
6 changes: 4 additions & 2 deletions Meadow.CLI.Core/CloudServices/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task<Package> UploadPackage(string mpakPath, string orgId, string d
}

var fi = new FileInfo(mpakPath);

var osVersion = GetPackageOsVersion(fi.FullName);

var httpClient = await GetAuthenticatedHttpClient(cancellationToken);
Expand All @@ -49,7 +49,7 @@ public async Task<Package> UploadPackage(string mpakPath, string orgId, string d

var fileStreamContent = new StreamContent(File.OpenRead(mpakPath));
fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

var crcFileHash = await CrcTools.CalculateCrc32FileHash(mpakPath);

dynamic payload = new
Expand Down Expand Up @@ -104,6 +104,7 @@ private string GetPackageOsVersion(string packagePath)

return result;
}

public async Task PublishPackage(string packageId, string collectionId, string metadata, string host,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -136,6 +137,7 @@ public async Task<List<Package>> GetOrgPackages(string orgId, string host, Cance
var httpClient = await GetAuthenticatedHttpClient(cancellationToken);

var result = await httpClient.GetStringAsync($"{host}/api/orgs/{orgId}/packages");

return JsonSerializer.Deserialize<List<Package>>(result) ?? new List<Package>();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Meadow.CLI.Core
{
public static class Constants
{
public const string CLI_VERSION = "1.2.2.0";
public const string CLI_VERSION = "1.3.0.0";
public const ushort HCOM_PROTOCOL_PREVIOUS_VERSION_NUMBER = 0x0006;
public const ushort HCOM_PROTOCOL_CURRENT_VERSION_NUMBER = 0x0007; // Used for transmission
public const string WILDERNESS_LABS_USB_VID = "2E6A";
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Managers/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ string CreateMpak(string postlinkBinDir, string mpakName, string osVersion, stri

return mpakPath;
}

void CreateEntry(ZipArchive archive, string fromFile, string entryPath)
{
// Windows '\' Path separator character will be written to the zip which meadow os does not properly unpack
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Meadow.CLI.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down
2 changes: 0 additions & 2 deletions Meadow.CLI/Commands/Cloud/Package/PublishPackageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public PublishCommand(ILoggerFactory loggerFactory, PackageService packageServic

[CommandOption("collectionId", 'c', Description = "The target collection for publishing", IsRequired = true)]
public string CollectionId { get; set; }

[CommandOption("metadata", 'm', Description = "Pass through metadata", IsRequired = false)]
public string Metadata { get; set; }

[CommandOption("host", Description = "Optionally set a host (default is https://www.meadowcloud.co)", IsRequired = false)]
public string Host { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI/Meadow.CLI.Classic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<AssemblyName>meadow</AssemblyName>
<LangVersion>latest</LangVersion>
<Copyright>Copyright 2020-2022 Wilderness Labs</Copyright>
<Copyright>Copyright 2020-2023 Wilderness Labs</Copyright>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<AssemblyName>meadow</AssemblyName>
<LangVersion>latest</LangVersion>
<Copyright>Copyright 2020-2022 Wilderness Labs</Copyright>
<Copyright>Copyright 2020-2023 Wilderness Labs</Copyright>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit dcc28fc

Please sign in to comment.