From 094b83b30b896c3d4c8129ea505d6671076b6823 Mon Sep 17 00:00:00 2001 From: Molunerfinn Date: Fri, 12 Oct 2018 14:56:25 +0800 Subject: [PATCH] Changed: npm search api url --- src/main/index.js | 16 ---------------- src/main/utils/picgoCoreIPC.js | 1 - src/main/utils/uploader.js | 1 + .../components/SettingView/PicGoSetting.vue | 4 ++-- src/renderer/components/SettingView/Plugin.vue | 5 +++-- 5 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index fafb1f8..0e044e0 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -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() } }) diff --git a/src/main/utils/picgoCoreIPC.js b/src/main/utils/picgoCoreIPC.js index d36340a..60b6923 100644 --- a/src/main/utils/picgoCoreIPC.js +++ b/src/main/utils/picgoCoreIPC.js @@ -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 = [] diff --git a/src/main/utils/uploader.js b/src/main/utils/uploader.js index 6c55845..d7e6f27 100644 --- a/src/main/utils/uploader.js +++ b/src/main/utils/uploader.js @@ -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': diff --git a/src/renderer/components/SettingView/PicGoSetting.vue b/src/renderer/components/SettingView/PicGoSetting.vue index 0df9a8d..a117394 100644 --- a/src/renderer/components/SettingView/PicGoSetting.vue +++ b/src/renderer/components/SettingView/PicGoSetting.vue @@ -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 { diff --git a/src/renderer/components/SettingView/Plugin.vue b/src/renderer/components/SettingView/Plugin.vue index 9d23e49..3a17e48 100644 --- a/src/renderer/components/SettingView/Plugin.vue +++ b/src/renderer/components/SettingView/Plugin.vue @@ -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