From 8c1f89dd651a07e32afb620d309e51d0c78cfb14 Mon Sep 17 00:00:00 2001 From: baiy Date: Tue, 7 Jul 2020 14:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=9F=AD=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adapter/chrome/manifest.json | 26 ++++++++---------------- src/views/tool/qrCode.vue | 34 ++------------------------------ 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/src/adapter/chrome/manifest.json b/src/adapter/chrome/manifest.json index 84fa747..c401968 100644 --- a/src/adapter/chrome/manifest.json +++ b/src/adapter/chrome/manifest.json @@ -6,32 +6,22 @@ "offline_enabled": true, "homepage_url": "https://github.com/baiy/Ctool", "manifest_version": 2, - "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", + "content_security_policy": "script-src 'self' 'unsafe-eval' https://www.baiy.org; object-src 'self'", "browser_action": { - "default_icon": "img/icon_chrome.png", + "default_icon": "img/icon128.png", "default_title": "常用开发工具", "default_popup": "index.html" }, - "default_locale": "zh_CN", - "background": { - "scripts": ["background.js"] - }, + "options_page": "setting.html", "icons": { - "16": "img/icon_chrome.png", - "48": "img/icon_chrome.png", - "128": "img/icon_chrome.png" + "16": "img/icon128.png", + "48": "img/icon128.png", + "128": "img/icon128.png" }, "permissions": [ "clipboardWrite", "clipboardRead", - "*://get.geojs.io/*", - "*://*.baiy.org/*" + "storage" ], - "commands": { - "panel": { - "description": "打开独立工具窗口", - "global": true - } - }, "update_url": "http://clients2.google.com/service/update2/crx" -} +} \ No newline at end of file diff --git a/src/views/tool/qrCode.vue b/src/views/tool/qrCode.vue index c815500..d91ba22 100644 --- a/src/views/tool/qrCode.vue +++ b/src/views/tool/qrCode.vue @@ -21,18 +21,10 @@ - - 生成短连接 - - - 短链接API由 t.cn 提供 -
-

- 短连接:{{current.generateShortUrl}}

@@ -135,36 +127,14 @@ } let history = this.generateHistory.getValue(index) this.current.generateInput = history.input - this.current.generateIsShort = history.isShort this.generate(false) }, generate (insertHistory = true) { if (!this.current.generateInput) return - if (this.current.generateIsShort) { - if (!isUrl(this.current.generateInput)) { - return this.$Message.error('生成短连接的内容是url') - } - request({ - url: 'http://api.t.sina.com.cn/short_url/shorten.json', - data: { 'source': '2815391962', 'url_long': this.current.generateInput }, - }, (err, res, result) => { - if (err) return this.$Message.error('二维码短连接生成错误:' + err) - result = JSON.parse(result) - if (!result[0]['url_short']) { - return this.$Message.error('短连接生成错误') - } else { - this.current.generateShortUrl = result[0]['url_short'] - this.generateHandle(this.current.generateShortUrl) - } - }) - } else { - this.current.generateShortUrl = '' - this.generateHandle(this.current.generateInput) - } + this.generateHandle(this.current.generateInput) if (insertHistory) { this.generateHistory.push({ - input: this.current.generateInput, - isShort: this.current.generateIsShort, + input: this.current.generateInput }) } this.$saveToolData(this.current) -- GitLab