obsidian_freesync/redirect.py
2025-04-17 15:07:44 +02:00

19 lines
No EOL
654 B
Python

from mitmproxy import http
class ObsidianRedirect:
def request(self, flow: http.HTTPFlow) -> None:
#return
if flow.request.pretty_host == "sync-32.obsidian.md":
flow.request.scheme = "http"
flow.request.host = "localhost"
flow.request.port = 5000
flow.request.headers["Host"] = "sync-32.obsidian.md"
if flow.request.pretty_host == "api.obsidian.md":
flow.request.scheme = "http"
flow.request.host = "localhost"
flow.request.port = 5000
flow.request.headers["Host"] = "api.obsidian.md"
addons = [ObsidianRedirect()]