Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: generator add reviosn

shuai5361f4e12710
diff --git a/ui/src/common/interface.ts b/ui/src/common/interface.ts
index cb6b63e3..640efcaa 100644
--- a/ui/src/common/interface.ts
+++ b/ui/src/common/interface.ts
@@ -328,6 +328,7 @@ export interface SiteSettings {
theme: AdminSettingsTheme;
site_seo: AdminSettingsSeo;
version: string;
+ revision: string;
}
export interface AdminSettingBranding {
diff --git a/ui/src/components/PageTags/index.tsx b/ui/src/components/PageTags/index.tsx
index 4f663ac1..bd6d02a4 100644
--- a/ui/src/components/PageTags/index.tsx
+++ b/ui/src/components/PageTags/index.tsx
@@ -11,6 +11,7 @@ const Index: FC = () => {
(state) => state.items,
);
const appVersion = siteInfoStore((_) => _.version);
+ const hashVersion = siteInfoStore((_) => _.revision);
const setAppGenerator = () => {
if (!appVersion) {
return;
@@ -19,7 +20,7 @@ const Index: FC = () => {
if (generatorMetaNode) {
generatorMetaNode.setAttribute(
'content',
- `Answer ${appVersion} - https://github.com/answerdev/answer`,
+ `Answer ${appVersion} - https://github.com/answerdev/answer version ${hashVersion}`,
);
}
};
diff --git a/ui/src/stores/siteInfo.ts b/ui/src/stores/siteInfo.ts
index 26c5321b..1072501a 100644
--- a/ui/src/stores/siteInfo.ts
+++ b/ui/src/stores/siteInfo.ts
@@ -6,8 +6,9 @@ import { DEFAULT_SITE_NAME } from '@/common/constants';
interface SiteInfoType {
siteInfo: AdminSettingsGeneral;
version: string;
+ revision: string;
update: (params: AdminSettingsGeneral) => void;
- updateVersion: (ver: string) => void;
+ updateVersion: (ver: string, revision: string) => void;
}
const siteInfo = create<SiteInfoType>((set) => ({
@@ -20,6 +21,7 @@ const siteInfo = create<SiteInfoType>((set) => ({
permalink: 1,
},
version: '',
+ revision: '',
update: (params) =>
set((_) => {
const o = { ..._.siteInfo, ...params };
@@ -30,9 +32,9 @@ const siteInfo = create<SiteInfoType>((set) => ({
siteInfo: o,
};
}),
- updateVersion: (ver) => {
+ updateVersion: (ver, revision) => {
set(() => {
- return { version: ver };
+ return { version: ver, revision };
});
},
}));
diff --git a/ui/src/utils/guard.ts b/ui/src/utils/guard.ts
index 5ff081af..fee55094 100644
--- a/ui/src/utils/guard.ts
+++ b/ui/src/utils/guard.ts
@@ -302,7 +302,9 @@ export const initAppSettingsStore = async () => {
const appSettings = await getAppSettings();
if (appSettings) {
siteInfoStore.getState().update(appSettings.general);
- siteInfoStore.getState().updateVersion(appSettings.version);
+ siteInfoStore
+ .getState()
+ .updateVersion(appSettings.version, appSettings.revision);
interfaceStore.getState().update(appSettings.interface);
brandingStore.getState().update(appSettings.branding);
loginSettingStore.getState().update(appSettings.login);