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

Function icloudRequest

background.js:2928–2951  ·  view source on GitHub ↗
(method, url, options = {})

Source from the content-addressed store, hash-verified

2926}
2927
2928async function icloudRequest(method, url, options = {}) {
2929 const { data } = options;
2930 let response;
2931 try {
2932 response = await fetch(url, {
2933 method,
2934 credentials: 'include',
2935 headers: data !== undefined ? { 'Content-Type': 'application/json' } : undefined,
2936 body: data !== undefined ? JSON.stringify(data) : undefined,
2937 });
2938 } catch (err) {
2939 throw new Error(`iCloud 请求失败:${method} ${url},${err.message}`);
2940 }
2941
2942 if (!response.ok) {
2943 throw new Error(`iCloud 请求失败:${method} ${url},status ${response.status}`);
2944 }
2945
2946 try {
2947 return await response.json();
2948 } catch (err) {
2949 throw new Error(`iCloud 返回的 JSON 无法解析:${method} ${url},${err.message}`);
2950 }
2951}
2952
2953async function validateIcloudSession(setupUrl) {
2954 const data = await icloudRequest('POST', `${setupUrl}/validate`);

Callers 4

validateIcloudSessionFunction · 0.85
listIcloudAliasesFunction · 0.85
deleteIcloudAliasFunction · 0.85
fetchIcloudHideMyEmailFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected