mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 08:45:08 +01:00
Remove requestDomain
This commit is contained in:
parent
3704dfba10
commit
6c7f1acece
@ -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;
|
||||
|
@ -1,6 +1,4 @@
|
||||
export interface ExtensionBaseRequest {
|
||||
requestDomain: string;
|
||||
}
|
||||
export interface ExtensionBaseRequest {}
|
||||
|
||||
export type ExtensionBaseResponse<T = object> =
|
||||
| ({
|
||||
|
Loading…
Reference in New Issue
Block a user