Changed: npm search api url

This commit is contained in:
Molunerfinn
2018-10-12 14:56:25 +08:00
parent ea5b937c93
commit 094b83b30b
5 changed files with 6 additions and 21 deletions

View File

@@ -35,14 +35,6 @@ const miniWinURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/#mini-page`
: `file://${__dirname}/index.html#mini-page`
const uploadFailed = () => {
const notification = new Notification({
title: '上传失败',
body: '请检查你的图床配置!'
})
notification.show()
}
function createTray () {
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
tray = new Tray(menubarPic)
@@ -171,8 +163,6 @@ function createTray () {
db.read().get('uploaded').insert(item).write()
})
window.webContents.send('dragFiles', imgs)
} else {
uploadFailed()
}
})
// toggleWindow()
@@ -383,8 +373,6 @@ const uploadClipboardFiles = async () => {
})
notification.show()
}
} else {
uploadFailed()
}
}
@@ -426,8 +414,6 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
} else {
uploadFailed()
}
})
@@ -460,8 +446,6 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
} else {
uploadFailed()
}
})

View File

@@ -35,7 +35,6 @@ const handleConfigWithFunction = config => {
const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
ipcMain.on('getPluginList', event => {
console.log(CONFIG_PATH)
const picgo = new PicGo(CONFIG_PATH)
const pluginList = picgo.pluginLoader.getList()
const list = []

View File

@@ -62,6 +62,7 @@ const waitForRename = (window, id) => {
const uploader = (img, type, webContents) => {
const picgo = new PicGo(CONFIG_PATH)
picgo.config.debug = true
let input = []
switch (type) {
case 'imgFromClipboard':

View File

@@ -250,7 +250,7 @@ export default {
},
confirmKeyBinding () {
const oldKey = this.$db.read().get('settings.shortKey').value()
this.db.read().set('settings.shortKey', this.shortKey).write()
this.$db.read().set('settings.shortKey', this.shortKey).write()
this.keyBindingVisible = false
this.$electron.ipcRenderer.send('updateShortKey', oldKey)
},
@@ -261,7 +261,7 @@ export default {
confirmCustomLink () {
this.$refs.customLink.validate((valid) => {
if (valid) {
this.db.read().set('settings.customLink', this.customLink.value).write()
this.$db.read().set('settings.customLink', this.customLink.value).write()
this.customLinkVisible = false
this.$electron.ipcRenderer.send('updateCustomLink')
} else {

View File

@@ -233,9 +233,10 @@ export default {
}
},
getSearchResult: function (val) {
this.$http.get(`https://api.npms.io/v2/search?q=${val}`)
// this.$http.get(`https://api.npms.io/v2/search?q=${val}`)
this.$http.get(`https://registry.npmjs.com/-/v1/search?text=${val}`)
.then(res => {
this.pluginList = res.data.results.map(item => {
this.pluginList = res.data.objects.map(item => {
return this.handleSearchResult(item)
})
this.loading = false