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

Function fetchDuckEmail

background/generated-email-helpers.js:163–186  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

161 }
162
163 async function fetchDuckEmail(options = {}) {
164 throwIfStopped();
165 const { generateNew = true } = options;
166
167 await addLog(`Duck 邮箱:正在打开自动填充设置(${generateNew ? '生成新地址' : '复用当前地址'})...`);
168 await reuseOrCreateTab('duck-mail', DUCK_AUTOFILL_URL);
169
170 const result = await sendToContentScript('duck-mail', {
171 type: 'FETCH_DUCK_EMAIL',
172 source: 'background',
173 payload: { generateNew },
174 });
175
176 if (result?.error) {
177 throw new Error(result.error);
178 }
179 if (!result?.email) {
180 throw new Error('未返回 Duck 邮箱地址。');
181 }
182
183 await setEmailState(result.email);
184 await addLog(`Duck 邮箱:${result.generated ? '已生成' : '已读取'} ${result.email}`, 'ok');
185 return result.email;
186 }
187
188 async function fetchGeneratedEmail(state, options = {}) {
189 const currentState = state || await getState();

Callers 1

fetchGeneratedEmailFunction · 0.70

Calls 5

setEmailStateFunction · 0.85
addLogFunction · 0.70
reuseOrCreateTabFunction · 0.70
sendToContentScriptFunction · 0.70
throwIfStoppedFunction · 0.50

Tested by

no test coverage detected