mirror of
https://github.com/openziti/zrok.git
synced 2024-11-26 01:54:09 +01:00
warning graphic for limit email (#279); only run relax actions when reverting a limit not a warning (#276)
This commit is contained in:
parent
d3be3195bf
commit
69990447c9
@ -132,7 +132,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="banner" style="margin: auto;">
|
<div class="banner" style="margin: auto;">
|
||||||
<img src="https://zrok.io/wp-content/uploads/2023/01/reset.jpg" width="363px" height="500px" style="padding-bottom: 10px;"/>
|
<img src="https://zrok.io/wp-content/uploads/2023/03/warning.jpg" width="363px" height="500px" style="padding-bottom: 10px;"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="cta" style="text-align: center;">
|
<div class="cta" style="text-align: center;">
|
||||||
<p style="text-align: center;">Your account is reaching a transfer limit, {{ .EmailAddress }}.</p>
|
<p style="text-align: center;">Your account is reaching a transfer limit, {{ .EmailAddress }}.</p>
|
||||||
|
@ -437,12 +437,14 @@ func (a *Agent) relax() error {
|
|||||||
if slj.Action == store.WarningAction || slj.Action == store.LimitAction {
|
if slj.Action == store.WarningAction || slj.Action == store.LimitAction {
|
||||||
if enforce, warning, rxBytes, txBytes, err := a.checkShareLimit(shr.Token); err == nil {
|
if enforce, warning, rxBytes, txBytes, err := a.checkShareLimit(shr.Token); err == nil {
|
||||||
if !enforce && !warning {
|
if !enforce && !warning {
|
||||||
|
if slj.Action == store.LimitAction {
|
||||||
// run relax actions for share
|
// run relax actions for share
|
||||||
for _, action := range a.shrRelaxActions {
|
for _, action := range a.shrRelaxActions {
|
||||||
if err := action.HandleShare(shr, rxBytes, txBytes, a.cfg.Bandwidth.PerShare, trx); err != nil {
|
if err := action.HandleShare(shr, rxBytes, txBytes, a.cfg.Bandwidth.PerShare, trx); err != nil {
|
||||||
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if err := a.str.DeleteShareLimitJournalForShare(shr.Id, trx); err == nil {
|
if err := a.str.DeleteShareLimitJournalForShare(shr.Id, trx); err == nil {
|
||||||
commit = true
|
commit = true
|
||||||
} else {
|
} else {
|
||||||
@ -469,12 +471,14 @@ func (a *Agent) relax() error {
|
|||||||
if elj.Action == store.WarningAction || elj.Action == store.LimitAction {
|
if elj.Action == store.WarningAction || elj.Action == store.LimitAction {
|
||||||
if enforce, warning, rxBytes, txBytes, err := a.checkEnvironmentLimit(int64(elj.EnvironmentId)); err == nil {
|
if enforce, warning, rxBytes, txBytes, err := a.checkEnvironmentLimit(int64(elj.EnvironmentId)); err == nil {
|
||||||
if !enforce && !warning {
|
if !enforce && !warning {
|
||||||
|
if elj.Action == store.LimitAction {
|
||||||
// run relax actions for environment
|
// run relax actions for environment
|
||||||
for _, action := range a.envRelaxActions {
|
for _, action := range a.envRelaxActions {
|
||||||
if err := action.HandleEnvironment(env, rxBytes, txBytes, a.cfg.Bandwidth.PerEnvironment, trx); err != nil {
|
if err := action.HandleEnvironment(env, rxBytes, txBytes, a.cfg.Bandwidth.PerEnvironment, trx); err != nil {
|
||||||
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if err := a.str.DeleteEnvironmentLimitJournalForEnvironment(env.Id, trx); err == nil {
|
if err := a.str.DeleteEnvironmentLimitJournalForEnvironment(env.Id, trx); err == nil {
|
||||||
commit = true
|
commit = true
|
||||||
} else {
|
} else {
|
||||||
@ -501,12 +505,14 @@ func (a *Agent) relax() error {
|
|||||||
if alj.Action == store.WarningAction || alj.Action == store.LimitAction {
|
if alj.Action == store.WarningAction || alj.Action == store.LimitAction {
|
||||||
if enforce, warning, rxBytes, txBytes, err := a.checkAccountLimit(int64(alj.AccountId)); err == nil {
|
if enforce, warning, rxBytes, txBytes, err := a.checkAccountLimit(int64(alj.AccountId)); err == nil {
|
||||||
if !enforce && !warning {
|
if !enforce && !warning {
|
||||||
|
if alj.Action == store.LimitAction {
|
||||||
// run relax actions for account
|
// run relax actions for account
|
||||||
for _, action := range a.acctRelaxActions {
|
for _, action := range a.acctRelaxActions {
|
||||||
if err := action.HandleAccount(acct, rxBytes, txBytes, a.cfg.Bandwidth.PerAccount, trx); err != nil {
|
if err := action.HandleAccount(acct, rxBytes, txBytes, a.cfg.Bandwidth.PerAccount, trx); err != nil {
|
||||||
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
return errors.Wrapf(err, "%v", reflect.TypeOf(action).String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if err := a.str.DeleteAccountLimitJournalForAccount(acct.Id, trx); err == nil {
|
if err := a.str.DeleteAccountLimitJournalForAccount(acct.Id, trx); err == nil {
|
||||||
commit = true
|
commit = true
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user