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
-16
View File
@@ -35,14 +35,6 @@ const miniWinURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/#mini-page` ? `http://localhost:9080/#mini-page`
: `file://${__dirname}/index.html#mini-page` : `file://${__dirname}/index.html#mini-page`
const uploadFailed = () => {
const notification = new Notification({
title: '上传失败',
body: '请检查你的图床配置!'
})
notification.show()
}
function createTray () { function createTray () {
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png` const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
tray = new Tray(menubarPic) tray = new Tray(menubarPic)
@@ -171,8 +163,6 @@ function createTray () {
db.read().get('uploaded').insert(item).write() db.read().get('uploaded').insert(item).write()
}) })
window.webContents.send('dragFiles', imgs) window.webContents.send('dragFiles', imgs)
} else {
uploadFailed()
} }
}) })
// toggleWindow() // toggleWindow()
@@ -383,8 +373,6 @@ const uploadClipboardFiles = async () => {
}) })
notification.show() notification.show()
} }
} else {
uploadFailed()
} }
} }
@@ -426,8 +414,6 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
if (settingWindow) { if (settingWindow) {
settingWindow.webContents.send('updateGallery') settingWindow.webContents.send('updateGallery')
} }
} else {
uploadFailed()
} }
}) })
@@ -460,8 +446,6 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
if (settingWindow) { if (settingWindow) {
settingWindow.webContents.send('updateGallery') settingWindow.webContents.send('updateGallery')
} }
} else {
uploadFailed()
} }
}) })
-1
View File
@@ -35,7 +35,6 @@ const handleConfigWithFunction = config => {
const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => { const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
ipcMain.on('getPluginList', event => { ipcMain.on('getPluginList', event => {
console.log(CONFIG_PATH)
const picgo = new PicGo(CONFIG_PATH) const picgo = new PicGo(CONFIG_PATH)
const pluginList = picgo.pluginLoader.getList() const pluginList = picgo.pluginLoader.getList()
const list = [] const list = []
+1
View File
@@ -62,6 +62,7 @@ const waitForRename = (window, id) => {
const uploader = (img, type, webContents) => { const uploader = (img, type, webContents) => {
const picgo = new PicGo(CONFIG_PATH) const picgo = new PicGo(CONFIG_PATH)
picgo.config.debug = true
let input = [] let input = []
switch (type) { switch (type) {
case 'imgFromClipboard': case 'imgFromClipboard':
@@ -250,7 +250,7 @@ export default {
}, },
confirmKeyBinding () { confirmKeyBinding () {
const oldKey = this.$db.read().get('settings.shortKey').value() 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.keyBindingVisible = false
this.$electron.ipcRenderer.send('updateShortKey', oldKey) this.$electron.ipcRenderer.send('updateShortKey', oldKey)
}, },
@@ -261,7 +261,7 @@ export default {
confirmCustomLink () { confirmCustomLink () {
this.$refs.customLink.validate((valid) => { this.$refs.customLink.validate((valid) => {
if (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.customLinkVisible = false
this.$electron.ipcRenderer.send('updateCustomLink') this.$electron.ipcRenderer.send('updateCustomLink')
} else { } else {
@@ -233,9 +233,10 @@ export default {
} }
}, },
getSearchResult: function (val) { 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 => { .then(res => {
this.pluginList = res.data.results.map(item => { this.pluginList = res.data.objects.map(item => {
return this.handleSearchResult(item) return this.handleSearchResult(item)
}) })
this.loading = false this.loading = false