diff --git a/RMuseum/Models/GanjoorAudio/AudioReviewStatus.cs b/RMuseum/Models/GanjoorAudio/AudioReviewStatus.cs
new file mode 100644
index 00000000..16d730da
--- /dev/null
+++ b/RMuseum/Models/GanjoorAudio/AudioReviewStatus.cs
@@ -0,0 +1,23 @@
+namespace RMuseum.Models.GanjoorAudio
+{
+ ///
+ /// Audio Review Status
+ ///
+ public enum AudioReviewStatus
+ {
+ ///
+ /// pending for review
+ ///
+ Pending = 0,
+
+ ///
+ /// approved
+ ///
+ Approved = 1,
+
+ ///
+ /// Rejected
+ ///
+ Rejected = 2
+ }
+}
diff --git a/RMuseum/Models/GanjoorAudio/AudioSyncStatus.cs b/RMuseum/Models/GanjoorAudio/AudioSyncStatus.cs
new file mode 100644
index 00000000..6dcc29b0
--- /dev/null
+++ b/RMuseum/Models/GanjoorAudio/AudioSyncStatus.cs
@@ -0,0 +1,39 @@
+namespace RMuseum.Models.GanjoorAudio
+{
+ ///
+ /// Audio Synchronization Status (binary combination is acceptable)
+ ///
+ public enum AudioSyncStatus
+ {
+ ///
+ /// no changed
+ ///
+ SynchronizedOrRejected = 0,
+
+ ///
+ /// new upload
+ ///
+ NewItem = 1,
+
+ ///
+ /// meta data should be updated
+ ///
+ MetadataChanged = 2,
+
+ ///
+ /// sound files should be reuploaded
+ ///
+ SoundFilesChanged = 4,
+
+ ///
+ /// Xml file should be reuploaded
+ ///
+ XmlFileChanged = 8,
+
+ ///
+ /// Item is deleted
+ ///
+ Deleted = 16
+
+ }
+}
diff --git a/RMuseum/Models/GanjoorAudio/PoemNarration.cs b/RMuseum/Models/GanjoorAudio/PoemNarration.cs
new file mode 100644
index 00000000..788400b7
--- /dev/null
+++ b/RMuseum/Models/GanjoorAudio/PoemNarration.cs
@@ -0,0 +1,164 @@
+using RSecurityBackend.Models.Auth.Db;
+using System;
+
+
+namespace RMuseum.Models.GanjoorAudio
+{
+ ///
+ /// Poem Narration
+ ///
+ public class PoemNarration
+ {
+ ///
+ /// Id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Owner User
+ ///
+ public RAppUser Owner { get; set; }
+
+ ///
+ /// Owner User Id
+ ///
+ public Guid OwnerId { get; set; }
+
+ ///
+ /// Final data is actually exported to a MySQL database which this auto increment field is its key
+ ///
+ public int GanjoorAudioId { get; set; }
+
+ ///
+ /// Ganjoor Post Id
+ ///
+ public int GanjoorPostId { get; set; }
+
+ ///
+ /// This determines where an audio is displayed between a list of sounds related to a specfic poem
+ ///
+ public int AudioOrder { get; set; }
+
+ ///
+ /// Using this field content you would determine xml, mp3 and ogg file names
+ ///
+ public string FileNameWithoutExtension { get; set; }
+
+ ///
+ /// combining this with + .ext would preduce relative path of sound files on our file server the full path would become [HOMEPath] + '/i/' + this value
+ ///
+ ///
+ /// "a2"
+ ///
+ ///
+ /// We had previously used different pathes because when a directory became overcrowded our connection time would increase unbearably due to IRAN internet problems, so it is sensible to store it per record and not as a global option value
+ ///
+ public string SoundFilesFolder { get; set; }
+
+ ///
+ /// MP3 File Path
+ ///
+ public string RemoteMp3FilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
+
+ ///
+ /// MP3 url
+ ///
+ public string Mp3Url { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.mp3"; } }
+
+
+ ///
+ /// OGG File Path
+ ///
+ public string RemoteOggFilePath { get { return $"/i/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
+
+ ///
+ /// OGG url
+ ///
+ public string OggUrl { get { return $"https://i.ganjoor.net/{SoundFilesFolder}/{FileNameWithoutExtension}.ogg"; } }
+
+ ///
+ /// This is also a legacy field
+ ///
+ ///
+ /// "/i/a2/x"
+ ///
+ public string RemoteXMLFilePath { get { return $"/i/{SoundFilesFolder}/x/{FileNameWithoutExtension}.xml"; } }
+
+ ///
+ /// Audio Title
+ ///
+ public string AudioTitle { get; set; }
+
+ ///
+ /// Audio Artist
+ ///
+ public string AudioArtist { get; set; }
+
+ ///
+ /// Audio Artist Url
+ ///
+ public string AudioArtistUrl { get; set; }
+
+ ///
+ /// Audio Source
+ ///
+ public string AudioSrc { get; set; }
+
+ ///
+ /// Audio Src Url
+ ///
+ public string AudioSrcUrl { get; set; }
+
+ ///
+ /// Legacy Audio Guid
+ ///
+ public Guid LegacyAudioGuid { get; set; }
+
+ ///
+ /// Audio File CheckSum
+ ///
+ public string Mp3FileCheckSum { get; set; }
+
+ ///
+ /// mp3 size in bytes
+ ///
+ public int Mp3SizeInBytes { get; set; }
+
+ ///
+ /// ogg size in bytes
+ ///
+ public int OggSizeInBytes { get; set; }
+
+ ///
+ /// Upload Date
+ ///
+ public DateTime UploadDate { get; set; }
+
+ ///
+ /// Review Date (Approve or Reject)
+ ///
+ public DateTime ReviewDate{ get; set; }
+
+ ///
+ /// MP3 File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
+ ///
+ public string LocalMp3FilePath { get; set; }
+
+ ///
+ /// XML File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
+ ///
+ public string LocalXmlFilePath { get; set; }
+
+ ///
+ /// Value is one or a combination of
+ ///
+ public int AudioSyncStatus { get; set; }
+
+ ///
+ /// Review Status
+ ///
+ public AudioReviewStatus ReviewStatus { get; set; }
+
+
+ }
+}
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index f44a4d22..4ed7ebf5 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -1495,6 +1495,215 @@
User Note
+
+
+ Audio Review Status
+
+
+
+
+ pending for review
+
+
+
+
+ approved
+
+
+
+
+ Rejected
+
+
+
+
+ Audio Synchronization Status (binary combination is acceptable)
+
+
+
+
+ no changed
+
+
+
+
+ new upload
+
+
+
+
+ meta data should be updated
+
+
+
+
+ sound files should be reuploaded
+
+
+
+
+ Xml file should be reuploaded
+
+
+
+
+ Item is deleted
+
+
+
+
+ Poem Narration
+
+
+
+
+ Id
+
+
+
+
+ Owner User
+
+
+
+
+ Owner User Id
+
+
+
+
+ Final data is actually exported to a MySQL database which this auto increment field is its key
+
+
+
+
+ Ganjoor Post Id
+
+
+
+
+ This determines where an audio is displayed between a list of sounds related to a specfic poem
+
+
+
+
+ Using this field content you would determine xml, mp3 and ogg file names
+
+
+
+
+ combining this with + .ext would preduce relative path of sound files on our file server the full path would become [HOMEPath] + '/i/' + this value
+
+
+ "a2"
+
+
+ We had previously used different pathes because when a directory became overcrowded our connection time would increase unbearably due to IRAN internet problems, so it is sensible to store it per record and not as a global option value
+
+
+
+
+ MP3 File Path
+
+
+
+
+ MP3 url
+
+
+
+
+ OGG File Path
+
+
+
+
+ OGG url
+
+
+
+
+ This is also a legacy field
+
+
+ "/i/a2/x"
+
+
+
+
+ Audio Title
+
+
+
+
+ Audio Artist
+
+
+
+
+ Audio Artist Url
+
+
+
+
+ Audio Source
+
+
+
+
+ Audio Src Url
+
+
+
+
+ Legacy Audio Guid
+
+
+
+
+ Audio File CheckSum
+
+
+
+
+ mp3 size in bytes
+
+
+
+
+ ogg size in bytes
+
+
+
+
+ Upload Date
+
+
+
+
+ Review Date (Approve or Reject)
+
+
+
+
+ MP3 File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
+
+
+
+
+ XML File local path on Windows Server (if item is not rejected probably it is not valid and it is deleted)
+
+
+
+
+ Value is one or a combination of
+
+
+
+
+ Review Status
+
+
ganjoor link for artifacts and items
@@ -3501,11 +3710,6 @@
-
-
- SmptConfig
-
-
manipulating picture files
diff --git a/RMuseum/Services/Implementation/MailKitEmailSender.cs b/RMuseum/Services/Implementation/MailKitEmailSender.cs
deleted file mode 100644
index 8b858e37..00000000
--- a/RMuseum/Services/Implementation/MailKitEmailSender.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using RSecurityBackend.Models.Mail;
-using RSecurityBackend.Services.Implementation;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace RMuseum.Services.Implementation
-{
- public class MailKitEmailSender : MailKitEmailSenderBase
- {
- ///
- /// SmptConfig
- ///
- public override SmptConfig SmptConfig
- {
- get
- {
- return
- new SmptConfig()
- {
- port = 25,
- server = "ganjgah.ir",
- smtpUsername = "noreply@ganjgah.ir",
- smtpPassword = "sahY%6&$OnD67i0978",
- from = "noreply@ganjgah.ir",
- useSsl = false
- };
- }
- }
- }
-
-}
diff --git a/RMuseum/appsettings.json b/RMuseum/appsettings.json
index 8e7270f1..5405574b 100644
--- a/RMuseum/appsettings.json
+++ b/RMuseum/appsettings.json
@@ -25,5 +25,14 @@
"Secret": "k4Fy7pDsc0LgXQ8PCCfZtwmju5Ed8asc",
"DefaultTokenExpirationInSeconds": "2502000"
},
- "AllowedHosts": "*"
- }
+ "SmptConfig": {
+ "Server": "smtp.gmail.com",
+ "Port": "465",
+ "UseSsl": "true",
+ "Username": "test@gmail.com",
+ "Password": "password",
+ "From": "test@gmail.com"
+ },
+
+ "AllowedHosts": "*"
+}
diff --git a/RSecurityBackend/RSecurityBackend.xml b/RSecurityBackend/RSecurityBackend.xml
index df14a63e..7f5fbf08 100644
--- a/RSecurityBackend/RSecurityBackend.xml
+++ b/RSecurityBackend/RSecurityBackend.xml
@@ -2571,27 +2571,33 @@
-
+
mail sender using MailKit
-
+
constructor
+
-
+
+
+ Configuration
+
+
+
options
-
+
SmptConfig
-
+
send email
@@ -2600,7 +2606,7 @@
-
+
diff --git a/RSecurityBackend/Services/Implementation/MailKitEmailSenderBase.cs b/RSecurityBackend/Services/Implementation/MailKitEmailSender.cs
similarity index 64%
rename from RSecurityBackend/Services/Implementation/MailKitEmailSenderBase.cs
rename to RSecurityBackend/Services/Implementation/MailKitEmailSender.cs
index 3c97f607..07929f5a 100644
--- a/RSecurityBackend/Services/Implementation/MailKitEmailSenderBase.cs
+++ b/RSecurityBackend/Services/Implementation/MailKitEmailSender.cs
@@ -1,6 +1,6 @@
using MailKit.Net.Smtp;
using Microsoft.AspNetCore.Identity.UI.Services;
-using Microsoft.Extensions.Options;
+using Microsoft.Extensions.Configuration;
using MimeKit;
using RSecurityBackend.Models.Mail;
using System.Threading.Tasks;
@@ -10,38 +10,55 @@ namespace RSecurityBackend.Services.Implementation
///
/// mail sender using MailKit
///
- public class MailKitEmailSenderBase : IEmailSender
+ public class MailKitEmailSender : IEmailSender
{
///
/// constructor
///
- public MailKitEmailSenderBase()
+ ///
+ public MailKitEmailSender(IConfiguration configuration)
{
+ Configuration = configuration;
Options = SmptConfig;
+
}
+ ///
+ /// Configuration
+ ///
+ protected IConfiguration Configuration { get; }
+
///
/// options
///
public SmptConfig Options { get; } //set only via Secret Manager
+
+ private SmptConfig _SmptConfig = null;
+
///
/// SmptConfig
///
- public virtual SmptConfig SmptConfig
+ public SmptConfig SmptConfig
{
get
{
- return
- new SmptConfig()
- {
- port = 465,
- server = "smtp.gmail.com",
- smtpUsername = "nonexistingganjoor@gmail.com",
- smtpPassword = "APasswordHere",
- from = "nonexistingganjoor@gmail.com",
- useSsl = true
- };
+ if (_SmptConfig == null)
+ {
+ _SmptConfig =
+ new SmptConfig()
+ {
+ server = $"{Configuration.GetSection("SmptConfig")["Server"]}",
+ port = int.Parse($"{Configuration.GetSection("SmptConfig")["Port"]}"),
+ useSsl = bool.Parse($"{Configuration.GetSection("SmptConfig")["UseSsl"]}"),
+ smtpUsername = $"{ Configuration.GetSection("SmptConfig")["Username"] }",
+ smtpPassword = $"{Configuration.GetSection("SmptConfig")["Password"]}",
+ from = $"{ Configuration.GetSection("SmptConfig")["From"] }"
+
+ };
+ }
+ return _SmptConfig;
+
}
}