diff --git a/ArchiveState.go b/ArchiveState.go index aaa10a6..70e9636 100644 --- a/ArchiveState.go +++ b/ArchiveState.go @@ -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