Add DisableLastIP configuration setting.

Reduce default PollIPCutoff to 365.
This commit is contained in:
Azareal 2020-01-02 16:04:10 +10:00
parent e2f97d29cb
commit 0d81557009
4 changed files with 9 additions and 5 deletions

View File

@ -316,7 +316,7 @@ func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) {
} }
} }
if usercpy.Loggedin && host != usercpy.GetIP() { if !Config.DisableLastIP && usercpy.Loggedin && host != usercpy.GetIP() {
mon := time.Now().Month() mon := time.Now().Month()
err = usercpy.UpdateIP(strconv.Itoa(int(mon)) + "-" + host) err = usercpy.UpdateIP(strconv.Itoa(int(mon)) + "-" + host)
if err != nil { if err != nil {

View File

@ -96,6 +96,8 @@ type config struct {
PollIPCutoff int PollIPCutoff int
LogPruneCutoff int LogPruneCutoff int
DisableLastIP bool
DisableLiveTopicList bool DisableLiveTopicList bool
DisableJSAntispam bool DisableJSAntispam bool
//LooseCSP bool //LooseCSP bool
@ -230,7 +232,7 @@ func ProcessConfig() (err error) {
Config.LastIPCutoff = 12 Config.LastIPCutoff = 12
} }
if Config.PollIPCutoff == 0 { if Config.PollIPCutoff == 0 {
Config.PollIPCutoff = 720 // Default cutoff Config.PollIPCutoff = 365 // Default cutoff
} }
if Config.NoEmbed { if Config.NoEmbed {
DefaultParseSettings.NoEmbed = true DefaultParseSettings.NoEmbed = true

View File

@ -90,6 +90,8 @@ PostIPCutoff - The number of days which need to pass before the IP data for a po
PollIPCutoff - The number of days which need to pass before the IP data for a poll is automatically deleted. 0 defaults to whatever the current default is, currently -1 and -1 disables this feature. PollIPCutoff - The number of days which need to pass before the IP data for a poll is automatically deleted. 0 defaults to whatever the current default is, currently -1 and -1 disables this feature.
DisableLastIP - Disable storing last IPs for users and purge any existing user last IP data. Default: false
LogPruneCutoff - The number of days which need to pass before the login and registration logs are pruned. 0 defaults to whatever the current default is, currently 180 and -1 disables this feature. LogPruneCutoff - The number of days which need to pass before the login and registration logs are pruned. 0 defaults to whatever the current default is, currently 180 and -1 disables this feature.
DisableLiveTopicList - This switch allows you to disable the live topic list. Default: false DisableLiveTopicList - This switch allows you to disable the live topic list. Default: false

View File

@ -205,12 +205,12 @@ func dailies() {
} }
// TODO: lastActiveAt isn't currently set, so we can't rely on this to purge last_ips of users who haven't been on in a while // TODO: lastActiveAt isn't currently set, so we can't rely on this to purge last_ips of users who haven't been on in a while
/*if c.Config.LastIPCutoff == -1 { if c.Config.DisableLastIP {
_, err := qgen.NewAcc().Update("users").Set("last_ip=0").Where("last_ip!=0").Exec() _, err := qgen.NewAcc().Update("users").Set("last_ip=0").Where("last_ip!=0").Exec()
if err != nil { if err != nil {
c.LogError(err) c.LogError(err)
} }
} else */if c.Config.LastIPCutoff > 0 { } else if c.Config.LastIPCutoff > 0 {
/*_, err = qgen.NewAcc().Update("users").Set("last_ip='0'").DateOlderThan("lastActiveAt",c.Config.PostIPCutoff,"day").Where("last_ip!='0'").Exec() /*_, err = qgen.NewAcc().Update("users").Set("last_ip='0'").DateOlderThan("lastActiveAt",c.Config.PostIPCutoff,"day").Where("last_ip!='0'").Exec()
if err != nil { if err != nil {
c.LogError(err) c.LogError(err)