mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge branch 'preview-features' into preview
This commit is contained in:
commit
2b5c1f8f84
@ -17,7 +17,7 @@ import {
|
||||
VButton,
|
||||
VIcon,
|
||||
} from '@/ui'
|
||||
import { silentCheckUpdateAndReload } from './checker'
|
||||
import { forceCheckUpdateAndReload } from './checker'
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
@ -34,7 +34,7 @@ export default Vue.extend({
|
||||
try {
|
||||
this.disabled = true
|
||||
const toast = Toast.info('正在检查更新...', '检查所有更新')
|
||||
await silentCheckUpdateAndReload()
|
||||
await forceCheckUpdateAndReload()
|
||||
toast.dismiss()
|
||||
} finally {
|
||||
this.disabled = false
|
||||
|
||||
@ -10,6 +10,7 @@ import {
|
||||
CheckSingleTypeUpdate,
|
||||
UpdateRecord,
|
||||
UpdateCheckItem,
|
||||
CheckSingleTypeUpdateConfig,
|
||||
} from './utils'
|
||||
|
||||
export const checkUpdate = async (config: CheckUpdateConfig) => {
|
||||
@ -121,17 +122,27 @@ const checkByName = (method: CheckSingleTypeUpdate) => reload(
|
||||
await method({ filterNames: itemNames, force: true })
|
||||
},
|
||||
) as (...itemNames: string[]) => Promise<void>
|
||||
export const silentCheckUpdate = async () => {
|
||||
|
||||
export const checkAllUpdate = async (config: CheckSingleTypeUpdateConfig) => {
|
||||
const { options } = getComponentSettings(name)
|
||||
console.log('[自动更新器] 开始检查更新')
|
||||
console.log(await checkComponentsUpdate({ maxCount: options.maxUpdateCount }) || '暂无组件更新')
|
||||
console.log(await checkPluginsUpdate({ maxCount: options.maxUpdateCount }) || '暂无插件更新')
|
||||
console.log(await checkStylesUpdate({ maxCount: options.maxUpdateCount }) || '暂无样式更新')
|
||||
console.log(await checkComponentsUpdate(config) || '暂无组件更新')
|
||||
console.log(await checkPluginsUpdate(config) || '暂无插件更新')
|
||||
console.log(await checkStylesUpdate(config) || '暂无样式更新')
|
||||
options.lastUpdateCheck = Number(new Date())
|
||||
options.lastInstalledVersion = meta.version
|
||||
console.log('[自动更新器] 完成更新检查')
|
||||
}
|
||||
export const silentCheckUpdate = () => checkAllUpdate({
|
||||
maxCount: getComponentSettings(name).options.maxUpdateCount,
|
||||
})
|
||||
export const silentCheckUpdateAndReload = reload(silentCheckUpdate)
|
||||
|
||||
export const forceCheckUpdate = () => checkAllUpdate({
|
||||
force: true,
|
||||
})
|
||||
export const forceCheckUpdateAndReload = reload(forceCheckUpdate)
|
||||
|
||||
export const checkComponentsByName = checkByName(checkComponentsUpdate)
|
||||
export const checkPluginsByName = checkByName(checkPluginsUpdate)
|
||||
export const checkStylesByName = checkByName(checkStylesUpdate)
|
||||
|
||||
@ -14,8 +14,9 @@ import * as checkerMethods from './checker'
|
||||
const {
|
||||
checkComponentsUpdate,
|
||||
checkLastFeature,
|
||||
forceCheckUpdate,
|
||||
forceCheckUpdateAndReload,
|
||||
silentCheckUpdate,
|
||||
silentCheckUpdateAndReload,
|
||||
} = checkerMethods
|
||||
|
||||
export const component: ComponentMetadata = {
|
||||
@ -68,8 +69,10 @@ export const component: ComponentMetadata = {
|
||||
const isDurationExceeded = duration >= options.minimumDuration
|
||||
const isVersionOutdated = new Version(meta.version)
|
||||
.greaterThan(new Version(options.lastInstalledVersion))
|
||||
if (isDurationExceeded || isVersionOutdated) {
|
||||
if (isDurationExceeded) {
|
||||
coreApis.lifeCycle.fullyLoaded(() => silentCheckUpdate())
|
||||
} else if (isVersionOutdated) {
|
||||
coreApis.lifeCycle.fullyLoaded(() => forceCheckUpdate())
|
||||
}
|
||||
|
||||
return checkerMethods
|
||||
@ -151,7 +154,7 @@ export const component: ComponentMetadata = {
|
||||
action: async () => {
|
||||
const { Toast } = await import('@/core/toast')
|
||||
const toast = Toast.info('正在检查更新...', '检查所有更新')
|
||||
await silentCheckUpdateAndReload()
|
||||
await forceCheckUpdateAndReload()
|
||||
toast.dismiss()
|
||||
},
|
||||
icon,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user