mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
🔨 Refactor: change vue-js -> vue-ts && add typos
This commit is contained in:
parent
29a55ed855
commit
b8ec879e23
@ -252,7 +252,7 @@ const createMiniWidow = () => {
|
|||||||
if (miniWindow) {
|
if (miniWindow) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
let obj: BrowserWindowOptions = {
|
let obj: IBrowserWindowOptions = {
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
show: process.platform === 'linux',
|
show: process.platform === 'linux',
|
||||||
@ -284,7 +284,7 @@ const createMiniWidow = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createSettingWindow = () => {
|
const createSettingWindow = () => {
|
||||||
const options: BrowserWindowOptions = {
|
const options: IBrowserWindowOptions = {
|
||||||
height: 450,
|
height: 450,
|
||||||
width: 800,
|
width: 800,
|
||||||
show: false,
|
show: false,
|
||||||
@ -355,7 +355,7 @@ const createMenu = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleWindow = (bounds: Bounds) => {
|
const toggleWindow = (bounds: IBounds) => {
|
||||||
if (window!.isVisible()) {
|
if (window!.isVisible()) {
|
||||||
window!.hide()
|
window!.hide()
|
||||||
} else {
|
} else {
|
||||||
@ -363,7 +363,7 @@ const toggleWindow = (bounds: Bounds) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const showWindow = (bounds: Bounds) => {
|
const showWindow = (bounds: IBounds) => {
|
||||||
window!.setPosition(bounds.x - 98 + 11, bounds.y, false)
|
window!.setPosition(bounds.x - 98 + 11, bounds.y, false)
|
||||||
window!.webContents.send('updateFiles')
|
window!.webContents.send('updateFiles')
|
||||||
window!.show()
|
window!.show()
|
||||||
@ -404,7 +404,7 @@ const uploadClipboardFiles = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadChoosedFiles = async (webContents: WebContents, files: FileWithPath[]) => {
|
const uploadChoosedFiles = async (webContents: WebContents, files: IFileWithPath[]) => {
|
||||||
const input = files.map(item => item.path)
|
const input = files.map(item => item.path)
|
||||||
const imgs = await new Uploader(input, webContents).upload()
|
const imgs = await new Uploader(input, webContents).upload()
|
||||||
if (imgs !== false) {
|
if (imgs !== false) {
|
||||||
@ -458,11 +458,11 @@ ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
|
|||||||
uploadClipboardFiles()
|
uploadClipboardFiles()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('uploadChoosedFiles', async (evt: IpcMainEvent, files: FileWithPath[]) => {
|
ipcMain.on('uploadChoosedFiles', async (evt: IpcMainEvent, files: IFileWithPath[]) => {
|
||||||
return uploadChoosedFiles(evt.sender, files)
|
return uploadChoosedFiles(evt.sender, files)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: ShortKeyConfig, oldKey: string) => {
|
ipcMain.on('updateShortKey', (evt: IpcMainEvent, item: IShortKeyConfig, oldKey: string) => {
|
||||||
shortKeyUpdater(globalShortcut, item, oldKey)
|
shortKeyUpdater(globalShortcut, item, oldKey)
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作成功',
|
title: '操作成功',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import DB from '#/datastore'
|
import DB from '#/datastore'
|
||||||
// from v2.1.2
|
// from v2.1.2
|
||||||
const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: ShortKeyConfigs | OldShortKeyConfigs) => {
|
const updateShortKeyFromVersion212 = (db: typeof DB, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
||||||
let needUpgrade = false
|
let needUpgrade = false
|
||||||
if (shortKeyConfig.upload) {
|
if (shortKeyConfig.upload) {
|
||||||
needUpgrade = true
|
needUpgrade = true
|
||||||
|
@ -12,13 +12,13 @@ const getPicBeds = (app: App) => {
|
|||||||
const picBedTypes = picgo.helper.uploader.getIdList()
|
const picBedTypes = picgo.helper.uploader.getIdList()
|
||||||
const picBedFromDB = db.get('picBed.list') || []
|
const picBedFromDB = db.get('picBed.list') || []
|
||||||
const picBeds = picBedTypes.map((item: string) => {
|
const picBeds = picBedTypes.map((item: string) => {
|
||||||
const visible = picBedFromDB.find((i: PicBedType) => i.type === item) // object or undefined
|
const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
|
||||||
return {
|
return {
|
||||||
type: item,
|
type: item,
|
||||||
name: picgo.helper.uploader.get(item).name || item,
|
name: picgo.helper.uploader.get(item).name || item,
|
||||||
visible: visible ? visible.visible : true
|
visible: visible ? visible.visible : true
|
||||||
}
|
}
|
||||||
}) as PicBedType[]
|
}) as IPicBedType[]
|
||||||
picgo.cmd.program.removeAllListeners()
|
picgo.cmd.program.removeAllListeners()
|
||||||
return picBeds
|
return picBeds
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ const shortKeyHandler = (name: string) => {
|
|||||||
/**
|
/**
|
||||||
* 用于更新快捷键绑定
|
* 用于更新快捷键绑定
|
||||||
*/
|
*/
|
||||||
const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: ShortKeyConfig, oldKey: string) => {
|
const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: IShortKeyConfig, oldKey: string) => {
|
||||||
// 如果提供了旧key,则解绑
|
// 如果提供了旧key,则解绑
|
||||||
if (oldKey) {
|
if (oldKey) {
|
||||||
globalShortcut.unregister(oldKey)
|
globalShortcut.unregister(oldKey)
|
||||||
@ -39,7 +39,7 @@ const shortKeyUpdater = (globalShortcut: GlobalShortcut, item: ShortKeyConfig, o
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化阶段的注册
|
// 初始化阶段的注册
|
||||||
const initShortKeyRegister = (globalShortcut: GlobalShortcut, shortKeys: ShortKeyConfig[]) => {
|
const initShortKeyRegister = (globalShortcut: GlobalShortcut, shortKeys: IShortKeyConfig[]) => {
|
||||||
let errorList = []
|
let errorList = []
|
||||||
for (let i in shortKeys) {
|
for (let i in shortKeys) {
|
||||||
try {
|
try {
|
||||||
|
@ -36,7 +36,7 @@ const renameURL = process.env.NODE_ENV === 'development'
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
const createRenameWindow = (win: BrowserWindow) => {
|
const createRenameWindow = (win: BrowserWindow) => {
|
||||||
let options: BrowserWindowOptions = {
|
let options: IBrowserWindowOptions = {
|
||||||
height: 175,
|
height: 175,
|
||||||
width: 300,
|
width: 300,
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -174,7 +174,7 @@ export default class extends Vue {
|
|||||||
shortKey: ShortKeyMap = {
|
shortKey: ShortKeyMap = {
|
||||||
upload: db.get('shortKey.upload')
|
upload: db.get('shortKey.upload')
|
||||||
}
|
}
|
||||||
picBed: PicBedType[] = []
|
picBed: IPicBedType[] = []
|
||||||
// for showInputBox
|
// for showInputBox
|
||||||
showInputBoxVisible = false
|
showInputBoxVisible = false
|
||||||
inputBoxValue = ''
|
inputBoxValue = ''
|
||||||
@ -276,7 +276,7 @@ export default class extends Vue {
|
|||||||
openMiniWindow () {
|
openMiniWindow () {
|
||||||
ipcRenderer.send('openMiniWindow')
|
ipcRenderer.send('openMiniWindow')
|
||||||
}
|
}
|
||||||
getPicBeds (event: IpcRendererEvent, picBeds: PicBedType[]) {
|
getPicBeds (event: IpcRendererEvent, picBeds: IPicBedType[]) {
|
||||||
this.picBed = picBeds
|
this.picBed = picBeds
|
||||||
}
|
}
|
||||||
handleInputBoxClose () {
|
handleInputBoxClose () {
|
||||||
|
@ -143,7 +143,7 @@ export default class extends Vue {
|
|||||||
UBB: 'UBB',
|
UBB: 'UBB',
|
||||||
Custom: 'Custom'
|
Custom: 'Custom'
|
||||||
}
|
}
|
||||||
picBed: PicBedType[] = []
|
picBed: IPicBedType[] = []
|
||||||
beforeRouteEnter (to: any, from: any, next: any) {
|
beforeRouteEnter (to: any, from: any, next: any) {
|
||||||
next((vm: any) => {
|
next((vm: any) => {
|
||||||
vm.getGallery()
|
vm.getGallery()
|
||||||
@ -166,7 +166,7 @@ export default class extends Vue {
|
|||||||
set filterList (val) {
|
set filterList (val) {
|
||||||
this.images = val
|
this.images = val
|
||||||
}
|
}
|
||||||
getPicBeds (event: IpcRendererEvent, picBeds: PicBedType[]) {
|
getPicBeds (event: IpcRendererEvent, picBeds: IPicBedType[]) {
|
||||||
this.picBed = picBeds
|
this.picBed = picBeds
|
||||||
}
|
}
|
||||||
getGallery () {
|
getGallery () {
|
||||||
|
@ -40,7 +40,7 @@ export default class extends Vue {
|
|||||||
screenY: number = -1
|
screenY: number = -1
|
||||||
menu: Electron.Menu | null = null
|
menu: Electron.Menu | null = null
|
||||||
os = ''
|
os = ''
|
||||||
picBed: PicBedType[] = []
|
picBed: IPicBedType[] = []
|
||||||
created () {
|
created () {
|
||||||
this.os = process.platform
|
this.os = process.platform
|
||||||
ipcRenderer.on('uploadProgress', (event: IpcRendererEvent, progress: number) => {
|
ipcRenderer.on('uploadProgress', (event: IpcRendererEvent, progress: number) => {
|
||||||
@ -90,7 +90,7 @@ export default class extends Vue {
|
|||||||
document.getElementById('file-uploader').value = ''
|
document.getElementById('file-uploader').value = ''
|
||||||
}
|
}
|
||||||
ipcSendFiles (files: FileList) {
|
ipcSendFiles (files: FileList) {
|
||||||
let sendFiles: FileWithPath[] = []
|
let sendFiles: IFileWithPath[] = []
|
||||||
Array.from(files).forEach((item, index) => {
|
Array.from(files).forEach((item, index) => {
|
||||||
let obj = {
|
let obj = {
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -283,7 +283,7 @@ export default class extends Vue {
|
|||||||
miniWindowOntop: db.get('settings.miniWindowOntop') || false,
|
miniWindowOntop: db.get('settings.miniWindowOntop') || false,
|
||||||
logLevel
|
logLevel
|
||||||
}
|
}
|
||||||
picBed: PicBedType[] = []
|
picBed: IPicBedType[] = []
|
||||||
logFileVisible = false
|
logFileVisible = false
|
||||||
keyBindingVisible = false
|
keyBindingVisible = false
|
||||||
customLinkVisible = false
|
customLinkVisible = false
|
||||||
@ -325,7 +325,7 @@ export default class extends Vue {
|
|||||||
ipcRenderer.send('getPicBeds')
|
ipcRenderer.send('getPicBeds')
|
||||||
ipcRenderer.on('getPicBeds', this.getPicBeds)
|
ipcRenderer.on('getPicBeds', this.getPicBeds)
|
||||||
}
|
}
|
||||||
getPicBeds (event: Event, picBeds: PicBedType[]) {
|
getPicBeds (event: Event, picBeds: IPicBedType[]) {
|
||||||
this.picBed = picBeds
|
this.picBed = picBeds
|
||||||
this.form.showPicBedList = this.picBed.map(item => {
|
this.form.showPicBedList = this.picBed.map(item => {
|
||||||
if (item.visible) {
|
if (item.visible) {
|
||||||
|
@ -102,13 +102,13 @@ import { ipcRenderer } from 'electron'
|
|||||||
name: 'shortcut-page'
|
name: 'shortcut-page'
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
list: ShortKeyConfig[] = []
|
list: IShortKeyConfig[] = []
|
||||||
keyBindingVisible = false
|
keyBindingVisible = false
|
||||||
shortKeyName = ''
|
shortKeyName = ''
|
||||||
shortKey = ''
|
shortKey = ''
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
created () {
|
created () {
|
||||||
const shortKeyConfig = this.$db.get('settings.shortKey') as ShortKeyConfigs
|
const shortKeyConfig = this.$db.get('settings.shortKey') as IShortKeyConfigs
|
||||||
this.list = Object.keys(shortKeyConfig).map(item => shortKeyConfig[item])
|
this.list = Object.keys(shortKeyConfig).map(item => shortKeyConfig[item])
|
||||||
}
|
}
|
||||||
@Watch('keyBindingVisible')
|
@Watch('keyBindingVisible')
|
||||||
@ -119,7 +119,7 @@ export default class extends Vue {
|
|||||||
const [origin] = item.split(':')
|
const [origin] = item.split(':')
|
||||||
return origin
|
return origin
|
||||||
}
|
}
|
||||||
toggleEnable (item: ShortKeyConfig) {
|
toggleEnable (item: IShortKeyConfig) {
|
||||||
const status = !item.enable
|
const status = !item.enable
|
||||||
item.enable = status
|
item.enable = status
|
||||||
this.$db.set(`settings.shortKey.${item.name}.enable`, status)
|
this.$db.set(`settings.shortKey.${item.name}.enable`, status)
|
||||||
|
@ -72,7 +72,7 @@ export default class extends Vue {
|
|||||||
showProgress = false
|
showProgress = false
|
||||||
showError = false
|
showError = false
|
||||||
pasteStyle = ''
|
pasteStyle = ''
|
||||||
picBed: PicBedType[] = []
|
picBed: IPicBedType[] = []
|
||||||
picBedName = ''
|
picBedName = ''
|
||||||
menu: Electron.Menu | null= null
|
menu: Electron.Menu | null= null
|
||||||
mounted () {
|
mounted () {
|
||||||
@ -122,7 +122,7 @@ export default class extends Vue {
|
|||||||
(document.getElementById('file-uploader') as HTMLInputElement).value = ''
|
(document.getElementById('file-uploader') as HTMLInputElement).value = ''
|
||||||
}
|
}
|
||||||
ipcSendFiles (files: FileList) {
|
ipcSendFiles (files: FileList) {
|
||||||
let sendFiles: FileWithPath[] = []
|
let sendFiles: IFileWithPath[] = []
|
||||||
Array.from(files).forEach((item, index) => {
|
Array.from(files).forEach((item, index) => {
|
||||||
let obj = {
|
let obj = {
|
||||||
name: item.name,
|
name: item.name,
|
||||||
@ -149,7 +149,7 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getPicBeds (event: Event, picBeds: PicBedType[]) {
|
getPicBeds (event: Event, picBeds: IPicBedType[]) {
|
||||||
this.picBed = picBeds
|
this.picBed = picBeds
|
||||||
this.getDefaultPicBed()
|
this.getDefaultPicBed()
|
||||||
}
|
}
|
||||||
|
@ -64,47 +64,43 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
mixins: [mixin],
|
|
||||||
name: 'aliyun',
|
name: 'aliyun',
|
||||||
data () {
|
mixins: [mixin]
|
||||||
return {
|
})
|
||||||
form: {
|
export default class extends Vue {
|
||||||
accessKeyId: '',
|
form: IAliYunConfig = {
|
||||||
accessKeySecret: '',
|
accessKeyId: '',
|
||||||
bucket: '',
|
accessKeySecret: '',
|
||||||
area: '',
|
bucket: '',
|
||||||
path: '',
|
area: '',
|
||||||
customUrl: ''
|
path: '',
|
||||||
}
|
customUrl: ''
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.aliyun')
|
const config = this.$db.get('picBed.aliyun') as IAliYunConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.aliyun.validate((valid) => {
|
this.$refs.aliyun.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.aliyun', this.form).write()
|
this.$db.set('picBed.aliyun', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new window.Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -56,46 +56,42 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
name: 'github',
|
name: 'github',
|
||||||
mixins: [mixin],
|
mixins: [mixin]
|
||||||
data () {
|
})
|
||||||
return {
|
export default class extends Vue {
|
||||||
form: {
|
form: IGitHubConfig = {
|
||||||
repo: '',
|
repo: '',
|
||||||
token: '',
|
token: '',
|
||||||
path: '',
|
path: '',
|
||||||
customUrl: '',
|
customUrl: '',
|
||||||
branch: ''
|
branch: ''
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.github')
|
const config = this.$db.get('picBed.github') as IGitHubConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.github.validate((valid) => {
|
this.$refs.github.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.github', this.form).write()
|
this.$db.set('picBed.github', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -36,43 +36,39 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
name: 'imgur',
|
name: 'imgur',
|
||||||
mixins: [mixin],
|
mixins: [mixin]
|
||||||
data () {
|
})
|
||||||
return {
|
export default class extends Vue {
|
||||||
form: {
|
form: IImgurConfig = {
|
||||||
clientId: '',
|
clientId: '',
|
||||||
proxy: ''
|
proxy: ''
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.imgur')
|
const config = this.$db.get('picBed.imgur') as IImgurConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.imgur.validate((valid) => {
|
this.$refs.imgur.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.imgur', this.form).write()
|
this.$db.set('picBed.imgur', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -27,57 +27,61 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
import ConfigForm from '@/components/ConfigForm'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
|
import ConfigForm from '@/components/ConfigForm.vue'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
import {
|
||||||
|
ipcRenderer,
|
||||||
|
IpcRendererEvent
|
||||||
|
} from 'electron'
|
||||||
|
|
||||||
|
@Component({
|
||||||
name: 'OtherPicBed',
|
name: 'OtherPicBed',
|
||||||
mixins: [mixin],
|
mixins: [mixin],
|
||||||
components: {
|
components: {
|
||||||
ConfigForm
|
ConfigForm
|
||||||
},
|
}
|
||||||
data () {
|
})
|
||||||
return {
|
export default class extends Vue {
|
||||||
type: '',
|
type: string = ''
|
||||||
config: [],
|
config: any[] = []
|
||||||
picBedName: ''
|
picBedName: string = ''
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
this.type = this.$route.params.type
|
this.type = this.$route.params.type
|
||||||
this.$electron.ipcRenderer.send('getPicBedConfig', this.$route.params.type)
|
ipcRenderer.send('getPicBedConfig', this.$route.params.type)
|
||||||
this.$electron.ipcRenderer.on('getPicBedConfig', this.getPicBeds)
|
ipcRenderer.on('getPicBedConfig', this.getPicBeds)
|
||||||
},
|
}
|
||||||
methods: {
|
async handleConfirm () {
|
||||||
async handleConfirm () {
|
// @ts-ignore
|
||||||
const result = await this.$refs.configForm.validate()
|
const result = await this.$refs.configForm.validate()
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
this.$db.set(`picBed.${this.type}`, result)
|
this.$db.set(`picBed.${this.type}`, result)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new Notification('设置结果', {
|
||||||
body: '设置成功'
|
|
||||||
})
|
|
||||||
successNotification.onclick = () => {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setDefaultPicBed (type) {
|
|
||||||
this.$db.set('picBed.current', type)
|
|
||||||
this.defaultPicBed = type
|
|
||||||
const successNotification = new window.Notification('设置默认图床', {
|
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
getPicBeds (event, config, name) {
|
|
||||||
this.config = config
|
|
||||||
this.picBedName = name
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
setDefaultPicBed (type: string) {
|
||||||
|
this.$db.set('picBed.current', type)
|
||||||
|
// @ts-ignore 来自mixin的数据
|
||||||
|
this.defaultPicBed = type
|
||||||
|
const successNotification = new Notification('设置默认图床', {
|
||||||
|
body: '设置成功'
|
||||||
|
})
|
||||||
|
successNotification.onclick = () => {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getPicBeds (event: IpcRendererEvent, config: any[], name: string) {
|
||||||
|
this.config = config
|
||||||
|
this.picBedName = name
|
||||||
|
}
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.$electron.ipcRenderer.removeListener('getPicBedConfig', this.getPicBeds)
|
ipcRenderer.removeListener('getPicBedConfig', this.getPicBeds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -71,48 +71,44 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
mixins: [mixin],
|
|
||||||
name: 'qiniu',
|
name: 'qiniu',
|
||||||
data () {
|
mixins: [mixin]
|
||||||
return {
|
})
|
||||||
form: {
|
export default class extends Vue {
|
||||||
accessKey: '',
|
form: IQiniuConfig = {
|
||||||
secretKey: '',
|
accessKey: '',
|
||||||
bucket: '',
|
secretKey: '',
|
||||||
url: '',
|
bucket: '',
|
||||||
area: '',
|
url: '',
|
||||||
options: '',
|
area: '',
|
||||||
path: ''
|
options: '',
|
||||||
}
|
path: ''
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.qiniu')
|
const config = this.$db.get('picBed.qiniu') as IQiniuConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.qiniu.validate((valid) => {
|
this.$refs.qiniu.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.qiniu', this.form).write()
|
this.$db.set('picBed.qiniu', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,24 +15,23 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
mixins: [mixin],
|
name: 'smms',
|
||||||
name: 'upyun',
|
mixins: [mixin]
|
||||||
data () {
|
})
|
||||||
return {}
|
export default class extends Vue {
|
||||||
},
|
confirm () {
|
||||||
methods: {
|
this.$db.set('picBed.smms', true)
|
||||||
confirm () {
|
// @ts-ignore 来自mixin
|
||||||
this.$db.set('picBed.smms', true).write()
|
this.setDefaultPicBed('smms')
|
||||||
this.setDefaultPicBed('smms')
|
const successNotification = new window.Notification('设置结果', {
|
||||||
const successNotification = new window.Notification('设置结果', {
|
body: '设置成功'
|
||||||
body: '设置成功'
|
})
|
||||||
})
|
successNotification.onclick = () => {
|
||||||
successNotification.onclick = () => {
|
return true
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,52 +85,49 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
import { remote } from 'electron'
|
||||||
mixins: [mixin],
|
@Component({
|
||||||
name: 'tcyun',
|
name: 'tcyun',
|
||||||
data () {
|
mixins: [mixin]
|
||||||
return {
|
})
|
||||||
form: {
|
export default class extends Vue {
|
||||||
secretId: '',
|
form: ITcYunConfig = {
|
||||||
secretKey: '',
|
secretId: '',
|
||||||
bucket: '',
|
secretKey: '',
|
||||||
appId: '',
|
bucket: '',
|
||||||
area: '',
|
appId: '',
|
||||||
path: '',
|
area: '',
|
||||||
customUrl: '',
|
path: '',
|
||||||
version: 'v4'
|
customUrl: '',
|
||||||
}
|
version: 'v4'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.tcyun')
|
const config = this.$db.get('picBed.tcyun') as ITcYunConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.tcyun.validate((valid) => {
|
this.$refs.tcyun.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.tcyun', this.form).write()
|
this.$db.set('picBed.tcyun', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new window.Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
},
|
return false
|
||||||
openWiki () {
|
}
|
||||||
this.$electron.remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#腾讯云cos')
|
})
|
||||||
}
|
}
|
||||||
|
openWiki () {
|
||||||
|
remote.shell.openExternal('https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#腾讯云cos')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -64,46 +64,42 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import mixin from '@/utils/ConfirmButtonMixin'
|
import mixin from '@/utils/ConfirmButtonMixin'
|
||||||
export default {
|
@Component({
|
||||||
name: 'upyun',
|
name: 'upyun',
|
||||||
mixins: [mixin],
|
mixins: [mixin]
|
||||||
data () {
|
})
|
||||||
return {
|
export default class extends Vue {
|
||||||
form: {
|
form: IUpYunConfig = {
|
||||||
bucket: '',
|
bucket: '',
|
||||||
operator: '',
|
operator: '',
|
||||||
password: '',
|
password: '',
|
||||||
options: '',
|
options: '',
|
||||||
path: ''
|
path: ''
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
const config = this.$db.get('picBed.upyun')
|
const config = this.$db.get('picBed.upyun') as IUpYunConfig
|
||||||
if (config) {
|
if (config) {
|
||||||
for (let i in config) {
|
this.form = Object.assign({}, config)
|
||||||
this.form[i] = config[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
confirm () {
|
||||||
confirm () {
|
// @ts-ignore
|
||||||
this.$refs.tcyun.validate((valid) => {
|
this.$refs.tcyun.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$db.set('picBed.upyun', this.form).write()
|
this.$db.set('picBed.upyun', this.form)
|
||||||
const successNotification = new window.Notification('设置结果', {
|
const successNotification = new Notification('设置结果', {
|
||||||
body: '设置成功'
|
body: '设置成功'
|
||||||
})
|
})
|
||||||
successNotification.onclick = () => {
|
successNotification.onclick = () => {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col :span="16" :offset="4">
|
<el-col :span="16" :offset="4">
|
||||||
<div class="view-title">
|
<div class="view-title">
|
||||||
微博图床设置
|
微博图床设置[已停止支持]
|
||||||
</div>
|
</div>
|
||||||
<el-form
|
<el-form
|
||||||
ref="weiboForm"
|
ref="weiboForm"
|
||||||
|
69
src/universal/types/types.d.ts
vendored
69
src/universal/types/types.d.ts
vendored
@ -19,30 +19,30 @@ interface ImgInfo {
|
|||||||
[propName: string]: any
|
[propName: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PicBedType {
|
interface IPicBedType {
|
||||||
type: string
|
type: string
|
||||||
name: string
|
name: string
|
||||||
visible: boolean
|
visible: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config Settings
|
// Config Settings
|
||||||
interface ShortKeyConfig {
|
interface IShortKeyConfig {
|
||||||
enable: boolean
|
enable: boolean
|
||||||
key: string // 按键
|
key: string // 按键
|
||||||
name: string
|
name: string
|
||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ShortKeyConfigs {
|
interface IShortKeyConfigs {
|
||||||
[propName: string]: ShortKeyConfig
|
[propName: string]: IShortKeyConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OldShortKeyConfigs {
|
interface IOldShortKeyConfigs {
|
||||||
upload: string
|
upload: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main process
|
// Main process
|
||||||
interface BrowserWindowOptions {
|
interface IBrowserWindowOptions {
|
||||||
height: number,
|
height: number,
|
||||||
width: number,
|
width: number,
|
||||||
show: boolean,
|
show: boolean,
|
||||||
@ -67,12 +67,12 @@ interface BrowserWindowOptions {
|
|||||||
alwaysOnTop?: boolean
|
alwaysOnTop?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileWithPath {
|
interface IFileWithPath {
|
||||||
path: string
|
path: string
|
||||||
name?: string
|
name?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Bounds {
|
interface IBounds {
|
||||||
x: number
|
x: number
|
||||||
y: number
|
y: number
|
||||||
}
|
}
|
||||||
@ -140,3 +140,56 @@ interface IShowInputBoxOption {
|
|||||||
title: string
|
title: string
|
||||||
placeholder: string
|
placeholder: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PicBeds
|
||||||
|
|
||||||
|
interface IAliYunConfig {
|
||||||
|
accessKeyId: string
|
||||||
|
accessKeySecret: string,
|
||||||
|
bucket: string,
|
||||||
|
area: string,
|
||||||
|
path: string,
|
||||||
|
customUrl: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGitHubConfig {
|
||||||
|
repo: string,
|
||||||
|
token: string,
|
||||||
|
path: string,
|
||||||
|
customUrl: string,
|
||||||
|
branch: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IImgurConfig {
|
||||||
|
clientId: string,
|
||||||
|
proxy: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IQiniuConfig {
|
||||||
|
accessKey: string,
|
||||||
|
secretKey: string,
|
||||||
|
bucket: string,
|
||||||
|
url: string,
|
||||||
|
area: string,
|
||||||
|
options: string,
|
||||||
|
path: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ITcYunConfig {
|
||||||
|
secretId: string,
|
||||||
|
secretKey: string,
|
||||||
|
bucket: string,
|
||||||
|
appId: string,
|
||||||
|
area: string,
|
||||||
|
path: string,
|
||||||
|
customUrl: string,
|
||||||
|
version: 'v4' | 'v5'
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUpYunConfig {
|
||||||
|
bucket: string,
|
||||||
|
operator: string,
|
||||||
|
password: string,
|
||||||
|
options: string,
|
||||||
|
path: string
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user