mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 09:11:06 +00:00
refactor: consolidate and debloat calendar sync implementation
Merge duplicated Google/Outlook engines, background handlers, and API layers into shared calendarSync modules to cut complexity without changing user-facing sync behavior.
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
import browser from "webextension-polyfill";
|
||||
|
||||
/** Vite asset imports are often already absolute extension URLs in production bundles. */
|
||||
export function resolveExtensionAssetUrl(importedUrl: string): string {
|
||||
if (!importedUrl) return importedUrl;
|
||||
|
||||
const doublePrefix = importedUrl.match(
|
||||
/^((?:chrome|moz)-extension:\/\/[^/]+)\/\1\/(.+)$/,
|
||||
);
|
||||
if (doublePrefix) {
|
||||
return `${doublePrefix[1]}/${doublePrefix[2]}`;
|
||||
}
|
||||
|
||||
if (/^(chrome-extension|moz-extension|https?|data):/.test(importedUrl)) {
|
||||
return importedUrl;
|
||||
}
|
||||
return browser.runtime.getURL(importedUrl.replace(/^\/+/, ""));
|
||||
/** Resolve Vite asset imports to a usable extension URL. */
|
||||
export function resolveExtensionAssetUrl(url: string): string {
|
||||
const doubled = url.match(/^((?:chrome|moz)-extension:\/\/[^/]+)\/\1\/(.+)$/);
|
||||
if (doubled) return `${doubled[1]}/${doubled[2]}`;
|
||||
if (/^(?:chrome|moz)-extension:\/\/|https?:|data:/.test(url)) return url;
|
||||
return browser.runtime.getURL(url.replace(/^\/+/, ""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user