Browse Source

Extension should only be classed as active/valid when it's allowed on the domain

pull/760/head
William Oldham 2 years ago
parent
commit
1918aa6d9b
  1. 2
      src/backend/extension/messaging.ts
  2. 5
      src/pages/parts/player/MetaPart.tsx

2
src/backend/extension/messaging.ts

@ -67,5 +67,5 @@ export async function isExtensionActive(): Promise<boolean> { @@ -67,5 +67,5 @@ export async function isExtensionActive(): Promise<boolean> {
if (!info?.success) return false;
const allowedVersion = isAllowedExtensionVersion(info.version);
if (!allowedVersion) return false;
return true;
return info.allowed && info.hasPermission;
}

5
src/pages/parts/player/MetaPart.tsx

@ -46,11 +46,10 @@ export function MetaPart(props: MetaPartProps) { @@ -46,11 +46,10 @@ export function MetaPart(props: MetaPartProps) {
const { error, value, loading } = useAsync(async () => {
const info = await extensionInfo();
const isValidExtension =
info?.success && isAllowedExtensionVersion(info.version);
info?.success && isAllowedExtensionVersion(info.version) && info.allowed;
if (isValidExtension) {
if (!info.allowed || !info.hasPermission)
throw new Error("extension-no-permission");
if (!info.hasPermission) throw new Error("extension-no-permission");
}
// use api metadata or providers metadata

Loading…
Cancel
Save