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()
err = usercpy.UpdateIP(strconv.Itoa(int(mon)) + "-" + host)
if err != nil {

View File

@ -93,9 +93,11 @@ type config struct {
ServerCount int
LastIPCutoff int // Currently just -1, non--1, but will accept the number of months a user's last IP should be retained for in the future before being purged. Please note that the other two cutoffs below operate off the numbers of days instead.
PostIPCutoff int
PollIPCutoff int
PollIPCutoff int
LogPruneCutoff int
DisableLastIP bool
DisableLiveTopicList bool
DisableJSAntispam bool
//LooseCSP bool
@ -230,7 +232,7 @@ func ProcessConfig() (err error) {
Config.LastIPCutoff = 12
}
if Config.PollIPCutoff == 0 {
Config.PollIPCutoff = 720 // Default cutoff
Config.PollIPCutoff = 365 // Default cutoff
}
if Config.NoEmbed {
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.
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.
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
/*if c.Config.LastIPCutoff == -1 {
if c.Config.DisableLastIP {
_, err := qgen.NewAcc().Update("users").Set("last_ip=0").Where("last_ip!=0").Exec()
if err != nil {
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()
if err != nil {
c.LogError(err)