mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 18:13:25 +00:00
add permission page
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { PlasmoMessaging } from '@plasmohq/messaging';
|
||||
|
||||
import { hasPermission } from '~hooks/usePermission';
|
||||
import { getVersion } from '~hooks/useVersion';
|
||||
import type { BaseRequest } from '~types/request';
|
||||
import type { BaseResponse } from '~types/response';
|
||||
@@ -8,16 +9,17 @@ import { isDomainWhitelisted } from '~utils/storage';
|
||||
type Response = BaseResponse<{
|
||||
version: string;
|
||||
allowed: boolean;
|
||||
hasPermission: boolean;
|
||||
}>;
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler<BaseRequest, Response> = async (req, res) => {
|
||||
try {
|
||||
const version = getVersion();
|
||||
|
||||
res.send({
|
||||
success: true,
|
||||
version,
|
||||
allowed: await isDomainWhitelisted(req.sender.tab.url),
|
||||
hasPermission: await hasPermission(),
|
||||
});
|
||||
} catch (err) {
|
||||
res.send({
|
||||
|
Reference in New Issue
Block a user