mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-04 16:47:40 +01:00
d82de1f7c8
* Add better scrape error messages for the extension * Remove config.js silly me * Polish and resolve issues * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Update src/pages/parts/player/ScrapeErrorPart.tsx Co-authored-by: William Oldham <github@binaryoverload.co.uk> * Fix duplicate button value * Resolve issues * Ok now i fixed it all * Apply suggestions from code review * I am dum --------- Co-authored-by: Cooper Ransom <cooperransom08@outlook.com> Co-authored-by: William Oldham <github@binaryoverload.co.uk>
20 lines
795 B
TypeScript
20 lines
795 B
TypeScript
import { isAllowedExtensionVersion } from "@/backend/extension/compatibility";
|
|
import { extensionInfo } from "@/backend/extension/messaging";
|
|
|
|
export type ExtensionStatus =
|
|
| "unknown"
|
|
| "failed"
|
|
| "disallowed"
|
|
| "noperms"
|
|
| "outdated"
|
|
| "success";
|
|
|
|
export async function getExtensionState(): Promise<ExtensionStatus> {
|
|
const info = await extensionInfo();
|
|
if (!info) return "unknown"; // cant talk to extension
|
|
if (!info.success) return "failed"; // extension failed to respond
|
|
if (!info.allowed) return "disallowed"; // extension is not enabled on this page
|
|
if (!info.hasPermission) return "noperms"; // extension has no perms to do it's tasks
|
|
if (!isAllowedExtensionVersion(info.version)) return "outdated"; // extension is too old
|
|
return "success"; // no problems
|
|
}
|