This commit is contained in:
@@ -25,6 +25,9 @@ CODING WORK
|
||||
IMMEDIATE ITEMS:
|
||||
================
|
||||
|
||||
Go through startup.cs ensure all the route related stuff needs to be there and correctly handle the spa routes if reload.
|
||||
|
||||
|
||||
*** CLIENT SHELL ***
|
||||
|
||||
Go through the TOOLS.txt file VUE section and install
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace AyaNova.Api.Controllers
|
||||
<div style=""text-align: center;"">
|
||||
<div style=""display: inline-block;text-align:left;"">
|
||||
<h1>{AyaNovaVersion.FullNameAndVersion}</h1>
|
||||
<a href=""/"">AyaNova Client</a><br/><br/>
|
||||
<a href=""/docs"">AyaNova manual</a><br/><br/>
|
||||
<a href=""/api-docs"">API explorer</a><br/><br/>
|
||||
<a href=""mailto:support@ayanova.com"">Email AyaNova support</a><br/><br/>
|
||||
|
||||
@@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Util;
|
||||
@@ -304,17 +305,20 @@ namespace AyaNova
|
||||
#region STATIC FILES
|
||||
_log.LogDebug("BOOT: pipeline - static files");
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
OnPrepareResponse = context =>
|
||||
{
|
||||
if (context.File.Name == "default.htm")
|
||||
{
|
||||
context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
|
||||
context.Context.Response.Headers.Add("Expires", "-1");
|
||||
}
|
||||
}
|
||||
});
|
||||
app.UseStaticFiles();
|
||||
//Might need the following if the page doesn't update in the client properly
|
||||
//however the vue build process will automatically uniquify each build file names so maybe not required
|
||||
// app.UseStaticFiles(new StaticFileOptions
|
||||
// {
|
||||
// OnPrepareResponse = context =>
|
||||
// {
|
||||
// if (context.File.Name == "index.html")
|
||||
// {
|
||||
// context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
|
||||
// context.Context.Response.Headers.Add("Expires", "-1");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
#endregion
|
||||
|
||||
#region AUTH / ROLES
|
||||
@@ -358,9 +362,6 @@ namespace AyaNova
|
||||
_log.LogDebug("BOOT: pipeline - MVC");
|
||||
app.UseMvc();
|
||||
|
||||
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// ******************** TESTING WIPE DB *****************************
|
||||
//
|
||||
@@ -410,9 +411,25 @@ namespace AyaNova
|
||||
#endif
|
||||
|
||||
|
||||
//Set autoId values
|
||||
//AUTOID VALUES INITIALIZATION
|
||||
ServerBootConfig.SetMostRecentAutoIdValuesFromDatabase(dbContext);
|
||||
|
||||
//SPA FALLBACK ROUTE
|
||||
//this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally
|
||||
//by the client
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
await next();
|
||||
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
|
||||
{
|
||||
context.Request.Path = "/index.html";
|
||||
context.Response.StatusCode = 200;
|
||||
context.Response.ContentType = "text/html";
|
||||
await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Open up the server for visitors
|
||||
apiServerState.SetOpen();
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
||||
crossorigin="anonymous"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#upload").click(function (evt) {
|
||||
var fileUpload = $("#files").get(0);
|
||||
var files = fileUpload.files;
|
||||
var data = new FormData();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
data.append(files[i].name, files[i]);
|
||||
}
|
||||
|
||||
//attachment test
|
||||
data.append('AttachToObjectType','2');//object 2 is widget
|
||||
data.append('AttachToObjectId','200');//there should normally always be a widget with id 1
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://localhost:7575/api/v8.0/Attachment",
|
||||
headers: {
|
||||
Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTIxNTY5ODE5IiwiZXhwIjoiMTUyNDE2MTgxOSIsImlzcyI6IkF5YU5vdmEiLCJpZCI6IjEifQ.4PzkzZNYK5mJkbfCHGQ2N2248atAvvcDgApoz65oIC0"
|
||||
},
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: data,
|
||||
success: function (message) {
|
||||
alert("upload successful!");
|
||||
console.log(message);
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
alert("There was an error uploading files!");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="file" id="files" name="files" multiple />
|
||||
<!-- <input type="file" accept=".zip,application/zip" id="files" name="files" multiple /> -->
|
||||
<input type="button" id="upload" value="Upload file(s)" />
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user