MCPcopy Create free account
hub / github.com/pollinations/pollinations / detachPagesDomainFromProject

Function detachPagesDomainFromProject

apps/_scripts/deploy-app.js:136–169  ·  view source on GitHub ↗
(
    account,
    headers,
    project,
    customDomain,
)

Source from the content-addressed store, hash-verified

134}
135
136async function detachPagesDomainFromProject(
137 account,
138 headers,
139 project,
140 customDomain,
141) {
142 const { ok: listOk, json: domains } = await cf(
143 `${CF_API}/accounts/${account}/pages/projects/${project}/domains`,
144 headers,
145 );
146 if (!listOk) {
147 throw new Error(
148 `List domains for ${project} failed: ${JSON.stringify(domains)}`,
149 );
150 }
151
152 if (!domains.result?.some((domain) => domain.name === customDomain)) {
153 return false;
154 }
155
156 const { ok: deleteOk, json: deleted } = await cf(
157 `${CF_API}/accounts/${account}/pages/projects/${project}/domains/${customDomain}`,
158 headers,
159 { method: "DELETE" },
160 );
161 if (!deleteOk) {
162 throw new Error(
163 `Detach ${customDomain} from ${project} failed: ${JSON.stringify(deleted)}`,
164 );
165 }
166
167 console.log(`Detached ${customDomain} from ${project}`);
168 return true;
169}
170
171async function projectHasPagesDomain(account, headers, project, customDomain) {
172 const { ok, json } = await cf(

Callers 1

detachPagesDomainFunction · 0.85

Calls 3

stringifyMethod · 0.80
logMethod · 0.80
cfFunction · 0.70

Tested by

no test coverage detected