Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown encoding: base64url #97 #5

Closed
AliAkhgar opened this issue Dec 5, 2024 · 1 comment
Closed

Unknown encoding: base64url #97 #5

AliAkhgar opened this issue Dec 5, 2024 · 1 comment

Comments

@AliAkhgar
Copy link

Hi,
im encoutring this error at ece.decrypt only in production mode. this error has been indicated in here.
MatthieuLemoine/electron-push-receiver#97

any idea what might cause the problem?
here is my webpack, tsc and package json configs.

I moved your lib into my project to examine it carefully but no luck.


/**
 * Webpack config for production electron main process
 */

import path from 'path';
import webpack from 'webpack';
import { merge } from 'webpack-merge';
import TerserPlugin from 'terser-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import baseConfig from './webpack.config.base';
import webpackPaths from './webpack.paths';
import checkNodeEnv from '../scripts/check-node-env';
import deleteSourceMaps from '../scripts/delete-source-maps';
import WebpackObfuscator from 'webpack-obfuscator';
const CopyWebpackPlugin = require("copy-webpack-plugin")

checkNodeEnv('production');
deleteSourceMaps();

  // {from: "node_modules/push-receiver/src/mcs.proto", to: "./"},
//     {from: "node_modules/push-receiver/src/gcm/android_checkin.proto", to: "./"},
//     {from: "node_modules/push-receiver/src/gcm/checkin.proto", to: "./"},


const configuration: webpack.Configuration = {
  devtool: 'source-map',

  mode: 'production',

  target: 'electron-main',

  entry: {
    main: path.join(webpackPaths.srcMainPath, 'main.ts'),
    preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
  },

  output: {
    path: webpackPaths.distMainPath,
    filename: '[name].js',
    library: {
      type: 'umd',
    },
  },

  optimization: {
    minimizer: [
      new TerserPlugin({
        parallel: true,
      }),
    ],
  },

  plugins: [
    new BundleAnalyzerPlugin({
      analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
      analyzerPort: 8888,
    }),

    /**
     * Create global constants which can be configured at compile time.
     *
     * Useful for allowing different behaviour between development builds and
     * release builds
     *
     * NODE_ENV should be production so that modules do not perform certain
     * development checks
     */
    new webpack.EnvironmentPlugin({
      NODE_ENV: 'production',
      DEBUG_PROD: false,
      START_MINIMIZED: false,
    }),

    new webpack.DefinePlugin({
      'process.type': '"browser"',
    }),
    new CopyWebpackPlugin({
      patterns: [
       {from: "src/main/mcs.proto", to: "mcs.proto"},
    {from: "src/main/android_checkin.proto", to: "android_checkin.proto"},
    {from: "src/main/checkin.proto", to: "checkin.proto"},
    {from: "src/main/mcs.proto", to: "utils/mcs.proto"},
    {from: "src/main/android_checkin.proto", to: "utils/android_checkin.proto"},
    {from: "src/main/checkin.proto", to: "utils/checkin.proto"},
  ]}),



  //   new WebpackObfuscator ({
  //     rotateStringArray: true
  // }, ['mcs.proto','android_checkin.proto','checkin.proto']) 
  ],

  /**

  //   ,//'mcs.proto','android_checkin.proto','checkin.proto'
   * Disables webpack processing of __dirname and __filename.
   * If you run the bundle in node.js it falls back to these values of node.js.
   * https://github.com/webpack/webpack/issues/2010
   */
  node: {
      
    __dirname: false,
    __filename: false
    },
};

export default merge(baseConfig, configuration);


{
  "compilerOptions": {

    "incremental": true,
    "target": "es2022",
    "module": "commonjs",
    "lib": ["dom", "ES2022"],
    "jsx": "react-jsx",
    "strict": true,
    "sourceMap": true,
    "baseUrl": "./src",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "allowJs": true,
    "outDir": ".erb/dll",
    "typeRoots": ["src/types/custom.d.ts","node_modules/@types" ]
  },
  "exclude": ["test", "release/build", "release/app/dist", ".erb/dll"]
}

{
  "description": "A vpn client by AAA",
  "keywords": [
    "V2ray",
    "SingBox",
    "mac",
    "windows",
    "linux",
    "tun",
    "vmess",
    "vless",
    "leaf"
  ],
  "homepage": "https://github.com/aliakhgar/",
  "bugs": {
    "url": "https://github.com/aliakhgar"
  },
  "license": "MIT",
  "author": {
    "name": "Tripl3A",
    "email": "[email protected]",
    "url": "https://aliakhgar.com"
  },
  "contributors": [
    {
      "name": "AAA",
      "email": "[email protected]",
      "url": "https://github.com/aliakhgar"
    }
  ],
  "main": "./src/main/main.ts",
  "scripts": {
    "build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
    "build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
    "build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
    "postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
    "lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
    "package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
    "rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
    "start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
    "start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .",
    "start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
    "start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
    "test": "jest",
    "dev": "nodemon --watch ./src/**/* --watch . --exec 'npm run electron'",
    "download": "ts-node -O '{\"module\":\"commonjs\"}' download-v2ray.ts",
    "downloadAll": "ts-node -O '{\"module\":\"commonjs\"}' download-v2ray.ts --all"
  },
  "browserslist": [],
  "prettier": {
    "singleQuote": true,
    "overrides": [
      {
        "files": [
          ".prettierrc",
          ".eslintrc"
        ],
        "options": {
          "parser": "json"
        }
      }
    ]
  },
  "jest": {
    "moduleDirectories": [
      "node_modules",
      "release/app/node_modules",
      "src"
    ],
    "moduleFileExtensions": [
      "js",
      "jsx",
      "ts",
      "tsx",
      "json"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.erb/mocks/fileMock.js",
      "\\.(css|less|sass|scss)$": "identity-obj-proxy"
    },
    "setupFiles": [
      "./.erb/scripts/check-build-exists.ts"
    ],
    "testEnvironment": "jsdom",
    "testEnvironmentOptions": {
      "url": "http://localhost/"
    },
    "testPathIgnorePatterns": [
      "release/app/dist",
      ".erb/dll"
    ],
    "transform": {
      "\\.(ts|tsx|js|jsx)$": "ts-jest"
    }
  },
  "dependencies": {
    "@emotion/react": "^11.11.1",
    "@emotion/styled": "^11.11.0",
    "@mui/material": "^5.14.0",
    "@ramonak/react-progress-bar": "^5.0.3",
    "@react-spring/web": "^9.7.3",
    "animejs": "^3.2.1",
    "axios": "^1.3.4",
    "axios-retry": "^3.5.1",
    "copy-webpack-plugin": "^11.0.0",
    "electron-config": "^1.0.0",
    "electron-debug": "^3.2.0",
    "electron-is-dev": "^2.0.0",
    "electron-log": "^4.4.8",
    "electron-reload": "^2.0.0-alpha.1",
    "electron-store": "^8.1.0",
    "electron-updater": "^5.3.0",
    "fix-path": "^4.0.0",
    "framer-motion": "^10.12.18",
    "hddserial": "^0.0.7",
    "http_ece": "^1.0.5",
    "immer": "^9.0.19",
    "js-base64": "^3.7.5",
    "long": "^3.2.0",
    "lottie-react": "^2.4.0",
    "master": "^1.0.9",
    "mui": "^0.0.1",
    "ngx-electron": "^2.2.0",
    "node-fetch": "^2.6.6",
    "node-machine-id": "^1.1.12",
    "node-polyfill-webpack-plugin": "^2.0.1",
    "node-powershell": "^4.0.0",
    "path": "^0.12.7",
    "protobufjs": "^7.4.0",
    "rc-progress": "^3.4.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-modal-sheet": "^2.0.0",
    "react-router-dom": "^6.8.1",
    "react-transition-group": "^4.4.5",
    "request": "^2.88.2",
    "request-promise": "^4.2.6",
    "unzipper": "^0.10.11",
    "uuid": "^10.0.0"
  },
  "resolutions": {
    "electron": "^22.0.0"
  },
  "devDependencies": {
    "@electron/notarize": "^1.2.3",
    "@electron/rebuild": "^3.2.10",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
    "@svgr/webpack": "^6.5.1",
    "@teamsupercell/typings-for-css-modules-loader": "^2.5.2",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@types/jest": "^29.4.0",
    "@types/node": "^18.13.0",
    "@types/node-fetch": "^2.6.2",
    "@types/node-powershell": "^4.0.1",
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@types/react-test-renderer": "^18.0.0",
    "@types/terser-webpack-plugin": "^5.0.4",
    "@types/unzipper": "^0.10.5",
    "@types/webpack-bundle-analyzer": "^4.6.0",
    "@typescript-eslint/eslint-plugin": "^5.51.0",
    "@typescript-eslint/parser": "^5.51.0",
    "browserslist-config-erb": "^0.0.3",
    "chalk": "^4.1.2",
    "concurrently": "^7.6.0",
    "core-js": "^3.27.2",
    "cross-env": "^7.0.3",
    "css-loader": "^6.7.3",
    "css-minimizer-webpack-plugin": "^4.2.2",
    "detect-port": "^1.5.1",
    "electron": "^22.0.0",
    "electron-builder": "^23.6.0",
    "electron-devtools-installer": "^3.2.0",
    "electronmon": "^2.0.2",
    "eslint": "^8.33.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-config-erb": "^4.0.6",
    "eslint-import-resolver-typescript": "^3.5.3",
    "eslint-import-resolver-webpack": "^0.13.2",
    "eslint-plugin-compat": "^4.1.1",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jest": "^27.2.1",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "file-loader": "^6.2.0",
    "html-webpack-plugin": "^5.5.0",
    "identity-obj-proxy": "^3.0.0",
    "javascript-obfuscator": "^4.0.2",
    "jest": "^29.4.2",
    "jest-environment-jsdom": "^29.4.2",
    "mini-css-extract-plugin": "^2.7.2",
    "prettier": "^2.8.4",
    "react-refresh": "^0.14.0",
    "react-test-renderer": "^18.2.0",
    "rimraf": "^4.1.2",
    "sass": "^1.58.0",
    "sass-loader": "^13.2.0",
    "style-loader": "^3.3.1",
    "terser-webpack-plugin": "^5.3.6",
    "ts-jest": "^29.0.5",
    "ts-loader": "^9.4.2",
    "ts-node": "^10.9.1",
    "tsconfig-paths-webpack-plugin": "^4.0.0",
    "typescript": "^4.9.5",
    "url-loader": "^4.1.1",
    "webpack": "^5.75.0",
    "webpack-bundle-analyzer": "^4.7.0",
    "webpack-cli": "^5.0.1",
    "webpack-dev-server": "^4.11.1",
    "webpack-merge": "^5.8.0",
    "webpack-obfuscator": "^3.5.1"
  },
  "build": {
    "productName": "BaharVPN",
    "appId": "com.ns.BHVPN",
    "asar": true,
    "asarUnpack": "**\\*.{node,dll}",
    "files": [
      "dist",
      "node_modules",
      "package.json",
      {
        "from": "dist/",
        "to": "./",
        "filter": [
          "*.proto"
        ]
      }
    ],
    "nsis": {
      "oneClick": false,
      "allowToChangeInstallationDirectory": true,
      "include": "build/installer.nsh"
    },
    "afterSign": ".erb/scripts/notarize.js",
    "mac": {
      "target": {
        "target": "default",
        "arch": [
          "arm64",
          "x64"
        ]
      },
      "type": "distribution",
      "hardenedRuntime": true,
      "entitlements": "assets/entitlements.mac.plist",
      "entitlementsInherit": "assets/entitlements.mac.plist",
      "gatekeeperAssess": false
    },
    "dmg": {
      "contents": [
        {
          "x": 130,
          "y": 220
        },
        {
          "x": 410,
          "y": 220,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "requestedExecutionLevel": "highestAvailable",
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ]
    },
    "portable": {
      "artifactName": "BHV_V1.0.exe",
      "requestExecutionLevel": "admin"
    },
    "linux": {
      "target": [
        "AppImage"
      ],
      "category": "Development"
    },
    "directories": {
      "app": "release/app",
      "buildResources": "assets",
      "output": "release/build"
    },
    "extraResources": [
      "./assets/**"
    ],
    "publish": {
      "provider": "github",
      "owner": "singbox-v2ray-elo-desktop",
      "repo": "singbox-v2ray-elo-desktop"
    }
  },
  "collective": {
    "url": "https://aliakhgar.com"
  },
  "engines": {
    "node": ">=14.x",
    "npm": ">=7.x"
  },
  "electronmon": {
    "patterns": [
      "!**/**",
      "src/main/**"
    ],
    "logLevel": "quiet"
  }
}

@AliAkhgar
Copy link
Author

had to rebase my project to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant