|
|
@ -201,12 +201,16 @@ namespace Ombi
|
|
|
|
SettingsName = "OmbiSettings",
|
|
|
|
SettingsName = "OmbiSettings",
|
|
|
|
Content = JsonConvert.SerializeObject(new OmbiSettings())
|
|
|
|
Content = JsonConvert.SerializeObject(new OmbiSettings())
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var strat = settingsDb.Database.CreateExecutionStrategy();
|
|
|
|
|
|
|
|
await strat.ExecuteAsync(async () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
settingsDb.Add(ombiSettingsContent);
|
|
|
|
settingsDb.Add(ombiSettingsContent);
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var ombiSettings = JsonConvert.DeserializeObject<OmbiSettings>(ombiSettingsContent.Content);
|
|
|
|
var ombiSettings = JsonConvert.DeserializeObject<OmbiSettings>(ombiSettingsContent.Content);
|
|
|
|
if (ombiSettings == null)
|
|
|
|
if (ombiSettings == null)
|
|
|
@ -220,12 +224,16 @@ namespace Ombi
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings);
|
|
|
|
ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings);
|
|
|
|
|
|
|
|
var strat = settingsDb.Database.CreateExecutionStrategy();
|
|
|
|
|
|
|
|
await strat.ExecuteAsync(async () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
settingsDb.Update(ombiSettingsContent);
|
|
|
|
settingsDb.Update(ombiSettingsContent);
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (baseUrl.HasValue() && !baseUrl.Equals(ombiSettings.BaseUrl))
|
|
|
|
else if (baseUrl.HasValue() && !baseUrl.Equals(ombiSettings.BaseUrl))
|
|
|
@ -234,17 +242,22 @@ namespace Ombi
|
|
|
|
ombiSettings.BaseUrl = baseUrl;
|
|
|
|
ombiSettings.BaseUrl = baseUrl;
|
|
|
|
|
|
|
|
|
|
|
|
ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings);
|
|
|
|
ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings);
|
|
|
|
|
|
|
|
var strat = settingsDb.Database.CreateExecutionStrategy();
|
|
|
|
|
|
|
|
await strat.ExecuteAsync(async () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
using (var tran = await settingsDb.Database.BeginTransactionAsync())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
settingsDb.Update(ombiSettingsContent);
|
|
|
|
settingsDb.Update(ombiSettingsContent);
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await settingsDb.SaveChangesAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
await tran.CommitAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (setBaseUrl)
|
|
|
|
if (setBaseUrl)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var trimmedBaseUrl = baseUrl.EndsWith('/') ? baseUrl.TrimEnd('/') : baseUrl;
|
|
|
|
var process = Process.GetCurrentProcess().MainModule.FileName;
|
|
|
|
var process = Process.GetCurrentProcess().MainModule.FileName;
|
|
|
|
var ombiInstalledDir = Path.GetDirectoryName(process);
|
|
|
|
var ombiInstalledDir = Path.GetDirectoryName(process);
|
|
|
|
var indexPath = Path.Combine(ombiInstalledDir, "ClientApp", "dist", "index.html");
|
|
|
|
var indexPath = Path.Combine(ombiInstalledDir, "ClientApp", "dist", "index.html");
|
|
|
@ -256,7 +269,7 @@ namespace Ombi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var indexHtml = await File.ReadAllTextAsync(indexPath);
|
|
|
|
var indexHtml = await File.ReadAllTextAsync(indexPath);
|
|
|
|
indexHtml = indexHtml.Replace("<script type='text/javascript'>window[\"baseHref\"] = '/';</script>"
|
|
|
|
indexHtml = indexHtml.Replace("<script type='text/javascript'>window[\"baseHref\"] = '/';</script>"
|
|
|
|
, $"<script type='text/javascript'>window[\"baseHref\"] = '{baseUrl}';</script><base href=\"{baseUrl}\">", StringComparison.InvariantCultureIgnoreCase);
|
|
|
|
, $"<script type='text/javascript'>window[\"baseHref\"] = '{trimmedBaseUrl}';</script><base href=\"{baseUrl}\">", StringComparison.InvariantCultureIgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
await File.WriteAllTextAsync(indexPath, indexHtml);
|
|
|
|
await File.WriteAllTextAsync(indexPath, indexHtml);
|
|
|
|
|
|
|
|
|
|
|
|