SPB Git

Repository Public

asc-safari.sh 2.7 KB 72 lines shellscript

1#!/bin/zsh2# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : Groupe Ka — app iOS native8# File             : Scripts/portal/asc-safari.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/groupe-ka-ios11# Project Website  : Not specified12# Created          : 2026-12-0313# Last Modified    : 2026-12-0314#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# =============================================================================4142# Groupe Ka iOS43# File: Scripts/portal/asc-safari.sh44# Description: exécute un fichier JavaScript dans l'onglet Safari App Store Connect déjà ouvert et connecté45#              par le propriétaire (AppleScript « do JavaScript »). Ne lit ni témoin, ni mot de passe, ni code.46#47# Author: Simon-Pierre Boucher48# Contact: contact@spboucher.ai49#50# usage : asc-safari.sh fichier.js   (le fichier définit : async function main(){ … return chaîne })51osascript - "$1" <<'OSA'52on run argv53  set js to read (POSIX file (item 1 of argv)) as «class utf8»54  tell application "Safari"55    repeat with w in windows56      repeat with t in tabs of w57        if (URL of t) contains "appstoreconnect.apple.com" then58          do JavaScript "window.__r='PENDING'; (async()=>{try{" & js & "; window.__r=String(await main())}catch(e){window.__r='ERR '+e}})();" in t59          repeat 80 times60            delay 0.561            set r to do JavaScript "window.__r" in t62            if r is not "PENDING" then return r63          end repeat64          return "TIMEOUT"65        end if66      end repeat67    end repeat68    return "AUCUN ONGLET appstoreconnect.apple.com"69  end tell70end run71OSA72
Files main
Menu

Theme