SPB Git

Repository Public

asc-create-apps.js 3.5 KB 63 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Claude Remote / Codex Remote8 * File             : Scripts/asc-create-apps.js9 * Module           : Scripts10 * Repository       : https://git.spboucher.ai/claude-remote-apple11 * Project Website  : https://claude.spboucher.ai12 * Created          : 2026-11-2913 * Last Modified    : 2026-11-2914 *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: support@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 */4243async function create(bundleId, sku, names) {44  for (const name of names) {45    const body = {data:{type:"apps",attributes:{sku, primaryLocale:"fr-CA", bundleId},46      relationships:{appStoreVersions:{data:[{type:"appStoreVersions",id:"${store-version-ios}"}]},appInfos:{data:[{type:"appInfos",id:"${new-appInfo-id}"}]}}},47      included:[{type:"appStoreVersions",id:"${store-version-ios}",attributes:{platform:"IOS",versionString:"1.0.0"},relationships:{appStoreVersionLocalizations:{data:[{type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}"}]}}},48        {type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}",attributes:{locale:"fr-CA"}},49        {type:"appInfos",id:"${new-appInfo-id}",relationships:{appInfoLocalizations:{data:[{type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}"}]}}},50        {type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}",attributes:{locale:"fr-CA",name}}]};51    const r = await fetch('/iris/v1/apps',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','X-Csrf-Itc':'[asc-ui]'},body:JSON.stringify(body)});52    const t = await r.text();53    if (r.status < 300) { const j = JSON.parse(t); return bundleId+' OK id='+j.data.id+' name='+name; }54    const msg = (()=>{try{return JSON.stringify(JSON.parse(t).errors.map(e=>[e.code,e.detail,e.source]))}catch(e){return t.slice(0,400)}})();55    if (!/name|NAME/.test(msg) || names.indexOf(name) === names.length-1) return bundleId+' FAIL '+r.status+' '+msg;56  }57}58async function main(){59  const a = await create('ai.spboucher.clauderemote','clauderemote-ios-001',['Claude Remote','Claude Remote MacLustr','SPB Claude Remote']);60  const b = await create('ai.spboucher.codexremote','codexremote-ios-001',['Codex Remote','Codex Remote MacLustr','SPB Codex Remote']);61  return a+'\n'+b;62}63
Files main
Menu

Theme