Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | INFRASTRUCTURE & AUTOMATION4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : MacLustr Storage Node8 * File : Scripts/portal/create-app-id.js9 * Module : Scripts10 * Repository : https://git.spboucher.ai/maclustr-storage-ios11 * Project Website : https://storage.spboucher.ai12 * Created : 2026-12-0113 * Last Modified : 2026-12-0114 *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: admin@spboucher.ai23 * Technical Contact: dev@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// MacLustr Storage Node — Scripts/portal/create-app-id.js43// Registers the explicit App ID ai.spboucher.maclustr.storage ("MacLustr Storage Node") on the developer portal,44// after checking that it does not exist. One-time operation: run again, it reports EXISTS.45// Author: Simon-Pierre Boucher — contact@spboucher.ai46async function main(){47 const ID = 'ai.spboucher.maclustr.storage', NAME = 'MacLustr Storage Node', TEAM = '3YM54G49SN';48 const H = {'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json, application/json, text/plain, */*','X-Requested-With':'XMLHttpRequest'};49 const q = await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:{...H,'X-HTTP-Method-Override':'GET'},body:JSON.stringify({urlEncodedQueryParams:'limit=5&filter[identifier]='+ID,teamId:TEAM})});50 const qt = await q.text();51 let qj; try { qj = JSON.parse(qt); } catch(e) { return 'QUERY FAIL '+q.status+' '+qt.slice(0,300); }52 if (!qj.data) return 'QUERY FAIL '+q.status+' '+JSON.stringify(qj).slice(0,400);53 const existing = qj.data.filter(d=>d.attributes.identifier===ID);54 if (existing.length) return 'EXISTS '+existing[0].id+' '+existing[0].attributes.name;55 const csrf = q.headers.get('csrf'), ts = q.headers.get('csrf_ts');56 const body = {data:{type:'bundleIds',attributes:{identifier:ID,name:NAME,seedId:TEAM,teamId:TEAM},relationships:{bundleIdCapabilities:{data:[]}}}};57 const r = await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:{...H,...(csrf?{csrf:csrf,csrf_ts:ts}:{})},body:JSON.stringify(body)});58 const t = await r.text();59 try { const j = JSON.parse(t); if (j.data) return 'CREATED '+j.data.id+' '+JSON.stringify(j.data.attributes).slice(0,400); return 'FAIL '+r.status+' '+JSON.stringify(j.errors||j).slice(0,600); } catch(e){ return 'FAIL '+r.status+' '+t.slice(0,400); }60}61