commit
381eb072c2
|
@ -35,7 +35,6 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public bool IsEnabled { get; set; } = true;
|
||||
public bool TestMode { get; set; } = true;
|
||||
public bool EnableBetaFeatures { get; set; } = false;
|
||||
public string ProfitTrailerPath { get; set; }
|
||||
public string ProfitTrailerLicense { get; set; } = "";
|
||||
public string ProfitTrailerServerAPIToken { get; set; }
|
||||
public string ProfitTrailerMonitorURL { get; set; } = "http://localhost:8081/";
|
||||
|
|
|
@ -542,7 +542,7 @@ namespace Core.Helper
|
|||
}
|
||||
else
|
||||
{
|
||||
result = "https://uk.tradingview.com/?symbol=" + exchange.ToUpper() + ":" + market.ToUpper();
|
||||
result = "https://uk.tradingview.com/chart/?symbol=" + exchange.ToUpper() + ":" + market.ToUpper();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -703,20 +703,11 @@ namespace Core.Main
|
|||
{
|
||||
try
|
||||
{
|
||||
if (this.PTMagicConfiguration.GeneralSettings.Application.TestMode) this.Log.DoLogInfo("TESTMODE ENABLED - No files will be changed!");
|
||||
|
||||
// Check for PT Directory
|
||||
DirectoryInfo ptRoot = new DirectoryInfo(this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath);
|
||||
if (ptRoot.Exists)
|
||||
if (this.PTMagicConfiguration.GeneralSettings.Application.TestMode)
|
||||
{
|
||||
this.Log.DoLogInfo("Profit Trailer directory found");
|
||||
this.Log.DoLogInfo("TESTMODE ENABLED - No files will be changed!");
|
||||
}
|
||||
result = RunProfitTrailerSettingsAPIChecks();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Log.DoLogError("Profit Trailer directory not found (" + this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath + ")");
|
||||
result = false;
|
||||
}
|
||||
|
||||
// Check for CoinMarketCap API Key
|
||||
if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey))
|
||||
|
@ -1142,14 +1133,7 @@ namespace Core.Main
|
|||
}
|
||||
}
|
||||
|
||||
private void GetProfitTrailerPropertiesPaths(out string pairsPropertiesPath, out string dcaPropertiesPath, out string indicatorsPropertiesPath)
|
||||
{
|
||||
// Get current PT properties
|
||||
pairsPropertiesPath = this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath + Constants.PTPathTrading + Path.DirectorySeparatorChar + this.PairsFileName;
|
||||
dcaPropertiesPath = this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath + Constants.PTPathTrading + Path.DirectorySeparatorChar + this.DCAFileName;
|
||||
indicatorsPropertiesPath = this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath + Constants.PTPathTrading + Path.DirectorySeparatorChar + this.IndicatorsFileName;
|
||||
}
|
||||
|
||||
private void LoadCurrentProfitTrailerProperties()
|
||||
{
|
||||
// Load current PT properties from API (Valid for PT 2.x and above)
|
||||
|
@ -2143,9 +2127,6 @@ namespace Core.Main
|
|||
private void SaveProfitTrailerProperties()
|
||||
{
|
||||
// Get current PT properties
|
||||
string pairsPropertiesPath, dcaPropertiesPath, indicatorsPropertiesPath;
|
||||
GetProfitTrailerPropertiesPaths(out pairsPropertiesPath, out dcaPropertiesPath, out indicatorsPropertiesPath);
|
||||
|
||||
if (this.GlobalSettingWritten || this.SingleMarketSettingChanged)
|
||||
{
|
||||
// Save current PT properties to API (Valid for PT 2.x and above)
|
||||
|
|
|
@ -47,11 +47,6 @@ namespace Core.Main
|
|||
AnalyzerSettingsWrapper asw = JsonConvert.DeserializeObject<AnalyzerSettingsWrapper>(File.ReadAllText(basePath + "settings.analyzer.json"));
|
||||
_analyzerSettings = asw.AnalyzerSettings;
|
||||
|
||||
if (!_generalSettings.Application.ProfitTrailerPath.EndsWith(Path.DirectorySeparatorChar))
|
||||
{
|
||||
_generalSettings.Application.ProfitTrailerPath += Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
if (!_generalSettings.Application.ProfitTrailerMonitorURL.EndsWith("/"))
|
||||
{
|
||||
_generalSettings.Application.ProfitTrailerMonitorURL += "/";
|
||||
|
@ -83,6 +78,28 @@ namespace Core.Main
|
|||
return result;
|
||||
}
|
||||
|
||||
public string GetProfitTrailerServerAPITokenMasked()
|
||||
{
|
||||
string result = "";
|
||||
|
||||
if (!this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Equals(""))
|
||||
{
|
||||
int tokenLength = this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length;
|
||||
if (tokenLength == 1)
|
||||
{
|
||||
result = "*";
|
||||
}
|
||||
else
|
||||
result = this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Substring(0, 1);
|
||||
for (int i = 1; i < this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length; i++)
|
||||
{
|
||||
result += "*";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public GeneralSettings GeneralSettings
|
||||
{
|
||||
get
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace Monitor.Pages
|
|||
if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword))
|
||||
{
|
||||
HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
|
||||
|
||||
PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = true;
|
||||
PTMagicConfiguration.WriteGeneralSettings();
|
||||
if (cbRememberMe != null)
|
||||
{
|
||||
if (cbRememberMe.Equals("on", StringComparison.InvariantCultureIgnoreCase))
|
||||
|
|
|
@ -68,12 +68,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">Profit Trailer Path <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Path to your Profit Trailer main directory."></i></label>
|
||||
<div class="col-md-8">
|
||||
@Model.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerPath
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">Profit Trailer License <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Your Profit Trailer license key (needed to change your settings for PT 2.0 and above)"></i></label>
|
||||
|
@ -92,7 +86,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">Profit Trailer Server API Token <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The API token needed to communicate with Profit Trailer - set in Profit Trailer Server Settings"></i></label>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="Application_ProfitTrailerServerAPIToken" value="@Model.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken">
|
||||
@Model.PTMagicConfiguration.GetProfitTrailerServerAPITokenMasked()
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -139,14 +133,14 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">CoinMarketCap API Key <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The API Key that will be used to get Coin Data from CoinMarketCap."></i></label>
|
||||
<label class="col-md-4 col-form-label">CoinMarketCap API Key <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The API Key that will be used to get Coin Data from CoinMarketCap (optional)."></i></label>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="Application_CoinMarketCapAPIKey" value="@Model.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">FreeCurrencyConverter API Key <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The api key needed for currency conversions for non-USD currency users."></i></label>
|
||||
<label class="col-md-4 col-form-label">FreeCurrencyConverter API Key <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The api key needed for currency conversions for non-USD currency users (optional)."></i></label>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="Application_FreeCurrencyConverterAPIKey" value="@Model.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey">
|
||||
</div>
|
||||
|
@ -169,9 +163,9 @@
|
|||
</div>
|
||||
<div id="collapse2" class="panel-collapse collapse">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-4 col-form-label">Is Password Protected <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Defines if your monitor will be asking to setup a password on its first start."></i></label>
|
||||
<label class="col-md-4 col-form-label">Is Password Protected <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="A password is required to view and edit settings via the GUI."></i></label>
|
||||
<div class="col-md-8">
|
||||
<input type="checkbox" name="Monitor_IsPasswordProtected" checked="@(Model.PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected)" data-plugin="switchery" data-color="#81c868" data-size="small" />
|
||||
<input type="checkbox" name="Monitor_IsPasswordProtected" checked="@(Model.PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected)" data-plugin="switchery" data-color="#81c868" data-size="small" /><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)SetupPassword" label class="col-md-4 col-form-label">(Change Password)</a> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Change the password required to log in, and view the settings pages"></i></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ namespace Monitor.Pages
|
|||
PTMagicConfiguration.GeneralSettings.Application.StartBalance = SystemHelper.TextToDouble(HttpContext.Request.Form["Application_StartBalance"], PTMagicConfiguration.GeneralSettings.Application.StartBalance, "en-US");
|
||||
PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerDefaultSettingName = HttpContext.Request.Form["Application_ProfitTrailerDefaultSettingName"];
|
||||
|
||||
PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken = HttpContext.Request.Form["Application_ProfitTrailerServerAPIToken"];
|
||||
PTMagicConfiguration.GeneralSettings.Application.TimezoneOffset = HttpContext.Request.Form["Application_TimezoneOffset"];
|
||||
PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency = HttpContext.Request.Form["Application_MainFiatCurrency"];
|
||||
|
||||
|
|
|
@ -14,29 +14,30 @@
|
|||
<h3 class="text-center"> <strong class="text-custom">PT Magic</strong> </h3>
|
||||
<p class="text-center">Setup your password.</p>
|
||||
</div>
|
||||
|
||||
<div class="p-20">
|
||||
<form class="form-horizontal m-t-20" method="post">
|
||||
|
||||
@if (System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "/settings.secure.json"))
|
||||
{
|
||||
<div class="form-group">
|
||||
<div class="col-12">
|
||||
<input name="Password" class="form-control" type="password" required="" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-12">
|
||||
<input name="PasswordConfirm" class="form-control" type="password" required="" compare="Password" placeholder="Confirm Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!Model.ValidationMessage.Equals("")) {
|
||||
<div class="form-group">
|
||||
<div class="text-danger m-l-10">
|
||||
@Model.ValidationMessage
|
||||
<input name="OldPassword" class="form-control" type="password" required="" placeholder="Old Password">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-12">
|
||||
<input name="Password" class="form-control" type="password" required="" placeholder="New Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-12">
|
||||
<input name="PasswordConfirm" class="form-control" type="password" required="" compare="Password" placeholder="Confirm New Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center m-t-40">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-ptmagic btn-block text-uppercase waves-effect waves-light" type="submit">
|
||||
|
@ -44,9 +45,12 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="text-danger m-l-10">
|
||||
@Model.ValidationMessage
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Core.Main;
|
||||
using Core.Helper;
|
||||
|
||||
namespace Monitor.Pages
|
||||
{
|
||||
|
@ -16,21 +17,41 @@ namespace Monitor.Pages
|
|||
base.PreInit();
|
||||
}
|
||||
|
||||
public void OnPost(string password, string passwordConfirm)
|
||||
{
|
||||
if (!password.Equals(passwordConfirm))
|
||||
{
|
||||
ValidationMessage = "Password does not match the confirmation!";
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
public void OnPost(string OldPassword, string Password, string PasswordConfirm)
|
||||
{
|
||||
base.PreInit();
|
||||
PTMagicConfiguration.WriteSecureSettings(password);
|
||||
ValidationMessage = "Test";
|
||||
string encryptedOldPassword = null;
|
||||
|
||||
if (OldPassword != null)
|
||||
{
|
||||
encryptedOldPassword = EncryptionHelper.Encrypt(OldPassword);
|
||||
|
||||
if (!Password.Equals(PasswordConfirm) || !encryptedOldPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword) && System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "/settings.secure.json"))
|
||||
{
|
||||
ValidationMessage = "Old Password wrong or new Password does not match with confirmation";
|
||||
}
|
||||
else if (ModelState.IsValid)
|
||||
{
|
||||
PTMagicConfiguration.WriteSecureSettings(Password);
|
||||
ValidationMessage = "";
|
||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Password.Equals(PasswordConfirm) && !System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "/settings.secure.json"))
|
||||
{
|
||||
ValidationMessage = "New Password does not match with confirmation";
|
||||
}
|
||||
else if (ModelState.IsValid)
|
||||
{
|
||||
PTMagicConfiguration.WriteSecureSettings(Password);
|
||||
ValidationMessage = "";
|
||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
</li>
|
||||
} else {
|
||||
<li>
|
||||
<a data-toggle="tooltip" data-placement="top" title="Settings menu is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> <span> Settings</span></a>
|
||||
<a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)Login" data-toggle="tooltip" data-placement="top" title="Settings menu is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> <span> Settings</span></a>
|
||||
</li>
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Core.Main;
|
||||
using Core.Helper;
|
||||
|
@ -27,7 +28,8 @@ namespace Monitor._Internal
|
|||
// Security check
|
||||
if (!IsLoggedIn(this.HttpContext))
|
||||
{
|
||||
HttpContext.Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + _redirectUrl);
|
||||
this.HttpContext.Response.Clear();
|
||||
this.HttpContext.Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + _redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ using Core.Helper;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
||||
[assembly: AssemblyVersion("2.5.6")]
|
||||
[assembly: AssemblyVersion("2.5.7")]
|
||||
[assembly: AssemblyProduct("PT Magic")]
|
||||
|
||||
namespace PTMagic
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"Application": {
|
||||
"IsEnabled": true, // Enables the PTMagic bot (needs restart to take effect)
|
||||
"TestMode": false, // If TestMode is active, no properties files will be changed
|
||||
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
|
||||
"ProfitTrailerLicense": "YOUR PROFIT TRAILER LICENSE KEY", // Your Profit Trailer license key (needed to change your settings for PT 2.0 and above)
|
||||
"ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token
|
||||
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"Application": {
|
||||
"IsEnabled": true, // Enables the PTMagic bot (needs restart to take effect)
|
||||
"TestMode": false, // If TestMode is active, no properties files will be changed
|
||||
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
|
||||
"ProfitTrailerLicense": "YOUR PROFIT TRAILER LICENSE KEY", // Your Profit Trailer license key (needed to change your settings for PT 2.0 and above)
|
||||
"ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token
|
||||
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above)
|
||||
|
|
Loading…
Reference in New Issue