Skip to content

Commit

Permalink
Merge pull request #1054 from loki-project/clearnet
Browse files Browse the repository at this point in the history
Clearnet --> Master for v1.0.6 #2
  • Loading branch information
Mikunj committed Apr 3, 2020
2 parents 6438698 + f632a87 commit 85e5a06
Show file tree
Hide file tree
Showing 97 changed files with 4,815 additions and 2,602 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Remember, you can preview this before saving it.
### Contributor checklist:

* [ ] My commits are in nice logical chunks with [good commit messages](http://chris.beams.io/posts/git-commit/)
* [ ] My changes are [rebased](https://medium.freecodecamp.org/git-rebase-and-the-golden-rule-explained-70715eccc372) on the latest [`clearnet`](https://github.com/loki-project/loki-messenger/tree/development) branch
* [ ] My changes are [rebased](https://blog.axosoft.com/golden-rule-of-rebasing-in-git/) on the latest [`clearnet`](https://github.com/loki-project/loki-messenger/tree/clearnet) branch
* [ ] A `yarn ready` run passes successfully ([more about tests here](https://github.com/loki-project/loki-messenger/blob/master/CONTRIBUTING.md#tests))
* [ ] My changes are ready to be shipped to users

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
run: yarn generate

- name: Lint Files
if: runner.os != 'Windows'
run: yarn lint-full

- name: Build windows production binaries
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ jobs:
run: yarn generate

- name: Lint Files
if: runner.os != 'Windows'
run: |
yarn format-full --list-different
yarn format-full
yarn eslint
yarn tslint
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
run: yarn generate

- name: Lint Files
if: runner.os != 'Windows'
run: yarn lint-full

- name: Build windows production binaries
Expand Down
61 changes: 58 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Building

Building session binaries is done using github actions. Windows and linux binaries will build right out of the box but there are some extra steps needed for Mac OS
## Automated

## Mac OS
Automatic building of session binaries is done using github actions. Windows and linux binaries will build right out of the box but there are some extra steps needed for Mac OS

### Mac OS

The build script for Mac OS requires you to have a valid `Developer ID Application` certificate. Without this the build script cannot sign and notarize the mac binary which is needed for Catalina 10.15 and above.
If you would like to disable this then comment out `"afterSign": "build/notarize.js",` in package.json.

You will also need an [App-specific password](https://support.apple.com/en-al/HT204397) for the apple account you wish to notarize with

### Setup
#### Setup

Once you have your `Developer ID Application` you need to export it into a `.p12` file. Keep a note of the password used to encrypt this file as it will be needed later.

Expand Down Expand Up @@ -40,3 +42,56 @@ base64 -i certificate.p12 -o encoded.txt
5. Team ID (Optional)
* Name: `SIGNING_TEAM_ID`
* Value: The apple team id if you're sigining the application for a team

## Manual

### Node version

You will need node `10.13.0`.
This can be done by using [nvm](https://github.com/nvm-sh/nvm) and running `nvm use` or you can install it manually.

### Prerequisites

<details>
<summary>Windows</summary>

Building on windows should work straight out of the box, but if it fails then you will need to run the following:

```
npm install --global --production windows-build-tools@4.0.0
npm install --global node-gyp@latest
npm config set python python2.7
npm config set msvs_version 2015
```

</details>

<details>
<summary>Mac</summary>

If you are going to distribute the binary then make sure you have a `Developer ID Application` certificate in your keychain.

You will then need to generate an [app specific password](https://support.apple.com/HT204397) for your Apple ID.

Then run the following to export the variables

```
export SIGNING_APPLE_ID=<your apple id>
export SIGNING_APP_PASSWORD=<your app specific password>
export SIGNING_TEAM_ID=<your team id if applicable>
```

</details>

### Commands

Run the following to build the binaries for your specific system OS.

```
npm install yarn --no-save
yarn install --frozen-lockfile
yarn generate
yarn build-release
```

The binaries will be placed inside the `release/` folder.
63 changes: 27 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,40 +82,46 @@ while you make changes:
yarn grunt dev # runs until you stop it, re-generating built assets on file changes
```

## Additional storage profiles
## Multiple instances

Since there is no registration for Session, you can create as many accounts as you
can public keys. To test the P2P functionality on the same machine, however, requries
that each client binds their message server to a different port.
can public keys. Each client however has a dedicated storage profile which is determined by the environment and instance variables.

You can use the following command to start a client bound to a different port.
This profile will change [userData](https://electron.atom.io/docs/all/#appgetpathname)
directory from `%appData%/Session` to `%appData%/Session-{environment}-{instance}`.

There are a few scripts which you can use:

```
yarn start-multi
yarn start - Start development
yarn start-multi - Start second instance of development
yarn start-prod - Start production but in development mode
yarn start-prod-multi - Start another instance of production
```

For more than 2 clients, you can setup additional storage profiles and switch
between them using the `NODE_APP_INSTANCE` environment variable and specifying a
new localServerPort in the config.

For example, to create an 'alice' profile, put a file called `local-alice.json` in the
`config` directory:
For more than 2 clients, you may run the above command with `NODE_APP_INSTANCE` set before them.
For example, running:

```
{
"storageProfile": "aliceProfile",
"localServerPort": "8082",
}
NODE_APP_INSTANCE=alice yarn start
```

Then you can start up the application a little differently to load the profile:
Will run the development environment with the `alice` instance and thus create a seperate storage profile.

If a fixed profile is needed (in the case of tests), you can specify it using `storageProfile` in the config file. If the change is local then put it in `local-{instance}.json` otherwise put it in `default-{instance}.json` or `{env}-{instance}.json`.

Local config files will be ignored by default in git.

For example, to create an 'alice' profile locally, put a file called `local-alice.json` in the
`config` directory:

```
NODE_APP_INSTANCE=alice yarn run start
{
"storageProfile": "alice-profile",
}
```

This changes the [userData](https://electron.atom.io/docs/all/#appgetpathname)
directory from `%appData%/Session` to `%appData%/Session-aliceProfile`.
This will then set the `userData` directory to `%appData%/Session-alice-profile` when running the `alice` instance.

# Making changes

Expand Down Expand Up @@ -187,26 +193,11 @@ Above all, spend some time with the repository. Follow the pull request template
your pull request description automatically. Take a look at recent approved pull requests,
see how they did things.

## Testing Production Builds
## Production Builds

To test changes to the build system, build a release using
You can build a production binary by running the following:

```
yarn generate
yarn build-release
```

Then, run the tests using `grunt test-release:osx --dir=release`, replacing `osx` with `linux` or `win` depending on your platform.

<!-- TODO:
## Translations
To pull the latest translations, follow these steps:
1. Download Transifex client:
https://docs.transifex.com/client/installing-the-client
2. Create Transifex account: https://transifex.com
3. Generate API token: https://www.transifex.com/user/settings/api/
4. Create `~/.transifexrc` configuration:
https://docs.transifex.com/client/client-configuration#-transifexrc
5. Run `yarn grunt tx`. -->
23 changes: 20 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ module.exports = grunt => {
NODE_ENV: environment,
},
requireName: 'unused',
chromeDriverArgs: [
`remote-debugging-port=${Math.floor(
Math.random() * (9999 - 9000) + 9000
)}`,
],
});

function getMochaResults() {
Expand Down Expand Up @@ -368,11 +373,18 @@ module.exports = grunt => {
logs.forEach(log => {
console.log(log);
});

return app.stop();
try {
return app.stop();
} catch (err) {
return Promise.resolve();
}
});
}
return app.stop();
try {
return app.stop();
} catch (err) {
return Promise.resolve();
}
})
.then(() => {
if (failure) {
Expand Down Expand Up @@ -465,6 +477,11 @@ module.exports = grunt => {
const app = new Application({
path: [dir, config.exe].join('/'),
requireName: 'unused',
chromeDriverArgs: [
`remote-debugging-port=${Math.floor(
Math.random() * (9999 - 9000) + 9000
)}`,
],
});

app
Expand Down
52 changes: 39 additions & 13 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@
"description":
"Only available on development modes, menu option to open up the standalone device setup sequence"
},
"contextMenuNoSuggestions": {
"message": "No Suggestions",
"description":
"Shown in the context menu for a misspelled word to indicate that there are no suggestions to replace the misspelled word"
},
"connectingLoad": {
"message": "Connecting To Server",
"description":
Expand Down Expand Up @@ -982,10 +987,17 @@
"message": "Pair New Device"
},
"devicePairingAccepted": {
"message": "Device Pairing Accepted"
"message": "Device Linking Accepted"
},
"devicePairingReceived": {
"message": "Device Pairing Received"
"message": "Device Linking Received"
},
"devicePairingRequestReceivedNoListenerTitle": {
"message": "Device linking request received."
},
"devicePairingRequestReceivedNoListenerDescription": {
"message":
"Device linking request received but you are not on the device linking screen. \nFirst go to Settings -> Device -> Link New Device."
},
"waitingForDeviceToRegister": {
"message": "Waiting for device to register..."
Expand All @@ -994,34 +1006,37 @@
"message": "Scan the QR Code on your secondary device"
},
"pairedDevices": {
"message": "Paired Devices"
"message": "Linked Devices"
},
"noPairedDevices": {
"message": "No paired devices"
"message": "No linked devices"
},
"deviceIsSecondaryNoPairing": {
"message": "This device is a secondary device and so cannot be linked."
},
"allowPairing": {
"message": "Allow Pairing"
"message": "Allow Linking"
},
"allowPairingWithDevice": {
"message": "Allow pairing with this device?"
"message": "Allow linking with this device?"
},
"provideDeviceAlias": {
"message": "Please provide an alias for this paired device"
"message": "Please provide an alias for this linked device"
},
"showPairingWordsTitle": {
"message": "Pairing Secret Words"
"message": "Linking Secret Words"
},
"secretPrompt": {
"message": "Here is your secret"
},
"confirmUnpairingTitle": {
"message": "Please confirm you want to unpair the following device:"
"message": "Please confirm you want to unlink the following device:"
},
"unpairDevice": {
"message": "Unpair Device"
"message": "Unlink Device"
},
"deviceUnpaired": {
"message": "Device Unpaired"
"message": "Device Unlinked"
},
"clear": {
"message": "Clear"
Expand Down Expand Up @@ -1404,6 +1419,11 @@
"message": "Enable spell check of text entered in message composition box",
"description": "Description of the media permission description"
},
"spellCheckDirty": {
"message": "You must restart Session to apply your new settings",
"description":
"Shown when the user changes their spellcheck setting to indicate that they must restart Signal."
},
"clearDataHeader": {
"message": "Clear All Local Data",
"description":
Expand Down Expand Up @@ -2289,6 +2309,12 @@
"confirmPassword": {
"message": "Confirm password"
},
"pasteLongPasswordToastTitle": {
"message":
"The clipboard content exceeds the maximum password length of $max_pwd_len$ characters.",
"description":
"Shown when user pastes a password which is longer than MAX_PASSWORD_LEN"
},
"showSeedPasswordRequest": {
"message": "Please enter your password",
"description": "Request for user to enter password to show seed."
Expand Down Expand Up @@ -2502,7 +2528,7 @@
"description": "Indicates that a friend request is pending"
},
"notFriends": {
"message": "not friends",
"message": "Not Friends",
"description": "Indicates that a conversation is not friends with us"
},
"emptyGroupNameError": {
Expand Down Expand Up @@ -2814,7 +2840,7 @@
"message": "Filter received requests"
},
"secretWords": {
"message": "Secret words:"
"message": "Secret words"
},
"pairingDevice": {
"message": "Pairing Device"
Expand Down

0 comments on commit 85e5a06

Please sign in to comment.