diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..6575a36 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# CONTRIBUTING + +> First off, thank you for considering contributing to electerm-web. + +> electerm-web is an open source project and I love to receive contributions from our community — you! There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into electerm-web itself. + +> Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). + +Basic process: + +> 1. Create your own fork of the code +> 2. Do the changes in your fork +> 3. If you like the change and think the project could use it: + * Be sure you have followed the code style for the project by running `npm run lint`. + * Send a pull request + +> Want to report a issue or give some suggestions? +[Submit a issue](https://github.com/electerm/electerm-web/issues/new) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..2237214 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: electerm +open_collective: electerm +custom: https://paypal.me/zhaoxudongPS \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..62fdb13 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1 @@ +## 👉 [Please follow one of these issue templates](https://github.com/electerm/electerm-web/issues/new/choose) 👈 diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml new file mode 100644 index 0000000..8f5d1b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -0,0 +1,53 @@ +name: "\U0001F41B Bug report(提交bug)" +description: Create a report to help us improve +body: + - type: markdown + attributes: + value: | + Thank you for reporting an issue. + + This issue tracker is for bugs and issues found within electerm-web. + If you require more general support please start a discussion on our discussion board https://github.com/electerm/electerm-web/discussions + + Please fill in as much of the form below as you're able. + + Before continue, make sure you are using the latest release: check https://github.com/electerm/electerm-web/releases for latest release, also please + + 仅用来追踪bug, 如果有其他的讨论请移步讨论区 https://github.com/electerm/electerm-web/discussions, 请务必确保问题是基于最新版本: https://github.com/electerm/electerm-web/releases + + - type: input + attributes: + label: electerm-web Version and download file extension(electerm-web版本和下载文件后缀) + description: | + - electerm-web-xx.xx.xx-win-x64.tar.gz + validations: + required: true + - type: input + attributes: + label: Platform detail (平台详情) + description: | + windows 7/8/10/11, mac os(ARM or x64), or linux + UNIX: output of `uname -a` + Windows: output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in PowerShell console + validations: + required: true + - type: textarea + attributes: + label: What steps will reproduce the bug?(重新问题的详细步骤) + description: Enter details about your bug, preferably a simple code snippet that can be run using `node` directly without installing third-party dependencies. + validations: + required: true + - type: textarea + attributes: + label: What should have happened?(期望的结果) + description: If possible please provide screenshots. + validations: + required: true + - type: textarea + attributes: + label: Would this happen in other terminal app(是否能够在其他同类软件重现这个问题) + description: really important. + - type: textarea + attributes: + label: Additional information(其他任何相关信息) + description: Tell us anything else you think we should know. diff --git a/.github/ISSUE_TEMPLATE/2-proposal.yml b/.github/ISSUE_TEMPLATE/2-proposal.yml new file mode 100644 index 0000000..38dfeb7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-proposal.yml @@ -0,0 +1,10 @@ +name: "💥 Proposal / Feature (建议和新功能)" +description: Propose a non-trivial change or new feature for electerm-web +body: + - type: textarea + attributes: + label: What feature you'd like to see or proposal(期望什么新功能/特性或者建议) + description: A clear and concise description of what the proposal or feature is.(请尽可能详细描述,以便帮助其他人能够理解) + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..197d67e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: ⁉️ Need help with electerm-web? + url: https://github.com/electerm/electerm-web/discussions + about: Please start a discussion before opening a bug. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1230149 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/mac-test-1.yml b/.github/workflows/mac-test-1.yml new file mode 100644 index 0000000..f8a92fa --- /dev/null +++ b/.github/workflows/mac-test-1.yml @@ -0,0 +1,47 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: mac-test-1 + +on: + push: + branches: [ build, test ] + +jobs: + build: + + runs-on: macos-11 + environment: build + if: "!contains(github.event.head_commit.message, '[skip test]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip test2]')" + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: 18.x + + # before_install: + - run: npm i + - run: npx playwright install chromium + # script: + - run: npm run build + - run: cp .sampe.env .env + + - name: test + uses: GabrielBB/xvfb-action@v1 + with: + run: npm run test1 + env: + NODE_TEST: 1 + TEST_HOST: ${{ secrets.TEST_HOST }} + TEST_USER: ${{ secrets.TEST_USER_DARWIN }} + TEST_PASS: ${{ secrets.TEST_PASS_DARWIN }} + GIST_TOKEN: ${{ secrets.GIST_TOKEN }} + GIST_ID: ${{ secrets.GIST_ID }} + GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} + GITEE_ID: ${{ secrets.GITEE_ID }} + CUSTOM_SYNC_URL: ${{ secrets.CUSTOM_SYNC_URL }} + CUSTOM_SYNC_USER: ${{ secrets.CUSTOM_SYNC_USER }} + CUSTOM_SYNC_SECRET: ${{ secrets.CUSTOM_SYNC_SECRET }} + diff --git a/.github/workflows/mac-test-2.yml b/.github/workflows/mac-test-2.yml new file mode 100644 index 0000000..465a8a2 --- /dev/null +++ b/.github/workflows/mac-test-2.yml @@ -0,0 +1,47 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: mac-test-2 + +on: + push: + branches: [ build, test ] + +jobs: + build: + + runs-on: macos-11 + environment: build + if: "!contains(github.event.head_commit.message, '[skip test]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip test2]')" + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: 18.x + + # before_install: + - run: npm i + - run: npx playwright install chromium + # script: + - run: npm run build + - run: cp .sampe.env .env + + - name: test + uses: GabrielBB/xvfb-action@v1 + with: + run: npm run test2 && npm run test3 + env: + NODE_TEST: 1 + TEST_HOST: ${{ secrets.TEST_HOST }} + TEST_USER: ${{ secrets.TEST_USER_DARWIN }} + TEST_PASS: ${{ secrets.TEST_PASS_DARWIN }} + GIST_TOKEN: ${{ secrets.GIST_TOKEN }} + GIST_ID: ${{ secrets.GIST_ID }} + GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} + GITEE_ID: ${{ secrets.GITEE_ID }} + CUSTOM_SYNC_URL: ${{ secrets.CUSTOM_SYNC_URL }} + CUSTOM_SYNC_USER: ${{ secrets.CUSTOM_SYNC_USER }} + CUSTOM_SYNC_SECRET: ${{ secrets.CUSTOM_SYNC_SECRET }} + diff --git a/.sample.env b/.sample.env index caecbe0..19dca9e 100644 --- a/.sample.env +++ b/.sample.env @@ -4,9 +4,10 @@ HOST=127.0.0.1 PORT=5577 SERVER_SECRET=x4345655@!3446%5FS334*sfdgsf # change it in production env -ENABLE_SIMPLE_AUTH=1 +# ENABLE_AUTH=1 SERVER_USER=admin SERVER_PASS=1 +TOKEN_EXPIRED_TIME=120y # DB_PATH=/some/custom-path-to-db-folder # # to use same data as desktop electerm @@ -28,4 +29,13 @@ TEST_HOST=your-host TEST_USER=your-username ## test ssh password, required -TEST_PASS=your-pass \ No newline at end of file +TEST_PASS=your-pass + +# for sync data test +GIST_ID= +GIST_TOKEN= +GITEE_TOKEN= +GITEE_ID= +CUSTOM_SYNC_URL= +CUSTOM_SYNC_USER= +CUSTOM_SYNC_SECRET= \ No newline at end of file diff --git a/build/bin/copy.js b/build/bin/copy.js index 48e0c77..4a456cc 100644 --- a/build/bin/copy.js +++ b/build/bin/copy.js @@ -14,7 +14,7 @@ const from1 = resolve( ) const from3 = resolve( cwd, - '../iTerm2-Color-Schemes/electerm/*' + 'build/iTerm2-Color-Schemes/electerm/*' ) const to1 = resolve( cwd, diff --git a/build/vite/dev-server.js b/build/vite/dev-server.js index d8a40c8..5c64489 100644 --- a/build/vite/dev-server.js +++ b/build/vite/dev-server.js @@ -17,6 +17,8 @@ import os from 'os' import copy from 'json-deep-copy' import proxy from 'express-http-proxy' import fsFunctions from '../../src/app/common/fs-functions.js' +import { createToken } from '../../src/app/lib/jwt.js' +import { logDir } from '../../src/app/server/session-log.js' const devPort = env.DEV_PORT || 5570 const devHost = env.DEV_HOST || '127.0.0.1' @@ -34,7 +36,9 @@ const base = { packInfo: pack, home: os.homedir(), server: h, - stylus: loadDevStylus() + stylus: loadDevStylus(), + sessionLogPath: logDir, + tokenElecterm: process.env.ENABLE_AUTH ? '' : createToken() } function handleIndex (req, res) { diff --git a/package-lock.json b/package-lock.json index aae0988..c4bed47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,16 @@ { "name": "electerm-web", - "version": "1.34.38", + "version": "2.34.38", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "electerm-web", - "version": "1.34.38", + "version": "2.34.38", "hasInstallScript": true, "license": "MIT", "dependencies": { "@electerm/electerm-locales": "1.1.3", - "@electerm/ssh2": "1.11.2", "@electerm/strip-ansi": "1.0.0", "@yetzt/nedb": "1.8.0", "axios": "0.26.0", @@ -35,13 +34,13 @@ "node-bash": "5.0.1", "node-powershell": "5.0.1", "node-pty": "^1.1.0-beta2", - "open": "^9.1.0", "os-locale-s": "1.0.8", "pug": "3.0.2", "serialport": "10.4.0", "socks": "2.7.1", "socks-proxy-agent": "8.0.1", "ssh-config": "^4.4.1", + "ssh2": "1.14.0", "stylus": "0.59.0", "tar": "6.1.15" }, @@ -51,7 +50,7 @@ "@electerm/electerm-resource": "1.3.7", "@playwright/test": "1.39.0", "@types/node": "20.5.7", - "@vitejs/plugin-react": "4.1.0", + "@vitejs/plugin-react": "^4.1.0", "antd": "5.8.3", "chai": "4.3.10", "classnames": "2.3.2", @@ -698,19 +697,6 @@ "integrity": "sha512-sgif5sOBCn25WougNMOJEZANG64wv5NxMNpTYgUKAEm/xSC09bb6Ru4MYfCOk67KsFwQCmwSYD4RWzt5SqZGLA==", "dev": true }, - "node_modules/@electerm/ssh2": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/@electerm/ssh2/-/ssh2-1.11.2.tgz", - "integrity": "sha512-Ga+Os767opCnR4BwecTPhRKZE2KgYlSpw2o218/0ON0WXjclRyIz9Ai07ua7yCIA3CLYcK/YvMgncNLabMYwVw==", - "hasInstallScript": true, - "dependencies": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2" - }, - "engines": { - "node": ">=10.16.0" - } - }, "node_modules/@electerm/strip-ansi": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@electerm/strip-ansi/-/strip-ansi-1.0.0.tgz", @@ -2149,14 +2135,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "engines": { - "node": ">=0.6" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -2202,17 +2180,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dependencies": { - "big-integer": "^1.6.44" - }, - "engines": { - "node": ">= 5.10.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2271,6 +2238,15 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" }, + "node_modules/buildcheck": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", + "integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==", + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -2280,20 +2256,6 @@ "semver": "^7.0.0" } }, - "node_modules/bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "dependencies": { - "run-applescript": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/bundle-require": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.0.2.tgz", @@ -2636,6 +2598,20 @@ "node": ">=8" } }, + "node_modules/cpu-features": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.9.tgz", + "integrity": "sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "buildcheck": "~0.0.6", + "nan": "^2.17.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/crc-32": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", @@ -2670,6 +2646,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -2746,140 +2723,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "dependencies": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dependencies": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/execa": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", - "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/default-browser/node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/default-browser/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/define-data-property": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", @@ -2894,17 +2737,6 @@ "node": ">= 0.4" } }, - "node_modules/define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", @@ -4134,6 +3966,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -4615,6 +4448,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, "engines": { "node": ">=10" }, @@ -4870,6 +4704,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, "engines": { "node": ">=10.17.0" } @@ -5195,37 +5030,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "dependencies": { - "is-docker": "^3.0.0" - }, - "bin": { - "is-inside-container": "cli.js" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-inside-container/node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-map": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", @@ -5325,6 +5129,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, "engines": { "node": ">=8" }, @@ -5431,7 +5236,8 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true }, "node_modules/iterator.prototype": { "version": "1.1.2", @@ -5862,7 +5668,8 @@ "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "node_modules/merge2": { "version": "1.4.1", @@ -5928,6 +5735,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { "node": ">=6" } @@ -6117,9 +5925,9 @@ } }, "node_modules/node-pty": { - "version": "1.1.0-beta2", - "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.1.0-beta2.tgz", - "integrity": "sha512-9MffxhVuuYDFv9tqLCMd++AvubwqRQbEXEr5/vWUJKnrd6J4GpOlxjSZXe1iucEKS1fejnIM7oWUU/2NJTT7cA==", + "version": "1.1.0-beta5", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.1.0-beta5.tgz", + "integrity": "sha512-j3QdgFHnLY0JWxztrvM3g67RaQLOGvytv+C6mFu0PqD+JILlzqfwuoyqRqVxdZZjoOTUXPfSRj1qPVCaCH+eOw==", "hasInstallScript": true, "dependencies": { "nan": "^2.17.0" @@ -6144,6 +5952,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, "dependencies": { "path-key": "^3.0.0" }, @@ -6435,6 +6244,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -6445,23 +6255,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "dependencies": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/opentype.js": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-0.8.0.tgz", @@ -6643,6 +6436,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, "engines": { "node": ">=8" } @@ -8026,20 +7820,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "dependencies": { - "execa": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -8284,6 +8064,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -8295,6 +8076,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, "engines": { "node": ">=8" } @@ -8332,7 +8114,8 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/slash": { "version": "3.0.0", @@ -8400,6 +8183,23 @@ "resolved": "https://registry.npmjs.org/ssh-config/-/ssh-config-4.4.1.tgz", "integrity": "sha512-3VKB9wiwWbwVGjM8T5/nkIrijenIYhKXOHrcCH4cOlAX6d+hD4lMFJtJp3UF1KaUDIMtccg1MmwqoTCX7CoVzw==" }, + "node_modules/ssh2": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.14.0.tgz", + "integrity": "sha512-AqzD1UCqit8tbOKoj6ztDDi1ffJZ2rV2SwlgrVVrHPkV5vWqGJOVp5pmtj18PunkPJAuKQsnInyKV+/Nb2bUnA==", + "hasInstallScript": true, + "dependencies": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2" + }, + "engines": { + "node": ">=10.16.0" + }, + "optionalDependencies": { + "cpu-features": "~0.0.8", + "nan": "^2.17.0" + } + }, "node_modules/standard": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/standard/-/standard-17.1.0.tgz", @@ -8584,6 +8384,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, "engines": { "node": ">=6" } @@ -8786,17 +8587,6 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "dev": true }, - "node_modules/titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -9494,14 +9284,6 @@ "node": ">= 0.8" } }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "engines": { - "node": ">=8" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -9838,6 +9620,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -10628,15 +10411,6 @@ "integrity": "sha512-sgif5sOBCn25WougNMOJEZANG64wv5NxMNpTYgUKAEm/xSC09bb6Ru4MYfCOk67KsFwQCmwSYD4RWzt5SqZGLA==", "dev": true }, - "@electerm/ssh2": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/@electerm/ssh2/-/ssh2-1.11.2.tgz", - "integrity": "sha512-Ga+Os767opCnR4BwecTPhRKZE2KgYlSpw2o218/0ON0WXjclRyIz9Ai07ua7yCIA3CLYcK/YvMgncNLabMYwVw==", - "requires": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2" - } - }, "@electerm/strip-ansi": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@electerm/strip-ansi/-/strip-ansi-1.0.0.tgz", @@ -11603,11 +11377,6 @@ "tweetnacl": "^0.14.3" } }, - "big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" - }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -11648,14 +11417,6 @@ } } }, - "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "requires": { - "big-integer": "^1.6.44" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -11691,6 +11452,12 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" }, + "buildcheck": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", + "integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==", + "optional": true + }, "builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -11700,14 +11467,6 @@ "semver": "^7.0.0" } }, - "bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "requires": { - "run-applescript": "^5.0.0" - } - }, "bundle-require": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.0.2.tgz", @@ -11961,6 +11720,16 @@ } } }, + "cpu-features": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.9.tgz", + "integrity": "sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ==", + "optional": true, + "requires": { + "buildcheck": "~0.0.6", + "nan": "^2.17.0" + } + }, "crc-32": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", @@ -11980,6 +11749,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -12033,85 +11803,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "requires": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - }, - "dependencies": { - "execa": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", - "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - } - }, - "human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==" - }, - "is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==" - }, - "mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==" - }, - "npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "requires": { - "path-key": "^4.0.0" - } - }, - "onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "requires": { - "mimic-fn": "^4.0.0" - } - }, - "path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==" - }, - "strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==" - } - } - }, - "default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "requires": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - } - }, "define-data-property": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", @@ -12123,11 +11814,6 @@ "has-property-descriptors": "^1.0.0" } }, - "define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==" - }, "define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", @@ -12940,6 +12626,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, "requires": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -13320,7 +13007,8 @@ "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true }, "get-symbol-description": { "version": "1.0.0", @@ -13493,7 +13181,8 @@ "human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true }, "iconv-lite": { "version": "0.4.24", @@ -13719,21 +13408,6 @@ "is-extglob": "^2.1.1" } }, - "is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "requires": { - "is-docker": "^3.0.0" - }, - "dependencies": { - "is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==" - } - } - }, "is-map": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", @@ -13799,7 +13473,8 @@ "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true }, "is-string": { "version": "1.0.7", @@ -13870,7 +13545,8 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true }, "iterator.prototype": { "version": "1.1.2", @@ -14243,7 +13919,8 @@ "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "merge2": { "version": "1.4.1", @@ -14287,7 +13964,8 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "minimatch": { "version": "3.1.2", @@ -14437,9 +14115,9 @@ } }, "node-pty": { - "version": "1.1.0-beta2", - "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.1.0-beta2.tgz", - "integrity": "sha512-9MffxhVuuYDFv9tqLCMd++AvubwqRQbEXEr5/vWUJKnrd6J4GpOlxjSZXe1iucEKS1fejnIM7oWUU/2NJTT7cA==", + "version": "1.1.0-beta5", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.1.0-beta5.tgz", + "integrity": "sha512-j3QdgFHnLY0JWxztrvM3g67RaQLOGvytv+C6mFu0PqD+JILlzqfwuoyqRqVxdZZjoOTUXPfSRj1qPVCaCH+eOw==", "requires": { "nan": "^2.17.0" } @@ -14460,6 +14138,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, "requires": { "path-key": "^3.0.0" } @@ -14681,21 +14360,11 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "requires": { "mimic-fn": "^2.1.0" } }, - "open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "requires": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - } - }, "opentype.js": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-0.8.0.tgz", @@ -14823,7 +14492,8 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true }, "path-parse": { "version": "1.0.7", @@ -15792,14 +15462,6 @@ "fsevents": "~2.3.2" } }, - "run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "requires": { - "execa": "^5.0.0" - } - }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -15989,6 +15651,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -15996,7 +15659,8 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true }, "shelljs": { "version": "0.8.5", @@ -16022,7 +15686,8 @@ "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "slash": { "version": "3.0.0", @@ -16070,6 +15735,17 @@ "resolved": "https://registry.npmjs.org/ssh-config/-/ssh-config-4.4.1.tgz", "integrity": "sha512-3VKB9wiwWbwVGjM8T5/nkIrijenIYhKXOHrcCH4cOlAX6d+hD4lMFJtJp3UF1KaUDIMtccg1MmwqoTCX7CoVzw==" }, + "ssh2": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.14.0.tgz", + "integrity": "sha512-AqzD1UCqit8tbOKoj6ztDDi1ffJZ2rV2SwlgrVVrHPkV5vWqGJOVp5pmtj18PunkPJAuKQsnInyKV+/Nb2bUnA==", + "requires": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2", + "cpu-features": "~0.0.8", + "nan": "^2.17.0" + } + }, "standard": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/standard/-/standard-17.1.0.tgz", @@ -16189,7 +15865,8 @@ "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true }, "strip-json-comments": { "version": "3.1.1", @@ -16340,11 +16017,6 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "dev": true }, - "titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==" - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -16757,11 +16429,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, - "untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==" - }, "update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -16970,6 +16637,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "requires": { "isexe": "^2.0.0" } diff --git a/package.json b/package.json index cf71843..b071a70 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "electerm-web", - "version": "1.34.38", + "version": "2.34.38", "description": "Running electerm in as web app", "main": "src/app/app.js", "type": "module", "scripts": { "dev": "NODE_ENV=development node ./src/app/app.js", "prod": "NODE_ENV=production node ./src/app/app.js", - "build": "npm run vite-build", + "build": "npm run compile", "start": "NODE_ENV=development node ./build/vite/dev-server.js", "clean": "node build/bin/clean", "compile": "node build/bin/build", @@ -29,7 +29,7 @@ "sponsorLink": "https://electerm.html5beta.com/sponsor-electerm.html", "repository": { "type": "git", - "url": "git+https://github.com/electerm/electerm.git" + "url": "git+https://github.com/electerm/electerm-web.git" }, "author": { "name": "ZHAO Xudong", @@ -37,10 +37,10 @@ "url": "https://github.com/zxdong262" }, "bugs": { - "url": "https://github.com/electerm/electerm/issues" + "url": "https://github.com/electerm/electerm-web/issues" }, "homepage": "https://electerm.html5beta.com", - "releases": "https://github.com/electerm/electerm/releases", + "releases": "https://github.com/electerm/electerm-web/releases", "engines": { "node": ">=18.0.0" }, @@ -51,7 +51,7 @@ "@electerm/electerm-resource": "1.3.7", "@playwright/test": "1.39.0", "@types/node": "20.5.7", - "@vitejs/plugin-react": "4.1.0", + "@vitejs/plugin-react": "^4.1.0", "antd": "5.8.3", "chai": "4.3.10", "classnames": "2.3.2", @@ -92,7 +92,7 @@ }, "dependencies": { "@electerm/electerm-locales": "1.1.3", - "@electerm/ssh2": "1.11.2", + "ssh2": "1.14.0", "@electerm/strip-ansi": "1.0.0", "@yetzt/nedb": "1.8.0", "axios": "0.26.0", @@ -116,7 +116,6 @@ "node-bash": "5.0.1", "node-powershell": "5.0.1", "node-pty": "^1.1.0-beta2", - "open": "^9.1.0", "os-locale-s": "1.0.8", "pug": "3.0.2", "serialport": "10.4.0", diff --git a/src/app/lib/init.js b/src/app/lib/init.js index 3762214..4de5b33 100644 --- a/src/app/lib/init.js +++ b/src/app/lib/init.js @@ -33,7 +33,13 @@ export async function init () { const config = await getConfig(true) return { config, - langs: Object.keys(langMap), + isPortable: true, + langs: Object.keys(langMap).map(id => { + return { + id, + ...langMap[id] + } + }), langMap } } diff --git a/src/app/lib/jwt.js b/src/app/lib/jwt.js index 3eae1c0..73b2014 100644 --- a/src/app/lib/jwt.js +++ b/src/app/lib/jwt.js @@ -17,6 +17,17 @@ export const errHandler = function (err, req, res, next) { } } +export function createToken ( + user = process.env.SERVER_USER, + pass = process.env.SERVER_SECRET, + expire = process.env.TOKEN_EXPIRED_TIME || '120y' +) { + const x = jwtb.sign({ + id: user + }, pass, { expiresIn: expire }) + return x +} + export function verify (token) { return jwtb.verify(token, process.env.SERVER_SECRET) } diff --git a/src/app/lib/login.js b/src/app/lib/login.js index f61f01f..6b595ca 100644 --- a/src/app/lib/login.js +++ b/src/app/lib/login.js @@ -2,11 +2,10 @@ * simple login with password only */ -import jwt from 'jsonwebtoken' +import { createToken } from './jwt.js' const { - SERVER_PASS, - SERVER_USER + SERVER_PASS } = process.env export function login (req, res) { @@ -14,8 +13,6 @@ export function login (req, res) { if (password !== SERVER_PASS) { return res.status(401).send('pass not right') } - const token = jwt.sign({ - id: SERVER_USER - }, process.env.SERVER_SECRET, { expiresIn: '120y' }) + const token = createToken() res.send(token) } diff --git a/src/app/lib/run-sync.js b/src/app/lib/run-sync.js index 9177bf2..1c6a0f9 100644 --- a/src/app/lib/run-sync.js +++ b/src/app/lib/run-sync.js @@ -1,7 +1,6 @@ /** * serial port lib */ -import open from 'open' import log from '../common/log.js' import { toCss } from '../lib/style.js' import { listItermThemes } from '../lib/iterm-theme.js' @@ -15,13 +14,12 @@ import { checkDbUpgrade, doUpgrade } from '../upgrade/index.js' import { watchFile, unwatchFile } from './watch-file.js' import lookup from './lookup.js' import { init } from './init.js' +import { showItemInFolder } from './show-item-in-folder.js' const globs = { encryptAsync, decryptAsync, - showItemInFolder: (pth) => { - return open(pth) - }, + showItemInFolder, dbAction, lookup, watchFile, diff --git a/src/app/lib/show-item-in-folder.js b/src/app/lib/show-item-in-folder.js new file mode 100644 index 0000000..7481573 --- /dev/null +++ b/src/app/lib/show-item-in-folder.js @@ -0,0 +1,37 @@ +import { exec } from 'child_process' +import { + isWin, + isMac +} from '../common/runtime-constants.js' +import { dirname, resolve } from 'path' + +export async function showItemInFolder (filePath) { + const itemPath = resolve(filePath) + const folderPath = dirname(itemPath) + let command = '' + + if (isWin) { + // For Windows + command = `explorer.exe /select,"${itemPath}"` + } else if (isMac) { + // For macOS + command = `open -R "${folderPath}"` + } else { + // For Linux or other Unix-like systems + command = `xdg-open "${folderPath}"` + } + + return new Promise((resolve, reject) => { + exec(command, (error, stdout, stderr) => { + if (error) { + reject(new Error(`Failed to show item in folder: ${error.message}`)) + return + } + if (stderr) { + reject(new Error(`Error: ${stderr}`)) + return + } + resolve('Item shown in folder successfully.') + }) + }) +} diff --git a/src/app/lib/view.js b/src/app/lib/view.js index 0de43e1..eb4a98c 100644 --- a/src/app/lib/view.js +++ b/src/app/lib/view.js @@ -13,6 +13,8 @@ import { import fsFunctions from '../common/fs-functions.js' import { loadDevStylus } from './style.js' import copy from 'json-deep-copy' +import { createToken } from './jwt.js' +import { logDir } from '../server/session-log.js' const stylus = loadDevStylus() @@ -33,8 +35,15 @@ export function index (req, res) { fsFunctions, isWebApp: true, extIconPath, + sessionLogPath: logDir, server: process.env.SERVER || buildServer() } + const { + ENABLE_AUTH + } = process.env + if (!ENABLE_AUTH) { + data.tokenElecterm = createToken() + } data._global = copy(data) res.render('index', data) } diff --git a/src/app/server/server.js b/src/app/server/server.js index cfbe728..fe441a3 100644 --- a/src/app/server/server.js +++ b/src/app/server/server.js @@ -18,7 +18,7 @@ export async function createApp () { app.use(express.json()) app.use(morgan( - 'combined' + ':method :url :status :res[content-length] - :response-time ms' )) app.set('view engine', 'pug') app.set( diff --git a/src/app/server/session-log.js b/src/app/server/session-log.js index eebee86..68e3bae 100644 --- a/src/app/server/session-log.js +++ b/src/app/server/session-log.js @@ -2,12 +2,23 @@ * log ssh output to file */ -import { resolve } from 'path' -import { createWriteStream } from 'fs' +import { resolve, dirname } from 'path' +import { createWriteStream, existsSync, mkdirSync } from 'fs' import { cwd } from '../common/runtime-constants.js' +function mkdirP (resolvedPath) { + if (!existsSync(resolvedPath)) { + mkdirP(dirname(resolvedPath)) + mkdirSync(resolvedPath) + } +} + const { SESSION_LOG_PATH } = process.env -const logDir = SESSION_LOG_PATH || resolve(cwd, 'electerm_session_logs') +export const logDir = SESSION_LOG_PATH || resolve(cwd, 'electerm_session_logs') + +if (!existsSync(logDir)) { + mkdirP(logDir) +} export class SessionLog { constructor (options) { diff --git a/src/app/server/session-ssh.js b/src/app/server/session-ssh.js index b246574..41b26a3 100644 --- a/src/app/server/session-ssh.js +++ b/src/app/server/session-ssh.js @@ -1,7 +1,7 @@ /** * terminal/sftp/serial class */ -import { Client } from '@electerm/ssh2' +import { Client } from 'ssh2' import proxySock from './socks.js' import _ from 'lodash' import uid from '../common/uid.js' diff --git a/src/app/server/ssh2-alg.js b/src/app/server/ssh2-alg.js index 9b8ae22..1a8f303 100644 --- a/src/app/server/ssh2-alg.js +++ b/src/app/server/ssh2-alg.js @@ -20,7 +20,7 @@ export default { 'diffie-hellman-group1-sha1' ], cipher: [ - // 'chacha20-poly1305@openssh.com', + 'chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', @@ -34,12 +34,12 @@ export default { 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', - 'blowfish-cbc', - '3des-cbc', - 'arcfour256', - 'arcfour128', + // 'blowfish-cbc', + '3des-cbc' + // 'arcfour256', + // 'arcfour128', // 'cast128-cbc', - 'arcfour' + // 'arcfour' ], serverHostKey: [ 'ssh-ed25519', diff --git a/src/app/views/index.pug b/src/app/views/index.pug index f86c0dd..32689c5 100644 --- a/src/app/views/index.pug +++ b/src/app/views/index.pug @@ -38,6 +38,9 @@ html img.iblock.logo-filter(src='images/electerm.png', alt='', height=80) script. window.et = !{JSON.stringify(_global)} + - if (tokenElecterm) + script. + window.localStorage.setItem('tokenElecterm', window.et.tokenElecterm) - var url = '/src/client/entry-web/basic.js' - if (isDev) //- script(src='/external/react.development.js?' + version) diff --git a/test/e2e/001.basic.bookmarks-groups.spec.js b/test/e2e/001.basic.bookmarks-groups.spec.js index 8bc675c..8769dd5 100644 --- a/test/e2e/001.basic.bookmarks-groups.spec.js +++ b/test/e2e/001.basic.bookmarks-groups.spec.js @@ -1,20 +1,21 @@ import { test as it } from '@playwright/test' -import { chromium } from 'playwright' import delay from './common/wait.js' import log from './common/log.js' import { expect } from 'chai' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' +import { + close, + init +} from './common/common.js' const { describe } = it it.setTimeout(100000) describe('bookmark groups', function () { it('all buttons open proper bookmark tab', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) - await client.goto('/') + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') await delay(3500) @@ -49,6 +50,6 @@ describe('bookmark groups', function () { window.store.bookmarkGroups.filter(d => d !== 'u567') ) }) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/002.init.setting.spec.js b/test/e2e/002.init.setting.spec.js index 6f77ab9..ce8dec3 100644 --- a/test/e2e/002.init.setting.spec.js +++ b/test/e2e/002.init.setting.spec.js @@ -1,4 +1,7 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it, expect @@ -7,22 +10,15 @@ import { import delay from './common/wait.js' import log from './common/log.js' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('init setting buttons', function () { it('all buttons open proper setting tab', async function () { - const app = await chromium.launch() - // const app = await app.evaluate(async ({ app }) => { - // // This runs in the main Electron process, parameter here is always - // // the result of the require('electron') in the main app script. - // return app - // }) - // console.log(app) - const client = await app.newPage() - extendClient(client, app) + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') // await client.waitUntilWindowLoaded() @@ -73,7 +69,6 @@ describe('init setting buttons', function () { await delay(600) const text5 = await client.getText(sel) expect(text5).toEqual(e('bookmarks')) - - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/005.1.tab-context.spec.js b/test/e2e/005.1.tab-context.spec.js index 41bb948..6d6461b 100644 --- a/test/e2e/005.1.tab-context.spec.js +++ b/test/e2e/005.1.tab-context.spec.js @@ -3,23 +3,24 @@ * need TEST_HOST TEST_PASS TEST_USER env set */ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import { expect } from 'chai' import delay from './common/wait.js' -import extendClient from './common/client-extend.js' - const { describe } = it it.setTimeout(100000) describe('ssh', function () { it('should open window and basic ssh ls command works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4500) await delay(4500) await client.rightClick('.tabs .tab', 10, 10) @@ -29,5 +30,6 @@ describe('ssh', function () { return window.store.tabs.length }) expect(tabsCount).equal(2) + await close(context, app) }) }) diff --git a/test/e2e/005.basic-ssh.spec.js b/test/e2e/005.basic-ssh.spec.js index 4a71a7f..0c61ae3 100644 --- a/test/e2e/005.basic-ssh.spec.js +++ b/test/e2e/005.basic-ssh.spec.js @@ -8,10 +8,12 @@ import { TEST_PASS, TEST_USER } from './common/env.js' -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { expect } from 'chai' import delay from './common/wait.js' -import extendClient from './common/client-extend.js' import basicTermTest from './common/basic-terminal-test.js' const { describe } = it @@ -19,9 +21,9 @@ it.setTimeout(100000) describe('ssh', function () { it('should open window and basic ssh ls command works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4500) const cmd = 'ls' await delay(4500) @@ -38,5 +40,6 @@ describe('ssh', function () { await delay(4010) await basicTermTest(client, cmd) await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/006.basic-terminal-split.spec.js b/test/e2e/006.basic-terminal-split.spec.js index f1b9f6e..7ed631d 100644 --- a/test/e2e/006.basic-terminal-split.spec.js +++ b/test/e2e/006.basic-terminal-split.spec.js @@ -3,19 +3,21 @@ * need TEST_HOST TEST_PASS TEST_USER env set */ import { test as it } from '@playwright/test' -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { expect } from 'chai' import delay from './common/wait.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('terminal split', function () { it('split button works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(8500) await client.click('.session-current .term-controls .icon-split') await delay(2200) @@ -32,6 +34,6 @@ describe('terminal split', function () { terms = await client.elements('.session-current .term-wrap') terms = await terms.count() expect(terms).equal(2) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/007.basic.bookmarks.spec.js b/test/e2e/007.basic.bookmarks.spec.js index df13fd4..ac34ecb 100644 --- a/test/e2e/007.basic.bookmarks.spec.js +++ b/test/e2e/007.basic.bookmarks.spec.js @@ -1,4 +1,7 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import delay from './common/wait.js' import log from './common/log.js' @@ -9,16 +12,15 @@ import { TEST_USER } from './common/env.js' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('bookmarks', function () { it('all buttons open proper bookmark tab', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') await delay(5500) @@ -74,5 +76,6 @@ describe('bookmarks', function () { // const text4 = await client.getText(sel) // expect(text4).equal(e('setting')) // await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/008.basic.history.spec.js b/test/e2e/008.basic.history.spec.js index caf2967..b54bbc9 100644 --- a/test/e2e/008.basic.history.spec.js +++ b/test/e2e/008.basic.history.spec.js @@ -1,19 +1,21 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import delay from './common/wait.js' import log from './common/log.js' import { expect } from 'chai' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('history', function () { it('all buttons open proper history tab', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') await delay(4500) @@ -43,6 +45,6 @@ describe('history', function () { await client.click('.setting-wrap .item-list-unit') const list1 = await client.getAttribute('.setting-wrap .item-list-unit:nth-child(1)', 'class') expect(list1.includes('active')) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/009.basic.file-manager.spec.js b/test/e2e/009.basic.file-manager.spec.js index d73371f..2cc25d9 100644 --- a/test/e2e/009.basic.file-manager.spec.js +++ b/test/e2e/009.basic.file-manager.spec.js @@ -1,19 +1,21 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import log from './common/log.js' import { expect } from 'chai' import delay from './common/wait.js' import nanoid from './common/uid.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('local file manager', function () { it('should open window and basic sftp works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(3500) // click sftp tab @@ -97,6 +99,6 @@ describe('local file manager', function () { let localFileList2 = await client.elements('.session-current .file-list.local .sftp-item') localFileList2 = await localFileList2.count() expect(localFileList2).equal(localFileListBefore) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/011.basic.themes.spec.js b/test/e2e/011.basic.themes.spec.js index 6f4e6a7..c70af1f 100644 --- a/test/e2e/011.basic.themes.spec.js +++ b/test/e2e/011.basic.themes.spec.js @@ -1,19 +1,21 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import delay from './common/wait.js' import { test as it } from '@playwright/test' import log from './common/log.js' import { expect } from 'chai' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('terminal themes', function () { it('all buttons open proper terminal themes tab', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') const t = prefix('terminalThemes') @@ -50,6 +52,8 @@ describe('terminal themes', function () { }) await delay(1000) expect(themeNow).equal(themePrev + 1) + console.log() + expect(themeIterm > 10).equal(true) log('tab it') @@ -57,6 +61,6 @@ describe('terminal themes', function () { await delay(100) const text4 = await client.getText(sel) expect(text4).equal(e('setting')) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/012.basic.local-symbolic-link.spec.js b/test/e2e/012.basic.local-symbolic-link.spec.js index aea60e8..a9c5000 100644 --- a/test/e2e/012.basic.local-symbolic-link.spec.js +++ b/test/e2e/012.basic.local-symbolic-link.spec.js @@ -1,17 +1,19 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import delay from './common/wait.js' import { expect } from 'chai' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('symbolic links support', function () { it('symbolic links support works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4500) const tmp = 'tmp-' + (+new Date()) const cmd = `cd ~ && mkdir ${tmp} && cd ${tmp} && touch x.js && mkdir xx && ln -s x.js xk && ln -s xx xxk` @@ -32,6 +34,6 @@ describe('symbolic links support', function () { const cmd1 = `cd ~ && rm -rf ${tmp}` await client.keyboard.type(cmd1) await client.keyboard.press('Enter') - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/013.tabs.spec.js b/test/e2e/013.tabs.spec.js index 044e295..5f0878d 100644 --- a/test/e2e/013.tabs.spec.js +++ b/test/e2e/013.tabs.spec.js @@ -1,8 +1,10 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import delay from './common/wait.js' import { expect } from 'chai' -import extendClient from './common/client-extend.js' import log from './common/log.js' const { describe } = it @@ -10,9 +12,9 @@ it.setTimeout(100000) describe('tabs', function () { it('double click to duplicate tab button works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4500) const tabsLenBefore = await client.countElem('.tabs .tab') const wrapsBefore = await client.countElem('.sessions > div') @@ -29,6 +31,6 @@ describe('tabs', function () { await delay(1500) const tabs1 = await client.countElem('.tabs .tab') expect(tabs1).equal(tabsLenBefore + 2) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/015.timeout-setting.spec.js b/test/e2e/015.timeout-setting.spec.js index 30a0179..4c0bb99 100644 --- a/test/e2e/015.timeout-setting.spec.js +++ b/test/e2e/015.timeout-setting.spec.js @@ -3,7 +3,10 @@ * need TEST_HOST TEST_PASS TEST_USER env set */ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import { expect } from 'chai' import delay from './common/wait.js' @@ -13,16 +16,15 @@ import { TEST_PASS, TEST_USER } from './common/env.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('timeout setting', function () { it('timeout setting works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4000) log('set timeout to 100') @@ -72,6 +74,6 @@ describe('timeout setting', function () { await delay(150) expect(timeout1).equal(50000) await delay(400) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/016.quick-commands.spec.js b/test/e2e/016.quick-commands.spec.js index 21fe477..a0ef8f2 100644 --- a/test/e2e/016.quick-commands.spec.js +++ b/test/e2e/016.quick-commands.spec.js @@ -3,21 +3,23 @@ * need TEST_HOST TEST_PASS TEST_USER env set */ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import { expect } from 'chai' import delay from './common/wait.js' import log from './common/log.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('quick commands', function () { it('quick commands form', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() log('open setting') await delay(2000) await client.click('.btns .anticon-setting') @@ -61,6 +63,6 @@ describe('quick commands', function () { return window.store.currentQuickCommands.length }) expect(c2).equal(c1 + 1) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/017.1.upgrade.check.spec.js b/test/e2e/017.1.upgrade.check.spec.js deleted file mode 100644 index a883bf8..0000000 --- a/test/e2e/017.1.upgrade.check.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -import { chromium } from 'playwright' -import { test as it } from '@playwright/test' -import delay from './common/wait.js' -import extendClient from './common/client-extend.js' -import log from './common/log.js' -import { expect } from 'chai' - -const { describe } = it -it.setTimeout(100000) - -describe('auto upgrade check', function () { - it('auto upgrade check should work', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) - let v = '' - while (v !== '0.0.0') { - v = await client.evaluate(() => { - if (window.et) { - console.log('no retry set version') - window.et.version = '0.0.0' - return '0.0.0' - } - console.log('retry set version') - return '' - }) - await delay(2) - } - console.log('v', v) - const len1 = 10000 - const sel = '.animate.upgrade-panel' - for (let i = 0; i < len1; i++) { - await delay(500) - if (await client.elemExist(sel)) { - break - } - } - log('should show upgrade info') - log('start download upgrade') - await client.click('.upgrade-panel .ant-btn-primary') - const fr = {} - const len = 200 - for (let i = 0; i < len; i++) { - await delay(500) - const txt = await client.getText('.upgrade-panel .ant-btn-primary') - console.log('txt', txt) - if (txt.includes('Upgrading... 0% Cancel')) { - fr.zero = 1 - } else if ( - txt.includes('% Cancel') - ) { - fr.progress = 1 - } - if (fr.zero && fr.progress) { - break - } - } - expect(fr.progress).equal(1) - expect(fr.zero).equal(1) - await app.close().catch(console.log) - }) -}) diff --git a/test/e2e/017.upgrade.check.spec.js b/test/e2e/017.upgrade.check.spec.js index 1b9fc07..5fd69e0 100644 --- a/test/e2e/017.upgrade.check.spec.js +++ b/test/e2e/017.upgrade.check.spec.js @@ -1,17 +1,19 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { test as it } from '@playwright/test' import delay from './common/wait.js' import log from './common/log.js' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('Upgrade check', function () { it('Upgrade check should work', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(4500) log('button:about') @@ -23,6 +25,6 @@ describe('Upgrade check', function () { await client.click('.about-wrap .ant-btn-primary') await delay(9000) await client.hasElem('.upgrade-panel') - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/018.sync.spec.js b/test/e2e/018.sync.spec.js index 414b4b7..cd23050 100644 --- a/test/e2e/018.sync.spec.js +++ b/test/e2e/018.sync.spec.js @@ -1,11 +1,13 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { config } from 'dotenv' import { test as it } from '@playwright/test' import delay from './common/wait.js' import log from './common/log.js' import { expect } from 'chai' import prefixer from './common/lang.js' -import extendClient from './common/client-extend.js' config() @@ -24,9 +26,9 @@ it.setTimeout(100000) describe('data sync', function () { it('all buttons open proper terminal themes tab', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() const prefix = await prefixer() const e = prefix('common') @@ -96,5 +98,6 @@ describe('data sync', function () { return window.store.getBookmarks() }) expect(bks3.length > 3).equal(true) + await close(context, app) }) }) diff --git a/test/e2e/019.basic-terminal.spec.js b/test/e2e/019.basic-terminal.spec.js index d090cae..c66fb17 100644 --- a/test/e2e/019.basic-terminal.spec.js +++ b/test/e2e/019.basic-terminal.spec.js @@ -1,9 +1,11 @@ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import os from 'os' import { test as it } from '@playwright/test' import delay from './common/wait.js' import basicTermTest from './common/basic-terminal-test.js' -import extendClient from './common/client-extend.js' const platform = os.platform() const isWin = platform.startsWith('win') @@ -12,15 +14,15 @@ it.setTimeout(100000) describe('terminal', function () { it('should open window and local terminal ls/dir command works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() const cmd = isWin ? 'dir' : 'ls' await delay(13500) await basicTermTest(client, cmd) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/019.sftp-transfer.spec.js b/test/e2e/019.sftp-transfer.spec.js index 4242611..4ca5f60 100644 --- a/test/e2e/019.sftp-transfer.spec.js +++ b/test/e2e/019.sftp-transfer.spec.js @@ -3,7 +3,10 @@ * need TEST_HOST TEST_PASS TEST_USER env set */ -import { chromium } from 'playwright' +import { + close, + init +} from './common/common.js' import { expect } from 'chai' import { test as it } from '@playwright/test' import delay from './common/wait.js' @@ -14,16 +17,15 @@ import { } from './common/env.js' import log from './common/log.js' import { nanoid } from 'nanoid' -import extendClient from './common/client-extend.js' const { describe } = it it.setTimeout(100000) describe('sftp file transfer', function () { it('should open window and basic sftp works', async function () { - const app = await chromium.launch() - const client = await app.newPage() - extendClient(client) + const { + client, context, app + } = await init() await delay(3500) await client.click('.btns .anticon-plus-circle') await delay(500) @@ -195,6 +197,6 @@ describe('sftp file transfer', function () { let remoteFileList2 = await client.elements('.session-current .file-list.remote .sftp-item') remoteFileList2 = await remoteFileList2.count() expect(remoteFileList2).equal(remoteFileListBefore) - await app.close().catch(console.log) + await close(context, app) }) }) diff --git a/test/e2e/common/common.js b/test/e2e/common/common.js new file mode 100644 index 0000000..198a204 --- /dev/null +++ b/test/e2e/common/common.js @@ -0,0 +1,21 @@ +import { chromium } from 'playwright' +import extendClient from './client-extend.js' + +export async function init () { + const app = await chromium.launch() + const context = await app.newContext() + await context.addInitScript(() => { + window.localStorage.setItem('tokenElecterm', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFkbWluIiwiaWF0IjoxNjk4ODAxMDYwLCJleHAiOjU0ODU3MTMwNjB9.hUDysGzW06igCstugLs1ziuqhXLkKGaoICkFQ0NkFPA') + }) + const client = await context.newPage() + extendClient(client, app) + await client.goto('/') + return { + client, context, app + } +} + +export async function close (context, app) { + await context.close().catch(console.log) + await app.close().catch(console.log) +} diff --git a/test/playwright.conf.js b/test/playwright.conf.js index c348f6a..953c5e6 100644 --- a/test/playwright.conf.js +++ b/test/playwright.conf.js @@ -6,6 +6,9 @@ const port = env.PORT || 5577 const url = `http://${host}:${port}` export default defineConfig({ + use: { + baseURL: url + }, // Fail the build on CI if you accidentally left test.only in the source code. forbidOnly: !!process.env.CI, @@ -13,13 +16,5 @@ export default defineConfig({ retries: process.env.CI ? 2 : 0, // Opt out of parallel tests on CI. - workers: 1, - - // // Reporter to use - // reporter: 'html', - - use: { - // Base URL to use in actions like `await page.goto('/')`. - baseURL: url - } + workers: 1 })