mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app-proxy): tell the web client its release channel (#3448)
This commit is contained in:
1 parent
83bb9d89c8
commit
d514501d57
3 files changed
+81
-1
No files matched your search
@@ -24,6 +24,16 @@ if (!parsedBuildInfo.success) {
|
||||
}
|
||||
const buildInfo = parsedBuildInfo.output;
|
||||
|
||||
const SERVED_RELEASE_CHANNEL_META_SELECTOR = 'meta[name="fluxer-release-channel"]';
|
||||
|
||||
function servedReleaseChannel(): 'stable' | 'canary' | null {
|
||||
if (typeof document === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
const value = document.querySelector<HTMLMetaElement>(SERVED_RELEASE_CHANNEL_META_SELECTOR)?.content;
|
||||
return value === 'stable' || value === 'canary' ? value : null;
|
||||
}
|
||||
|
||||
function clientReleaseChannel(value: (typeof buildInfo)['PUBLIC_RELEASE_CHANNEL']): 'stable' | 'canary' {
|
||||
switch (value) {
|
||||
case 'stable':
|
||||
@@ -36,5 +46,5 @@ function clientReleaseChannel(value: (typeof buildInfo)['PUBLIC_RELEASE_CHANNEL'
|
||||
|
||||
export default {
|
||||
PUBLIC_BUILD_VERSION: buildInfo.PUBLIC_BUILD_VERSION,
|
||||
PUBLIC_RELEASE_CHANNEL: clientReleaseChannel(buildInfo.PUBLIC_RELEASE_CHANNEL),
|
||||
PUBLIC_RELEASE_CHANNEL: servedReleaseChannel() ?? clientReleaseChannel(buildInfo.PUBLIC_RELEASE_CHANNEL),
|
||||
} as const;
|
||||
Reference in new issue
Block a user