Merge branch 'main' of https://github.com/ganjoor/GanjoorService
This commit is contained in:
commit
572deb5090
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
@ -10,11 +8,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net9.0-windows7.0\publish\</PublishUrl>
|
||||
<PublishUrl>bin\Release\net10.0-windows7.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ProjectGuid>48f9cdfa-625f-4743-bf21-bd556f6f33e8</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
@ -10,11 +8,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net9.0-windows7.0\publish\</PublishUrl>
|
||||
<PublishUrl>bin\Release\net10.0-windows7.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ProjectGuid>113ef3de-e8a9-40ef-9da0-8dfabb3cdd68</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -472,6 +472,52 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (!skipUpload)
|
||||
{
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
}
|
||||
|
||||
|
||||
foreach (var image in item.Images)
|
||||
{
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = _pictureFileService.GetImagePath(image, imageSizeString).Result;
|
||||
if (imageSizeString == "norm")
|
||||
{
|
||||
image.ExternalNormalSizeImageUrl = $"{Configuration.GetSection("BackupFTPServer")["RootUrl"]}/{image.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
context.Update(image);
|
||||
}
|
||||
if (!skipUpload)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 0, localFilePath);
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/{bookFriendlyUrl}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipUpload)
|
||||
{
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
await jobProgressServiceEF.DeleteJob(job.Id);
|
||||
|
||||
}
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
|
||||
@ -1430,13 +1430,94 @@ namespace RMuseum.Services.Implementation
|
||||
await context.SaveChangesAsync();//redundant
|
||||
}
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", false, exp.ToString());
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (!skipUpload)
|
||||
{
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
}
|
||||
|
||||
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = _pictureFileService.GetImagePath(book.CoverImage, imageSizeString).Result;
|
||||
if (imageSizeString == "norm")
|
||||
{
|
||||
book.CoverImage.ExternalNormalSizeImageUrl = $"{Configuration.GetSection("BackupFTPServer")["RootUrl"]}/{book.CoverImage.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
context.Update(book.CoverImage);
|
||||
}
|
||||
if (!skipUpload)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 0, localFilePath);
|
||||
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/{book.CoverImage.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in book.Items)
|
||||
{
|
||||
foreach (var image in item.Images)
|
||||
{
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = _pictureFileService.GetImagePath(image, imageSizeString).Result;
|
||||
if (imageSizeString == "norm")
|
||||
{
|
||||
image.ExternalNormalSizeImageUrl = $"{Configuration.GetSection("BackupFTPServer")["RootUrl"]}/{image.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
context.Update(image);
|
||||
}
|
||||
if (!skipUpload)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 0, localFilePath);
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/{book.CoverImage.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipUpload)
|
||||
{
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", true);
|
||||
await context.SaveChangesAsync();//redundant
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", false, exp.ToString());
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
|
||||
|
||||
@ -3472,6 +3553,30 @@ namespace RMuseum.Services.Implementation
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = _pictureFileService.GetImagePath(picture.Result, imageSizeString).Result;
|
||||
if (imageSizeString == "norm")
|
||||
{
|
||||
picture.Result.ExternalNormalSizeImageUrl = $"{Configuration.GetSection("BackupFTPServer")["RootUrl"]}/Pinterest/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
}
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/Pinterest/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
}
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
|
||||
RArtifactMasterRecord book = new RArtifactMasterRecord(titleInToc, titleInToc)
|
||||
{
|
||||
|
||||
@ -336,6 +336,27 @@ namespace RMuseum.Services.Implementation
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
RServiceResult<string> imgPath = _imageFileService.GetImagePath(img.Result);
|
||||
if (!string.IsNullOrEmpty(imgPath.ExceptionString))
|
||||
return new RServiceResult<GanjoorCatViewModel>(null, imgPath.ExceptionString);
|
||||
|
||||
var localFilePath = imgPath.Result;
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/CategoryImages/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
}
|
||||
cat.BookName = bookName;
|
||||
cat.RImageId = imageId;
|
||||
|
||||
@ -196,6 +196,42 @@ namespace RMuseum.Services.Implementation
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
string dir = Path.GetDirectoryName(xmlFile);
|
||||
|
||||
string rootDirName = Path.GetFileName(dir);
|
||||
string gdbDirName = Path.GetFileName(Path.GetDirectoryName(outDir));
|
||||
|
||||
foreach (var localFilePath in Directory.GetFiles(Path.Combine(dir, gdbDirName), "*.zip"))
|
||||
{
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/{rootDirName}/{gdbDirName}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
string imgDirName = Path.GetFileName(Path.GetDirectoryName(imgDir));
|
||||
foreach (var localFilePath in Directory.GetFiles(Path.Combine(dir, imgDirName), "*.png"))
|
||||
{
|
||||
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/{rootDirName}/{imgDirName}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
await ftpClient.UploadFile(xmlFile, $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/{rootDirName}/{Path.GetFileName(xmlFile)}", createRemoteDir: true);
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
|
||||
@ -3537,6 +3537,26 @@ namespace RMuseum.Services.Implementation
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
RServiceResult<string> imgPath = _imageFileService.GetImagePath(img.Result);
|
||||
if (!string.IsNullOrEmpty(imgPath.ExceptionString))
|
||||
return new RServiceResult<bool>(false, imgPath.ExceptionString);
|
||||
|
||||
var localFilePath = imgPath.Result;
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/PoetImages/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
var dbPoet = await _context.GanjoorPoets.Where(p => p.Id == poetId).SingleAsync();
|
||||
dbPoet.RImageId = imageId;
|
||||
_context.GanjoorPoets.Update(dbPoet);
|
||||
|
||||
@ -277,6 +277,28 @@ namespace RMuseum.Services.Implementation
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = GetImagePath(rPictureFile, imageSizeString).Result;
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/{rPictureFile.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -359,6 +381,30 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = GetImagePath(rPictureFile, imageSizeString).Result;
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/{rPictureFile.FolderName}/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
}
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", true);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -672,6 +718,25 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
var localFilePath = _simpleImageStorage.GetImagePath(image).Result;
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/CroppedImages/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath, createRemoteDir: true);
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
return new RServiceResult<RImage>(image);
|
||||
}
|
||||
return res;
|
||||
|
||||
@ -268,7 +268,31 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
|
||||
if (model.Published && bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
foreach (var imageSizeString in new string[] { "orig", "norm", "thumb" })
|
||||
{
|
||||
var localFilePath = _pictureFileService.GetImagePath(dbModel.Picture, imageSizeString).Result;
|
||||
if (imageSizeString == "norm")
|
||||
{
|
||||
dbModel.Picture.ExternalNormalSizeImageUrl = $"{Configuration.GetSection("BackupFTPServer")["RootUrl"]}/PoetsPhotoSuggestions/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
}
|
||||
var remoteFilePath = $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}/images/PoetsPhotoSuggestions/{imageSizeString}/{Path.GetFileName(localFilePath)}";
|
||||
await ftpClient.UploadFile(localFilePath, remoteFilePath);
|
||||
}
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
bool publishIsChanged = model.Published != dbModel.Published;
|
||||
if(publishIsChanged)
|
||||
{
|
||||
|
||||
@ -1338,6 +1338,31 @@ namespace RMuseum.Services.Implementationa
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
await ftpClient.UploadFile(narration.LocalXmlFilePath, $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteXMLFilePath}", createRemoteDir: true);
|
||||
tracker.XmlFileCopied = true;
|
||||
context.RecitationPublishingTrackers.Update(tracker);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
await ftpClient.UploadFile(narration.LocalMp3FilePath, $"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteMp3FilePath}", createRemoteDir: true);
|
||||
tracker.Mp3FileCopied = true;
|
||||
context.RecitationPublishingTrackers.Update(tracker);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
narration.AudioSyncStatus = AudioSyncStatus.SynchronizedOrRejected;
|
||||
context.Recitations.Update(narration);
|
||||
await context.SaveChangesAsync();
|
||||
@ -1425,6 +1450,31 @@ namespace RMuseum.Services.Implementationa
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
if (bool.Parse(Configuration.GetSection("BackupFTPServer")["UploadEnabled"]))
|
||||
{
|
||||
var ftpClient = new AsyncFtpClient
|
||||
(
|
||||
Configuration.GetSection("BackupFTPServer")["Host"],
|
||||
Configuration.GetSection("BackupFTPServer")["Username"],
|
||||
Configuration.GetSection("BackupFTPServer")["Password"]
|
||||
);
|
||||
ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
|
||||
await ftpClient.AutoConnect();
|
||||
ftpClient.Config.RetryAttempts = 3;
|
||||
|
||||
if (true == await ftpClient.FileExists($"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteXMLFilePath}"))
|
||||
{
|
||||
await ftpClient.DeleteFile($"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteXMLFilePath}");
|
||||
}
|
||||
|
||||
if (true == await ftpClient.FileExists($"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteXMLFilePath}"))
|
||||
{
|
||||
await ftpClient.DeleteFile($"{Configuration.GetSection("BackupFTPServer")["RootPath"]}{narration.RemoteXMLFilePath}");
|
||||
}
|
||||
|
||||
await ftpClient.Disconnect();
|
||||
}
|
||||
|
||||
string audioTitle = narration.AudioTitle;
|
||||
int GanjoorPostId = narration.GanjoorPostId;
|
||||
Guid userId = narration.OwnerId;
|
||||
|
||||
@ -77,6 +77,16 @@
|
||||
"RootUrl": "https://i.ganjoor.net/images",
|
||||
"LoadFromExternalServer": "True"
|
||||
},
|
||||
"BackupFTPServer": {
|
||||
"Host": "localhost",
|
||||
"Port": "22",
|
||||
"Username": "root",
|
||||
"Password": "",
|
||||
"RootPath": "/home",
|
||||
"UploadEnabled": "False",
|
||||
"RootUrl": "https://i.ganjoor.net/images",
|
||||
"LoadFromExternalServer": "True"
|
||||
},
|
||||
"WebServiceUrl": "http://localhost:3439",
|
||||
"ReadOnlyMode": "False",
|
||||
"TransilerateFormData": "ctl00%24ContentPlaceHolder2%24ScriptManager1=ctl00%24ContentPlaceHolder2%24UpdatePanel1%7Cctl00%24ContentPlaceHolder2%24btnConvert&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=50SiwtZgcWB3spddjuBb6BloHj933fgmboKNaKJBIwGTAAKq9eDHSPq%2FLjZZI2sJIMOfywb%2FVO3ZWSadvUsRVLOnxPleQwkf3EHhZT9mSeNvEFld9VKQZ0ben0y15vOMMCfoPQ%3D%3D&__VIEWSTATEGENERATOR=82B657B9&__EVENTVALIDATION=wcYH3JuIbMl7ulzDUUsJdcDMJwjBkZ%2BEyx5Gwv7F31G5yIN75QiuxDkD7acnJpR6cBC8VNNEowaHZB5xRMOF7%2BMhsiZ3AugxyWjaeeiiAUvv1BugkbhRft4aXkJpVd3%2FaeYBHFAyDrKDkYIA2jFrmtjkj1NrtRl5uSvsFY5fPVt9antJQ8kgNRfDEeNtsBzU6BH%2FCw%3D%3D&ctl00%24ContentPlaceHolder2%24txtPersian=%D8%AD%D8%B3%D9%86&ctl00%24ContentPlaceHolder2%24txtSuggest=&__ASYNCPOST=true&ctl00%24ContentPlaceHolder2%24btnConvert=%D8%A8%D8%B1%DA%AF%D8%B1%D8%AF%D8%A7%D9%86",
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net8.0-windows\publish\</PublishUrl>
|
||||
<PublishUrl>bin\Release\net10.0-windows7.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||
<ProjectGuid>1c51eb06-5190-4646-84c7-5ee712c86f57</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
13
TajikGanjoor/dotnet-tools.json
Normal file
13
TajikGanjoor/dotnet-tools.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "10.0.9",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user