mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
feat(web-proxy): add plausible.pluralkit.me
This commit is contained in:
parent
91f5e7c8f6
commit
6c7abeb3de
1 changed files with 10 additions and 4 deletions
|
|
@ -23,10 +23,9 @@ var token2 string
|
||||||
|
|
||||||
// todo: this shouldn't be in this repo
|
// todo: this shouldn't be in this repo
|
||||||
var remotes = map[string]*httputil.ReverseProxy{
|
var remotes = map[string]*httputil.ReverseProxy{
|
||||||
"api.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:5000"),
|
"api.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:5000"),
|
||||||
"dash.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:8080"),
|
"dash.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:8080"),
|
||||||
"sentry.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:9000"),
|
"sentry.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:9000"),
|
||||||
"plausible.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:8000"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -48,6 +47,13 @@ func init() {
|
||||||
type ProxyHandler struct{}
|
type ProxyHandler struct{}
|
||||||
|
|
||||||
func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
// redirect to plausible through fly-proxy
|
||||||
|
if r.Host == "plausible.pluralkit.me" {
|
||||||
|
rw.Header().Add("fly-replay", "app=pluralkit-analytics")
|
||||||
|
rw.WriteHeader(200)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
remote, ok := remotes[r.Host]
|
remote, ok := remotes[r.Host]
|
||||||
if !ok {
|
if !ok {
|
||||||
// unknown domains redirect to landing page
|
// unknown domains redirect to landing page
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue