Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Prevent sending x-peertube-language to external

Chocobozzzdc3209e3b678
diff --git a/client/src/app/shared/shared-main/http/language-interceptor.service.ts b/client/src/app/shared/shared-main/http/language-interceptor.service.ts
index ecddc5c3e5..1cbf9d3a17 100644
--- a/client/src/app/shared/shared-main/http/language-interceptor.service.ts
+++ b/client/src/app/shared/shared-main/http/language-interceptor.service.ts
@@ -1,9 +1,14 @@
import { HttpHandlerFn, HttpRequest } from '@angular/common/http'
import { inject, LOCALE_ID } from '@angular/core'
+import { getBackendUrl } from '@app/helpers'
+import { isSameOrigin } from '@root-helpers/url'
export function languageInterceptor (req: HttpRequest<unknown>, next: HttpHandlerFn) {
const localeId = inject(LOCALE_ID)
+ const sameOrigin = req.url.startsWith('/') || isSameOrigin(getBackendUrl(), req.url)
+ if (!sameOrigin) return next(req)
+
const newReq = req.clone({ headers: req.headers.append('x-peertube-language', localeId) })
return next(newReq)