✨ Added display of updated version content.

This commit is contained in:
刘嘉伟 committed 2026-03-17 17:36:47 +08:00
1 parent 6dc2c9d7b5
commit 9f8aa570af
6 files changed
+29 -6

No files matched your search

+2 -1
View File
@@ -166,13 +166,14 @@ func (s *Service) GetAppVersion() string {
type LatestVersionResponse struct {
TagName string `json:"tag_name"`
HTMLURL string `json:"html_url"`
Body string `json:"body"`
}
// GetLatestVersion fetches the latest podux release from GitHub.
func (s *Service) GetLatestVersion() (*LatestVersionResponse, error) {
client := &http.Client{Timeout: 10 * time.Second}
req, err := http.NewRequest("GET", "https://api.github.com/repos/luckjiawei/podux/releases/latest", nil)
req, err := http.NewRequest("GET", "https://ghp.podux.io/repos/luckjiawei/podux/releases/latest", nil)
if err != nil {
return nil, err
}
+1 -1
View File
@@ -2,4 +2,4 @@ package buildinfo
// AppVersion is the single source of truth for the application version.
// Update this value to release a new version.
const AppVersion = "0.1.2"
const AppVersion = "0.1.3"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "podux-web",
"private": true,
"version": "0.1.2",
"version": "0.1.3",
"type": "module",
"scripts": {
"dev": "vite",
+21 -1
View File
@@ -83,6 +83,7 @@ export function MainLayout({ children }: MainLayoutProps) {
const [appVersion, setAppVersion] = useState<string>("");
const [latestVersion, setLatestVersion] = useState<string>("");
const [releaseUrl, setReleaseUrl] = useState<string>("");
const [releaseBody, setReleaseBody] = useState<string>("");
const updateAvailable = appVersion && latestVersion ? isNewerVersion(latestVersion, appVersion) : false;
useEffect(() => {
@@ -96,6 +97,7 @@ export function MainLayout({ children }: MainLayoutProps) {
.then((data) => {
if (data.tag_name) setLatestVersion(data.tag_name);
if (data.html_url) setReleaseUrl(data.html_url);
if (data.body) setReleaseBody(data.body);
})
.catch(() => {});
}, []);
@@ -222,7 +224,7 @@ export function MainLayout({ children }: MainLayoutProps) {
/>
</motion.div>
</Popover.Trigger>
<Popover.Content style={{ maxWidth: 280 }}>
<Popover.Content style={{ maxWidth: 320 }}>
<Flex direction="column" gap="3">
<Flex align="center" gap="2">
<Icon icon="lucide:package" width="16" height="16" style={{ color: "var(--amber-11)" }} />
@@ -240,6 +242,24 @@ export function MainLayout({ children }: MainLayoutProps) {
<Text size="1" weight="medium" style={{ color: "var(--amber-11)" }}>{latestVersion}</Text>
</Flex>
</Flex>
{releaseBody && (
<Flex direction="column" gap="1">
<Text size="1" color="gray" weight="medium">{t("version.releaseNotes")}</Text>
<Box
style={{
maxHeight: 160,
overflowY: "auto",
backgroundColor: "var(--gray-a2)",
borderRadius: "var(--radius-2)",
padding: "8px",
}}
>
<Text size="1" style={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}>
{releaseBody}
</Text>
</Box>
</Flex>
)}
{releaseUrl && (
<a href={releaseUrl} target="_blank" rel="noopener noreferrer" className="no-underline">
<Flex
+2 -1
View File
@@ -391,7 +391,8 @@
"checkUpdate": "Check for Updates",
"upToDate": "You are up to date",
"updateAvailable": "Update Available",
"updateNow": "View Release"
"updateNow": "View Release",
"releaseNotes": "Release Notes"
},
"import": {
"title": "Import",
+2 -1
View File
@@ -391,7 +391,8 @@
"checkUpdate": "检查更新",
"upToDate": "已是最新版本",
"updateAvailable": "有可用更新",
"updateNow": "查看发布"
"updateNow": "查看发布",
"releaseNotes": "更新内容"
},
"import": {
"title": "导入",