SPB Git

Repository Public BSD-3-Clause

dev-safari.sh 2.3 KB 63 lines shellscript

1#!/bin/zsh2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Maps8# File             : scripts/portal/dev-safari.sh9# Module           : scripts10# Repository       : https://git.spboucher.ai/orix-maps11# Created          : 2026-11-2512# Last Modified    : 2026-11-2513#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : Proprietary, all rights reserved (see license file)32# License File     : LICENSE33#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# usage: dev-safari.sh file.js   (file defines: async function main(){...return string}); runs in the signed-in developer.apple.com tab42osascript - "$1" <<'OSA'43on run argv44  set js to read (POSIX file (item 1 of argv)) as «class utf8»45  tell application "Safari"46    repeat with w in windows47      repeat with t in tabs of w48        if (URL of t) contains "developer.apple.com/account" then49          do JavaScript "window.__r='PENDING'; (async()=>{try{" & js & "; window.__r=String(await main())}catch(e){window.__r='ERR '+e}})();" in t50          repeat 80 times51            delay 0.552            set r to do JavaScript "window.__r" in t53            if r is not "PENDING" then return r54          end repeat55          return "TIMEOUT"56        end if57      end repeat58    end repeat59    return "NO TAB"60  end tell61end run62OSA63
Files main
Menu

Theme