SPB Git

Repository Public

app-id.js 3.4 KB 59 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : SPB Git for iOS and iPadOS8 * File             : scripts/portal/app-id.js9 * Module           : Scripts10 * Repository       : https://git.spboucher.ai/spbgit-ios11 * Project Website  : Not specified12 * Created          : 2026-12-0213 * Last Modified    : 2026-12-0214 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243// Apple Developer portal: create the explicit App ID ai.spboucher.git when it is missing (idempotent).44// Runs in the owner's signed-in Safari tab; reads no cookie, password or key.45async function main(){46  const team='3YM54G49SN', ident='ai.spboucher.git', name='SPB Git';47  const get={'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json, application/json','X-HTTP-Method-Override':'GET','X-Requested-With':'XMLHttpRequest'};48  const list=async()=>{const r=await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:get,body:JSON.stringify({urlEncodedQueryParams:'limit=1000',teamId:team})}); if(r.status>=300) throw new Error('list '+r.status); const j=await r.json(); return {r,data:j.data||[]};};49  let s=await list(); let found=s.data.find(d=>d.attributes.identifier===ident);50  if(found) return JSON.stringify({ident,action:'exists',id:found.id,name:found.attributes.name});51  const h={'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json, application/json','X-Requested-With':'XMLHttpRequest'};52  const c=s.r.headers.get('csrf'), ts=s.r.headers.get('csrf_ts'); if(c){h['csrf']=c; h['csrf_ts']=ts;}53  const body={data:{type:'bundleIds',attributes:{identifier:ident,name:name,seedId:team,teamId:team},relationships:{bundleIdCapabilities:{data:[]}}}};54  const r=await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:h,body:JSON.stringify(body)});55  const t=await r.text(); let j={}; try{j=JSON.parse(t)}catch(e){}56  s=await list(); found=s.data.find(d=>d.attributes.identifier===ident);57  return JSON.stringify({ident,action:'create',status:r.status,errors:(j.errors||[]).map(e=>(e.detail||e.title)),verifiedId:found&&found.id,raw:found?undefined:t.slice(0,300)});58}59
Files main
Menu

Theme