Merge origin/main into shots-glyphs
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
ff36fc5aaf
22 changed files with 1101 additions and 110 deletions
|
|
@ -468,6 +468,10 @@ export interface ShipConfig {
|
|||
languages: Language[];
|
||||
play?: {
|
||||
packageName: string; defaultLanguage?: string; listing?: string; icon?: string;
|
||||
/** The Play developer account id (the digits in play.google.com/console/u/0/developers/<id>/...). Optional: with
|
||||
* one Google login in several developer accounts, `storebound console fill` finds the app by package name and
|
||||
* remembers the account (~/.storebound/console-accounts.json); this skips that search. */
|
||||
developerId?: string;
|
||||
/** Promo video: a YouTube URL (public or unlisted, ads off, embeddable). Play takes no video upload. Sent by `play listing`. */
|
||||
video?: string;
|
||||
/** Cloud Storage bucket of the Play Console report exports, e.g. "pubsite_prod_rev_<number>" (Play Console >
|
||||
|
|
@ -638,6 +642,7 @@ const SHA256_RE = /^([0-9A-F]{2}:){31}[0-9A-F]{2}$/;
|
|||
export function validateExtras(cfg: Partial<ShipConfig>): string[] {
|
||||
const e: string[] = [];
|
||||
if (cfg.apple?.teamId !== undefined && !/^[A-Z0-9]{10}$/.test(cfg.apple.teamId)) e.push('apple.teamId: the 10-character Team ID (Membership details)');
|
||||
if (cfg.play?.developerId !== undefined && !/^\d{1,25}$/.test(cfg.play.developerId)) e.push('play.developerId: the digits of play.google.com/console/u/0/developers/<id>');
|
||||
const ad = cfg.apple?.adhoc;
|
||||
if (ad?.method !== undefined && ad.method !== 'release-testing' && ad.method !== 'ad-hoc') e.push('apple.adhoc.method: release-testing | ad-hoc');
|
||||
const ppp = cfg.prices?.ppp;
|
||||
|
|
|
|||
|
|
@ -112,14 +112,39 @@ export const forbiddenControl = (name: string): boolean => FORBIDDEN.test(name.t
|
|||
|
||||
const SIGN_IN_HOSTS = ['appleid.apple.com', 'idmsa.apple.com', 'accounts.google.com'];
|
||||
|
||||
/** A sign-in page (storebound never touches those; the owner signs in). */
|
||||
/**
|
||||
* A sign-in page or frame (storebound never touches those; the owner signs in): Apple ID / Google accounts hosts, App
|
||||
* Store Connect's /login, and Google sign-in paths (/signin, ServiceLogin) on any google.com host.
|
||||
*/
|
||||
export function isSignInUrl(url: string): boolean {
|
||||
try {
|
||||
const u = new URL(url);
|
||||
return SIGN_IN_HOSTS.includes(u.hostname) || (u.hostname === 'appstoreconnect.apple.com' && u.pathname.startsWith('/login'));
|
||||
const u = new URL(url), h = u.hostname;
|
||||
if (SIGN_IN_HOSTS.includes(h)) return true;
|
||||
if (h === 'appstoreconnect.apple.com' && /^\/login(\/|$)/.test(u.pathname)) return true;
|
||||
return (h === 'google.com' || h.endsWith('.google.com')) && /\/(signin|ServiceLogin)(\/|$)/i.test(u.pathname);
|
||||
} catch { return false; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Whole visible texts (or labels / placeholders) that only a sign-in form shows, English and Turkish. Apple's form
|
||||
* lives in an idmsa.apple.com frame and starts with no password field (Email or Phone Number > Continue > passkey or
|
||||
* password). `weak`: also used elsewhere (an account menu), so they count only inside a child frame.
|
||||
*/
|
||||
export const SIGN_IN_TEXTS = {
|
||||
strong: ['Sign in with Passkey', 'Email or Phone Number', 'Sign in to App Store Connect', 'Keep me signed in', 'Email or phone',
|
||||
'Geçiş Anahtarıyla Giriş Yap', 'Geçiş anahtarı ile giriş yap', 'Geçiş Anahtarı ile Giriş Yap', 'E-posta veya Telefon Numarası',
|
||||
'App Store Connect’e giriş yap', "App Store Connect'e giriş yap", 'Oturumum açık kalsın', 'E-posta veya telefon'],
|
||||
weak: ['Apple Account', 'Apple Hesabı', 'Apple ID'],
|
||||
};
|
||||
const textRe = (list: string[]) => new RegExp(`^\\s*(?:${list.map(esc).join('|')})\\s*$`, 'iu');
|
||||
const STRONG = textRe(SIGN_IN_TEXTS.strong), WEAK = textRe(SIGN_IN_TEXTS.weak);
|
||||
|
||||
/** A text that marks a sign-in form (`inFrame`: it is inside a child frame, where the weak texts count too). */
|
||||
export const isSignInText = (t: string, inFrame = false): boolean => {
|
||||
const s = t.normalize('NFC').replace(/\s+/g, ' ');
|
||||
return STRONG.test(s) || (inFrame && WEAK.test(s));
|
||||
};
|
||||
|
||||
/** The console itself is open (signed in). `base` overrides the console origin (tests only, 127.0.0.1). */
|
||||
export function consoleReached(store: 'apple' | 'play', url: string, base?: string): boolean {
|
||||
try {
|
||||
|
|
@ -192,8 +217,12 @@ export function navPlan(id: FormId, config: ShipConfig, bases: NavBases = NAV_BA
|
|||
? ['Content rating', ['Content rating', 'Content ratings', 'İçerik derecelendirmesi', /^content ratings?$/i]]
|
||||
: ['Target audience and content', ['Target audience and content', 'Hedef kitle ve içerik', /^target audience\b/i, /^hedef kitle\b/iu]];
|
||||
return [
|
||||
{ kind: 'goto', label: 'open Play Console', url: play },
|
||||
{ kind: 'pickApp', label: 'the app in the list', tokens: config.play?.packageName ? [config.play.packageName] : [], ...named, search: [/^search/i, 'Uygulama ara', /^ara$/iu] },
|
||||
config.play?.developerId
|
||||
? { kind: 'goto', label: 'open the app list of the developer account', url: playAppList(play, config.play.developerId) }
|
||||
: { kind: 'goto', label: 'open Play Console', url: play },
|
||||
// by package name only when there is one: with several developer accounts, an app of the same name in another
|
||||
// account must not count
|
||||
{ kind: 'pickApp', label: 'the app in the list', tokens: config.play?.packageName ? [config.play.packageName] : [], ...(config.play?.packageName ? {} : named), search: [/^search/i, 'Uygulama ara', /^ara$/iu] },
|
||||
{ kind: 'click', label: 'Policy and programs (opens the menu)', roles: ['button', 'link'], names: POLICY, optional: true, unless: { roles: ['link'], names: APP_CONTENT } },
|
||||
{ kind: 'click', label: 'App content', roles: ['link'], names: APP_CONTENT },
|
||||
{ kind: 'formLink', label: `${title}: Start or Manage`, entry },
|
||||
|
|
@ -213,5 +242,30 @@ export function navAllowed(name: string, role: string): boolean {
|
|||
return n.length > 0 && !forbiddenControl(n);
|
||||
}
|
||||
|
||||
// ---- one login, several developer accounts / teams ----
|
||||
// Switching the developer account (Play) or the team (App Store Connect) changes what the console shows, it writes
|
||||
// nothing: such a click is let through when its target is one of the accounts storebound just read from the chooser or
|
||||
// the team menu (exact name), is a link / menu item / option / row / button, and is never a sign-out or a deny-listed
|
||||
// control (forbiddenControl stays absolute, so a studio named "Next Games" is not clicked: the owner picks it).
|
||||
|
||||
/** Play Console's app list of one developer account. */
|
||||
export const playAppList = (playBase: string, developerId: string): string => `${playBase.replace(/\/$/, '')}/u/0/developers/${encodeURIComponent(developerId)}/app-list`;
|
||||
|
||||
/** The developer account id in a Play Console URL (/developers/<digits>), or null. */
|
||||
export function playDeveloperId(url: string): string | null {
|
||||
try { return new URL(url).pathname.match(/\/developers\/(\d{1,25})(?:\/|$)/)?.[1] ?? null; } catch { return null; }
|
||||
}
|
||||
|
||||
const SIGN_OUT = /\b(sign|log)\s*(out|off)\b|çıkış|oturumu kapat|hesap ekle|add account/iu;
|
||||
/** Entries of an account menu that are not accounts (profile, settings, help, sign out). */
|
||||
export const NOT_AN_ACCOUNT = /^(?:edit profile|profile|settings|account settings|help|users and access|switch team|teams?|profil(?:i düzenle)?|ayarlar|yardım|kullanıcılar ve erişim|ekip değiştir|ekipler?)$/iu;
|
||||
|
||||
/** The account-switch click gate: `name` must be one of `listed` (read from the chooser / team menu just before). */
|
||||
export function switchAllowed(name: string, role: string, listed: string[]): boolean {
|
||||
const n = name.trim().replace(/\s+/g, ' ');
|
||||
return ['link', 'menuitem', 'menuitemradio', 'option', 'radio', 'row', 'button'].includes(role) && listed.includes(n)
|
||||
&& !SIGN_OUT.test(n) && !NOT_AN_ACCOUNT.test(n) && navAllowed(n, role);
|
||||
}
|
||||
|
||||
/** `id` as a whole token of `text` (com.example.game, not com.example.game2 or com.example.gamepro). */
|
||||
export const hasToken = (text: string, id: string): boolean => new RegExp(`(?<![\\w.])${esc(id)}(?![\\w.])`).test(text);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ export interface WsAccount {
|
|||
label?: string;
|
||||
/** The desktop's account id (16 hex) when it came from there; else derived from store + profile. */
|
||||
id?: string;
|
||||
/** play: the developer account id (console URL /developers/<id>); `console fill` opens that account directly. Not a secret. */
|
||||
developerId?: string;
|
||||
/** apple: the 10-character Team ID; `console fill` switches to that team. Not a secret. */
|
||||
teamId?: string;
|
||||
}
|
||||
export interface WsStudio { id?: string; name: string; color?: StudioColor; accounts?: WsAccount[]; apps?: string[] }
|
||||
export interface WsAppEntry { path: string; name?: string; apple?: string; play?: string }
|
||||
|
|
@ -96,7 +100,7 @@ export async function loadWorkspace(from: string, explicit?: string): Promise<Lo
|
|||
return { file, root: resolve(file, '..'), ws: raw as Workspace };
|
||||
}
|
||||
|
||||
const ACCOUNT_KEYS = ['store', 'profile', 'label', 'id'];
|
||||
const ACCOUNT_KEYS = ['store', 'profile', 'label', 'id', 'developerId', 'teamId'];
|
||||
|
||||
/** Problems of a workspace file (empty = fine). Secrets are refused: only profile names belong here. */
|
||||
export function checkWorkspace(raw: unknown): string[] {
|
||||
|
|
@ -120,6 +124,8 @@ export function checkWorkspace(raw: unknown): string[] {
|
|||
if (typeof o.profile !== 'string' || !PROFILE_RE.test(o.profile)) e.push(`${where}.profile: a credential profile name (letters, digits, . _ -)`);
|
||||
if (o.id !== undefined && (typeof o.id !== 'string' || !/^[0-9a-f]{16}$/.test(o.id))) e.push(`${where}.id: 16 hex characters (the desktop's account id)`);
|
||||
if (o.label !== undefined && (typeof o.label !== 'string' || o.label.length > 60)) e.push(`${where}.label: up to 60 characters`);
|
||||
if (o.developerId !== undefined && (o.store !== 'play' || typeof o.developerId !== 'string' || !/^\d{1,25}$/.test(o.developerId))) e.push(`${where}.developerId: a play account's developer id (digits)`);
|
||||
if (o.teamId !== undefined && (o.store !== 'apple' || typeof o.teamId !== 'string' || !/^[A-Z0-9]{10}$/.test(o.teamId))) e.push(`${where}.teamId: an apple account's 10-character Team ID`);
|
||||
};
|
||||
if (w.accounts !== undefined) { if (!Array.isArray(w.accounts)) e.push('accounts: a list'); else w.accounts.forEach((a, i) => account(a, `accounts[${i}]`)); }
|
||||
if (w.studios !== undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue