1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Remove requestDomain

This commit is contained in:
mrjvs 2024-01-11 19:16:22 +01:00
parent 3704dfba10
commit 6c7f1acece
2 changed files with 4 additions and 18 deletions

View file

@ -36,31 +36,19 @@ function sendMessage<MessageKey extends keyof MessagesMetadata>(
export async function sendExtensionRequest<T>(
ops: Omit<MessagesMetadata["makeRequest"]["req"], "requestDomain">,
): Promise<ExtensionMakeRequestResponse<T> | null> {
return sendMessage("makeRequest", {
requestDomain: window.location.origin, // TODO unsafe
...ops,
});
return sendMessage("makeRequest", ops);
}
export async function setDomainRule(
ops: Omit<MessagesMetadata["prepareStream"]["req"], "requestDomain">,
): Promise<MessagesMetadata["prepareStream"]["res"] | null> {
return sendMessage("prepareStream", {
requestDomain: window.location.origin,
...ops,
});
return sendMessage("prepareStream", ops);
}
export async function extensionInfo(): Promise<
MessagesMetadata["hello"]["res"] | null
> {
const message = await sendMessage(
"hello",
{
requestDomain: window.location.origin,
},
300,
);
const message = await sendMessage("hello", {}, 300);
if (!message?.success) return null;
if (!message.allowed) return null;
return message;

View file

@ -1,6 +1,4 @@
export interface ExtensionBaseRequest {
requestDomain: string;
}
export interface ExtensionBaseRequest {}
export type ExtensionBaseResponse<T = object> =
| ({