Avatar
This commit is contained in:
parent
3d0632303d
commit
fbd352e788
18 changed files with 179 additions and 55 deletions
|
|
@ -13,10 +13,11 @@ namespace Yavsc
|
|||
public static string UserFilesDirName { get; private set; }
|
||||
public static FileServerOptions UserFilesOptions { get; private set; }
|
||||
|
||||
public static FileServerOptions AvatarsOptions { get; set; }
|
||||
public void ConfigureFileServerApp(IApplicationBuilder app,
|
||||
SiteSettings siteSettings, IHostingEnvironment env)
|
||||
{
|
||||
var userFilesDirInfo = new DirectoryInfo( siteSettings.UserFiles.DirName );
|
||||
var userFilesDirInfo = new DirectoryInfo( siteSettings.UserFiles.Blog );
|
||||
UserFilesDirName = userFilesDirInfo.FullName;
|
||||
|
||||
if (!userFilesDirInfo.Exists) userFilesDirInfo.Create();
|
||||
|
|
@ -24,10 +25,24 @@ namespace Yavsc
|
|||
UserFilesOptions = new FileServerOptions()
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(UserFilesDirName),
|
||||
RequestPath = new PathString("/" + siteSettings.UserFiles.DirName),
|
||||
RequestPath = new PathString(Constants.UserFilesPath),
|
||||
EnableDirectoryBrowsing = env.IsDevelopment()
|
||||
};
|
||||
var avatarsDirInfo = new DirectoryInfo(Startup.SiteSetup.UserFiles.Avatars);
|
||||
if (!avatarsDirInfo.Exists) avatarsDirInfo.Create();
|
||||
AvatarsDirName = avatarsDirInfo.FullName;
|
||||
|
||||
AvatarsOptions = new FileServerOptions()
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(AvatarsDirName),
|
||||
RequestPath = new PathString(Constants.AvatarsPath),
|
||||
EnableDirectoryBrowsing = env.IsDevelopment()
|
||||
};
|
||||
|
||||
app.UseFileServer(UserFilesOptions);
|
||||
|
||||
app.UseFileServer(AvatarsOptions);
|
||||
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ namespace Yavsc
|
|||
{
|
||||
public static string ConnectionString { get; private set; }
|
||||
public static string UserBillsDirName { private set; get; }
|
||||
public static string AvatarsDirName { private set; get; }
|
||||
public static string Authority { get; private set; }
|
||||
public static string Audience { get; private set; }
|
||||
public static SiteSettings SiteSetup { get; private set; }
|
||||
|
|
@ -229,8 +230,8 @@ namespace Yavsc
|
|||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
SiteSetup = siteSettings.Value;
|
||||
Startup.UserFilesDirName = siteSettings.Value.UserFiles.DirName;
|
||||
Startup.UserBillsDirName = siteSettings.Value.UserFiles.Bills;
|
||||
Startup.UserFilesDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Blog).FullName;
|
||||
Startup.UserBillsDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Bills).FullName;
|
||||
|
||||
// TODO implement an installation & upgrade procedure
|
||||
// Create required directories
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue