generated from azures04/Photino-Boilerplate
Added prod loading deployment
This commit is contained in:
parent
e9958306d1
commit
98b6cd681f
@ -8,6 +8,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<ApplicationIcon>src/resources/build/icon.ico</ApplicationIcon>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<SelfContained>true</SelfContained>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
|
||||
</PropertyGroup>
|
||||
<Target Name="PackRenderer" BeforeTargets="DispatchToInnerBuild;BeforeBuild">
|
||||
<PropertyGroup>
|
||||
@ -20,9 +24,13 @@
|
||||
<Message Importance="high" Text="[] Renderer packed at: $(OutputPathFile)" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<None Update="src\resources\build\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="$(TargetDir)root.dat">
|
||||
<Pack>true</Pack>
|
||||
<PublishState>Included</PublishState>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<ExcludeFromSingleFile>false</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BrikPackager" Version="0.0.1" GeneratePathProperty="true" />
|
||||
|
||||
@ -10,7 +10,7 @@ public class Constants {
|
||||
public static readonly string Os = OsHelper.getOperatingSystem();
|
||||
public static readonly string Arch = OsHelper.getArchitecture();
|
||||
|
||||
public static readonly string Env = "DEV";
|
||||
public static readonly string Env = "PROD";
|
||||
|
||||
public static readonly string BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
public static readonly string CurrentWorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
|
||||
|
||||
@ -4,9 +4,7 @@ using System.Text.Json;
|
||||
using BrikInstaller.Utils;
|
||||
using BrikInstaller.Schemas;
|
||||
using BrikInstaller.Services;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace BrikInstaller;
|
||||
|
||||
@ -16,11 +14,15 @@ class Program{
|
||||
CreateMainWindow().WaitForClose();
|
||||
}
|
||||
|
||||
public static PhotinoWindow CreateMainWindow() {
|
||||
BrikPackage bpkg = new BrikPackage(Path.Combine(Constants.CurrentWorkingDirectory, "root.dat"), 66);
|
||||
public static PhotinoWindow CreateMainWindow() {
|
||||
var BrikPackagePath = Path.Combine(Constants.BaseDirectory, "root.dat");
|
||||
if (Constants.Env == "PROD") {
|
||||
BrikPackagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "root.dat");
|
||||
}
|
||||
BrikPackage bpkg = new BrikPackage(BrikPackagePath, 66);
|
||||
List<string> entries = bpkg.ListEntries();
|
||||
foreach (string entry in entries) {
|
||||
Console.WriteLine($"[File] > entry");
|
||||
Console.WriteLine($"[File] > {entry}");
|
||||
}
|
||||
var window = new PhotinoWindow()
|
||||
.SetTitle("Brik Installer")
|
||||
@ -52,7 +54,7 @@ class Program{
|
||||
window.Center();
|
||||
};
|
||||
|
||||
LoadPage(window, "index.html");
|
||||
LoadPage(window, "index.html");
|
||||
return window;
|
||||
}
|
||||
|
||||
@ -142,7 +144,6 @@ class Program{
|
||||
HttpMethod httpMethod = HttpMethod.Get;
|
||||
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Configuration(Constants.ProductMetadata.Name, Constants.Os, Constants.Arch), httpMethod);
|
||||
var productConfig = await response.Content.ReadFromJsonAsync<ProductConfig>(Constants._jsonOptions);
|
||||
Console.WriteLine(productConfig!.Executable);
|
||||
InstallationFinish installationFinish = jsonPayload.Deserialize<InstallationFinish>(Constants._jsonOptions)!;
|
||||
if (installationFinish.CreateShortcut) {
|
||||
ShortcutService.CreateShortcut(Constants.ProductMetadata.Name, Path.Combine(Constants.ProductMetadata.InstallPath, productConfig.Executable!));
|
||||
@ -164,7 +165,6 @@ class Program{
|
||||
HttpMethod httpMethod = HttpMethod.Get;
|
||||
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Metadata(), httpMethod);
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine(content);
|
||||
responsePayload = new { success = true, content = content.ToString() };
|
||||
} catch (Exception) {
|
||||
responsePayload = new { success = false };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user