mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-21 23:32:27 +00:00
New: Use instance name in PWA manifest
(cherry picked from commit 1fcfb88d2aa0126c4b3c878c8e310311ea57d04d) Closes #5203
This commit is contained in:
parent
0c2ede48e8
commit
e39e990696
2 changed files with 22 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "Lidarr",
|
||||
"name": "__INSTANCE_NAME__",
|
||||
"icons": [
|
||||
{
|
||||
"src": "__URL_BASE__/Content/Images/Icons/android-chrome-192x192.png",
|
||||
|
|
|
@ -8,9 +8,14 @@ namespace Lidarr.Http.Frontend.Mappers
|
|||
{
|
||||
public class ManifestMapper : UrlBaseReplacementResourceMapperBase
|
||||
{
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
|
||||
private string _generatedContent;
|
||||
|
||||
public ManifestMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, IConfigFileProvider configFileProvider, Logger logger)
|
||||
: base(diskProvider, configFileProvider, logger)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
FilePath = Path.Combine(appFolderInfo.StartUpFolder, configFileProvider.UiFolder, "Content", "manifest.json");
|
||||
}
|
||||
|
||||
|
@ -23,5 +28,21 @@ public override bool CanHandle(string resourceUrl)
|
|||
{
|
||||
return resourceUrl.StartsWith("/Content/manifest");
|
||||
}
|
||||
|
||||
protected override string GetFileText()
|
||||
{
|
||||
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
||||
{
|
||||
return _generatedContent;
|
||||
}
|
||||
|
||||
var text = base.GetFileText();
|
||||
|
||||
text = text.Replace("__INSTANCE_NAME__", _configFileProvider.InstanceName);
|
||||
|
||||
_generatedContent = text;
|
||||
|
||||
return _generatedContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue