Build, package, publish and debug instructions for OpenMTP. For the app itself, see the README.
Requirements: Node.js v16, Git and Yarn package manager
$ git clone https://github.com/ganeshrvel/openmtp.git
$ cd openmtp
# install yarn
npm install -g yarn
# install sentry cli
npm -g i @sentry/cli$ yarnA fresh clone might throw undefined state error. Run the following commands once to fix the issue.
# For Mac and Linux
$ UPGRADE_EXTENSIONS=1 npm run dev
# For Windows
$ set UPGRADE_EXTENSIONS=1 && npm run dev# Development
$ yarn dev
# Pre-production
$ yarn start
# In the terminal, run
$ "/path/to/OpenMTP.app/Contents/MacOS/OpenMTP" --remote-debugging-port=6363- Open a Chromium browser
- Input "about://inspect" into the URL bar
- Add a new connection
localhost:6363 - Inspect OpenMTP at port
6363
- CodeMagic.io
- Create a new App (Choose others -> Enter Electron)
- Environment variables:
APPLEID:<Apple developer account username>APPLE_APP_SPECIFIC_PASSWORD:<App-Specific Password>- Log into your Apple Account
- Go to Sign-In and Security > App-Specific Passwords
- Click on Generate Password..., enter a password label and click Create
- Copy the displayed app-specific-password
APPLE_TEAM_ID:<Apple Team ID>- To get Team ID, go to your Apple Developer Account
- Then click on "Membership details", and there you will find your Team ID.
SENTRY_URL:https://sentry.io/SENTRY_ORG:<Sentry Organization Name>SENTRY_PROJECT:<Sentry Project>SENTRY_TOKEN_ID:<Sentry Auth Token>- Find it from here: Auth Tokens
- Scopes:
event:admin, event:read, member:read, org:read, project:read, project:releases, team:read
GITHUB_TOKEN:Personal access token- There are two options available:
- Fine-grained personal access tokens
- https://github.com/settings/tokens?type=beta
- Permissions:
Contents - (Read and Write access to code)
- Personal access tokens (classic)
- https://github.com/settings/tokens
- Scopes:
admin:gpg_key, admin:public_key, repo, user, workflow
- There are two options available:
CSC_LINK:- Keychain ->
Default Keychainsmenu in the left -> Login -> My Certificates - Search for
Developer ID Applicationin the top search bar- If there are no results for the
Developer ID Application, for the organization, create one from here: Apple Developer Certificates - Follow these steps to get the Apple Developer certificate installed on the local machine Obtaining-an-Apple-Developer-ID-Certificate-for-macOS-Provisioning
- If there are no results for the
- Search for
Developer ID Applicationin the top search bar - Expand
Developer ID Application: <User Name> (XXXYYYZZZ) - See if the private key's name matches this:
Mac Developer ID Application: <User Name>- Otherwise, rename the private key as (right click -> get info)
Mac Developer ID Application: <User Name> - Close the window
- Otherwise, rename the private key as (right click -> get info)
- Right-click on the private key ->
Mac Developer ID Application: <User Name> - Export
Mac Developer ID Application: <User Name> - File name:
CERTIFICATE_PRIVATE_KEY.p12 - Enter Password. This is the
CSC_KEY_PASSWORD, note this down - Run (this step doesn't work if you are using fig or ohmyzsh, use raw terminal):
base64 -i CERTIFICATE_PRIVATE_KEY.p12 -o CERTIFICATE_PRIVATE_KEY.txt
- Copy the whole content of the file
CERTIFICATE_PRIVATE_KEY.txt - Paste the content as the value for the field
CSC_LINK
- Keychain ->
CSC_KEY_PASSWORDis the password from the above stepCODEMAGIC_AUTH_TOKEN_ID:<CodeMagic API Token>- Find it from here: Sidebar -> Teams -> Personal Account -> Integrations -> Codemagic API
CODEMAGIC_INTEL_X64_WORKFLOW_ID_PROD:<Prod Codemagic workflow id>- Find the relevant workflow id from
codemagic.yaml, (mostlymacos-intel-x64-build-prod)
- Find the relevant workflow id from
CODEMAGIC_INTEL_X64_WORKFLOW_ID_DEV:<Dev Codemagic workflow id>- Find the relevant workflow id from
codemagic.yaml, (mostlymacos-intel-x64-build-dev)
- Find the relevant workflow id from
PUBLISH_PROD_REPOSITORY:<Repository to publish the production app>PUBLISH_DEV_REPOSITORY:<Repository to publish the dev app>CODEMAGIC_PUBLISH_PROJECT_ID:<Codemagic intel project id>PUBLISH_EMAIL:Email address to receive the updates on publish- References:
Set up the code signing to build, package (locally) and publish the app.
App Notarization for macOS (skip this section for non-macOS builds)
- Rename sample.env file as .env
- To update
APPLEIDandAPPLE_APP_SPECIFIC_PASSWORDin the .env file - Log into your Apple Account
- Go to Sign-In and Security > App-Specific Passwords
- Click on Generate Password..., enter a password label and click Create
- Copy the displayed app-specific-password
- Run
security add-generic-password -a "<apple-developer-account-username>" -w <app-specific-password> -s "APPLE_APP_SPECIFIC_PASSWORD"- Log into your Apple App Store Connect Account and accept the presented terms and conditions
- The statuses shall turn Active
Sentry
- Auth Tokens Settings page: https://sentry.io/settings/account/api/auth-tokens/
npm install -g @sentry/wizard
sentry-wizard --integration electron
# Upload Debug Information
# Every time the electron.js version is upgraded, run:
node sentry-symbols.js
sentry-cli loginPackaging Instructions: https://www.electron.build/code-signing
$ export GH_TOKEN="<github token>"# For local platform
$ yarn package
# For multiple platforms
$ yarn package-all- Built using Electron v17 and React v18
- Loadables, Dynamic Reducer Injection, Selectors for code splitting and performance optimization
- Hot module reload (HMR) for instant feedback
- Built-in error logging and profile/settings management
- Industry standard state management
- JSS, SASS/SCSS styling
- Port assigned: 4642
- config/env/env.dev.js and config/env/env.prod.js contain the PORT number of the app.
- config/dev-app-update.yml file holds the GitHub repo variables required by electron-updater.
- config/google-analytics-key.js file contains the Google Analytics Tracking ID.
- package.json build.publish object holds the values for publishing the packaged application.
- app/constants folder contains all the constants required by the app.
electron-react-boilerplate/electron-react-boilerplate#400
electron-react-boilerplate/electron-react-boilerplate#118
electron-react-boilerplate/electron-react-boilerplate#108
# For Mac and Linux
$ UPGRADE_EXTENSIONS=1 npm run dev
# For Windows
$ set UPGRADE_EXTENSIONS=1 && npm run dev- On macOS <= 10.14.x (Mojave) the
yarn installwill throw a npm-rebuild error - To "test" or "debug" the app on macOS Mojave:
- remove the
node-mac-permissionsdependency frompackage.json - Add the ignorePlugin line to
default.pluginsin the filewebpack/config.base.jsnew webpack.IgnorePlugin({ resourceRegExp: /^(node-mac-permissions)$/u }),
- WARNING: DO NOT commit these changes to the upstream!!
- remove the
- The
NODE_MAC_PERMISSIONS_MIN_OSconstant defines the minimum OS version that is required to show the macOS usage access permission pop-up - For distribution, make sure to build the app on a machine which is at least 10.15 (Catalina)
- Raise an issue if your device is undetected: https://github.com/ganeshrvel/openmtp/issues/new?template=contribute.md
- Uninstall Samsung Smart Switch if installed: https://farazfazli.medium.com/how-i-reverse-engineered-keis-and-sidesync-and-fixed-mtp-8949acbb1c29, ganeshrvel#212.