Something went wrong. Try again.
(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
extension web atproto comments
Something went wrong. Try again.
726 B · 24 lines
TypeScript
at main
12345678910111213141516171819202122232425import { defineContentScript } from 'wxt/sandbox';import { sendMessage } from '@/utils/messaging';
export default defineContentScript({ matches: ['https://margin.at/*'], runAt: 'document_idle',
main() { browser.runtime.onMessage.addListener((message: any) => { if (message.type === 'SAFARI_FETCH') { const { url, options } = message; return fetch(url, { ...options, credentials: 'include' }) .then(async (res) => ({ ok: res.ok, status: res.status, body: await res.text(), })) .catch((err) => ({ ok: false, status: 0, body: String(err) })); } });
sendMessage('sessionPing', undefined).catch(() => {}); },});