Skip to content

Commit 8e16b94

Browse files
committed
fix: rework versionExtended flow to be done via meteor runtime_config
1 parent 503e622 commit 8e16b94

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

meteor/server/api/rest/koa.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import _ from 'underscore'
88
import { public_dir } from '../../lib'
99
import staticServe from 'koa-static'
1010
import { logger } from '../../logging'
11+
import { PackageInfo } from '../../coreSystem'
1112

1213
declare module 'http' {
1314
interface IncomingMessage {
@@ -55,8 +56,13 @@ Meteor.startup(() => {
5556

5657
// Serve the meteor runtime config
5758
rootRouter.get('/meteor-runtime-config.js', async (ctx) => {
58-
// @ts-expect-error missing types for internal meteor detail
59-
ctx.body = `window.__meteor_runtime_config__ = (${JSON.stringify(__meteor_runtime_config__)})`
59+
const versionExtended: string = PackageInfo.versionExtended || PackageInfo.version // package version
60+
61+
ctx.body = `window.__meteor_runtime_config__ = (${JSON.stringify({
62+
// @ts-expect-error missing types for internal meteor detail
63+
...__meteor_runtime_config__,
64+
sofieVersionExtended: versionExtended,
65+
})})`
6066
})
6167

6268
koaApp.use(rootRouter.routes()).use(rootRouter.allowedMethods())

packages/webui/src/client/lib/Settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ const MeteorInjectedSettings: any = window.__meteor_runtime_config__
1717
if (MeteorInjectedSettings?.PUBLIC_SETTINGS) {
1818
Settings = _.extend(Settings, MeteorInjectedSettings.PUBLIC_SETTINGS)
1919
}
20+
21+
export const APP_VERSION_EXTENDED: string | undefined = MeteorInjectedSettings?.sofieVersionExtended

packages/webui/src/client/lib/lib.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export function catchError(context: string): (...errs: any[]) => void {
231231
}
232232

233233
export function hashSingleUseToken(token: string): string {
234-
// nocommit - a hack because the crypto polyfill doesn't work for some reason
234+
// Future: it would be nice for this to use a better webcrypto/better library, but this works
235235
return shajs('sha1')
236236
.update(SINGLE_USE_TOKEN_SALT + token)
237237
.digest('base64')

packages/webui/src/client/ui/RundownList/RundownListFooter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TOOLTIP_DEFAULT_DELAY } from '../../lib/lib'
66
import { useTranslation } from 'react-i18next'
77
import { MeteorCall } from '../../lib/meteorApi'
88
import { NoticeLevel, Notification, NotificationCenter } from '../../lib/notifications/notifications'
9+
import { APP_VERSION_EXTENDED } from '../../lib/Settings'
910

1011
export function RundownListFooter(): JSX.Element {
1112
const { t } = useTranslation()
@@ -40,7 +41,7 @@ export function RundownListFooter(): JSX.Element {
4041
}, [])
4142

4243
const version = __APP_VERSION__ || 'UNSTABLE'
43-
const versionExtended = __APP_VERSION_EXTENDED__ || version
44+
const versionExtended = APP_VERSION_EXTENDED || version
4445

4546
return (
4647
<div className="mtl gutter version-info">

packages/webui/src/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/// <reference types="vite/client" />
22

33
declare const __APP_VERSION__: string
4-
declare const __APP_VERSION_EXTENDED__: string

packages/webui/vite.config.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default defineConfig({
5252

5353
define: {
5454
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
55-
__APP_VERSION_EXTENDED__: JSON.stringify(process.env.npm_package_version), // nocommit do this properly
5655
},
5756

5857
server: {

0 commit comments

Comments
 (0)