proxy.go 547 B

123456789101112131415161718192021
  1. // Copyright 2020 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package proxy // import "miniflux.app/proxy"
  5. import (
  6. "encoding/base64"
  7. "miniflux.app/http/route"
  8. "github.com/gorilla/mux"
  9. )
  10. // ProxifyURL generates an URL for a proxified resource.
  11. func ProxifyURL(router *mux.Router, link string) string {
  12. if link != "" {
  13. return route.Path(router, "proxy", "encodedURL", base64.URLEncoding.EncodeToString([]byte(link)))
  14. }
  15. return ""
  16. }