添加当前软件版本所对应的代码提交版本、提交时间的显示

pull/1853/head
lyswhut 2024-04-13 18:08:45 +08:00
parent b6bc545e7d
commit 9cef7e3370
11 changed files with 70 additions and 27 deletions

View File

@ -78,6 +78,7 @@ jobs:
NPM_CACHE: '%APPDATA%\npm-cache' NPM_CACHE: '%APPDATA%\npm-cache'
ELECTRON_CACHE: '%LOCALAPPDATA%\electron\Cache' ELECTRON_CACHE: '%LOCALAPPDATA%\electron\Cache'
ELECTRON_BUILDERCACHE: '%LOCALAPPDATA%\electron-builder\Cache' ELECTRON_BUILDERCACHE: '%LOCALAPPDATA%\electron-builder\Cache'
BUILD_WIN_7: 'true'
# needs: CheckCode # needs: CheckCode
steps: steps:
- name: Check out git repository - name: Check out git repository

View File

@ -5,6 +5,11 @@ const { merge } = require('webpack-merge')
const baseConfig = require('./webpack.config.base') const baseConfig = require('./webpack.config.base')
const gitInfo = {
commit_id: '',
commit_date: '',
}
module.exports = merge(baseConfig, { module.exports = merge(baseConfig, {
mode: 'development', mode: 'development',
devtool: 'eval-source-map', devtool: 'eval-source-map',
@ -18,6 +23,8 @@ module.exports = merge(baseConfig, {
__VUE_OPTIONS_API__: 'true', __VUE_OPTIONS_API__: 'true',
__VUE_PROD_DEVTOOLS__: 'false', __VUE_PROD_DEVTOOLS__: 'false',
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false', __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
COMMIT_ID: `"${gitInfo.commit_id}"`,
COMMIT_DATE: `"${gitInfo.commit_date}"`,
staticPath: `"${path.join(__dirname, '../../src/static').replace(/\\/g, '\\\\')}"`, staticPath: `"${path.join(__dirname, '../../src/static').replace(/\\/g, '\\\\')}"`,
}), }),
], ],

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const { execSync } = require('child_process')
const webpack = require('webpack') const webpack = require('webpack')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin')
@ -12,6 +13,17 @@ const buildConfig = require('../webpack-build-config')
// let whiteListedModules = ['vue', 'vue-router', 'vuex', 'vue-i18n'] // let whiteListedModules = ['vue', 'vue-router', 'vuex', 'vue-i18n']
const gitInfo = {
commit_id: '',
commit_date: '',
}
try {
if (!execSync('git status --porcelain').toString().trim() || process.env.BUILD_WIN_7) {
gitInfo.commit_id = execSync('git log -1 --pretty=format:"%H"').toString().trim()
gitInfo.commit_date = execSync('git log -1 --pretty=format:"%ad" --date=iso-strict').toString().trim()
}
} catch {}
module.exports = merge(baseConfig, { module.exports = merge(baseConfig, {
mode: 'production', mode: 'production',
@ -45,6 +57,8 @@ module.exports = merge(baseConfig, {
__VUE_OPTIONS_API__: 'true', __VUE_OPTIONS_API__: 'true',
__VUE_PROD_DEVTOOLS__: 'false', __VUE_PROD_DEVTOOLS__: 'false',
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false', __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
COMMIT_ID: `"${gitInfo.commit_id}"`,
COMMIT_DATE: `"${gitInfo.commit_date}"`,
}), }),
], ],
optimization: { optimization: {

44
package-lock.json generated
View File

@ -47,7 +47,7 @@
"@types/tunnel": "^0.0.7", "@types/tunnel": "^0.0.7",
"@types/ws": "8.5.4", "@types/ws": "8.5.4",
"@volar/vue-language-plugin-pug": "^1.6.5", "@volar/vue-language-plugin-pug": "^1.6.5",
"@vue/language-plugin-pug": "^2.0.12", "@vue/language-plugin-pug": "^2.0.13",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"browserslist": "^4.23.0", "browserslist": "^4.23.0",
"chalk": "^4.1.2", "chalk": "^4.1.2",
@ -62,7 +62,7 @@
"electron-builder": "^24.13.3", "electron-builder": "^24.13.3",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.4.733", "electron-to-chromium": "^1.4.736",
"electron-updater": "^6.1.8", "electron-updater": "^6.1.8",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
@ -3536,19 +3536,19 @@
"integrity": "sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==" "integrity": "sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA=="
}, },
"node_modules/@vue/language-plugin-pug": { "node_modules/@vue/language-plugin-pug": {
"version": "2.0.12", "version": "2.0.13",
"resolved": "https://registry.npmjs.org/@vue/language-plugin-pug/-/language-plugin-pug-2.0.12.tgz", "resolved": "https://registry.npmjs.org/@vue/language-plugin-pug/-/language-plugin-pug-2.0.13.tgz",
"integrity": "sha512-HiFztLIeH4uipd7t6SfNe3pmRpydzg6GY4kncTvskcyj7ST2ayanxlymD2N2ldH5EAyd1ekGsELHfgIMH7tboA==", "integrity": "sha512-3XlW+V8lsa1v6BV75BinWa8YZEbEGurFOll6S+YOf+2HI2SfIZLdhwJZs/8sDVbMndaqPouCSSKYk+kea46QUA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@volar/source-map": "2.2.0-alpha.7", "@volar/source-map": "2.2.0-alpha.8",
"volar-service-pug": "0.0.38" "volar-service-pug": "0.0.38"
} }
}, },
"node_modules/@vue/language-plugin-pug/node_modules/@volar/source-map": { "node_modules/@vue/language-plugin-pug/node_modules/@volar/source-map": {
"version": "2.2.0-alpha.7", "version": "2.2.0-alpha.8",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.2.0-alpha.7.tgz", "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.2.0-alpha.8.tgz",
"integrity": "sha512-iIZM2EovdEnr6mMwlsnt4ciix4xz7HSGHyUSviRaY5cii5PMXGHeUU9UDeb+xzLCx8kdk3L5J4z+ts50AhkYcg==", "integrity": "sha512-E1ZVmXFJ5DU4fWDcWHzi8OLqqReqIDwhXvIMhVdk6+VipfMVv4SkryXu7/rs4GA/GsebcRyJdaSkKBB3OAkIcA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"muggle-string": "^0.4.0" "muggle-string": "^0.4.0"
@ -7256,9 +7256,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.733", "version": "1.4.736",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.733.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.736.tgz",
"integrity": "sha512-gUI9nhI2iBGF0OaYYLKOaOtliFMl+Bt1rY7VmEjwxOxqoYLub/D9xmduPEhbw2imE6gYkJKhIE5it+KE2ulVxQ==", "integrity": "sha512-Rer6wc3ynLelKNM4lOCg7/zPQj8tPOCB2hzD32PX9wd3hgRRi9MxEbmkFCokzcEhRVMiOVLjnL9ig9cefJ+6+Q==",
"dev": true "dev": true
}, },
"node_modules/electron-updater": { "node_modules/electron-updater": {
@ -20428,19 +20428,19 @@
"integrity": "sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==" "integrity": "sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA=="
}, },
"@vue/language-plugin-pug": { "@vue/language-plugin-pug": {
"version": "2.0.12", "version": "2.0.13",
"resolved": "https://registry.npmjs.org/@vue/language-plugin-pug/-/language-plugin-pug-2.0.12.tgz", "resolved": "https://registry.npmjs.org/@vue/language-plugin-pug/-/language-plugin-pug-2.0.13.tgz",
"integrity": "sha512-HiFztLIeH4uipd7t6SfNe3pmRpydzg6GY4kncTvskcyj7ST2ayanxlymD2N2ldH5EAyd1ekGsELHfgIMH7tboA==", "integrity": "sha512-3XlW+V8lsa1v6BV75BinWa8YZEbEGurFOll6S+YOf+2HI2SfIZLdhwJZs/8sDVbMndaqPouCSSKYk+kea46QUA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@volar/source-map": "2.2.0-alpha.7", "@volar/source-map": "2.2.0-alpha.8",
"volar-service-pug": "0.0.38" "volar-service-pug": "0.0.38"
}, },
"dependencies": { "dependencies": {
"@volar/source-map": { "@volar/source-map": {
"version": "2.2.0-alpha.7", "version": "2.2.0-alpha.8",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.2.0-alpha.7.tgz", "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.2.0-alpha.8.tgz",
"integrity": "sha512-iIZM2EovdEnr6mMwlsnt4ciix4xz7HSGHyUSviRaY5cii5PMXGHeUU9UDeb+xzLCx8kdk3L5J4z+ts50AhkYcg==", "integrity": "sha512-E1ZVmXFJ5DU4fWDcWHzi8OLqqReqIDwhXvIMhVdk6+VipfMVv4SkryXu7/rs4GA/GsebcRyJdaSkKBB3OAkIcA==",
"dev": true, "dev": true,
"requires": { "requires": {
"muggle-string": "^0.4.0" "muggle-string": "^0.4.0"
@ -23275,9 +23275,9 @@
} }
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.4.733", "version": "1.4.736",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.733.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.736.tgz",
"integrity": "sha512-gUI9nhI2iBGF0OaYYLKOaOtliFMl+Bt1rY7VmEjwxOxqoYLub/D9xmduPEhbw2imE6gYkJKhIE5it+KE2ulVxQ==", "integrity": "sha512-Rer6wc3ynLelKNM4lOCg7/zPQj8tPOCB2hzD32PX9wd3hgRRi9MxEbmkFCokzcEhRVMiOVLjnL9ig9cefJ+6+Q==",
"dev": true "dev": true
}, },
"electron-updater": { "electron-updater": {

View File

@ -122,7 +122,7 @@
"@types/tunnel": "^0.0.7", "@types/tunnel": "^0.0.7",
"@types/ws": "8.5.4", "@types/ws": "8.5.4",
"@volar/vue-language-plugin-pug": "^1.6.5", "@volar/vue-language-plugin-pug": "^1.6.5",
"@vue/language-plugin-pug": "^2.0.12", "@vue/language-plugin-pug": "^2.0.13",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"browserslist": "^4.23.0", "browserslist": "^4.23.0",
"chalk": "^4.1.2", "chalk": "^4.1.2",
@ -137,7 +137,7 @@
"electron-builder": "^24.13.3", "electron-builder": "^24.13.3",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.4.733", "electron-to-chromium": "^1.4.736",
"electron-updater": "^6.1.8", "electron-updater": "^6.1.8",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",

View File

@ -4,6 +4,7 @@
- 新增在线自定义源导入功能允许通过http/https链接导入自定义源 - 新增在线自定义源导入功能允许通过http/https链接导入自定义源
- 新增HTTP开放API服务默认关闭该服务可以为第三方软件提供调用LX的能力可用API看[说明文档](https://lyswhut.github.io/lx-music-doc/desktop/open-api)#1824 - 新增HTTP开放API服务默认关闭该服务可以为第三方软件提供调用LX的能力可用API看[说明文档](https://lyswhut.github.io/lx-music-doc/desktop/open-api)#1824
- 托盘菜单新增播放、切歌、收藏控制 - 托盘菜单新增播放、切歌、收藏控制
- 添加当前软件版本所对应的代码提交版本、提交时间的显示,可到设置-版本更新查看
### 优化 ### 优化

View File

@ -560,6 +560,8 @@
"setting__sync_tip": "For how to use it, please see the \"Sync function\" section of the FAQ", "setting__sync_tip": "For how to use it, please see the \"Sync function\" section of the FAQ",
"setting__update": "Update", "setting__update": "Update",
"setting__update_checking": "Checking for updates...", "setting__update_checking": "Checking for updates...",
"setting__update_commit_date": "Submission date:",
"setting__update_commit_id": "Code version:",
"setting__update_current_label": "Current version: ", "setting__update_current_label": "Current version: ",
"setting__update_downloading": "Update is found and being downloaded...⏳", "setting__update_downloading": "Update is found and being downloaded...⏳",
"setting__update_init": "Processing update...", "setting__update_init": "Processing update...",

View File

@ -560,6 +560,8 @@
"setting__sync_tip": "使用方式请看常见问题“同步功能”部分", "setting__sync_tip": "使用方式请看常见问题“同步功能”部分",
"setting__update": "软件更新", "setting__update": "软件更新",
"setting__update_checking": "检查更新中...", "setting__update_checking": "检查更新中...",
"setting__update_commit_date": "提交日期:",
"setting__update_commit_id": "代码版本:",
"setting__update_current_label": "当前版本:", "setting__update_current_label": "当前版本:",
"setting__update_downloading": "发现新版本并在努力下载中,请稍后...⏳", "setting__update_downloading": "发现新版本并在努力下载中,请稍后...⏳",
"setting__update_init": "处理更新中...", "setting__update_init": "处理更新中...",

View File

@ -560,6 +560,8 @@
"setting__sync_tip": "使用方式請看常見問題「同步功能」部分", "setting__sync_tip": "使用方式請看常見問題「同步功能」部分",
"setting__update": "軟體更新", "setting__update": "軟體更新",
"setting__update_checking": "檢查更新中...", "setting__update_checking": "檢查更新中...",
"setting__update_commit_date": "提交日期:",
"setting__update_commit_id": "程式碼版本:",
"setting__update_current_label": "目前版本:", "setting__update_current_label": "目前版本:",
"setting__update_downloading": "發現新版本並在努力下載中,請稍後...⏳", "setting__update_downloading": "發現新版本並在努力下載中,請稍後...⏳",
"setting__update_init": "處理更新中...", "setting__update_init": "處理更新中...",

View File

@ -1,3 +1,4 @@
/* eslint-disable no-var */
import { type AppEventTypes, type KeyEventTypes } from '@renderer/event' import { type AppEventTypes, type KeyEventTypes } from '@renderer/event'
import { type MainTypes, type DownloadTypes } from '@renderer/worker/utils' import { type MainTypes, type DownloadTypes } from '@renderer/worker/utils'
import { type I18n } from '@renderer/plugins/i18n' import { type I18n } from '@renderer/plugins/i18n'
@ -93,6 +94,9 @@ declare global {
lx_handled?: boolean lx_handled?: boolean
} }
} }
var COMMIT_ID: string
var COMMIT_DATE: string
} }

View File

@ -6,9 +6,15 @@ dd
.gap-top .gap-top
base-checkbox(id="setting__update_showChangeLog" :model-value="appSetting['common.showChangeLog']" :label="$t('setting__update_show_change_log')" @update:model-value="updateSetting({'common.showChangeLog': $event})") base-checkbox(id="setting__update_showChangeLog" :model-value="appSetting['common.showChangeLog']" :label="$t('setting__update_show_change_log')" @update:model-value="updateSetting({'common.showChangeLog': $event})")
.gap-top .gap-top
.p.small .gap-top
| {{ $t('setting__update_latest_label') }}{{ versionInfo.newVersion && versionInfo.newVersion.version != '0.0.0' ? versionInfo.newVersion.version : $t('setting__update_unknown') }}
.p.small(@click="handleOpenDevTools") {{ $t('setting__update_current_label') }}{{ versionInfo.version }} .p.small(@click="handleOpenDevTools") {{ $t('setting__update_current_label') }}{{ versionInfo.version }}
.p.small(v-if="commit_id")
| {{ $t('setting__update_commit_id') }}
span.select {{ commit_id }}
.p.small(v-if="commit_date") {{ $t('setting__update_commit_date') }}{{ commit_date }}
.p.small.gap-top
| {{ $t('setting__update_latest_label') }}{{ versionInfo.newVersion && versionInfo.newVersion.version != '0.0.0' ? versionInfo.newVersion.version : $t('setting__update_unknown') }}
.p.small(v-if="downloadProgress" style="line-height: 1.5;") .p.small(v-if="downloadProgress" style="line-height: 1.5;")
| {{ $t('setting__update_downloading') }} | {{ $t('setting__update_downloading') }}
br br
@ -28,7 +34,7 @@ dd
<script> <script>
import { computed } from '@common/utils/vueTools' import { computed } from '@common/utils/vueTools'
import { versionInfo } from '@renderer/store' import { versionInfo } from '@renderer/store'
import { sizeFormate } from '@common/utils/common' import { dateFormat, sizeFormate } from '@common/utils/common'
// import { openDirInExplorer, selectDir } from '@renderer/utils' // import { openDirInExplorer, selectDir } from '@renderer/utils'
import { openDevTools } from '@renderer/utils/ipc' import { openDevTools } from '@renderer/utils/ipc'
import { useI18n } from '@renderer/plugins/i18n' import { useI18n } from '@renderer/plugins/i18n'
@ -39,6 +45,8 @@ export default {
setup() { setup() {
let lastClickTime = 0 let lastClickTime = 0
let clickNum = 0 let clickNum = 0
const commit_id = COMMIT_ID
const commit_date = dateFormat(COMMIT_DATE)
const t = useI18n() const t = useI18n()
@ -75,6 +83,8 @@ export default {
showUpdateModal, showUpdateModal,
appSetting, appSetting,
updateSetting, updateSetting,
commit_id,
commit_date,
} }
}, },
} }