From 4e75eb4a5f91d56d2a41bdcf03ecf4df4f14cf67 Mon Sep 17 00:00:00 2001 From: Leon Morival Date: Wed, 9 Sep 2026 11:51:08 +0200 Subject: [PATCH] feat: timeout --- android/app/src/main/AndroidManifest.xml | 4 ++- android/app/src/main/res/values/strings.xml | 1 + app.json | 24 +++++++++++++-- bun.lock | 13 +++++++- eas.json | 6 ++-- functions/helpers/gemini.js | 8 +++++ functions/src/lyrics.js | 1 + package.json | 1 + yarn.lock | 34 +++++++++++++++++++-- 9 files changed, 83 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ac90e19..d9e9c03 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -20,9 +20,11 @@ - + + + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 8ee479c..ebf686e 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -2,4 +2,5 @@ MusicLand contain false + 1.0.0 \ No newline at end of file diff --git a/app.json b/app.json index 9139fb2..9637a43 100644 --- a/app.json +++ b/app.json @@ -19,7 +19,8 @@ "iosDisplayInForeground": true }, "updates": { - "fallbackToCacheTimeout": 0 + "fallbackToCacheTimeout": 0, + "url": "https://u.expo.dev/5a57617e-a8b2-41d6-8441-9bda538764a1" }, "splash": { "image": "./assets/splash.png", @@ -33,23 +34,31 @@ "requireFullScreen": true, "userInterfaceStyle": "dark", "associatedDomains": [ + "applinks:musicland-one.vercel.app", "applinks:musicland-one.vercel.app" ], "bundleIdentifier": "com.omedis.musicland.ai", "infoPlist": { "UIBackgroundModes": [ + "audio", "audio" ], "NSMicrophoneUsageDescription": "MusicLand uses the microphone to record your voice and audio so you can create and collaborate on music projects.", "UISupportedInterfaceOrientations": [ + "UIInterfaceOrientationPortrait", + "UIInterfaceOrientationPortraitUpsideDown", "UIInterfaceOrientationPortrait", "UIInterfaceOrientationPortraitUpsideDown" ], "UISupportedInterfaceOrientations~ipad": [ + "UIInterfaceOrientationLandscapeLeft", + "UIInterfaceOrientationLandscapeRight", "UIInterfaceOrientationLandscapeLeft", "UIInterfaceOrientationLandscapeRight" ], "LSApplicationQueriesSchemes": [ + "itms-apps", + "minuit", "itms-apps", "minuit" ] @@ -60,6 +69,7 @@ "entitlements": { "aps-environment": "development", "com.apple.developer.applesignin": [ + "Default", "Default" ] }, @@ -78,7 +88,14 @@ "android.permission.MODIFY_AUDIO_SETTINGS", "android.permission.POST_NOTIFICATIONS", "android.permission.WAKE_LOCK", - "android.permission.FOREGROUND_SERVICE" + "android.permission.FOREGROUND_SERVICE", + "android.permission.RECORD_AUDIO", + "android.permission.CAMERA", + "android.permission.MODIFY_AUDIO_SETTINGS", + "android.permission.POST_NOTIFICATIONS", + "android.permission.WAKE_LOCK", + "android.permission.FOREGROUND_SERVICE", + "android.permission.RECORD_AUDIO" ] }, "web": { @@ -133,6 +150,7 @@ "eas": { "projectId": "5a57617e-a8b2-41d6-8441-9bda538764a1" } - } + }, + "runtimeVersion": "1.0.0" } } diff --git a/bun.lock b/bun.lock index 61f68ab..579ceb9 100644 --- a/bun.lock +++ b/bun.lock @@ -55,6 +55,7 @@ "expo-status-bar": "~2.0.1", "expo-store-review": "~8.0.1", "expo-system-ui": "~4.0.9", + "expo-updates": "~0.27.5", "expo-video": "~2.0.6", "expo-web-browser": "~14.0.2", "firebase": "~9.20.0", @@ -884,7 +885,7 @@ "archive-type": ["archive-type@4.0.0", "", { "dependencies": { "file-type": "^4.2.0" } }, "sha512-zV4Ky0v1F8dBrdYElwTvQhweQ0P7Kwc1aluqJsYtOBP01jXcWCyW2IEfI1YiqsG+Iy7ZR+o5LF1N+PGECBxHWA=="], - "arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="], + "arg": ["arg@4.1.0", "", {}, "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg=="], "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], @@ -1398,8 +1399,12 @@ "expo-store-review": ["expo-store-review@8.0.1", "", { "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-eJoZbsAsOXpyl1CEXauiMqs3z++8Qf1OMDUBEGmRj9hew+w9JbS3wvFOZpc0UXbm/NYn5YwiLfK7epQjLLKz4A=="], + "expo-structured-headers": ["expo-structured-headers@4.0.0", "", {}, "sha512-uPiwZjWq3AdFGgY52+I2nGPrNa6izxAglymPXHUZLekZW290GqIUOk7MBNDD4sg4JwUbSi3gdxEurpEvuq+FSg=="], + "expo-system-ui": ["expo-system-ui@4.0.9", "", { "dependencies": { "@react-native/normalize-colors": "0.76.8", "debug": "^4.3.2" }, "peerDependencies": { "expo": "*", "react-native": "*", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-hqBc0EWeK/BTB8i4H84vqNjje8GgxhapYrcWdg5qriaRA/u+bNNxhmpZXdAjFuhonOP4SmAbF+gjoJJWsTrhUg=="], + "expo-updates": ["expo-updates@0.27.5", "", { "dependencies": { "@expo/code-signing-certificates": "^0.0.6", "@expo/config": "~10.0.11", "@expo/config-plugins": "~9.0.17", "@expo/spawn-async": "^1.7.2", "arg": "4.1.0", "chalk": "^4.1.2", "expo-eas-client": "~0.13.3", "expo-manifests": "~0.15.8", "expo-structured-headers": "~4.0.0", "expo-updates-interface": "~1.0.0", "fast-glob": "^3.3.2", "fbemitter": "^3.0.0", "ignore": "^5.3.1", "resolve-from": "^5.0.0" }, "peerDependencies": { "expo": "*", "react": "*" }, "bin": { "expo-updates": "bin/cli.js" } }, "sha512-Y771xWW+jRT/pgAwE/BYHEZ4NrY/aSDyqbUABkbzyobQsS03usTwGZb7nadT4f1+x9NbKHxanWtsZeEmWeOx8w=="], + "expo-updates-interface": ["expo-updates-interface@1.0.0", "", { "peerDependencies": { "expo": "*" } }, "sha512-93oWtvULJOj+Pp+N/lpTcFfuREX1wNeHtp7Lwn8EbzYYmdn37MvZU3TPW2tYYCZuhzmKEXnUblYcruYoDu7IrQ=="], "expo-video": ["expo-video@2.0.6", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-oDorKwjreHT596oY6ZfktbDa3VF+Sq7gVsTbnQ4QVqGYL13mIO0s+h4y9xMyG/cDWyFpiRc4UT8KkPdxL0wViQ=="], @@ -2806,6 +2811,8 @@ "@expo/bunyan/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], + "@expo/cli/arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="], + "@expo/cli/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], "@expo/cli/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], @@ -2832,6 +2839,8 @@ "@expo/devcert/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="], + "@expo/fingerprint/arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="], + "@expo/fingerprint/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], "@expo/image-utils/fs-extra": ["fs-extra@9.0.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^1.0.0" } }, "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g=="], @@ -3242,6 +3251,8 @@ "svgo/css-tree": ["css-tree@2.3.1", "", { "dependencies": { "mdn-data": "2.0.30", "source-map-js": "^1.0.1" } }, "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw=="], + "tailwindcss/arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="], + "tailwindcss/postcss-nested": ["postcss-nested@6.2.0", "", { "dependencies": { "postcss-selector-parser": "^6.1.1" }, "peerDependencies": { "postcss": "^8.2.14" } }, "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ=="], "tailwindcss/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], diff --git a/eas.json b/eas.json index 53481d4..04884a8 100644 --- a/eas.json +++ b/eas.json @@ -12,7 +12,8 @@ }, "ios": { "simulator": true - } + }, + "channel": "preview" }, "production": { "android": { @@ -23,7 +24,8 @@ "ios": { "buildConfiguration": "Release", "autoIncrement": "buildNumber" - } + }, + "channel": "production" } } } diff --git a/functions/helpers/gemini.js b/functions/helpers/gemini.js index 566d405..dfe2a33 100644 --- a/functions/helpers/gemini.js +++ b/functions/helpers/gemini.js @@ -10,6 +10,7 @@ const { setTimeout } = require('timers/promises') // changer sans déploiement et pointer temporairement vers un modèle saturé. const TEXT_MODEL_NAMES = ['gemini-3.6-flash', 'gemini-3.5-flash', 'gemini-3.1-flash-lite'] const MODERATION_MODEL_NAMES = ['gemini-3.1-flash-lite', 'gemini-3.6-flash', 'gemini-3.5-flash'] +const MODEL_REQUEST_TIMEOUT_MS = 35000 const RETRYABLE_STATUS_CODES = new Set([404, 429, 500, 502, 503, 504]) const getErrorStatus = (error) => { @@ -21,8 +22,14 @@ const canTryFallbackModel = (error) => { const status = getErrorStatus(error) if (status && RETRYABLE_STATUS_CODES.has(status)) return true + if (error?.name === 'AbortError' || error?.name === 'TimeoutError' || error?.code === 'ABORT_ERR') { + return true + } + const message = String(error?.message || '').toLowerCase() return ( + message.includes('abort') || + message.includes('timeout') || message.includes('high demand') || message.includes('overloaded') || message.includes('temporarily unavailable') || @@ -41,6 +48,7 @@ const generateWithModelFallback = async ({ ai, modelNames, label, request }) => const response = await ai.generate({ ...request, model: googleAI.model(modelName), + abortSignal: AbortSignal.timeout(MODEL_REQUEST_TIMEOUT_MS), }) if (!response?.output) { diff --git a/functions/src/lyrics.js b/functions/src/lyrics.js index b351f4e..1d6742b 100644 --- a/functions/src/lyrics.js +++ b/functions/src/lyrics.js @@ -61,6 +61,7 @@ const STRUCTURE_ALIASES = { const LYRICS_FUNCTION_OPTIONS = { region: REGION, + timeoutSeconds: 180, cors: true, invoker: 'public', secrets: [GEMINI_API_KEY], diff --git a/package.json b/package.json index 51da118..9bcf5fe 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "expo-status-bar": "~2.0.1", "expo-store-review": "~8.0.1", "expo-system-ui": "~4.0.9", + "expo-updates": "~0.27.5", "expo-video": "~2.0.6", "expo-web-browser": "~14.0.2", "firebase": "~9.20.0", diff --git a/yarn.lock b/yarn.lock index d3ea427..c8d989c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3046,6 +3046,11 @@ archive-type@^4.0.0: dependencies: file-type "^4.2.0" +arg@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0" + integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg== + arg@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" @@ -5180,7 +5185,7 @@ expo-document-picker@~13.0.3: resolved "https://registry.yarnpkg.com/expo-document-picker/-/expo-document-picker-13.0.3.tgz#9ec9b056447d11a68d61e93d33c2211fd01b460f" integrity sha512-348xcsiA/YhgWm1SuJNNdb5cUDpRJYCyIk8MhOU2MEDxbVRR+Q1TiUBTCIMVqaWHcxsFQzP56Wwv9n24qjeILg== -expo-eas-client@~0.13.2: +expo-eas-client@~0.13.2, expo-eas-client@~0.13.3: version "0.13.3" resolved "https://registry.yarnpkg.com/expo-eas-client/-/expo-eas-client-0.13.3.tgz#1535a99a224e360581c6253b0a1ea767e19815b8" integrity sha512-t+1F1tiDocSot8iSnrn/CjTUMvVvPV2DpafSVcticpbSzMGybEN7wcamO1t18fK7WxGXpZE9gxtd80qwv/LLqQ== @@ -5325,6 +5330,11 @@ expo-store-review@~8.0.1: resolved "https://registry.yarnpkg.com/expo-store-review/-/expo-store-review-8.0.1.tgz#f9d5f584ee6d1e97e7c6374dc840641a31ccfd36" integrity sha512-eJoZbsAsOXpyl1CEXauiMqs3z++8Qf1OMDUBEGmRj9hew+w9JbS3wvFOZpc0UXbm/NYn5YwiLfK7epQjLLKz4A== +expo-structured-headers@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/expo-structured-headers/-/expo-structured-headers-4.0.0.tgz#85537ae6daec61ebfb214ede4107c8841c6e16d0" + integrity sha512-uPiwZjWq3AdFGgY52+I2nGPrNa6izxAglymPXHUZLekZW290GqIUOk7MBNDD4sg4JwUbSi3gdxEurpEvuq+FSg== + expo-system-ui@~4.0.9: version "4.0.9" resolved "https://registry.yarnpkg.com/expo-system-ui/-/expo-system-ui-4.0.9.tgz#a3dc4af52dab589dd433a28ed286360cea0e008d" @@ -5338,6 +5348,26 @@ expo-updates-interface@~1.0.0: resolved "https://registry.yarnpkg.com/expo-updates-interface/-/expo-updates-interface-1.0.0.tgz#b98c66b800d29561c62409556948b2af3d5316e5" integrity sha512-93oWtvULJOj+Pp+N/lpTcFfuREX1wNeHtp7Lwn8EbzYYmdn37MvZU3TPW2tYYCZuhzmKEXnUblYcruYoDu7IrQ== +expo-updates@~0.27.5: + version "0.27.5" + resolved "https://registry.yarnpkg.com/expo-updates/-/expo-updates-0.27.5.tgz#2f7c7f4cc159adb5ee9de7ae3378ef7da67026f1" + integrity sha512-Y771xWW+jRT/pgAwE/BYHEZ4NrY/aSDyqbUABkbzyobQsS03usTwGZb7nadT4f1+x9NbKHxanWtsZeEmWeOx8w== + dependencies: + "@expo/code-signing-certificates" "^0.0.6" + "@expo/config" "~10.0.11" + "@expo/config-plugins" "~9.0.17" + "@expo/spawn-async" "^1.7.2" + arg "4.1.0" + chalk "^4.1.2" + expo-eas-client "~0.13.3" + expo-manifests "~0.15.8" + expo-structured-headers "~4.0.0" + expo-updates-interface "~1.0.0" + fast-glob "^3.3.2" + fbemitter "^3.0.0" + ignore "^5.3.1" + resolve-from "^5.0.0" + expo-video@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/expo-video/-/expo-video-2.0.6.tgz#4da4e4d427ad42649881a5336697b5a7164aaab3" @@ -6309,7 +6339,7 @@ ieee754@^1.1.13, ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.2.0: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==