add archiveState.URL() method
This commit is contained in:
parent
8568c4bdc2
commit
e078383e6d
@ -35,6 +35,22 @@ func NewArchiveState(svr *ArchiveServer) *ArchiveState {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ArchiveState) URL() string {
|
||||
if len(this.query) > 0 {
|
||||
if this.queryIsRegex {
|
||||
return fmt.Sprintf(`/%s/rx/%s`, this.logBestSlug, url.QueryEscape(this.query))
|
||||
} else {
|
||||
return fmt.Sprintf(`/%s/search/%s`, this.logBestSlug, url.QueryEscape(this.query))
|
||||
}
|
||||
} else {
|
||||
if this.page == pageNotSet {
|
||||
return fmt.Sprintf(`/%s/%s/%s`, this.logBestSlug, this.ym.Year, this.ym.Month)
|
||||
} else {
|
||||
return fmt.Sprintf(`/%s/%s/%s/page-%d`, this.logBestSlug, this.ym.Year, this.ym.Month, this.page)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ArchiveState) selectSource(log *LogSource, slug string) {
|
||||
this.log = log
|
||||
this.logBestSlug = slug
|
||||
|
Loading…
Reference in New Issue
Block a user