mirror of https://github.com/2dust/v2rayN
add auto update sub setting
parent
d431c63245
commit
fcc5f29882
|
@ -68,6 +68,8 @@
|
|||
this.txtKcpmtu = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.txtautoUpdateSubInterval = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.chkEnableSecurityProtocolTls13 = new System.Windows.Forms.CheckBox();
|
||||
this.chkEnableAutoAdjustMainLvColWidth = new System.Windows.Forms.CheckBox();
|
||||
this.btnSetLoopback = new System.Windows.Forms.Button();
|
||||
|
@ -374,6 +376,8 @@
|
|||
// tabPage7
|
||||
//
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Controls.Add(this.txtautoUpdateSubInterval);
|
||||
this.tabPage7.Controls.Add(this.label3);
|
||||
this.tabPage7.Controls.Add(this.chkEnableSecurityProtocolTls13);
|
||||
this.tabPage7.Controls.Add(this.chkEnableAutoAdjustMainLvColWidth);
|
||||
this.tabPage7.Controls.Add(this.btnSetLoopback);
|
||||
|
@ -388,6 +392,16 @@
|
|||
this.tabPage7.Name = "tabPage7";
|
||||
this.tabPage7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtautoUpdateSubInterval
|
||||
//
|
||||
resources.ApplyResources(this.txtautoUpdateSubInterval, "txtautoUpdateSubInterval");
|
||||
this.txtautoUpdateSubInterval.Name = "txtautoUpdateSubInterval";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// chkEnableSecurityProtocolTls13
|
||||
//
|
||||
resources.ApplyResources(this.chkEnableSecurityProtocolTls13, "chkEnableSecurityProtocolTls13");
|
||||
|
@ -697,5 +711,7 @@
|
|||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtpass;
|
||||
private System.Windows.Forms.TextBox txtuser;
|
||||
private System.Windows.Forms.TextBox txtautoUpdateSubInterval;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
|
@ -112,6 +112,7 @@ namespace v2rayN.Forms
|
|||
|
||||
chkIgnoreGeoUpdateCore.Checked = config.ignoreGeoUpdateCore;
|
||||
txtautoUpdateInterval.Text = config.autoUpdateInterval.ToString();
|
||||
txtautoUpdateSubInterval.Text = config.autoUpdateSubInterval.ToString();
|
||||
chkEnableAutoAdjustMainLvColWidth.Checked = config.uiItem.enableAutoAdjustMainLvColWidth;
|
||||
chkEnableSecurityProtocolTls13.Checked = config.enableSecurityProtocolTls13;
|
||||
}
|
||||
|
@ -305,6 +306,7 @@ namespace v2rayN.Forms
|
|||
|
||||
config.ignoreGeoUpdateCore = chkIgnoreGeoUpdateCore.Checked;
|
||||
config.autoUpdateInterval = Utils.ToInt(txtautoUpdateInterval.Text);
|
||||
config.autoUpdateSubInterval = Utils.ToInt(txtautoUpdateSubInterval.Text);
|
||||
config.uiItem.enableAutoAdjustMainLvColWidth = chkEnableAutoAdjustMainLvColWidth.Checked;
|
||||
config.enableSecurityProtocolTls13 = chkEnableSecurityProtocolTls13.Checked;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -250,6 +250,15 @@
|
|||
<data name="tabPage7.Text" xml:space="preserve">
|
||||
<value> v2rayN设置 </value>
|
||||
</data>
|
||||
<data name="txtautoUpdateSubInterval.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>248, 159</value>
|
||||
</data>
|
||||
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>173, 12</value>
|
||||
</data>
|
||||
<data name="label3.Text" xml:space="preserve">
|
||||
<value>自动更新订阅的间隔(单位小时)</value>
|
||||
</data>
|
||||
<data name="chkEnableSecurityProtocolTls13.Text" xml:space="preserve">
|
||||
<value>启用安全协议TLS v1.3 (订阅/检查更新/测速)</value>
|
||||
</data>
|
||||
|
@ -263,13 +272,13 @@
|
|||
<value>解除Windows10 UWP应用回环代理限制</value>
|
||||
</data>
|
||||
<data name="txtautoUpdateInterval.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>274, 134</value>
|
||||
<value>248, 134</value>
|
||||
</data>
|
||||
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>227, 12</value>
|
||||
<value>191, 12</value>
|
||||
</data>
|
||||
<data name="label15.Text" xml:space="preserve">
|
||||
<value>自动更新订阅和Geo文件的间隔(单位小时)</value>
|
||||
<value>自动更新Geo文件的间隔(单位小时)</value>
|
||||
</data>
|
||||
<data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>150, 16</value>
|
||||
|
|
|
@ -208,40 +208,54 @@ namespace v2rayN.Handler
|
|||
|
||||
private void UpdateTaskRun(Config config, Action<bool, string> update)
|
||||
{
|
||||
var autoUpdateSubTime = DateTime.Now;
|
||||
var autoUpdateGeoTime = DateTime.Now;
|
||||
|
||||
Thread.Sleep(60000);
|
||||
Utils.SaveLog("UpdateTaskRun");
|
||||
|
||||
var updateHandle = new UpdateHandle();
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(60000);
|
||||
if (config.autoUpdateInterval <= 0)
|
||||
var dtNow = DateTime.Now;
|
||||
|
||||
if (config.autoUpdateSubInterval > 0)
|
||||
{
|
||||
continue;
|
||||
if ((dtNow - autoUpdateSubTime).Hours % config.autoUpdateSubInterval == 0)
|
||||
{
|
||||
updateHandle.UpdateSubscriptionProcess(config, true, (bool success, string msg) =>
|
||||
{
|
||||
update(success, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("subscription" + msg);
|
||||
});
|
||||
autoUpdateSubTime = dtNow;
|
||||
}
|
||||
Thread.Sleep(60000);
|
||||
}
|
||||
Utils.SaveLog("UpdateTaskRun");
|
||||
|
||||
updateHandle.UpdateSubscriptionProcess(config, true, (bool success, string msg) =>
|
||||
if (config.autoUpdateInterval > 0)
|
||||
{
|
||||
update(success, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("subscription" + msg);
|
||||
});
|
||||
if ((dtNow - autoUpdateGeoTime).Hours % config.autoUpdateInterval == 0)
|
||||
{
|
||||
updateHandle.UpdateGeoFile("geosite", config, (bool success, string msg) =>
|
||||
{
|
||||
update(false, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("geosite" + msg);
|
||||
});
|
||||
|
||||
Thread.Sleep(60000);
|
||||
updateHandle.UpdateGeoFile("geoip", config, (bool success, string msg) =>
|
||||
{
|
||||
update(false, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("geoip" + msg);
|
||||
});
|
||||
autoUpdateGeoTime = dtNow;
|
||||
}
|
||||
}
|
||||
|
||||
updateHandle.UpdateGeoFile("geosite", config, (bool success, string msg) =>
|
||||
{
|
||||
update(false, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("geosite" + msg);
|
||||
});
|
||||
|
||||
updateHandle.UpdateGeoFile("geoip", config, (bool success, string msg) =>
|
||||
{
|
||||
update(false, msg);
|
||||
if (success)
|
||||
Utils.SaveLog("geoip" + msg);
|
||||
});
|
||||
|
||||
Thread.Sleep(1000 * 3600 * config.autoUpdateInterval);
|
||||
Thread.Sleep(1000 * 3600);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,10 +125,9 @@ namespace v2rayN.Mode
|
|||
get; set;
|
||||
}
|
||||
|
||||
public int autoUpdateInterval
|
||||
{
|
||||
get; set;
|
||||
} = 0;
|
||||
public int autoUpdateInterval { get; set; } = 0;
|
||||
|
||||
public int autoUpdateSubInterval { get; set; } = 0;
|
||||
|
||||
public bool enableSecurityProtocolTls13
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue