fixed data collection "disabling"
This commit is contained in:
parent
3bee2790a4
commit
240094d741
10
README.md
10
README.md
@ -133,13 +133,19 @@ dig clients.plex.tv +short
|
|||||||
dig plex.tv +short
|
dig plex.tv +short
|
||||||
# 52.17.59.150
|
# 52.17.59.150
|
||||||
# 52.49.56.127
|
# 52.49.56.127
|
||||||
|
|
||||||
|
dig features.plex.tv +short
|
||||||
|
# global-latency.plex.bz. -> we can ignore this one it points to the 3 IPs below
|
||||||
|
# 34.246.123.195
|
||||||
|
# 52.210.35.163
|
||||||
|
# 54.216.30.15
|
||||||
```
|
```
|
||||||
|
|
||||||
Then go into `Firewall` > `Aliases` and create two aliases:
|
Then go into `Firewall` > `Aliases` and create two aliases:
|
||||||
|
|
||||||
- `plex_ips`
|
- `plex_ips`
|
||||||
- Type: Host(s)
|
- Type: Host(s)
|
||||||
- Content: <the 4 IPs you found above>
|
- Content: <the IPs you found above>
|
||||||
- `plex_do_not_proxy`
|
- `plex_do_not_proxy`
|
||||||
- Type: Host(s)
|
- Type: Host(s)
|
||||||
- Content: <your plex server IP> and <your proxy server IP>
|
- Content: <your plex server IP> and <your proxy server IP>
|
||||||
@ -168,7 +174,7 @@ Finally go to `Firewall` > `NAT` > `Outbound` and create a new rule *(select Hyb
|
|||||||
|
|
||||||
##### Test the redirection
|
##### Test the redirection
|
||||||
|
|
||||||
Now if you try to go to `https://clients.plex.tv/api/hack` you should see a JSON response along the lines of :
|
Now if you try to go to `https://clients.plex.tv/proxy` you should see a JSON response along the lines of :
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
|
|
||||||
from fastapi import FastAPI, Request, HTTPException
|
from fastapi import FastAPI, Request
|
||||||
from starlette.responses import FileResponse
|
from starlette.responses import FileResponse
|
||||||
|
|
||||||
from const import FEATURES_DICT, ENTITLEMENTS, CURRENT_DATE_MINUS_ONE_DAY, FEATURES, \
|
from const import FEATURES_DICT, ENTITLEMENTS, CURRENT_DATE_MINUS_ONE_DAY, FEATURES, \
|
||||||
CURRENT_DATE_MINUS_ONE_DAY_Z, NEXT_MONTH_DATE_Z, PLEXAMP_FEATURES, TIMESTAMP_CURRENT_PLUS_30DAYS, \
|
CURRENT_DATE_MINUS_ONE_DAY_Z, NEXT_MONTH_DATE_Z, PLEXAMP_FEATURES, TIMESTAMP_CURRENT_PLUS_30DAYS, \
|
||||||
TIMESTAMP_CURRENT_MINUS_30MIN, PLEXAMP_SUBSCRIPTION_XML, Hosts
|
TIMESTAMP_CURRENT_MINUS_30MIN, PLEXAMP_SUBSCRIPTION_XML, Hosts
|
||||||
from utils import call_official, return_edited_response, host_required
|
from utils import call_official, return_edited_response, host_required, fake_response
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@ -241,8 +241,9 @@ async def fake_list_user_webhooks(request: Request, _=host_required([Hosts.CLIEN
|
|||||||
@app.post("/v1/rgstr", tags=[Hosts.FEATURES.value])
|
@app.post("/v1/rgstr", tags=[Hosts.FEATURES.value])
|
||||||
@app.options("/v1/rgstr", tags=[Hosts.FEATURES.value])
|
@app.options("/v1/rgstr", tags=[Hosts.FEATURES.value])
|
||||||
@app.post("/collect/event", tags=[Hosts.ANALYTICS.value])
|
@app.post("/collect/event", tags=[Hosts.ANALYTICS.value])
|
||||||
async def fake_initialize(request: Request, _=host_required([Hosts.FEATURES])):
|
@app.options("/collect/event", tags=[Hosts.ANALYTICS.value])
|
||||||
raise HTTPException(status_code=200, detail="Features/analytics data collection disabled by proxy")
|
async def block_telemetry():
|
||||||
|
return fake_response({"status": "disabled by proxy :)"}, status_code=200)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/favicon.ico")
|
@app.get("/favicon.ico")
|
||||||
|
13
utils.py
13
utils.py
@ -101,3 +101,16 @@ async def return_edited_response(
|
|||||||
headers=response.headers,
|
headers=response.headers,
|
||||||
media_type=content_type
|
media_type=content_type
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def fake_response(content: dict | None = None, status_code: int = 200) -> Response:
|
||||||
|
headers = {
|
||||||
|
"Access-Control-Allow-Origin": "*", # request.headers["origin"]
|
||||||
|
"Access-Control-Allow-Methods": "POST, OPTIONS",
|
||||||
|
"Access-Control-Allow-Headers": "*",
|
||||||
|
}
|
||||||
|
|
||||||
|
if content is None:
|
||||||
|
return Response(status_code=status_code, headers=headers)
|
||||||
|
|
||||||
|
return JSONResponse(content=content, status_code=status_code, headers=headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user