Skip to content

Commit

Permalink
feat: v3.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Dec 17, 2021
1 parent db7db41 commit 61ee423
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 22 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file.

### v3.2.5 (2021-12-17)

**Feature**

- `HitHub` > `GitHub`
- Improve axios error infos
- Suspend `Wallpaper` service

### v3.2.4 (2021-12-17)

**Feature**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "surmon.me",
"version": "3.2.4",
"version": "3.2.5",
"description": "Surmon.me blog",
"author": {
"name": "Surmon",
Expand Down
1 change: 0 additions & 1 deletion src/components/layout/mobile/aside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@
margin-bottom: 0.5em;
border: none;
text-decoration: none;
text-transform: uppercase;
font-weight: 700;
color: $white;
Expand Down
4 changes: 3 additions & 1 deletion src/components/widget/wallpaper/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
}
onMounted(() => {
wallpaperStore.fetchPapers()
wallpaperStore.fetchPapers().catch((error) => {
console.warn(`[wallpaper] error:`, error)
})
})
return {
Expand Down
2 changes: 1 addition & 1 deletion src/language/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const langMap: I18nMap<LANGUAGE_KEYS, Language> = {
},
[LANGUAGE_KEYS.PAGE_GITHUB]: {
[Language.Zh]: '丹青阁',
[Language.En]: 'HitHub'
[Language.En]: 'GitHub'
},
[LANGUAGE_KEYS.PAGE_ARCHIVE]: {
[Language.Zh]: '万象殿',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/about/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const i18ns = {
},
TelegramGroup: {
[Language.Zh]: `加入电报群`,
[Language.En]: `Join Telegram group`
[Language.En]: `Telegram group`
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/tunnel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const handleTunnelService = (tunnelService: () => Promise<any>): RequestHandler
.then((data) => response.send(data))
.catch((error) => {
response.status(INVALID_ERROR)
response.send(error.message)
response.send(error?.message || String(error))
})
}
}
Expand Down
30 changes: 17 additions & 13 deletions src/server/tunnel/wallpaper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,22 @@ const fetchWallpapers = async (params?: WonderfulBingWallpaperOption): Promise<a
}

// 今日壁纸缓存(ZH)
const fetchZHWallpapers = () =>
fetchWallpapers({
const fetchZHWallpapers = () => {
return fetchWallpapers({
local: 'zh-CN',
host: 'cn.bing.com',
ensearch: 0
})
}

// 今日壁纸缓存(EN)
const getENWallpapers = () =>
fetchWallpapers({
const getENWallpapers = () => {
return fetchWallpapers({
local: 'en-US',
host: 'bing.com',
ensearch: 1
})
}

const fetchAllWallpapers = async (): Promise<IWallpaper> => {
const [zh, en] = await Promise.all([fetchZHWallpapers(), getENWallpapers()])
Expand All @@ -54,9 +56,9 @@ const autoUpdateData = () => {
tunnelCache.set(TunnelModule.Wallpaper, data)
})
.catch((error) => {
// 失败后 10 分钟更新一次数据
// 失败后 30 分钟更新一次数据
console.warn('[Tunnel Wallpaper]', '请求失败', error)
setTimeout(autoUpdateData, 1000 * 60 * 10)
setTimeout(autoUpdateData, 1000 * 60 * 30)
})
}

Expand All @@ -66,11 +68,13 @@ autoUpdateData()
schedule.scheduleJob('10 0 0 * * *', autoUpdateData)

export const wallpaperService = async (): Promise<any> => {
if (tunnelCache.has(TunnelModule.Wallpaper)) {
return tunnelCache.get(TunnelModule.Wallpaper)
} else {
const data = await fetchAllWallpapers()
tunnelCache.set(TunnelModule.Wallpaper, data)
return data
}
// GFW! https://www.ithome.com/0/592/920.htm
return Promise.reject(`GFW! https://www.ithome.com/0/592/920.htm`)
// if (tunnelCache.has(TunnelModule.Wallpaper)) {
// return tunnelCache.get(TunnelModule.Wallpaper)
// } else {
// const data = await fetchAllWallpapers()
// tunnelCache.set(TunnelModule.Wallpaper, data)
// return data
// }
}
5 changes: 4 additions & 1 deletion src/services/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/

import { App, Plugin, inject, readonly, reactive, computed } from 'vue'
import { getFileProxyUrl } from '/@/transforms/url'
import { UNDEFINED } from '/@/constants/value'
import { TunnelModule } from '/@/constants/tunnel'
import { getFileProxyUrl } from '/@/transforms/url'
import type { Song } from '/@/server/tunnel/music'
import tunnel from '/@/services/tunnel'

Expand Down Expand Up @@ -84,6 +85,8 @@ const createMusicPlayer = (config: PlayerConfig) => {
const currentSong = computed<Song | void>(() => {
if (state.inited && state.index !== undefined) {
return amplitude.getActiveSongMetadata()
} else {
return UNDEFINED
}
})

Expand Down
3 changes: 1 addition & 2 deletions src/services/nodepress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ nodepress.interceptors.response.use(
: {
name: errorJSON.name,
message: errorJSON.message,
code: errorJSON.code,
status: errorJSON.status,
stack: errorJSON.stack,
code: errorJSON.code,
method: errorJSON.config.method,
baseURL: errorJSON.config.baseURL,
url: errorJSON.config.url,
Expand Down

0 comments on commit 61ee423

Please sign in to comment.