This commit is contained in:
@@ -25,6 +25,9 @@ CODING WORK
|
|||||||
IMMEDIATE ITEMS:
|
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 ***
|
*** CLIENT SHELL ***
|
||||||
|
|
||||||
Go through the TOOLS.txt file VUE section and install
|
Go through the TOOLS.txt file VUE section and install
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
<body >
|
<body >
|
||||||
<div style=""text-align: center;"">
|
<div style=""text-align: center;"">
|
||||||
<div style=""display: inline-block;text-align:left;"">
|
<div style=""display: inline-block;text-align:left;"">
|
||||||
<h1>{AyaNovaVersion.FullNameAndVersion}</h1>
|
<h1>{AyaNovaVersion.FullNameAndVersion}</h1>
|
||||||
|
<a href=""/"">AyaNova Client</a><br/><br/>
|
||||||
<a href=""/docs"">AyaNova manual</a><br/><br/>
|
<a href=""/docs"">AyaNova manual</a><br/><br/>
|
||||||
<a href=""/api-docs"">API explorer</a><br/><br/>
|
<a href=""/api-docs"">API explorer</a><br/><br/>
|
||||||
<a href=""mailto:support@ayanova.com"">Email AyaNova support</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.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
@@ -304,17 +305,20 @@ namespace AyaNova
|
|||||||
#region STATIC FILES
|
#region STATIC FILES
|
||||||
_log.LogDebug("BOOT: pipeline - static files");
|
_log.LogDebug("BOOT: pipeline - static files");
|
||||||
app.UseDefaultFiles();
|
app.UseDefaultFiles();
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles();
|
||||||
{
|
//Might need the following if the page doesn't update in the client properly
|
||||||
OnPrepareResponse = context =>
|
//however the vue build process will automatically uniquify each build file names so maybe not required
|
||||||
{
|
// app.UseStaticFiles(new StaticFileOptions
|
||||||
if (context.File.Name == "default.htm")
|
// {
|
||||||
{
|
// OnPrepareResponse = context =>
|
||||||
context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
|
// {
|
||||||
context.Context.Response.Headers.Add("Expires", "-1");
|
// 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
|
#endregion
|
||||||
|
|
||||||
#region AUTH / ROLES
|
#region AUTH / ROLES
|
||||||
@@ -358,9 +362,6 @@ namespace AyaNova
|
|||||||
_log.LogDebug("BOOT: pipeline - MVC");
|
_log.LogDebug("BOOT: pipeline - MVC");
|
||||||
app.UseMvc();
|
app.UseMvc();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// ******************** TESTING WIPE DB *****************************
|
// ******************** TESTING WIPE DB *****************************
|
||||||
//
|
//
|
||||||
@@ -410,9 +411,25 @@ namespace AyaNova
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//Set autoId values
|
//AUTOID VALUES INITIALIZATION
|
||||||
ServerBootConfig.SetMostRecentAutoIdValuesFromDatabase(dbContext);
|
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
|
//Open up the server for visitors
|
||||||
apiServerState.SetOpen();
|
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