mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Added an application URL in the customization settings #1513
This commit is contained in:
parent
5472baff24
commit
9556ed1b34
7 changed files with 44 additions and 9 deletions
|
@ -7,10 +7,11 @@ using Ombi.Store.Entities.Requests;
|
||||||
namespace Ombi.Notifications
|
namespace Ombi.Notifications
|
||||||
{
|
{
|
||||||
public class NotificationMessageCurlys
|
public class NotificationMessageCurlys
|
||||||
{
|
{
|
||||||
|
|
||||||
public void Setup(FullBaseRequest req, CustomizationSettings s)
|
public void Setup(FullBaseRequest req, CustomizationSettings s)
|
||||||
{
|
{
|
||||||
|
ApplicationUrl = s.ApplicationUrl;
|
||||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||||
? req.RequestedUser.UserName
|
? req.RequestedUser.UserName
|
||||||
|
@ -25,6 +26,7 @@ namespace Ombi.Notifications
|
||||||
|
|
||||||
public void Setup(ChildRequests req, CustomizationSettings s)
|
public void Setup(ChildRequests req, CustomizationSettings s)
|
||||||
{
|
{
|
||||||
|
ApplicationUrl = s.ApplicationUrl;
|
||||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||||
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
|
||||||
? req.RequestedUser.UserName
|
? req.RequestedUser.UserName
|
||||||
|
@ -40,10 +42,11 @@ namespace Ombi.Notifications
|
||||||
|
|
||||||
public void Setup(OmbiUser user, CustomizationSettings s)
|
public void Setup(OmbiUser user, CustomizationSettings s)
|
||||||
{
|
{
|
||||||
|
ApplicationUrl = s.ApplicationUrl;
|
||||||
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
ApplicationName = string.IsNullOrEmpty(s.ApplicationName) ? "Ombi" : s.ApplicationName;
|
||||||
RequestedUser = user.UserName;
|
RequestedUser = user.UserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// User Defined
|
// User Defined
|
||||||
public string RequestedUser { get; set; }
|
public string RequestedUser { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
@ -56,6 +59,7 @@ namespace Ombi.Notifications
|
||||||
public string SeasonsList { get; set; }
|
public string SeasonsList { get; set; }
|
||||||
public string PosterImage { get; set; }
|
public string PosterImage { get; set; }
|
||||||
public string ApplicationName { get; set; }
|
public string ApplicationName { get; set; }
|
||||||
|
public string ApplicationUrl { get; set; }
|
||||||
|
|
||||||
// System Defined
|
// System Defined
|
||||||
private string LongDate => DateTime.Now.ToString("D");
|
private string LongDate => DateTime.Now.ToString("D");
|
||||||
|
@ -80,6 +84,7 @@ namespace Ombi.Notifications
|
||||||
{nameof(SeasonsList),SeasonsList},
|
{nameof(SeasonsList),SeasonsList},
|
||||||
{nameof(PosterImage),PosterImage},
|
{nameof(PosterImage),PosterImage},
|
||||||
{nameof(ApplicationName),ApplicationName},
|
{nameof(ApplicationName),ApplicationName},
|
||||||
|
{nameof(ApplicationUrl),ApplicationUrl},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,29 @@
|
||||||
namespace Ombi.Settings.Settings.Models
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Ombi.Settings.Settings.Models
|
||||||
{
|
{
|
||||||
public class CustomizationSettings : Settings
|
public class CustomizationSettings : Settings
|
||||||
{
|
{
|
||||||
public string ApplicationName { get; set; }
|
public string ApplicationName { get; set; }
|
||||||
|
public string ApplicationUrl { get; set; }
|
||||||
|
|
||||||
|
public void AddToUrl(string part)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(ApplicationUrl))
|
||||||
|
{
|
||||||
|
ApplicationUrl = part;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ApplicationUrl.EndsWith("/"))
|
||||||
|
{
|
||||||
|
ApplicationUrl.Remove(ApplicationUrl.Length - 1);
|
||||||
|
}
|
||||||
|
if (!part.StartsWith("/"))
|
||||||
|
{
|
||||||
|
part = "/" + part;
|
||||||
|
}
|
||||||
|
ApplicationUrl = ApplicationUrl + part;
|
||||||
|
}
|
||||||
public string Logo { get; set; }
|
public string Logo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -170,7 +170,7 @@ namespace Ombi.Store.Context
|
||||||
notificationToAdd = new NotificationTemplates
|
notificationToAdd = new NotificationTemplates
|
||||||
{
|
{
|
||||||
NotificationType = notificationType,
|
NotificationType = notificationType,
|
||||||
Message = "Hello! You have been invited to use {ApplicationName}!",
|
Message = "Hello! You have been invited to use {ApplicationName}! You can login here: {ApplicationUrl}",
|
||||||
Subject = "Invite to {ApplicationName}",
|
Subject = "Invite to {ApplicationName}",
|
||||||
Agent = agent,
|
Agent = agent,
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
|
|
|
@ -87,6 +87,7 @@ export interface ILandingPageSettings extends ISettings {
|
||||||
|
|
||||||
export interface ICustomizationSettings extends ISettings {
|
export interface ICustomizationSettings extends ISettings {
|
||||||
applicationName: string;
|
applicationName: string;
|
||||||
|
applicationUrl: string;
|
||||||
logo: string;
|
logo: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="applicationurl" class="control-label">Application URL</label>
|
||||||
|
<div>
|
||||||
|
<input type="text" [(ngModel)]="settings.applicationurl" class="form-control form-control-custom " id="applicationurl" name="applicationurl" placeholder="http://ombi.io/" value="{{settings.applicationurl}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="logo" class="control-label">Custom Logo</label>
|
<label for="logo" class="control-label">Custom Logo</label>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class NotificationTemplate {
|
||||||
{SeasonsList} : A comma seperated list of seasons requested<br/>
|
{SeasonsList} : A comma seperated list of seasons requested<br/>
|
||||||
{PosterImage} : The requested poster image link<br/>
|
{PosterImage} : The requested poster image link<br/>
|
||||||
{ApplicationName} : The Application Name from the Customization Settings
|
{ApplicationName} : The Application Name from the Customization Settings
|
||||||
|
{ApplicationUrl} : The Application URL from the Customization Settings
|
||||||
{LongDate} : 15 June 2017 <br/>
|
{LongDate} : 15 June 2017 <br/>
|
||||||
{ShortDate} : 15/06/2017 <br/>
|
{ShortDate} : 15/06/2017 <br/>
|
||||||
{LongTime} : 16:02:34 <br/>
|
{LongTime} : 16:02:34 <br/>
|
||||||
|
|
|
@ -472,16 +472,16 @@ namespace Ombi.Controllers
|
||||||
var appName = (string.IsNullOrEmpty(customizationSettings.ApplicationName)
|
var appName = (string.IsNullOrEmpty(customizationSettings.ApplicationName)
|
||||||
? "Ombi"
|
? "Ombi"
|
||||||
: customizationSettings.ApplicationName);
|
: customizationSettings.ApplicationName);
|
||||||
|
|
||||||
|
customizationSettings.AddToUrl("/token?token=");
|
||||||
var url =
|
var url = customizationSettings.ApplicationUrl;
|
||||||
$"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}";
|
|
||||||
await EmailProvider.SendAdHoc(new NotificationMessage
|
await EmailProvider.SendAdHoc(new NotificationMessage
|
||||||
{
|
{
|
||||||
To = user.Email,
|
To = user.Email,
|
||||||
Subject = $"{appName} Password Reset",
|
Subject = $"{appName} Password Reset",
|
||||||
Message = $"You recently made a request to reset your {appName} account. Please click the link below to complete the process.<br/><br/>" +
|
Message = $"You recently made a request to reset your {appName} account. Please click the link below to complete the process.<br/><br/>" +
|
||||||
$"<a href=\"{url}/token?token={token}\"> Reset </a>"
|
$"<a href=\"{url}{token}\"> Reset </a>"
|
||||||
}, emailSettings);
|
}, emailSettings);
|
||||||
|
|
||||||
return defaultMessage;
|
return defaultMessage;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue