update
This commit is contained in:
		
							
								
								
									
										48
									
								
								.github/workflows/electron-build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								.github/workflows/electron-build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
name: Build and Release Electron App
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    tags:
 | 
			
		||||
      - 'v*'
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: [macos-latest, windows-latest]
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Use Node.js
 | 
			
		||||
        uses: actions/setup-node@v4
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '22.15.0'
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm install
 | 
			
		||||
 | 
			
		||||
      - name: Build Electron app
 | 
			
		||||
        run: npm run build
 | 
			
		||||
 | 
			
		||||
      - name: Package Electron app (macOS)
 | 
			
		||||
        if: matrix.os == 'macos-latest'
 | 
			
		||||
        run: npm run build:mac
 | 
			
		||||
 | 
			
		||||
      - name: Package Electron app (Windows)
 | 
			
		||||
        if: matrix.os == 'windows-latest'
 | 
			
		||||
        run: npm run build:win
 | 
			
		||||
 | 
			
		||||
      - name: Upload release assets
 | 
			
		||||
        uses: softprops/action-gh-release@v2
 | 
			
		||||
        with:
 | 
			
		||||
          tag_name: ${{ github.ref_name }}
 | 
			
		||||
          name: Release ${{ github.ref_name }}
 | 
			
		||||
          files: |
 | 
			
		||||
            build/*.dmg
 | 
			
		||||
            build/*.exe
 | 
			
		||||
        env:
 | 
			
		||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
							
								
								
									
										15
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								package.json
									
									
									
									
									
								
							@@ -1,20 +1,20 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "silky-assistant",
 | 
			
		||||
  "version": "0.0.2",
 | 
			
		||||
  "version": "0.0.3",
 | 
			
		||||
  "description": "Silky Assistant",
 | 
			
		||||
  "main": "app-dist/main.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "dev": "vite --config vite.config.ts",
 | 
			
		||||
    "build": "cross-env NODE_ENV=production vite build --config vite.config.ts",
 | 
			
		||||
    "build:watch": "cross-env NODE_ENV=development vite build --config vite.config.ts -w",
 | 
			
		||||
    "build:mac": "electron-builder --mac --win",
 | 
			
		||||
    "build:mac": "electron-builder --mac",
 | 
			
		||||
    "build:win": "electron-builder --win",
 | 
			
		||||
    "build:linux": "electron-builder --linux",
 | 
			
		||||
    "watch:electron": "electron app-dist/main.js --watch",
 | 
			
		||||
    "start": "electron .",
 | 
			
		||||
    "html": "tsx scripts/clear-directory.ts",
 | 
			
		||||
    "prepub": "pnpm html",
 | 
			
		||||
    "pub": "ev deploy ./build -k silky-assistant -v 0.0.2 -u -o root"
 | 
			
		||||
    "pub": "ev deploy ./build -k silky-assistant -v 0.0.3 -u -o root"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [],
 | 
			
		||||
  "author": "abearxiong <xiongxiao@xiongxiao.me>",
 | 
			
		||||
@@ -23,10 +23,9 @@
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@rollup/plugin-commonjs": "^28.0.3",
 | 
			
		||||
    "@rollup/plugin-node-resolve": "^16.0.1",
 | 
			
		||||
    "@types/electron": "^1.6.12",
 | 
			
		||||
    "@types/node": "^22.15.18",
 | 
			
		||||
    "@types/node": "^22.15.21",
 | 
			
		||||
    "cross-env": "^7.0.3",
 | 
			
		||||
    "electron": "^36.2.1",
 | 
			
		||||
    "electron": "^36.3.1",
 | 
			
		||||
    "electron-builder": "^26.0.12",
 | 
			
		||||
    "electron-log": "^5.4.0",
 | 
			
		||||
    "typescript": "^5.8.3",
 | 
			
		||||
@@ -35,10 +34,8 @@
 | 
			
		||||
    "vite-plugin-static-copy": "^3.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@kevisual/assistant-module": "^0.0.3",
 | 
			
		||||
    "@kevisual/use-config": "^1.0.17",
 | 
			
		||||
    "electron-updater": "^6.6.2",
 | 
			
		||||
    "node-pty": "^1.0.0"
 | 
			
		||||
    "electron-updater": "^6.6.2"
 | 
			
		||||
  },
 | 
			
		||||
  "build": {
 | 
			
		||||
    "appId": "cn.silkeyai.assistant",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										82
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										82
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							@@ -17,9 +17,6 @@ importers:
 | 
			
		||||
      electron-updater:
 | 
			
		||||
        specifier: ^6.6.2
 | 
			
		||||
        version: 6.6.2
 | 
			
		||||
      node-pty:
 | 
			
		||||
        specifier: ^1.0.0
 | 
			
		||||
        version: 1.0.0
 | 
			
		||||
    devDependencies:
 | 
			
		||||
      '@rollup/plugin-commonjs':
 | 
			
		||||
        specifier: ^28.0.3
 | 
			
		||||
@@ -27,18 +24,15 @@ importers:
 | 
			
		||||
      '@rollup/plugin-node-resolve':
 | 
			
		||||
        specifier: ^16.0.1
 | 
			
		||||
        version: 16.0.1(rollup@4.34.9)
 | 
			
		||||
      '@types/electron':
 | 
			
		||||
        specifier: ^1.6.12
 | 
			
		||||
        version: 1.6.12
 | 
			
		||||
      '@types/node':
 | 
			
		||||
        specifier: ^22.15.18
 | 
			
		||||
        version: 22.15.18
 | 
			
		||||
        specifier: ^22.15.21
 | 
			
		||||
        version: 22.15.21
 | 
			
		||||
      cross-env:
 | 
			
		||||
        specifier: ^7.0.3
 | 
			
		||||
        version: 7.0.3
 | 
			
		||||
      electron:
 | 
			
		||||
        specifier: ^36.2.1
 | 
			
		||||
        version: 36.2.1
 | 
			
		||||
        specifier: ^36.3.1
 | 
			
		||||
        version: 36.3.1
 | 
			
		||||
      electron-builder:
 | 
			
		||||
        specifier: ^26.0.12
 | 
			
		||||
        version: 26.0.12(electron-builder-squirrel-windows@25.1.8)
 | 
			
		||||
@@ -50,13 +44,13 @@ importers:
 | 
			
		||||
        version: 5.8.3
 | 
			
		||||
      vite:
 | 
			
		||||
        specifier: ^6.3.5
 | 
			
		||||
        version: 6.3.5(@types/node@22.15.18)
 | 
			
		||||
        version: 6.3.5(@types/node@22.15.21)
 | 
			
		||||
      vite-plugin-electron:
 | 
			
		||||
        specifier: ^0.29.0
 | 
			
		||||
        version: 0.29.0
 | 
			
		||||
      vite-plugin-static-copy:
 | 
			
		||||
        specifier: ^3.0.0
 | 
			
		||||
        version: 3.0.0(vite@6.3.5(@types/node@22.15.18))
 | 
			
		||||
        version: 3.0.0(vite@6.3.5(@types/node@22.15.21))
 | 
			
		||||
 | 
			
		||||
packages:
 | 
			
		||||
 | 
			
		||||
@@ -85,8 +79,8 @@ packages:
 | 
			
		||||
    resolution: {integrity: sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==}
 | 
			
		||||
    engines: {node: '>=12'}
 | 
			
		||||
 | 
			
		||||
  '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2':
 | 
			
		||||
    resolution: {tarball: https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2}
 | 
			
		||||
  '@electron/node-gyp@git+https://git@github.com:electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2':
 | 
			
		||||
    resolution: {commit: 06b29aafb7708acef8b3669835c8a7857ebc92d2, repo: git@github.com:electron/node-gyp.git, type: git}
 | 
			
		||||
    version: 10.2.0-electron.1
 | 
			
		||||
    engines: {node: '>=12.13.0'}
 | 
			
		||||
    hasBin: true
 | 
			
		||||
@@ -446,10 +440,6 @@ packages:
 | 
			
		||||
  '@types/debug@4.1.12':
 | 
			
		||||
    resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
 | 
			
		||||
 | 
			
		||||
  '@types/electron@1.6.12':
 | 
			
		||||
    resolution: {integrity: sha512-NIJokDkGv9h+MStCL1IuiL1FOHYVkszoWeNxJtSI5dcEKRGbX83JcVYNAgk019qOQgJkHtz9WdP0CDXvrArrGg==}
 | 
			
		||||
    deprecated: This is a stub types definition. electron provides its own type definitions, so you do not need this installed.
 | 
			
		||||
 | 
			
		||||
  '@types/estree@1.0.6':
 | 
			
		||||
    resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
 | 
			
		||||
 | 
			
		||||
@@ -465,8 +455,8 @@ packages:
 | 
			
		||||
  '@types/ms@2.1.0':
 | 
			
		||||
    resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
 | 
			
		||||
 | 
			
		||||
  '@types/node@22.15.18':
 | 
			
		||||
    resolution: {integrity: sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==}
 | 
			
		||||
  '@types/node@22.15.21':
 | 
			
		||||
    resolution: {integrity: sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ==}
 | 
			
		||||
 | 
			
		||||
  '@types/plist@3.0.5':
 | 
			
		||||
    resolution: {integrity: sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==}
 | 
			
		||||
@@ -893,8 +883,8 @@ packages:
 | 
			
		||||
  electron-updater@6.6.2:
 | 
			
		||||
    resolution: {integrity: sha512-Cr4GDOkbAUqRHP5/oeOmH/L2Bn6+FQPxVLZtPbcmKZC63a1F3uu5EefYOssgZXG3u/zBlubbJ5PJdITdMVggbw==}
 | 
			
		||||
 | 
			
		||||
  electron@36.2.1:
 | 
			
		||||
    resolution: {integrity: sha512-mm1Y+Ms46xcOTA69h8hpqfX392HfV4lga9aEkYkd/Syx1JBStvcACOIouCgGrnZpxNZPVS1jM8NTcMkNjuK6BQ==}
 | 
			
		||||
  electron@36.3.1:
 | 
			
		||||
    resolution: {integrity: sha512-LeOZ+tVahmctHaAssLCGRRUa2SAO09GXua3pKdG+WzkbSDMh+3iOPONNVPTqGp8HlWnzGj4r6mhsIbM2RgH+eQ==}
 | 
			
		||||
    engines: {node: '>= 12.20.55'}
 | 
			
		||||
    hasBin: true
 | 
			
		||||
 | 
			
		||||
@@ -1453,9 +1443,6 @@ packages:
 | 
			
		||||
  ms@2.1.3:
 | 
			
		||||
    resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
 | 
			
		||||
 | 
			
		||||
  nan@2.22.2:
 | 
			
		||||
    resolution: {integrity: sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==}
 | 
			
		||||
 | 
			
		||||
  nanoid@3.3.8:
 | 
			
		||||
    resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
 | 
			
		||||
    engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
 | 
			
		||||
@@ -1480,9 +1467,6 @@ packages:
 | 
			
		||||
    engines: {node: ^12.13 || ^14.13 || >=16}
 | 
			
		||||
    hasBin: true
 | 
			
		||||
 | 
			
		||||
  node-pty@1.0.0:
 | 
			
		||||
    resolution: {integrity: sha512-wtBMWWS7dFZm/VgqElrTvtfMq4GzJ6+edFI0Y0zyzygUSZMgZdraDUMUhCIvkjhJjme15qWmbyJbtAx4ot4uZA==}
 | 
			
		||||
 | 
			
		||||
  nopt@6.0.0:
 | 
			
		||||
    resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==}
 | 
			
		||||
    engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
 | 
			
		||||
@@ -2056,7 +2040,7 @@ snapshots:
 | 
			
		||||
    transitivePeerDependencies:
 | 
			
		||||
      - supports-color
 | 
			
		||||
 | 
			
		||||
  '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2':
 | 
			
		||||
  '@electron/node-gyp@git+https://git@github.com:electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      env-paths: 2.2.1
 | 
			
		||||
      exponential-backoff: 3.1.2
 | 
			
		||||
@@ -2113,7 +2097,7 @@ snapshots:
 | 
			
		||||
 | 
			
		||||
  '@electron/rebuild@3.7.0':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@electron/node-gyp': https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2
 | 
			
		||||
      '@electron/node-gyp': git+https://git@github.com:electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2
 | 
			
		||||
      '@malept/cross-spawn-promise': 2.0.0
 | 
			
		||||
      chalk: 4.1.2
 | 
			
		||||
      debug: 4.4.0
 | 
			
		||||
@@ -2374,40 +2358,34 @@ snapshots:
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/http-cache-semantics': 4.0.4
 | 
			
		||||
      '@types/keyv': 3.1.4
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
      '@types/responselike': 1.0.3
 | 
			
		||||
 | 
			
		||||
  '@types/debug@4.1.12':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/ms': 2.1.0
 | 
			
		||||
 | 
			
		||||
  '@types/electron@1.6.12':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      electron: 36.2.1
 | 
			
		||||
    transitivePeerDependencies:
 | 
			
		||||
      - supports-color
 | 
			
		||||
 | 
			
		||||
  '@types/estree@1.0.6': {}
 | 
			
		||||
 | 
			
		||||
  '@types/fs-extra@9.0.13':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
 | 
			
		||||
  '@types/http-cache-semantics@4.0.4': {}
 | 
			
		||||
 | 
			
		||||
  '@types/keyv@3.1.4':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
 | 
			
		||||
  '@types/ms@2.1.0': {}
 | 
			
		||||
 | 
			
		||||
  '@types/node@22.15.18':
 | 
			
		||||
  '@types/node@22.15.21':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      undici-types: 6.21.0
 | 
			
		||||
 | 
			
		||||
  '@types/plist@3.0.5':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
      xmlbuilder: 15.1.1
 | 
			
		||||
    optional: true
 | 
			
		||||
 | 
			
		||||
@@ -2415,14 +2393,14 @@ snapshots:
 | 
			
		||||
 | 
			
		||||
  '@types/responselike@1.0.3':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
 | 
			
		||||
  '@types/verror@1.10.11':
 | 
			
		||||
    optional: true
 | 
			
		||||
 | 
			
		||||
  '@types/yauzl@2.10.3':
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
    optional: true
 | 
			
		||||
 | 
			
		||||
  '@xmldom/xmldom@0.8.10': {}
 | 
			
		||||
@@ -3029,10 +3007,10 @@ snapshots:
 | 
			
		||||
    transitivePeerDependencies:
 | 
			
		||||
      - supports-color
 | 
			
		||||
 | 
			
		||||
  electron@36.2.1:
 | 
			
		||||
  electron@36.3.1:
 | 
			
		||||
    dependencies:
 | 
			
		||||
      '@electron/get': 2.0.3
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
      extract-zip: 2.0.1
 | 
			
		||||
    transitivePeerDependencies:
 | 
			
		||||
      - supports-color
 | 
			
		||||
@@ -3633,8 +3611,6 @@ snapshots:
 | 
			
		||||
 | 
			
		||||
  ms@2.1.3: {}
 | 
			
		||||
 | 
			
		||||
  nan@2.22.2: {}
 | 
			
		||||
 | 
			
		||||
  nanoid@3.3.8: {}
 | 
			
		||||
 | 
			
		||||
  negotiator@0.6.4: {}
 | 
			
		||||
@@ -3667,10 +3643,6 @@ snapshots:
 | 
			
		||||
      - bluebird
 | 
			
		||||
      - supports-color
 | 
			
		||||
 | 
			
		||||
  node-pty@1.0.0:
 | 
			
		||||
    dependencies:
 | 
			
		||||
      nan: 2.22.2
 | 
			
		||||
 | 
			
		||||
  nopt@6.0.0:
 | 
			
		||||
    dependencies:
 | 
			
		||||
      abbrev: 1.1.1
 | 
			
		||||
@@ -4105,16 +4077,16 @@ snapshots:
 | 
			
		||||
 | 
			
		||||
  vite-plugin-electron@0.29.0: {}
 | 
			
		||||
 | 
			
		||||
  vite-plugin-static-copy@3.0.0(vite@6.3.5(@types/node@22.15.18)):
 | 
			
		||||
  vite-plugin-static-copy@3.0.0(vite@6.3.5(@types/node@22.15.21)):
 | 
			
		||||
    dependencies:
 | 
			
		||||
      chokidar: 3.6.0
 | 
			
		||||
      fs-extra: 11.3.0
 | 
			
		||||
      p-map: 7.0.3
 | 
			
		||||
      picocolors: 1.1.1
 | 
			
		||||
      tinyglobby: 0.2.13
 | 
			
		||||
      vite: 6.3.5(@types/node@22.15.18)
 | 
			
		||||
      vite: 6.3.5(@types/node@22.15.21)
 | 
			
		||||
 | 
			
		||||
  vite@6.3.5(@types/node@22.15.18):
 | 
			
		||||
  vite@6.3.5(@types/node@22.15.21):
 | 
			
		||||
    dependencies:
 | 
			
		||||
      esbuild: 0.25.0
 | 
			
		||||
      fdir: 6.4.4(picomatch@4.0.2)
 | 
			
		||||
@@ -4123,7 +4095,7 @@ snapshots:
 | 
			
		||||
      rollup: 4.34.9
 | 
			
		||||
      tinyglobby: 0.2.13
 | 
			
		||||
    optionalDependencies:
 | 
			
		||||
      '@types/node': 22.15.18
 | 
			
		||||
      '@types/node': 22.15.21
 | 
			
		||||
      fsevents: 2.3.3
 | 
			
		||||
 | 
			
		||||
  wcwidth@1.0.1:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								pnpm-workspace.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								pnpm-workspace.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
onlyBuiltDependencies:
 | 
			
		||||
  - electron
 | 
			
		||||
  - esbuild
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import { BrowserWindow } from 'electron';
 | 
			
		||||
 | 
			
		||||
import path from 'node:path';
 | 
			
		||||
export const createTransWindow = () => {
 | 
			
		||||
  const window = new BrowserWindow({
 | 
			
		||||
    width: 800,
 | 
			
		||||
@@ -7,9 +7,23 @@ export const createTransWindow = () => {
 | 
			
		||||
    transparent: true,
 | 
			
		||||
    frame: false,
 | 
			
		||||
  });
 | 
			
		||||
  window.loadURL('https://www.baidu.com');
 | 
			
		||||
  window.loadURL(process?.env?.ASSISTANT_HOME ?? 'https://kevisual.silkyai.cn/root/talkshow-admin/');
 | 
			
		||||
  setTimeout(() => {
 | 
			
		||||
    window.setPosition(0, 0, true);
 | 
			
		||||
  }, 1000);
 | 
			
		||||
  return window;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const createDemoWinodw = (window?: BrowserWindow, opts?: any) => {
 | 
			
		||||
  if (window) return window;
 | 
			
		||||
  return new BrowserWindow({
 | 
			
		||||
    width: 800,
 | 
			
		||||
    height: 600,
 | 
			
		||||
    ...opts,
 | 
			
		||||
    webPreferences: {
 | 
			
		||||
      preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
 | 
			
		||||
      webSecurity: false,
 | 
			
		||||
      ...opts?.webPreferences,
 | 
			
		||||
    },
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -8,8 +8,8 @@ import { getLogPath, log } from './app.ts';
 | 
			
		||||
import { checkShowPage } from './window/page/index.ts';
 | 
			
		||||
import { closeProcess, createProcess } from './process/index.ts';
 | 
			
		||||
import { getElectronResourcePath, isMac } from './system/env.ts';
 | 
			
		||||
import { checkForUpdates } from './updater/index.ts';
 | 
			
		||||
import { createTransWindow } from './browsers/trans.ts';
 | 
			
		||||
// import { checkForUpdates } from './updater/index.ts';
 | 
			
		||||
import { createTransWindow, createDemoWinodw } from './browsers/trans.ts';
 | 
			
		||||
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
const __filename = fileURLToPath(import.meta.url);
 | 
			
		||||
@@ -22,19 +22,9 @@ async function createWindow() {
 | 
			
		||||
  log.info('resourcePath', resourcePath);
 | 
			
		||||
  log.info('createWindow');
 | 
			
		||||
  log.info('path', getLogPath());
 | 
			
		||||
  const _session = createSession();
 | 
			
		||||
  // mainWindow = new BrowserWindow({
 | 
			
		||||
  //   width: 800,
 | 
			
		||||
  //   height: 600,
 | 
			
		||||
  //   webPreferences: {
 | 
			
		||||
  //     preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
 | 
			
		||||
  //     session: _session,
 | 
			
		||||
  //     webSecurity: false,
 | 
			
		||||
  //   },
 | 
			
		||||
  // });
 | 
			
		||||
  loadMenu();
 | 
			
		||||
  // await checkShowPage(mainWindow);
 | 
			
		||||
  let transWindow = createTransWindow();
 | 
			
		||||
  let transWindow = createDemoWinodw();
 | 
			
		||||
  transWindow.on('closed', () => {
 | 
			
		||||
    transWindow = null;
 | 
			
		||||
  });
 | 
			
		||||
@@ -46,9 +36,9 @@ async function createWindow() {
 | 
			
		||||
app.on('ready', async () => {
 | 
			
		||||
  // await createProcess();
 | 
			
		||||
  createWindow();
 | 
			
		||||
  if (!isMac()) {
 | 
			
		||||
    checkForUpdates();
 | 
			
		||||
  }
 | 
			
		||||
  // if (!isMac()) {
 | 
			
		||||
  //   checkForUpdates();
 | 
			
		||||
  // }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.on('window-all-closed', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,53 +33,53 @@ export const loadMenu = () => {
 | 
			
		||||
        // },
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      label: '打开应用',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          label: '首页',
 | 
			
		||||
          click: () => {
 | 
			
		||||
            // 获取当前window
 | 
			
		||||
            const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
            if (mainWindow) {
 | 
			
		||||
              checkShowPage(mainWindow);
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: 'note',
 | 
			
		||||
          click: () => {
 | 
			
		||||
            // 获取当前window
 | 
			
		||||
            const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
            if (mainWindow) {
 | 
			
		||||
              checkShowPage(mainWindow, '/web/note');
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: 'root-center',
 | 
			
		||||
          click: () => {
 | 
			
		||||
            // 获取当前window
 | 
			
		||||
            const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
            if (mainWindow) {
 | 
			
		||||
              checkShowPage(mainWindow, '/root/center');
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: '打开配置',
 | 
			
		||||
          click: async () => {
 | 
			
		||||
            createEnterPage();
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: '打开应用市场',
 | 
			
		||||
          click: async () => {
 | 
			
		||||
            createAppPackagesPage();
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    // {
 | 
			
		||||
    //   label: '打开应用',
 | 
			
		||||
    //   submenu: [
 | 
			
		||||
    //     {
 | 
			
		||||
    //       label: '首页',
 | 
			
		||||
    //       click: () => {
 | 
			
		||||
    //         // 获取当前window
 | 
			
		||||
    //         const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
    //         if (mainWindow) {
 | 
			
		||||
    //           checkShowPage(mainWindow);
 | 
			
		||||
    //         }
 | 
			
		||||
    //       },
 | 
			
		||||
    //     },
 | 
			
		||||
    //     {
 | 
			
		||||
    //       label: 'note',
 | 
			
		||||
    //       click: () => {
 | 
			
		||||
    //         // 获取当前window
 | 
			
		||||
    //         const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
    //         if (mainWindow) {
 | 
			
		||||
    //           checkShowPage(mainWindow, '/web/note');
 | 
			
		||||
    //         }
 | 
			
		||||
    //       },
 | 
			
		||||
    //     },
 | 
			
		||||
    //     {
 | 
			
		||||
    //       label: 'root-center',
 | 
			
		||||
    //       click: () => {
 | 
			
		||||
    //         // 获取当前window
 | 
			
		||||
    //         const mainWindow = BrowserWindow.getFocusedWindow();
 | 
			
		||||
    //         if (mainWindow) {
 | 
			
		||||
    //           checkShowPage(mainWindow, '/root/center');
 | 
			
		||||
    //         }
 | 
			
		||||
    //       },
 | 
			
		||||
    //     },
 | 
			
		||||
    //     {
 | 
			
		||||
    //       label: '打开配置',
 | 
			
		||||
    //       click: async () => {
 | 
			
		||||
    //         createEnterPage();
 | 
			
		||||
    //       },
 | 
			
		||||
    //     },
 | 
			
		||||
    //     {
 | 
			
		||||
    //       label: '打开应用市场',
 | 
			
		||||
    //       click: async () => {
 | 
			
		||||
    //         createAppPackagesPage();
 | 
			
		||||
    //       },
 | 
			
		||||
    //     },
 | 
			
		||||
    //   ],
 | 
			
		||||
    // },
 | 
			
		||||
    {
 | 
			
		||||
      label: '编辑',
 | 
			
		||||
      submenu: [
 | 
			
		||||
 
 | 
			
		||||
@@ -33,15 +33,15 @@ export default defineConfig({
 | 
			
		||||
      },
 | 
			
		||||
    }),
 | 
			
		||||
 | 
			
		||||
    viteStaticCopy({
 | 
			
		||||
      targets: [
 | 
			
		||||
        { src: 'src/renderer/assistant-center/*', dest: '../dist' },
 | 
			
		||||
        {
 | 
			
		||||
          src: 'src/main/preload.js',
 | 
			
		||||
          dest: '../app-dist',
 | 
			
		||||
        },
 | 
			
		||||
      ],
 | 
			
		||||
    }),
 | 
			
		||||
    // viteStaticCopy({
 | 
			
		||||
    //   targets: [
 | 
			
		||||
    //     { src: 'src/renderer/assistant-center/*', dest: '../dist' },
 | 
			
		||||
    //     {
 | 
			
		||||
    //       src: 'src/main/preload.js',
 | 
			
		||||
    //       dest: '../app-dist',
 | 
			
		||||
    //     },
 | 
			
		||||
    //   ],
 | 
			
		||||
    // }),
 | 
			
		||||
  ],
 | 
			
		||||
  define: {},
 | 
			
		||||
  build: {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user