diff --git a/main.go b/main.go index 0ca8239..5cd964e 100644 --- a/main.go +++ b/main.go @@ -140,22 +140,22 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) { renderFeed(w, r, client) case regexp.MustCompile(`^/a/?$`).MatchString(r.URL.Path): renderAbout(w) - case regexp.MustCompile(`^/(` + langs + `)/s/?$`).MatchString(r.URL.Path): - renderSearch(lang, w, r, client) - case regexp.MustCompile(`^/(` + langs + `)/f/?$`).MatchString(r.URL.Path): - renderAllFiles(lang, w, client) - case regexp.MustCompile(`^/(` + langs + `)/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path): + case regexp.MustCompile(`^/s/?$`).MatchString(r.URL.Path): + renderSearch(w, r, client) + case regexp.MustCompile(`^/f/?$`).MatchString(r.URL.Path): + renderAllFiles(w, client) + case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path): urlParts := strings.Split(r.URL.Path, "/") w.WriteHeader( gemini.StatusPermanentRedirect, strings.Join(urlParts[:(len(urlParts)-2)], "/"), ) - case regexp.MustCompile(`^/(` + langs + `)/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path): - renderFile(lang, w, r, client) - case regexp.MustCompile(`^/(` + langs + `)/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path): - renderCategory(lang, w, r, client) - case regexp.MustCompile(`^/(` + langs + `)/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path): - renderTag(lang, w, r, client) + case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path): + renderFile(w, r, client) + case regexp.MustCompile(`^/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path): + renderCategory(w, r, client) + case regexp.MustCompile(`^/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path): + renderTag(w, r, client) case regexp.MustCompile(`^/__a/`).MatchString(r.URL.Path): downloadAttachment(w, r, client) default: