Skip to content

Commit

Permalink
feat(v1.4.1): 修复1.4.0新用户不能设置壁纸问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aitexiaoy committed Mar 8, 2020
1 parent 3a10f5d commit b5dc014
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Works on macOS 10.12+, and Windows 10+.

## 更新日志

> v1.4.1
- 修复新安装用户不能设置壁纸问题

> v1.4
- 修复pexels图库加载不成功问题
- 增加设置壁纸的填充方式(mac下有效)
Expand All @@ -81,6 +84,7 @@ Works on macOS 10.12+, and Windows 10+.
- 增加网页模式,网页模式下加载相关网页,并可直接在网页中可以下载图片到本地以及设置壁纸
- 增加公告展示


[历史更新](./update-log.md)


Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "strawberrywallpaper",
"version": "v1.4.0",
"version": "v1.4.1",
"author": "taoacat,流浪记",
"description": "a wallpaper app by electron",
"license": "",
Expand Down Expand Up @@ -36,14 +36,16 @@
"mac": {
"icon": "build-config/icons/icon.icns",
"target": [
"dmg"
"dmg",
"zip"
]
},
"win": {
"icon": "build-config/icons/icon.ico",
"requestedExecutionLevel": "highestAvailable",
"target": [
"nsis"
"nsis",
"zip"
]
},
"linux": {
Expand Down
6 changes: 3 additions & 3 deletions src/file/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const fs = require('fs')
const path = require('path')
const request = require('request')
const webp = require('webp-converter')
const store = require('../renderer/store')
const { md5_32: md5 } = require('../utils/md5')

/**
Expand Down Expand Up @@ -45,11 +44,12 @@ export function mkdirSync(dirname) {
* 从指定连接下图片
* @param {*} src 下载图片的绝对地址
* @param {*} sendData 发送消息
* @param {Object} userConfig 用户配置
*/
export const downloadPic = async function (src, sendData) {
export const downloadPic = async function (src, sendData, userConfig) {
return new Promise((resolve, reject) => {
// 创建文件夹
const hostdir = store.default.state.main.config.downloadImagePath
const hostdir = userConfig.downloadImagePath
// 文件名
const fileName = md5(src)
mkdirSync(hostdir)
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function ipcMainInit() {


ipcMain.on('dataWallpaper', (event, arg) => {
downloadPic(arg.downloadUrl, sendData).then((filePath) => {
downloadPic(arg.downloadUrl, sendData, arg.userConfig).then((filePath) => {
const { options } = arg
if (isMac() && options.autoSetAllScreens === false){
setCurrentWallpaper(filePath, {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/page/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export default {
const { wallpaperScale } = this.config
this.$swLoading.open(this.$refs[`image_item_${index}`][0])
const { autoSetAllScreens } = this.config
this.$ipcRenderer.send('dataWallpaper', { ...img, options: { scale: wallpaperScale, autoSetAllScreens } })
this.$ipcRenderer.send('dataWallpaper', { ...img, options: { scale: wallpaperScale, autoSetAllScreens }, userConfig: this.config })
this.currentImageBacColor = this.images[index].backgroundColor
this.currentWallpaperIndex = index
},
Expand Down
9 changes: 3 additions & 6 deletions src/renderer/page/full-window.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ export default {
progressValue: 0,
currentImageBacColor: '#ff66ff', // 进度条的颜色
currentSourceValue: '',
config: {}
config: this.$localStorage.getStore('userConfig'),
}
},
mounted() {
const config = this.$localStorage.getStore('userConfig')
this.handleNavClick(this.imageSourceType[0])
// this.webviewEventInit()
this.renderEventInit()
Expand Down Expand Up @@ -132,7 +131,8 @@ export default {
const { wallpaperScale } = this.config
this.$ipcRenderer.send('dataWallpaper', {
...data,
options: { scale: wallpaperScale, autoSetAllScreens }
options: { scale: wallpaperScale, autoSetAllScreens },
userConfig: this.config
})
}
else if (channel === 'notify'){
Expand Down Expand Up @@ -165,7 +165,6 @@ export default {
registerKeyEvent(){
document.addEventListener('keydown', (e) => {
console.log(e)
let ctrlPressed = 0
let altPressed = 0
let shiftPressed = 0
Expand All @@ -176,8 +175,6 @@ export default {
ctrlPressed = e.ctrlKey
const { shiftKey, ctrlKey, altKey, metaKey, key } = e
console.log(e)
if (webview){
// DevTools for each tab => command+Shift+I
if ((metaKey && shiftKey && key === 'i') || key === 'F12'){
Expand Down
6 changes: 1 addition & 5 deletions src/renderer/page/setter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,12 @@ export default {
version1: version, // 版本
...defaultConfig,
isMac: isMac(),
config: {},
config: this.$localStorage.getStore('userConfig'),
imageSourceType,
wallpaperScaleOptions,
}
},
beforeMount(){
this.config = this.$localStorage.getStore('userConfig')
},
mounted() {
this.$ipcRenderer.on('defaultPath', (event, arg) => {
this.config.downloadImagePath = arg
Expand Down
3 changes: 2 additions & 1 deletion user-config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export default {
emailUserName: '', // 电子邮箱账号
emailPassword: '', // 电子邮箱的授权码
baiDuTranslationAppId: '', // 百度翻译的appID
baiDuTranslationAppKey: '' // 百度翻译的appKey
baiDuTranslationAppKey: '', // 百度翻译的appKey
themoviedbAppKey: '', // themoviedb电影壁纸站的id
}

0 comments on commit b5dc014

Please sign in to comment.