SPB Git

Repository Public

asc-safari.sh 2.7 KB 71 lines shellscript

1#!/bin/zsh2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : Valo-Plex iOS8# File             : Scripts/portal/asc-safari.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/valo-plex-ios11# Project Website  : https://www.valo-plex.com12# 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: support@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# =============================================================================4041# Valo-Plex iOS42# File: Scripts/portal/asc-safari.sh43# Description: exécute un fichier JavaScript dans l'onglet Safari App Store Connect déjà ouvert et connecté44#              par le propriétaire (AppleScript « do JavaScript »). Ne lit ni témoin, ni mot de passe, ni code.45#46# Author: Simon-Pierre Boucher47# Contact: contact@spboucher.ai48#49# usage : asc-safari.sh fichier.js   (le fichier définit : async function main(){ … return chaîne })50osascript - "$1" <<'OSA'51on run argv52  set js to read (POSIX file (item 1 of argv)) as «class utf8»53  tell application "Safari"54    repeat with w in windows55      repeat with t in tabs of w56        if (URL of t) contains "appstoreconnect.apple.com" then57          do JavaScript "window.__r='PENDING'; (async()=>{try{" & js & "; window.__r=String(await main())}catch(e){window.__r='ERR '+e}})();" in t58          repeat 80 times59            delay 0.560            set r to do JavaScript "window.__r" in t61            if r is not "PENDING" then return r62          end repeat63          return "TIMEOUT"64        end if65      end repeat66    end repeat67    return "AUCUN ONGLET appstoreconnect.apple.com"68  end tell69end run70OSA71
Files main
Menu

Theme