MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / getOpenIcloudHostPreference

Function getOpenIcloudHostPreference

background.js:2790–2810  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2788}
2789
2790async function getOpenIcloudHostPreference() {
2791 try {
2792 const tabs = await chrome.tabs.query({
2793 url: [
2794 'https://www.icloud.com/*',
2795 'https://www.icloud.com.cn/*',
2796 ],
2797 });
2798
2799 const activeTab = tabs.find((tab) => tab.active);
2800 const candidates = activeTab ? [activeTab, ...tabs.filter((tab) => tab.id !== activeTab.id)] : tabs;
2801 for (const tab of candidates) {
2802 try {
2803 const host = normalizeIcloudHost(new URL(tab.url).host);
2804 if (host) return host;
2805 } catch {}
2806 }
2807 } catch {}
2808
2809 return '';
2810}
2811
2812async function getPreferredIcloudLoginUrl(error = null, state = null) {
2813 const currentState = state || await getState();

Callers 1

Calls 1

normalizeIcloudHostFunction · 0.85

Tested by

no test coverage detected