Skip to content

Commit db94ebd

Browse files
committed
feat: added build code name to license page
1 parent 438bea1 commit db94ebd

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

frontend/components/License.pro.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { __ } from '@common/helpers/i18nwrap'
22
import request from '@common/helpers/request'
33
import config from '@config/config'
44
import LucideIcn from '@icons/LucideIcn'
5-
import { Badge, Button, Space } from 'antd'
5+
import { Badge, Button, Space, Typography } from 'antd'
66
import Title from 'antd/es/typography/Title'
77
import { useEffect, useRef } from 'react'
88
import { useSearchParam } from 'react-use'
@@ -23,10 +23,22 @@ const handleDeactivateLicense = async () => {
2323
window.location.reload()
2424
}
2525

26+
const getCurrentBuildCodeName = (): string | undefined => {
27+
const scripts = [...document.scripts]
28+
for (const sc of scripts) {
29+
if (sc.src.includes('bit-pi') && sc.src.includes('main')) {
30+
return sc?.src?.split('/')?.at(-1)?.replace('main', '')?.replace('.js', '')
31+
?.replaceAll('-', ' ')
32+
}
33+
}
34+
}
35+
2636
export default function License({ pluginSlug }: { pluginSlug: string }) {
2737
const aboutPlugin = pluginInfo.plugins[pluginSlug as keyof typeof pluginInfo.plugins]
2838
const licenseKey = useRef(useSearchParam('licenseKey'))
2939

40+
const buildCodeName = getCurrentBuildCodeName()
41+
3042
const {
3143
FREE_VERSION: freeVersion,
3244
IS_PRO: isLicenseConnected,
@@ -70,11 +82,12 @@ export default function License({ pluginSlug }: { pluginSlug: string }) {
7082
return (
7183
<div className="mb-12">
7284
<Title level={5}>{__('License & Activation')}</Title>
73-
85+
<Typography.Text className="mb-2 inline-block text-xs" type="secondary">
86+
{__('Build Code Name:')} {buildCodeName}
87+
</Typography.Text>
7488
<div className="mb-2">
7589
{__('Version')}: {freeVersion}
7690
</div>
77-
7891
{!hasProPlugin && (
7992
<div className="mb-2">
8093
<Space className="mb-2">
@@ -97,7 +110,6 @@ export default function License({ pluginSlug }: { pluginSlug: string }) {
97110
<CheckNewUpdate />
98111
</div>
99112
)}
100-
101113
{hasProPlugin && (
102114
<div className="mb-2">
103115
<div className="mb-2">

0 commit comments

Comments
 (0)