Browse Source

feat: add release url in upgrade page #1126

Jacky 2 weeks ago
parent
commit
725e59037d

+ 6 - 2
app/src/api/upgrade.ts

@@ -5,8 +5,6 @@ export interface RuntimeInfo {
   os: string
   arch: string
   ex_path: string
-  body: string
-  published_at: string
   cur_version: Info
   in_docker: boolean
 }
@@ -18,6 +16,12 @@ interface Info {
   short_hash: string
 }
 
+export interface ReleaseInfo extends RuntimeInfo {
+  html_url: string
+  published_at: string
+  body: string
+}
+
 const upgrade = {
   get_latest_release(channel: string) {
     return http.get('/upgrade/release', {

+ 4 - 0
app/src/language/ar/app.po

@@ -5465,6 +5465,10 @@ msgstr "عرض"
 msgid "View all notifications"
 msgstr "عرض جميع التنبيهات"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "عرض على GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "عرض رموز الاسترداد"

+ 4 - 0
app/src/language/de_DE/app.po

@@ -5548,6 +5548,10 @@ msgstr "Anzeigen"
 msgid "View all notifications"
 msgstr "Alle Benachrichtigungen anzeigen"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Auf GitHub anzeigen"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Wiederherstellungscodes anzeigen"

+ 4 - 0
app/src/language/en/app.po

@@ -5308,6 +5308,10 @@ msgstr ""
 msgid "View all notifications"
 msgstr ""
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr ""
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr ""

+ 4 - 0
app/src/language/es/app.po

@@ -5556,6 +5556,10 @@ msgstr "Ver"
 msgid "View all notifications"
 msgstr "Ver todas las notificaciones"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Ver en GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Ver códigos de recuperación"

+ 4 - 0
app/src/language/fr_FR/app.po

@@ -5564,6 +5564,10 @@ msgstr "Voir"
 msgid "View all notifications"
 msgstr "Voir toutes les notifications"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Voir sur GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Afficher les codes de récupération"

+ 4 - 0
app/src/language/ja_JP/app.po

@@ -5375,6 +5375,10 @@ msgstr "ビュー"
 msgid "View all notifications"
 msgstr "すべての通知を表示します"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "GitHubで見る"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "リカバリーコードを表示"

+ 4 - 0
app/src/language/ko_KR/app.po

@@ -5369,6 +5369,10 @@ msgstr "보기"
 msgid "View all notifications"
 msgstr "모든 알림 보기"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "GitHub에서 보기"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "복구 코드를 봅니다"

+ 4 - 0
app/src/language/messages.pot

@@ -5217,6 +5217,10 @@ msgstr ""
 msgid "View all notifications"
 msgstr ""
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr ""
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr ""

+ 4 - 0
app/src/language/pt_PT/app.po

@@ -5527,6 +5527,10 @@ msgstr "Ver"
 msgid "View all notifications"
 msgstr "Ver todas notificações"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Ver no GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Ver códigos de recuperação"

+ 4 - 0
app/src/language/ru_RU/app.po

@@ -5524,6 +5524,10 @@ msgstr "Просмотр"
 msgid "View all notifications"
 msgstr "Просмотреть все уведомления"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Посмотреть на GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Просмотреть коды восстановления"

+ 4 - 0
app/src/language/tr_TR/app.po

@@ -5524,6 +5524,10 @@ msgstr "Görüntüle"
 msgid "View all notifications"
 msgstr "Tüm bildirimleri görüntüle"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "GitHub'da Görüntüle"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Kurtarma Kodlarını Görüntüle"

+ 4 - 0
app/src/language/uk_UA/app.po

@@ -5594,6 +5594,10 @@ msgstr "Переглянути"
 msgid "View all notifications"
 msgstr "Переглянути всі сповіщення"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Переглянути на GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Переглянути коди відновлення"

+ 4 - 0
app/src/language/vi_VN/app.po

@@ -5477,6 +5477,10 @@ msgstr "Xem"
 msgid "View all notifications"
 msgstr "Xem tất cả thông báo"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "Xem trên GitHub"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "Xem mã phục hồi"

+ 5 - 1
app/src/language/zh_CN/app.po

@@ -5349,6 +5349,10 @@ msgstr "查看"
 msgid "View all notifications"
 msgstr "查看全部通知"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "在 GitHub 上查看"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "查看恢复代码"
@@ -5503,7 +5507,7 @@ msgstr "您使用的是最新版本"
 
 #: src/views/system/Upgrade.vue:180
 msgid "You can check Nginx UI upgrade at this page."
-msgstr "你可以在这个页面检查Nginx UI的升级。"
+msgstr "你可以在这个页面检查 Nginx UI 的升级。"
 
 #: src/components/SystemRestore/SystemRestoreContent.vue:339
 msgid "You can close this dialog in %{countdown} seconds"

+ 4 - 0
app/src/language/zh_TW/app.po

@@ -5355,6 +5355,10 @@ msgstr "檢視"
 msgid "View all notifications"
 msgstr "檢視所有通知"
 
+#: src/views/system/Upgrade.vue:279
+msgid "View on GitHub"
+msgstr "在 GitHub 上查看"
+
 #: src/views/preference/components/AuthSettings/RecoveryCodes.vue:134
 msgid "View Recovery Codes"
 msgstr "檢視復原代碼"

+ 1 - 1
app/src/views/config/configUtils.ts

@@ -16,4 +16,4 @@ export function isProtectedPath(name: string): boolean {
  */
 export function getProtectedDirs(): string[] {
   return [...PROTECTED_DIRS]
-} 
+}

+ 11 - 4
app/src/views/environments/list/BatchUpgrader.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import type { Environment } from '@/api/environment'
-import type { RuntimeInfo } from '@/api/upgrade'
+import type { ReleaseInfo } from '@/api/upgrade'
 import { cloneDeep } from 'lodash'
 import { marked } from 'marked'
 import upgrade from '@/api/upgrade'
@@ -14,9 +14,7 @@ const channel = ref('stable')
 const nodeNames = computed(() => nodes.value.map(v => v.name).join(', '))
 const loading = ref(false)
 
-const data = ref<RuntimeInfo>({
-  name: '',
-} as RuntimeInfo)
+const data = ref<ReleaseInfo>({} as ReleaseInfo)
 
 const modalVisible = ref(false)
 const modalClosable = ref(false)
@@ -220,7 +218,16 @@ async function performUpgrade() {
               {{ $gettext('Pre-release') }}
             </ATag>
           </h1>
+
           <div v-dompurify-html="marked.parse(data.body)" />
+
+          <a
+            v-if="data.html_url"
+            :href="data.html_url"
+            target="_blank"
+          >
+            {{ $gettext('View on GitHub') }}
+          </a>
         </div>
 
         <div class="flex justify-end">

+ 10 - 2
app/src/views/system/Upgrade.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import type { Ref } from 'vue'
-import type { RuntimeInfo } from '@/api/upgrade'
+import type { ReleaseInfo } from '@/api/upgrade'
 import dayjs from 'dayjs'
 
 import { marked } from 'marked'
@@ -10,7 +10,7 @@ import websocket from '@/lib/websocket'
 import version from '@/version.json'
 
 const route = useRoute()
-const data = ref({}) as Ref<RuntimeInfo>
+const data = ref<ReleaseInfo>({} as ReleaseInfo)
 const lastCheck = ref('')
 const loading = ref(false)
 const channel = ref('stable')
@@ -270,6 +270,14 @@ const performUpgradeBtnText = computed(() => {
 
         <h3>{{ $gettext('Release Note') }}</h3>
         <div v-dompurify-html="marked.parse(data.body)" />
+
+        <a
+          v-if="data.html_url"
+          :href="data.html_url"
+          target="_blank"
+        >
+          {{ $gettext('View on GitHub') }}
+        </a>
       </template>
     </div>
   </ACard>

+ 1 - 0
internal/version/dev_build.go

@@ -66,6 +66,7 @@ func getDevBuild() (data TRelease, err error) {
 		Type:        ReleaseTypeDev,
 		PublishedAt: commit.Commit.Committer.Date,
 		Assets:      assets,
+		HTMLURL:     fmt.Sprintf("https://github.com/0xJacky/Nginx-UI/commit/%s", commit.SHA),
 	}
 
 	return

+ 1 - 0
internal/version/release.go

@@ -30,6 +30,7 @@ type TRelease struct {
 	Body        string          `json:"body"`
 	Prerelease  bool            `json:"prerelease"`
 	Type        ReleaseType     `json:"type"`
+	HTMLURL     string          `json:"html_url"`
 	Assets      []TReleaseAsset `json:"assets"`
 }