mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 12:04:02 +00:00
fix(miniapp): add build-time runtime config asset
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<div id="root"></div>
|
||||
|
||||
<script src="https://telegram.org/js/telegram-web-app.js"></script>
|
||||
<script src="/config.js"></script>
|
||||
<script src="/config.js" type="module"></script>
|
||||
<script src="/src/index.tsx" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
3
apps/miniapp/public/config.js
Normal file
3
apps/miniapp/public/config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
window.__HOUSEHOLD_CONFIG__ = {
|
||||
botApiUrl: ''
|
||||
}
|
||||
@@ -7,6 +7,10 @@ declare global {
|
||||
}
|
||||
|
||||
export function runtimeBotApiUrl(): string | undefined {
|
||||
if (typeof window === 'undefined') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const configured = window.__HOUSEHOLD_CONFIG__?.botApiUrl?.trim()
|
||||
|
||||
return configured && configured.length > 0 ? configured : undefined
|
||||
|
||||
Reference in New Issue
Block a user