mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
feat: fix anti-leech is not work on proxy website (#7801)
Refs https://github.com/1Panel-dev/1Panel/issues/7752
This commit is contained in:
parent
4be9d71edf
commit
74583aa1aa
2 changed files with 18 additions and 4 deletions
|
@ -95,8 +95,10 @@ type IWebsiteService interface {
|
||||||
|
|
||||||
GetAuthBasics(req request.NginxAuthReq) (res response.NginxAuthRes, err error)
|
GetAuthBasics(req request.NginxAuthReq) (res response.NginxAuthRes, err error)
|
||||||
UpdateAuthBasic(req request.NginxAuthUpdate) (err error)
|
UpdateAuthBasic(req request.NginxAuthUpdate) (err error)
|
||||||
|
|
||||||
GetAntiLeech(id uint) (*response.NginxAntiLeechRes, error)
|
GetAntiLeech(id uint) (*response.NginxAntiLeechRes, error)
|
||||||
UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err error)
|
UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err error)
|
||||||
|
|
||||||
OperateRedirect(req request.NginxRedirectReq) (err error)
|
OperateRedirect(req request.NginxRedirectReq) (err error)
|
||||||
GetRedirect(id uint) (res []response.NginxRedirectConfig, err error)
|
GetRedirect(id uint) (res []response.NginxRedirectConfig, err error)
|
||||||
UpdateRedirectFile(req request.NginxRedirectUpdate) (err error)
|
UpdateRedirectFile(req request.NginxRedirectUpdate) (err error)
|
||||||
|
@ -2069,7 +2071,19 @@ func (w WebsiteService) UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err e
|
||||||
}
|
}
|
||||||
newBlock.Directives = append(newBlock.Directives, ifDir)
|
newBlock.Directives = append(newBlock.Directives, ifDir)
|
||||||
newDirective.Block = newBlock
|
newDirective.Block = newBlock
|
||||||
block.Directives = append(block.Directives, &newDirective)
|
|
||||||
|
index := -1
|
||||||
|
for i, directive := range block.Directives {
|
||||||
|
if directive.GetName() == "include" {
|
||||||
|
index = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if index != -1 {
|
||||||
|
block.Directives = append(block.Directives[:index], append([]components.IDirective{&newDirective}, block.Directives[index:]...)...)
|
||||||
|
} else {
|
||||||
|
block.Directives = append(block.Directives, &newDirective)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = nginx.WriteConfig(nginxFull.SiteConfig.Config, nginx.IndentedStyle); err != nil {
|
if err = nginx.WriteConfig(nginxFull.SiteConfig.Config, nginx.IndentedStyle); err != nil {
|
||||||
|
|
|
@ -450,17 +450,17 @@ export function getAge(d1: string): string {
|
||||||
|
|
||||||
let res = '';
|
let res = '';
|
||||||
if (dayDiff > 0) {
|
if (dayDiff > 0) {
|
||||||
res += String(dayDiff) + i18n.global.t('commons.units.day', dayDiff);
|
res += String(dayDiff) + ' ' + i18n.global.t('commons.units.day', dayDiff) + ' ';
|
||||||
if (hours <= 0) {
|
if (hours <= 0) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
res += String(hours) + i18n.global.t('commons.units.hour', hours);
|
res += String(hours) + ' ' + i18n.global.t('commons.units.hour', hours) + ' ';
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (minutes > 0) {
|
if (minutes > 0) {
|
||||||
res += String(minutes) + i18n.global.t('commons.units.minute', minutes);
|
res += String(minutes) + ' ' + i18n.global.t('commons.units.minute', minutes);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return i18n.global.t('app.less1Minute');
|
return i18n.global.t('app.less1Minute');
|
||||||
|
|
Loading…
Add table
Reference in a new issue