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

Function promptIcloudLogin

background.js:2887–2914  ·  view source on GitHub ↗
(error, actionLabel = 'iCloud 操作')

Source from the content-addressed store, hash-verified

2885}
2886
2887async function promptIcloudLogin(error, actionLabel = 'iCloud 操作') {
2888 const now = Date.now();
2889 const preferredUrl = await getPreferredIcloudLoginUrl(error);
2890 const originalError = getErrorMessage(error);
2891
2892 chrome.runtime.sendMessage({
2893 type: 'ICLOUD_LOGIN_REQUIRED',
2894 payload: {
2895 actionLabel,
2896 loginUrl: preferredUrl,
2897 message: '需要先登录 iCloud,我已经为你打开登录页。',
2898 detail: originalError,
2899 },
2900 }).catch(() => { });
2901
2902 if (now - lastIcloudLoginPromptAt < 15000) {
2903 return;
2904 }
2905 lastIcloudLoginPromptAt = now;
2906
2907 await addLog(`iCloud:${actionLabel}时需要登录,正在打开 ${new URL(preferredUrl).host} ...`, 'warn');
2908
2909 try {
2910 await openIcloudLoginPage(preferredUrl);
2911 } catch (tabErr) {
2912 await addLog(`iCloud:自动打开登录页失败:${getErrorMessage(tabErr)}`, 'warn');
2913 }
2914}
2915
2916async function withIcloudLoginHelp(actionLabel, action) {
2917 try {

Callers 1

withIcloudLoginHelpFunction · 0.85

Calls 4

openIcloudLoginPageFunction · 0.85
getErrorMessageFunction · 0.70
addLogFunction · 0.70

Tested by

no test coverage detected