[BIG]
* Logs moins verbeux, + support config env var ASPNET_LOG_LEVEL * [REFACT/FS] Valid chars + [FIX] inclut maintenant le tiret (`-`) et `=` * scripts de déployement : timings des `sleep` plus sûrs * [HAIRCUT] les commandes de teintes (de la part du client) * index admin des coiffeurs * Maj de ma Home page * Mise en forme * [FIX] suppression de la reference externe aux scripts de ajax.aspnetcdn.com, pour un chargement sans Internet des pages.
This commit is contained in:
@ -6,11 +6,10 @@ using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.FileSystem;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
||||
using Yavsc.Exceptions;
|
||||
public class FSQuotaException : Exception {
|
||||
|
||||
}
|
||||
@ -46,10 +45,14 @@ namespace Yavsc.ApiControllers
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public IEnumerable<FileRecievedInfo> Post(string subdir="")
|
||||
public IEnumerable<IActionResult> Post(string subdir="")
|
||||
{
|
||||
var root = User.InitPostToFileSystem(subdir);
|
||||
|
||||
string root = null;
|
||||
try {
|
||||
root = User.InitPostToFileSystem(subdir);
|
||||
} catch (InvalidPathException) {}
|
||||
if (root==null)
|
||||
yield return new BadRequestObjectResult(new { error= "InvalidPathException" });
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == User.GetUserId()
|
||||
);
|
||||
@ -58,7 +61,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
var item = user.ReceiveUserFile(root, f);
|
||||
dbContext.SaveChanges(User.GetUserId());
|
||||
yield return item;
|
||||
yield return Ok(item);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace Yavsc
|
||||
AvatarsPath = "/Avatars",
|
||||
DefaultAvatar = "/images/Users/icon_user.png",
|
||||
AnonAvatar = "/images/Users/icon_anon_user.png";
|
||||
public static char[] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. ".ToCharArray();
|
||||
public static readonly long DefaultFSQ = 1024*1024*500;
|
||||
|
||||
public static readonly Scope[] SiteScopes = {
|
||||
|
9
Yavsc/Exceptions/InvalidPathException.cs
Normal file
9
Yavsc/Exceptions/InvalidPathException.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Yavsc.Exceptions
|
||||
{
|
||||
public class InvalidPathException: Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ using System.Net.Mime;
|
||||
using System.Security.Claims;
|
||||
using System.Web;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Yavsc.Exceptions;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.FileSystem;
|
||||
using Yavsc.ViewModels;
|
||||
@ -26,11 +27,11 @@ namespace Yavsc.Helpers
|
||||
|
||||
return di;
|
||||
}
|
||||
static char[] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~. ".ToCharArray();
|
||||
|
||||
|
||||
public static bool IsValidDirectoryName(this string name)
|
||||
{
|
||||
return !name.Any(c => !ValidChars.Contains(c));
|
||||
return !name.Any(c => !Constants.ValidChars.Contains(c));
|
||||
}
|
||||
public static bool IsValidPath(this string path)
|
||||
{
|
||||
@ -49,8 +50,6 @@ namespace Yavsc.Helpers
|
||||
string subpath)
|
||||
{
|
||||
var root = Path.Combine(Startup.UserFilesDirName, user.Identity.Name);
|
||||
// TOSO secure this path
|
||||
// if (subdir!=null) root = Path.Combine(root, subdir);
|
||||
var diRoot = new DirectoryInfo(root);
|
||||
if (!diRoot.Exists) diRoot.Create();
|
||||
if (subpath != null)
|
||||
@ -60,6 +59,7 @@ namespace Yavsc.Helpers
|
||||
diRoot = new DirectoryInfo(root);
|
||||
if (!diRoot.Exists) diRoot.Create();
|
||||
}
|
||||
else throw new InvalidPathException();
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Yavsc.Models;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
|
||||
namespace Yavsc.Migrations
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Migrations
|
||||
|
@ -48,7 +48,7 @@ namespace Yavsc
|
||||
// bingo
|
||||
if (typeof(IQueryable<ISpecializationSettings>).IsAssignableFrom(propinfo.PropertyType))
|
||||
{
|
||||
logger.LogInformation($"Paramêtres utilisateur déclaré: {propinfo.Name}");
|
||||
logger.LogVerbose($"Paramêtres utilisateur déclaré: {propinfo.Name}");
|
||||
UserSettings.Add(propinfo);
|
||||
} else
|
||||
// Design time error
|
||||
|
@ -22,13 +22,13 @@ using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Yavsc.Formatters;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.ViewModels.Auth.Handlers;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
using Formatters;
|
||||
using Models;
|
||||
using Services;
|
||||
using ViewModels.Auth.Handlers;
|
||||
public partial class Startup
|
||||
{
|
||||
public static string ConnectionString { get; private set; }
|
||||
@ -261,7 +261,24 @@ namespace Yavsc
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
loggerFactory.MinimumLevel = LogLevel.Verbose;
|
||||
var logenvvar = Environment.GetEnvironmentVariable("ASPNET_LOG_LEVEL");
|
||||
if (logenvvar!=null)
|
||||
switch (logenvvar) {
|
||||
case "info":
|
||||
loggerFactory.MinimumLevel = LogLevel.Information;
|
||||
break;
|
||||
case "warn":
|
||||
loggerFactory.MinimumLevel = LogLevel.Warning;
|
||||
break;
|
||||
case "err":
|
||||
loggerFactory.MinimumLevel = LogLevel.Error;
|
||||
break;
|
||||
default:
|
||||
loggerFactory.MinimumLevel = LogLevel.Information;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseRuntimeInfoPage();
|
||||
var epo = new ErrorPageOptions();
|
||||
|
7
Yavsc/ViewModels/Haircut/HaircutAdminViewModel.cs
Normal file
7
Yavsc/ViewModels/Haircut/HaircutAdminViewModel.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Yavsc.ViewModels.Haircut
|
||||
{
|
||||
public class HaircutAdminViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
5
Yavsc/Views/Administration/Haircut.cshtml
Normal file
5
Yavsc/Views/Administration/Haircut.cshtml
Normal file
@ -0,0 +1,5 @@
|
||||
@model HaircutAdminViewModel
|
||||
|
||||
<a asp-controller="HairTaints" class="btn btn-primary">
|
||||
Gestion des couleurs
|
||||
</a>
|
@ -32,3 +32,8 @@ Nombre </dt><dd> @Model.AdminCount</dd>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3>Coiffure</h3>
|
||||
|
||||
<a asp-controller="HairTaints" class="btn btn-primary">
|
||||
Gestion des couleurs
|
||||
</a>
|
@ -93,7 +93,14 @@ L'opération est annulable, jusqu'à deux semaines après sa programmation.
|
||||
|
||||
<environment names="Lua">
|
||||
<markdown>
|
||||
C'est mon site pérso.
|
||||
C'est mon site pérso, une customisation de _Yavsc_ (encore une autre très petite entreprise).
|
||||
|
||||
En voici d'autres:
|
||||
|
||||
* [Coiffure](https://coiffure.pschneider.fr)
|
||||
* [ZicMoove](https://zicmoove.pschneider.fr)
|
||||
* [Lua](https://lua.pschneider.fr)
|
||||
* [Yavsc](https://yavsc.pschneider.fr)
|
||||
|
||||
--
|
||||
Paul,
|
||||
@ -137,9 +144,12 @@ Veuillez excuser l'équipe de développement pour vous avoir fait part de cette
|
||||
|
||||
La "pré-production" affiche les sites suivants:
|
||||
|
||||
* [Coiffure](https://coiffure.pschneider.fr)
|
||||
* [ZicMoove](https://zicmoove.pschneider.fr)
|
||||
* [Yavsc](https://yavsc.pschneider.fr)
|
||||
* [Lua (le site perso de l'auteur de ce truc)](https://lua.pschneider.fr)
|
||||
* [Lua](https://lua.pschneider.fr)
|
||||
|
||||
</markdown>
|
||||
</environment>
|
||||
|
||||
|
||||
|
@ -26,13 +26,9 @@
|
||||
<link rel="alternate stylesheet" title="Dark" href="~/css/dark/site.min.css" asp-append-version="true" />
|
||||
<link rel="alternate stylesheet" title="Clear" href="~/css/clear/site.min.css" asp-append-version="true" />
|
||||
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
|
||||
asp-fallback-src="~/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery" >
|
||||
<script src="~/js/jquery.min.js">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js"
|
||||
asp-fallback-src="~/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||
<script src="~/js/bootstrap.min.js">
|
||||
</script>
|
||||
<script src="~/js/jquery-ui.min.js" asp-append-version="true"></script>
|
||||
<script src="~/js/jquery.signalR-2.2.1.min.js" asp-append-version="true"></script>
|
||||
|
@ -9,11 +9,11 @@ set -e
|
||||
cd bin/output/
|
||||
rsync -ravu wwwroot approot root@localhost:$FSPATH
|
||||
|
||||
sleep 3
|
||||
sleep 5
|
||||
ssh root@localhost service kestrel restart
|
||||
)
|
||||
|
||||
sleep 10
|
||||
sleep 15
|
||||
echo "Now, go and try <https://yavscpre.pschneider.fr>"
|
||||
# wait a little, for the processes to become stable
|
||||
sleep 15
|
||||
|
@ -2,17 +2,18 @@
|
||||
|
||||
FSPATH=/srv/www/yavsc
|
||||
|
||||
ssh root@localhost rm -rf $FSPATH/approot/src
|
||||
|
||||
|
||||
(
|
||||
set -e
|
||||
cd bin/output/
|
||||
rsync -ravu wwwroot approot root@localhost:$FSPATH
|
||||
set -e
|
||||
ssh root@localhost rm -rf $FSPATH/approot/src
|
||||
cd bin/output/
|
||||
rsync -ravu wwwroot approot root@localhost:$FSPATH
|
||||
|
||||
sleep 1
|
||||
ssh root@localhost service kestrel restart
|
||||
sleep 5
|
||||
ssh root@localhost service kestrel restart
|
||||
)
|
||||
|
||||
|
||||
# wait a little, for the processes to become stable
|
||||
sleep 10
|
||||
sleep 15
|
||||
|
@ -74,10 +74,16 @@
|
||||
tr.visiblepost {
|
||||
max-height: 3em;
|
||||
}
|
||||
tr.visiblepost img {
|
||||
max-height: 3em;
|
||||
}
|
||||
tr.hiddenpost {
|
||||
max-height: 2em;
|
||||
background-color: #888;
|
||||
font-size: smaller;
|
||||
max-height: 2em;
|
||||
}
|
||||
tr.hiddenpost img {
|
||||
max-height: 3em;
|
||||
}
|
||||
a.bloglink {
|
||||
font-weight: bold;
|
||||
|
2
Yavsc/wwwroot/css/main/site.min.css
vendored
2
Yavsc/wwwroot/css/main/site.min.css
vendored
@ -1 +1 @@
|
||||
.discussion,.notif,.pv{font-family:monospace}.smalltofhol,tr.visiblepost{max-height:3em}.blog a:active,.blog a:hover,a:active,a:hover{outline:0}#discussion,.blogphoto{float:left}.badge img{height:2em}.performer{padding-left:1em;background-repeat:no-repeat;background-image:url(/images/lis.svg);background-attachment:local;background-size:contain}.performer ul{margin-left:2.5em}.smalltofhol{max-width:3em;float:left;margin:.5em}.price,.total{font-weight:700;padding:.2em;margin:.2em}.price{font-size:x-large;border:2px solid #000;border-radius:1em}.total{font-size:xx-large;background-color:#f8f;border:3px solid #000;border-radius:1em}.blog,.panel{padding:1em}.blog a{font-weight:900}.discussion{color:#000}.notif{color:#006}.pv{color:#251;font-style:bold}#targets{display:block}tr.hiddenpost{background-color:#888;font-size:smaller;max-height:2em}a.bloglink{font-weight:700;text-shadow:0 0 8px #000}a{font-weight:900}.panel{display:inline-block;margin:1em;color:#000;background-color:inherit;border:1px solid #000}button,input,select,textarea{background-color:#bbb;color:#000}.jumbotron{padding:.5em}.carousel .item .btn{-webkit-transition:-webkit-transform 2s;transition:transform 2s background-color 1s color 1s;transform:scale3d(0,0,0);-webkit-transform:scale3d(0,0,0)}.carousel .active .btn{-webkit-transform:inherit;transform:inherit}.container{-webkit-transition:background-color 2s color 1s;-moz-transition:background-color 2s color 1s;transition:background-color 2s color 1s}.disabled{color:#999;background-color:#555}.carousel-caption-s p{font-family:jubilat;font-weight:600;font-size:large;line-height:1.1;text-decoration:overline;text-decoration-line:overline;text-shadow:3px 3px 7px #ffc8ff;-webkit-text-shadow:inset 0 3px 5px #ffc8ff;color:#000;margin:.5em;padding:.5em;animation:mymove 3s infinite;background-color:rgba(255,255,255,.6)}.carousel-caption-s{right:3em;top:1em;left:3em;z-index:10;padding-top:20px;padding-bottom:20px;text-align:center;min-height:16em;overflow:auto}.carousel-inner .item{padding-left:15%;padding-right:15%}.carousel-indicators{position:absolute;z-index:15;padding:0;text-align:center;list-style:none;top:.1em;height:1em}main.container{padding-right:1em;padding-left:1em;margin-left:1em;margin-right:1em}@-webkit-keyframes mymove{from,to{text-decoration-color:red}50%{text-decoration-color:#00f}}@keyframes mymove{from,to{text-decoration-color:red}50%{text-decoration-color:#00f}}ul.actiongroup li{display:inline}ul.actiongroup li a:hover{background-color:rgba(200,200,200,.6);color:#400}footer{vertical-align:bottom;padding:1.5em}.display-field{font-kerning:none;display:inline-flex;color:#008}.display-label{font-family:'Lucida Sans','Lucida Sans Regular','Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-stretch:condensed;display:inline-flex;color:#ff8;padding:.1em;border-radius:.5em;background-color:#210912}footer{color:grey;font-weight:bolder;font-size:x-small}.meta{color:#444;font-style:italic;font-size:smaller}.activity{font-family:fantasy}.blogtitle{display:inline-block;font-size:x-large}.blogphoto{margin:1em}.dl-horizontal dd{margin-left:20%}
|
||||
.discussion,.notif,.pv{font-family:monospace}.smalltofhol,tr.visiblepost,tr.visiblepost img{max-height:3em}.blog a:active,.blog a:hover,a:active,a:hover{outline:0}#discussion,.blogphoto{float:left}.badge img{height:2em}.performer{padding-left:1em;background-repeat:no-repeat;background-image:url(/images/lis.svg);background-attachment:local;background-size:contain}.performer ul{margin-left:2.5em}.smalltofhol{max-width:3em;float:left;margin:.5em}.price,.total{font-weight:700;padding:.2em;margin:.2em}.price{font-size:x-large;border:2px solid #000;border-radius:1em}.total{font-size:xx-large;background-color:#f8f;border:3px solid #000;border-radius:1em}.blog,.panel{padding:1em}.blog a{font-weight:900}.discussion{color:#000}.notif{color:#006}.pv{color:#251;font-style:bold}#targets{display:block}tr.hiddenpost{max-height:2em;background-color:#888;font-size:smaller}tr.hiddenpost img{max-height:3em}a.bloglink{font-weight:700;text-shadow:0 0 8px #000}a{font-weight:900}.panel{display:inline-block;margin:1em;color:#000;background-color:inherit;border:1px solid #000}button,input,select,textarea{background-color:#bbb;color:#000}.jumbotron{padding:.5em}.carousel .item .btn{-webkit-transition:-webkit-transform 2s;transition:transform 2s background-color 1s color 1s;transform:scale3d(0,0,0);-webkit-transform:scale3d(0,0,0)}.carousel .active .btn{-webkit-transform:inherit;transform:inherit}.container{-webkit-transition:background-color 2s color 1s;-moz-transition:background-color 2s color 1s;transition:background-color 2s color 1s}.disabled{color:#999;background-color:#555}.carousel-caption-s p{font-family:jubilat;font-weight:600;font-size:large;line-height:1.1;text-decoration:overline;text-decoration-line:overline;text-shadow:3px 3px 7px #ffc8ff;-webkit-text-shadow:inset 0 3px 5px #ffc8ff;color:#000;margin:.5em;padding:.5em;animation:mymove 3s infinite;background-color:rgba(255,255,255,.6)}.carousel-caption-s{right:3em;top:1em;left:3em;z-index:10;padding-top:20px;padding-bottom:20px;text-align:center;min-height:16em;overflow:auto}.carousel-inner .item{padding-left:15%;padding-right:15%}.carousel-indicators{position:absolute;z-index:15;padding:0;text-align:center;list-style:none;top:.1em;height:1em}main.container{padding-right:1em;padding-left:1em;margin-left:1em;margin-right:1em}@-webkit-keyframes mymove{from,to{text-decoration-color:red}50%{text-decoration-color:#00f}}@keyframes mymove{from,to{text-decoration-color:red}50%{text-decoration-color:#00f}}ul.actiongroup li{display:inline}ul.actiongroup li a:hover{background-color:rgba(200,200,200,.6);color:#400}footer{vertical-align:bottom;padding:1.5em}.display-field{font-kerning:none;display:inline-flex;color:#008}.display-label{font-family:'Lucida Sans','Lucida Sans Regular','Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-stretch:condensed;display:inline-flex;color:#ff8;padding:.1em;border-radius:.5em;background-color:#210912}footer{color:grey;font-weight:bolder;font-size:x-small}.meta{color:#444;font-style:italic;font-size:smaller}.activity{font-family:fantasy}.blogtitle{display:inline-block;font-size:x-large}.blogphoto{margin:1em}.dl-horizontal dd{margin-left:20%}
|
Reference in New Issue
Block a user