From 8af8ac8fc2c576b06e01e52511a79b084ea7063a Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:27:50 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E7=A7=81=E6=9C=89=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 48 ++++++++--------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 8ab4905..83b58ad 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -4,53 +4,27 @@ on: pull_request: branches: - master + push: + branches: + - dev-private-workflow env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - release: - strategy: - matrix: - node-version: [ 14.x ] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{matrix.node-version}} - uses: actions/setup-node@v1 - with: - node-version: ${{matrix.node-version}} - - name: Detect project version - id: project_version - run: echo "::set-output name=project_version::$(node -p "require('./package.json').version")" - shell: bash - - name: Current project version - run: echo ${{ steps.project_version.outputs.project_version}} - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.project_version.outputs.project_version}} - name: SearchX ${{ steps.project_version.outputs.project_version}} - draft: true - prerelease: false - bodyFile: .github/workflows/release-note.md - token: ${{ secrets.GITHUB_TOKEN }} build: strategy: matrix: - os: [ macos-10.15, windows-2019, ubuntu-18.04 ] + os: [ ubuntu-18.04 ] node-version: [ 14.x ] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{matrix.node-version}} in ${{matrix.os}} - uses: actions/setup-node@v1 + - name: Load private files + uses: DamianReeves/write-file-action with: - node-version: ${{matrix.node-version}} - - name: Download packages - run: npm install - - name: Build project - env: - CSC_IDENTITY_AUTO_DISCOVERY: false - run: npm run electron:build + path: src/private/StatisticsApi.js + content: ${{ secrets.STATISTICS_API }} + mode: overwrite + - name: Show private files + run: cat src/private/StatisticsApi.js From cc73e6426b4fcc340916af3a9c3a3a278b824a53 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:29:02 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E8=A1=A5=E4=B8=8A=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 83b58ad..2f6fb98 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Load private files - uses: DamianReeves/write-file-action + uses: DamianReeves/write-file-action@v1.0 with: path: src/private/StatisticsApi.js content: ${{ secrets.STATISTICS_API }} From 414664fcd4815c007b94f11b6d6f42de996d2c60 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:30:33 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E6=94=B9=E6=AD=A3=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2f6fb98..9f0dc93 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -24,7 +24,7 @@ jobs: uses: DamianReeves/write-file-action@v1.0 with: path: src/private/StatisticsApi.js - content: ${{ secrets.STATISTICS_API }} - mode: overwrite + contents: ${{ secrets.STATISTICS_API }} + write-mode: overwrite - name: Show private files - run: cat src/private/StatisticsApi.js + run: cat src/private/StatisticsApi.js && ls -al From abd0b29ec6fc818b13adcdb38a794af238d63320 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:31:49 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=86=99=E5=85=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8E=E7=9A=84=E6=96=87=E4=BB=B6=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9f0dc93..cd12131 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,4 +27,4 @@ jobs: contents: ${{ secrets.STATISTICS_API }} write-mode: overwrite - name: Show private files - run: cat src/private/StatisticsApi.js && ls -al + run: cat src/private/StatisticsApi.js && ls -al src && ls -al src/private From bf9c37d7549b9b3f041a2d13710a242c0d605ec2 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:33:32 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index cd12131..a2574b1 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,4 +27,4 @@ jobs: contents: ${{ secrets.STATISTICS_API }} write-mode: overwrite - name: Show private files - run: cat src/private/StatisticsApi.js && ls -al src && ls -al src/private + run: cat src/private/StatisticsApi.js && ls -al src && ls -al src/private && echo ${{ secrets.STATISTICS_API }} From 43b24e3a73cf9a0c71c167dfedd504f808340f44 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:36:58 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 47 ++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a2574b1..0b77bcf 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -4,18 +4,39 @@ on: pull_request: branches: - master - push: - branches: - - dev-private-workflow - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + release: + strategy: + matrix: + node-version: [ 14.x ] + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{matrix.node-version}} + uses: actions/setup-node@v1 + with: + node-version: ${{matrix.node-version}} + - name: Detect project version + id: project_version + run: echo "::set-output name=project_version::$(node -p "require('./package.json').version")" + shell: bash + - name: Current project version + run: echo ${{ steps.project_version.outputs.project_version}} + - name: Create Release + id: create_release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.project_version.outputs.project_version}} + name: SearchX ${{ steps.project_version.outputs.project_version}} + draft: true + prerelease: false + bodyFile: .github/workflows/release-note.md + token: ${{ secrets.GITHUB_TOKEN }} build: strategy: matrix: - os: [ ubuntu-18.04 ] + os: [ macos-10.15, windows-2019, ubuntu-18.04 ] node-version: [ 14.x ] runs-on: ${{matrix.os}} steps: @@ -26,5 +47,13 @@ jobs: path: src/private/StatisticsApi.js contents: ${{ secrets.STATISTICS_API }} write-mode: overwrite - - name: Show private files - run: cat src/private/StatisticsApi.js && ls -al src && ls -al src/private && echo ${{ secrets.STATISTICS_API }} + - name: Use Node.js ${{matrix.node-version}} in ${{matrix.os}} + uses: actions/setup-node@v1 + with: + node-version: ${{matrix.node-version}} + - name: Download packages + run: npm install + - name: Build project + env: + CSC_IDENTITY_AUTO_DISCOVERY: false + run: npm run electron:build From dd9e92ea1aab005678d3f7f6bde99105eb8cf7d8 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:41:01 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E5=88=B01.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/store/index.js | 2 +- src/store/update-info.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b44cb82..55a61ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "searchx", "productName": "SearchX", - "version": "1.1.1", + "version": "1.1.2", "author": { "name": "lanyuanxiaoyao", "email": "lanyuanxiaoyao@gmail.com" diff --git a/src/store/index.js b/src/store/index.js index 93025b7..9ffef00 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -17,7 +17,7 @@ const store = new Vuex.Store({ state: { currentUrl: '/', statisticUrl: 'http://127.0.0.1:8080/analysis/record', - version: '1.1.1', + version: '1.1.2', sites: [], categories: {}, settings: { diff --git a/src/store/update-info.js b/src/store/update-info.js index 336233f..2f045e4 100644 --- a/src/store/update-info.js +++ b/src/store/update-info.js @@ -42,7 +42,7 @@ export default { '⚡️ 其他代码改进。', ], [ - '1.1.1', + '1.1.2', '👏 新增 score 和 other 标签。', '⚡️ 订阅页面点击标题跳转详情页面。', '⚡️ 简化规则源码显示,不显示 null 值字段。', From a06e266a1567b8c5addef6738b39dc030c91703b Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 19 Feb 2021 17:49:08 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E5=8A=A0=E4=B8=8A=20GITHUB=5FTOKEN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node.js.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 0b77bcf..84f4d85 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,6 +5,9 @@ on: branches: - master +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: release: strategy: From e16b1580bb223ce559ed220ab227823f7e926a58 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 08:59:47 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/squirrel/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/squirrel/index.js b/src/squirrel/index.js index 7191225..8eacaa8 100644 --- a/src/squirrel/index.js +++ b/src/squirrel/index.js @@ -47,7 +47,7 @@ else { squirrelWrapper.info() .then(result => console.log(result)) .catch(error => console.log(error)) -squirrelWrapper.debug('true') +squirrelWrapper.debug('false') window.squirrel = squirrelWrapper From 3db450f9ab8bb5d01d8d9b7081612c9a76316fe2 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 09:14:18 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E4=B8=8D=E5=8F=91=E9=80=81=E7=BB=9F=E8=AE=A1=E4=BF=A1?= =?UTF-8?q?=E6=81=AF,=20=E5=AE=8C=E5=96=84=E5=90=84=E4=B8=AA=E5=9C=B0?= =?UTF-8?q?=E6=96=B9=E5=AF=B9=E5=BC=80=E5=8F=91=E6=A8=A1=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.electrondev | 2 ++ .env.utoolsdev | 2 ++ package.json | 4 ++-- src/App.vue | 4 +++- src/squirrel/squirrel-web.js | 4 ++-- src/utils/utils.js | 6 +++++- 6 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .env.electrondev create mode 100644 .env.utoolsdev diff --git a/.env.electrondev b/.env.electrondev new file mode 100644 index 0000000..62ae251 --- /dev/null +++ b/.env.electrondev @@ -0,0 +1,2 @@ +VUE_APP_MODE=electron +NODE_ENV=development diff --git a/.env.utoolsdev b/.env.utoolsdev new file mode 100644 index 0000000..6167472 --- /dev/null +++ b/.env.utoolsdev @@ -0,0 +1,2 @@ +VUE_APP_MODE=utools +NODE_ENV=development diff --git a/package.json b/package.json index 55a61ee..6303178 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,11 @@ "web:serve": "node scripts/pre-build-web.js && vue-cli-service serve --mode webdev", "web:build": "node scripts/pre-build-web.js && vue-cli-service build --mode web", "web:image": "node scripts/pre-build-web.js && vue-cli-service build --mode web && /bin/bash scripts/suf-build-web.sh", - "electron:serve": "node scripts/pre-build-electron.js && vue-cli-service electron:serve --mode electron", + "electron:serve": "node scripts/pre-build-electron.js && vue-cli-service electron:serve --mode electrondev", "electron:build": "node scripts/pre-build-electron.js && vue-cli-service electron:build --mode electron", "postinstall": "electron-builder install-app-deps", "postuninstall": "electron-builder install-app-deps", - "utools:serve": "node scripts/pre-build-utools.js && vue-cli-service serve --mode utools", + "utools:serve": "node scripts/pre-build-utools.js && vue-cli-service serve --mode utoolsdev", "utools:build": "node scripts/pre-build-utools.js && vue-cli-service build --mode utools", "clear": "node scripts/clear.js" }, diff --git a/src/App.vue b/src/App.vue index b434f17..b569ba7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -60,6 +60,8 @@ import {mapGetters} from 'vuex' import {isEmpty, isNil} from 'licia'; import DevelopmentTag from '@/components/DevelopmentTag' +const isDevelopment = process.env.NODE_ENV !== 'production' + export default { name: 'App', components: { @@ -72,7 +74,7 @@ export default { } }, mounted() { - if (process.env.NODE_ENV !== 'development') { + if (!isDevelopment) { squirrel.services.checkUpdate() .then(result => { if (result.cmp < 0) { diff --git a/src/squirrel/squirrel-web.js b/src/squirrel/squirrel-web.js index 6ef49ac..5d84b33 100644 --- a/src/squirrel/squirrel-web.js +++ b/src/squirrel/squirrel-web.js @@ -3,9 +3,9 @@ import store from '@/store' import Vue from 'vue' import {isNil, base64, strToBytes} from 'licia' -const env = process.env.NODE_ENV +const isDevelopment = process.env.NODE_ENV !== 'production' -const base = env === 'development' ? 'http://localhost:10086/management' : '/management' +const base = isDevelopment ? 'http://localhost:10086/management' : '/management' window.download = async url => (await superagent.get(`${base}/simpleGet?url=${base64.encode(strToBytes(url))}`)).text window.squirrelInitialReady = async () => { diff --git a/src/utils/utils.js b/src/utils/utils.js index fa24b0d..9c34452 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2,6 +2,8 @@ import {isEmpty, isFn, isNil, isPromise} from 'licia' import Vue from 'vue' import store from '@/store' +const isDevelopment = process.env.NODE_ENV !== 'production' + export default { generateTagList(item) { let tagList = [] @@ -110,6 +112,8 @@ export default { }, // 统计埋点 statistic(path, event) { + // 如果是开发模式, 不发送统计信息 + if (isDevelopment) return let query = {} query['path'] = path if (!isNil(event)) { @@ -119,7 +123,7 @@ export default { let api = require('@/private/StatisticsApi') if (!isNil(api)) { let options = api.default.tencentApi() - .options(query) + .options(query) console.log('options', options) if (!isNil(options)) { window.statistic(options) From 71f6f881952df47582e4a05efb53a6ff6c996842 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 09:15:41 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=87=BA=E7=8E=B0=E5=9C=A8=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index e81827d..f20a980 100644 --- a/src/background.js +++ b/src/background.js @@ -119,7 +119,7 @@ app.on('ready', async () => { {label: '全选', role: 'selectall'} ] }) - if (!process.env.IS_TEST) { + if (isDevelopment) { appMenuTemplate.push({ label: '开发', submenu: [ From a410c74a8c5c6164368e03f5b188e750dac093a7 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 09:38:37 +0800 Subject: [PATCH 12/15] =?UTF-8?q?electron=20=E7=AB=AF=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0=E6=93=8D=E4=BD=9C=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public_electron/preload.js | 37 ++++++++++++++++++++---------------- public_utools/preload.js | 33 +++++++++++++++++--------------- src/squirrel/squirrel-web.js | 16 ++++++++-------- 3 files changed, 47 insertions(+), 39 deletions(-) diff --git a/public_electron/preload.js b/public_electron/preload.js index d32b486..a6e0040 100644 --- a/public_electron/preload.js +++ b/public_electron/preload.js @@ -17,17 +17,17 @@ window.isFileExists = path => fs.existsSync(path) window.singleFileSelect = () => { let paths = dialog.showOpenDialogSync({ properties: ['openFile'], - filters: [{name: 'JSON File', extensions: ['json']}] + filters: [{name: 'JSON File', extensions: ['json']}], }) if (paths && paths.length > 0) return paths[0] return '' } window.readTextFromFile = path => { return new Promise((resolve, reject) => - fs.readFile(path, {encoding: 'utf8'}, (error, data) => { - if (error) reject(error) - resolve(data) - }) + fs.readFile(path, {encoding: 'utf8'}, (error, data) => { + if (error) reject(error) + resolve(data) + }), ) } const http = url => url.indexOf('https') === 0 ? require('https') : require('http') @@ -35,16 +35,19 @@ window.readTextFromUrl = url => { return new Promise((resolve, reject) => { // console.log(url, url.indexOf('https'), http(url)) let request = http(url) - .get(url, response => { - let result = '' - response.on('data', data => result += data) - response.on('end', () => resolve(result)) - }) + .get(url, response => { + let result = '' + response.on('data', data => result += data) + response.on('end', () => resolve(result)) + }) request.on('error', e => reject(e)) }) } +const platform = require('os') + .platform() window.statistic = (options) => { - let request = require('https').request( + let request = require('https') + .request( { host: options.host, method: options.method, @@ -54,11 +57,13 @@ window.statistic = (options) => { response => { let result = '' response.on('data', data => result += data) - response.on('end', () => {}) - } - ) - request.setHeader('mode', 'desktop') - Object.keys(options.headers).forEach(key => request.setHeader(key, options.headers[key])) + response.on('end', () => { + }) + }, + ) + request.setHeader('mode', `desktop-${platform}`) + Object.keys(options.headers) + .forEach(key => request.setHeader(key, options.headers[key])) request.end() } window.openInExternal = url => shell.openExternal(url) diff --git a/public_utools/preload.js b/public_utools/preload.js index f454e87..4b03016 100644 --- a/public_utools/preload.js +++ b/public_utools/preload.js @@ -18,17 +18,17 @@ window.isFileExists = path => fs.existsSync(path) window.singleFileSelect = () => { let paths = utools.showOpenDialog({ properties: ['openFile'], - filters: [{name: 'JSON File', extensions: ['json']}] + filters: [{name: 'JSON File', extensions: ['json']}], }) if (paths && paths.length > 0) return paths[0] return '' } window.readTextFromFile = path => { return new Promise((resolve, reject) => - fs.readFile(path, {encoding: 'utf8'}, (error, data) => { - if (error) reject(error) - resolve(data) - }) + fs.readFile(path, {encoding: 'utf8'}, (error, data) => { + if (error) reject(error) + resolve(data) + }), ) } const http = url => url.indexOf('https') === 0 ? require('https') : require('http') @@ -36,16 +36,17 @@ window.readTextFromUrl = url => { return new Promise((resolve, reject) => { // console.log(url, url.indexOf('https'), http(url)) let request = http(url) - .get(url, response => { - let result = '' - response.on('data', data => result += data) - response.on('end', () => resolve(result)) - }) + .get(url, response => { + let result = '' + response.on('data', data => result += data) + response.on('end', () => resolve(result)) + }) request.on('error', e => reject(e)) }) } window.statistic = (options) => { - let request = require('https').request( + let request = require('https') + .request( { host: options.host, method: options.method, @@ -55,11 +56,13 @@ window.statistic = (options) => { response => { let result = '' response.on('data', data => result += data) - response.on('end', () => {}) - } - ) + response.on('end', () => { + }) + }, + ) request.setHeader('mode', 'utools') - Object.keys(options.headers).forEach(key => request.setHeader(key, options.headers[key])) + Object.keys(options.headers) + .forEach(key => request.setHeader(key, options.headers[key])) request.end() } window.openInExternal = url => utools.shellOpenExternal(url) diff --git a/src/squirrel/squirrel-web.js b/src/squirrel/squirrel-web.js index 5d84b33..a92f387 100644 --- a/src/squirrel/squirrel-web.js +++ b/src/squirrel/squirrel-web.js @@ -1,7 +1,7 @@ import superagent from 'superagent' import store from '@/store' import Vue from 'vue' -import {isNil, base64, strToBytes} from 'licia' +import {base64, isNil, strToBytes} from 'licia' const isDevelopment = process.env.NODE_ENV !== 'production' @@ -24,10 +24,10 @@ window.readTextFromFile = path => { window.readTextFromUrl = async url => (await superagent.get(`${base}/simpleGet?url=${base64.encode(strToBytes(url))}`)).text window.statistic = options => { superagent.get(options.url) - .set(options.headers) - .set('mode', 'web') - .then(result => console.log(result)) - .catch(error => console.log(error)) + .set(options.headers) + .set('mode', 'web') + .then(result => console.log(result)) + .catch(error => console.log(error)) } window.openInExternal = url => window.open(url) window.copyText = async text => { @@ -41,14 +41,14 @@ window.copyText = async text => { textArea.focus() textArea.select() try { - let successful = document.execCommand('copy'); + let successful = document.execCommand('copy') if (!successful) { throw new Error('Copy Failure') } } catch (err) { throw new Error('Copy Failure') } - document.body.removeChild(textArea); + document.body.removeChild(textArea) } if (!navigator.clipboard) { fallback(text) @@ -60,7 +60,7 @@ window.notify = (text, callback) => { let notify = () => { let notification = new Notification('SearchX', { body: text, - requireInteraction: !isNil(callback) + requireInteraction: !isNil(callback), }) if (!isNil(callback)) { notification.onclick = callback From 95957ea1d5d86211462feb86ecf02df9ae65341c Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 09:56:50 +0800 Subject: [PATCH 13/15] =?UTF-8?q?utools=20=E7=AB=AF=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=89=BF=E4=B8=8A=E5=90=AF=E4=B8=8B=E7=9A=84=E5=90=8D?= =?UTF-8?q?=E5=AD=97,=20=E5=8A=A0=E5=85=A5=E5=BC=80=E5=8F=91=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/pre-build-utools.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/pre-build-utools.js b/scripts/pre-build-utools.js index fc50235..b0cd0e9 100644 --- a/scripts/pre-build-utools.js +++ b/scripts/pre-build-utools.js @@ -10,7 +10,7 @@ let publicSourcePath = path.join(__dirname, '..', 'public_utools') let packageFile = fs.readFileSync(path.join(__dirname, '..', 'package.json'), {encoding: 'utf-8'}) let version = JSON.parse(packageFile)['version'] let pluginFile = JSON.stringify({ - 'pluginName': 'SearchX', + 'pluginName': 'SearchX (资源搜索)', 'author': 'lanyuanxiaoyao', 'homepage': 'https://github.com/LanyuanXiaoyao-Studio/SearchX', 'description': '海纳百川, 搜遍天下', @@ -20,7 +20,11 @@ let pluginFile = JSON.stringify({ 'preload': 'preload.js', 'pluginSetting': { 'single': true, - 'height': 580 + 'height': 580, + }, + 'development': { + 'main': 'http://127.0.0.1:8080/index.html', + 'preload': './preload.js', }, 'features': [ { @@ -31,10 +35,10 @@ let pluginFile = JSON.stringify({ 'BT', '资源搜索', '种子搜索', - 'SearchX' - ] - } - ] + 'SearchX', + ], + }, + ], }) fs.writeFileSync(`${publicPath}/plugin.json`, pluginFile) From 31c589b17e23aef1f6f0d58920c364463fd62cae Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 11:11:45 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=20y=20=E6=BB=9A=E5=8A=A8=E6=9D=A1=E7=9A=84=E6=8A=96?= =?UTF-8?q?=E5=8A=A8=20#15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/App.vue b/src/App.vue index b569ba7..a669306 100644 --- a/src/App.vue +++ b/src/App.vue @@ -168,6 +168,7 @@ export default { .sider-menu height 100% overflow-y auto + overflow-x hidden .site-icon margin-right 10px From fc8eb740b9994bf5a13d3afed128b60e96de6973 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 20 Feb 2021 11:32:47 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E8=A1=A5=E5=85=85=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-note.md | 1 + src/store/update-info.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/release-note.md b/.github/workflows/release-note.md index 2e3af01..6f76127 100644 --- a/.github/workflows/release-note.md +++ b/.github/workflows/release-note.md @@ -2,3 +2,4 @@ - 👏 新增 score 和 other 标签。 - ⚡️ 订阅页面点击标题跳转详情页面。 - ⚡️ 简化规则源码显示,不显示 null 值字段。 +- ⚡️ 修复侧边栏在 Windows 和 Linux 下出现多余的横向滚动条。 #15 diff --git a/src/store/update-info.js b/src/store/update-info.js index 2f045e4..03827ee 100644 --- a/src/store/update-info.js +++ b/src/store/update-info.js @@ -46,6 +46,7 @@ export default { '👏 新增 score 和 other 标签。', '⚡️ 订阅页面点击标题跳转详情页面。', '⚡️ 简化规则源码显示,不显示 null 值字段。', + '⚡️ 修复侧边栏在 Windows 和 Linux 下出现多余的横向滚动条。 #15', ], ], }),