Compare commits
No commits in common. "8181f31d2718b4a8de5c48f6d9593fce33459064" and "9347ab03a60c5cc9a25634d8f0655f57b3723c81" have entirely different histories.
8181f31d27
...
9347ab03a6
@ -1,32 +1,22 @@
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
using CVRLIB.CARTS;
|
||||
using static CVRLIB.CVSTRINGS.TextFuncs;
|
||||
|
||||
using CVRLIB;
|
||||
using CVRLIB.Generic;
|
||||
|
||||
|
||||
using ZXing;
|
||||
using Newtonsoft.Json;
|
||||
using CVRLIB;
|
||||
|
||||
namespace VSERVERWS.Controllers {
|
||||
|
||||
//https://vserverws.cvr.cvrco.ca/api/cart/CartStatus
|
||||
|
||||
namespace VSERVERWS.Controllers;
|
||||
|
||||
|
||||
|
||||
//https://vserverws.cvr.cvrco.ca/api/cart/CartStatus
|
||||
|
||||
[Route("api/Cart/[action]")]
|
||||
[ApiController]
|
||||
public class CartController : ControllerBase {
|
||||
[Route("api/Cart/[action]")]
|
||||
[ApiController]
|
||||
public class CartController : ControllerBase {
|
||||
|
||||
|
||||
|
||||
@ -39,88 +29,6 @@ public class CartController : ControllerBase {
|
||||
}
|
||||
|
||||
|
||||
//https://localhost:7210/api/Cart/SubmitCartHTML?id=1337&source=beta%2Ecvr%2Ecvrco%2Eca
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("text/plain")]
|
||||
public async Task<IActionResult> SubmitCartHTML(string id, string source) {
|
||||
|
||||
var rTOR = new TryOperationResult();
|
||||
|
||||
var isEncrypted = false;
|
||||
var tdata = "";
|
||||
var data = "";
|
||||
|
||||
var HTML_PATH = Program.XDRIVE + "\\CVRCO\\BU\\Carts\\HTML";
|
||||
|
||||
var inSource = HttpUtility.UrlDecode(source);
|
||||
|
||||
if (!string.IsNullOrEmpty(inSource)) {
|
||||
HTML_PATH = HTML_PATH + "\\" + inSource;
|
||||
|
||||
if (!Directory.Exists(HTML_PATH)) {
|
||||
Directory.CreateDirectory(HTML_PATH);
|
||||
}
|
||||
} else {
|
||||
|
||||
rTOR.AddResult(false, "READ_SOURCE", "no source provided!");
|
||||
|
||||
return new JsonResult(rTOR);
|
||||
}
|
||||
|
||||
|
||||
using (var SR = new StreamReader(Request.Body)) {
|
||||
data = await SR.ReadToEndAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!Directory.Exists(HTML_PATH)) {
|
||||
Directory.CreateDirectory(HTML_PATH);
|
||||
}
|
||||
|
||||
if (!tdata.Contains("<html>")) { isEncrypted = true; }
|
||||
|
||||
|
||||
try {
|
||||
|
||||
if (isEncrypted) {
|
||||
tdata = NonSecureDecryptHexStringToString(data);
|
||||
}
|
||||
|
||||
if (!tdata.Contains("<html>")) {
|
||||
throw new Exception("Invalid html string");
|
||||
}
|
||||
|
||||
|
||||
|
||||
using (var FS = new FileStream(HTML_PATH + "\\" + id + ".txt", FileMode.Create, FileAccess.Write, FileShare.None)) {
|
||||
using (var SW = new StreamWriter(FS)) {
|
||||
|
||||
if (isEncrypted) {
|
||||
await SW.WriteAsync(data);
|
||||
} else {
|
||||
await SW.WriteAsync(NonSecureEncryptStringToHexString(tdata));
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
rTOR.AddResult(true, "TRY_SAVE_HTML_CART");
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
rTOR.AddResult(false, "TRY_SAVE_HTML_CART", ex.Message, ex);
|
||||
|
||||
Debug.WriteLine(ex.Message);
|
||||
Debug.WriteLine(ex.StackTrace);
|
||||
}
|
||||
|
||||
return new JsonResult(rTOR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
@ -161,4 +69,5 @@ public class CartController : ControllerBase {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
26
Program.cs
26
Program.cs
@ -38,19 +38,8 @@ if (!app.Environment.IsDevelopment()) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
var env = builder.Environment;
|
||||
|
||||
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\wwwroot
|
||||
AppPath = env.WebRootPath;
|
||||
|
||||
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\
|
||||
HTTPROOT = env.ContentRootPath;
|
||||
|
||||
|
||||
|
||||
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
|
||||
//VSERVERWS.Global.Globals.IsDevelopment = false;
|
||||
|
||||
|
||||
VSERVERWS.Global.Globals.LoadPrinters();
|
||||
|
||||
@ -90,17 +79,4 @@ public partial class Program {
|
||||
public static string HTTPROOT { get; set; } = "";
|
||||
public static bool IsDevMode { get; set; } = false;
|
||||
|
||||
|
||||
public static string XDRIVE {
|
||||
get {
|
||||
|
||||
if (Directory.Exists("X:\\Shares\\cvrdata")) {
|
||||
return "X:\\Shares\\cvrdata";
|
||||
} else {
|
||||
return "X:";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -7,16 +7,15 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.4.0" />
|
||||
<PackageReference Include="Magick.NET.Core" Version="13.4.0" />
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="11.3.0" />
|
||||
<PackageReference Include="Magick.NET.Core" Version="11.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.7" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.2" />
|
||||
<PackageReference Include="System.Threading.RateLimiting" Version="7.0.0" />
|
||||
<PackageReference Include="ZXing.Net" Version="0.16.9" />
|
||||
<PackageReference Include="ZXing.Net" Version="0.16.8" />
|
||||
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user