Skip to content

Commit

Permalink
Merge pull request #2730 from oxen-io/clearnet
Browse files Browse the repository at this point in the history
Session 1.10.8
  • Loading branch information
Bilb committed Apr 5, 2023
2 parents 9fa9537 + 94dee23 commit e2d3767
Show file tree
Hide file tree
Showing 54 changed files with 263 additions and 216 deletions.
55 changes: 23 additions & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,38 @@
## Advice for new contributors

Start small. The PRs most likely to be merged are the ones that make small,
easily reviewed changes with clear and specific intentions. See below for more
easily reviewed changes with clear and specific intentions.
[guidelines on pull requests](#pull-requests).

It's a good idea to gauge interest in your intended work by finding the current issue
for it or creating a new one yourself. You can use also that issue as a place to signal
for it or creating a new one yourself. Use Github issues as a place to signal
your intentions and get feedback from the users most likely to appreciate your changes.
If you intend to make a pull request for a new feature and the feature is user facing,
please let us know in a new, or existing issue, so we can guide your efforts around
UX/UI considerations.

You're most likely to have your pull request accepted easily if it addresses bugs already
in the [Next Steps project](https://github.com/oxen-io/session-desktop/projects/1),
especially if they are near the top of the Backlog column. Those are what we'll be looking
at next, so it would be great if you helped us out!
You're most likely to have your pull request accepted if it addresses an existing Github issue marked with the [good-first-issue](https://github.com/oxen-io/session-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) tag, these issues are specifically tagged, because they are generally features/bug fixes which can be cleanly merged on a single platform without requiring cross platform work, are generally of lower complexity than larger features and are non contentious, meaning that the core team doesn't need to try and assess the community desire for such a feature before merging.

Once you've spent a little bit of time planning your solution, it's a good idea to go
back to the issue and talk about your approach. We'd be happy to provide feedback. [An
ounce of prevention, as they say!](https://www.goodreads.com/quotes/247269-an-ounce-of-prevention-is-worth-a-pound-of-cure)
Of course we encourage community developers to work on ANY issue filed on our Github regardless of how it’s tagged, however if you pick up or create an issue without the “Good first issue” tag it would be best if you leave a comment on the issue so that the core team can give you any guidance required, especially around UI heavy features or issues which require cross platform integration.

## Developer Setup

First, you'll need [Node.js](https://nodejs.org/) which matches our current version.
You can check [`.nvmrc` in the `clearnet` branch](https://github.com/oxen-io/session-desktop/blob/clearnet/.nvmrc) to see what the current version is. If you have [nvm](https://github.com/creationix/nvm)
you can just run `nvm use` in the project directory and it will switch to the project's
desired Node.js version. [nvm for windows](https://github.com/coreybutler/nvm-windows) is
still useful, but it doesn't support `.nvmrc` files.
desired Node.js version.

If you are using Windows [nvm for windows](https://github.com/coreybutler/nvm-windows) is
still useful, but it doesn't support `.nvmrc` files. In this case you will need to `nvm install` the projects node version and `nvm use` the installed version

Then you need `git`, if you don't have that yet: https://git-scm.com/

## Platform Specific Instructions

### macOS

1. Install the [Xcode Command-Line Tools](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/).

### Windows

1. **Windows 7 only:**
- Install Microsoft .NET Framework 4.5.1:
https://www.microsoft.com/en-us/download/details.aspx?id=40773
- Install Windows SDK version 8.1: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
1. Install _Windows Build Tools_: Open the [Command Prompt (`cmd.exe`) as Administrator](<https://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx>)
and run: `npm install --vs2015 --global --production --add-python-to-path windows-build-tools`
Building on Windows versions 8+ is supported out of the box

### Linux

Expand All @@ -54,6 +45,12 @@ Then you need `git`, if you don't have that yet: https://git-scm.com/
1. Install `make`
1. Depending on your distro, you might need to install `hunspell` and `hunspell-<lan>` (e.g. `hunspell-en-au`)

If you are using a Debian based Linux distribution gcc, g++ and make can be installed as part of the `build-essential` package using

```
apt install build-essential
```

### All platforms

Now, run these commands in your preferred terminal in a good directory for development:
Expand Down Expand Up @@ -102,7 +99,7 @@ For example, running:
NODE_APP_INSTANCE=alice yarn start-prod
```

Will run the development environment with the `alice` instance and thus create a seperate storage profile.
Will run the development environment with the `alice` instance and thus create a separate 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`.

Expand Down Expand Up @@ -136,25 +133,20 @@ The easiest way to run all tests at once is `yarn test`.

So you wanna make a pull request? Please observe the following guidelines.

<!-- TODO:
* Please do not submit pull requests for translation fixes. Anyone can update
the translations in
[Transifex](https://www.transifex.com/projects/p/signal-desktop).
-->

- First, make sure that your `yarn ready` run passes - it's very similar to what our
Continuous Integration servers do to test the app.
- Never use plain strings right in the source code - pull them from `messages.json`!
You **only** need to modify the default locale
[`_locales/en/messages.json`](_locales/en/messages.json).
<!-- TODO:
Other locales are generated automatically based on that file and then periodically
uploaded to Transifex for translation. -->
uploaded to Crowdin for translation.
- Please do not submit pull requests for pure translation fixes. Anyone can update
the translations at [Crowdin](https://crowdin.com/project/session-desktop).
- [Rebase](https://nathanleclaire.com/blog/2014/09/14/dont-be-scared-of-git-rebase/) your
changes on the latest `development` branch, resolving any conflicts.
changes on the latest `clearnet` branch, resolving any conflicts.
This ensures that your changes will merge cleanly when you open your PR.
- Be sure to add and run tests!
- Make sure the diff between our master and your branch contains only the
- Make sure the diff between `clearnet` and your branch contains only the
minimal set of changes needed to implement your feature or bugfix. This will
make it easier for the person reviewing your code to approve the changes.
Please do not submit a PR with commented out code or unfinished features.
Expand All @@ -174,7 +166,6 @@ So you wanna make a pull request? Please observe the following guidelines.
choices that may be helpful to someone reviewing or auditing the commit
history in the future. When in doubt, err on the side of a longer
commit message.

Above all, spend some time with the repository. Follow the pull request template added to
your pull request description automatically. Take a look at recent approved pull requests,
see how they did things.
Expand Down
6 changes: 4 additions & 2 deletions BUILDING.md → INTERNALBUILDS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Building

This document alongside [Releasing.md](RELEASING.md) primarily cover our internal build process for release builds, if you are an external contributor please refer to [Contributing.md](CONTRIBUTING.md) for building instructions.

## Automated

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
Expand Down Expand Up @@ -65,7 +67,7 @@ git lfs install
nvm install # install the current node version used in this project
nvm use # use the current node version used in this project
npm install -g yarn # install yarn globally for this node version
yarn install --frozen-lockfile # install all dependecies of this project
yarn install --frozen-lockfile # install all dependencies of this project
yarn build-everything # transpile and assemble files
yarn start-prod # start the app on production mode (currently this is the only one supported)
```
Expand Down Expand Up @@ -115,7 +117,7 @@ git lfs install # once git lfs is installed, you have to run this command too
nvm install # install the current node version used in this project
nvm use # use the current node version used in this project
npm install -g yarn # install yarn globally for this node version
yarn install --frozen-lockfile # install all dependecies of this project
yarn install --frozen-lockfile # install all dependencies of this project
yarn build-everything # transpile and assemble files
yarn start-prod # start the app on production mode (currently this is the only one supported)
```
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ Session integrates directly with [Oxen Service Nodes](https://docs.oxen.io/about

## Want to Contribute? Found a Bug or Have a feature request?

Please search for any [existing issues](https://github.com/oxen-io/session-desktop/issues) that describe your bugs in order to avoid duplicate submissions. <br><br>Submissions can be made by making a pull request to our development branch. If you don't know where to start contributing, try reading the Github issues page for ideas.
Please search for any [existing issues](https://github.com/oxen-io/session-desktop/issues) that describe your bug in order to avoid duplicate submissions. <br><br>Submissions can be made by making a pull request to our development branch.If you don't know where to start contributing please read [Contributing.md](CONTRIBUTING.md) and refer to issues tagged with the [Good-first-issue](https://github.com/oxen-io/session-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) tag.

## Build instruction

Build instructions can be found in [BUILDING.md](BUILDING.md).

Build instructions can be found in [Contributing.md](CONTRIBUTING.md).

## Verifying signatures

Expand Down Expand Up @@ -55,5 +54,5 @@ Please visit https://deb.oxen.io/<br/>

Copyright 2011 Whisper Systems<br/>
Copyright 2013-2017 Open Whisper Systems<br/>
Copyright 2019-2021 The Oxen Project<br/>
Copyright 2019-2023 The Oxen Project<br/>
Licensed under the GPLv3: https://www.gnu.org/licenses/gpl-3.0.html<br/>
2 changes: 1 addition & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"openGroupInvitation": "Community invitation",
"joinOpenGroupAfterInvitationConfirmationTitle": "Join $roomName$?",
"joinOpenGroupAfterInvitationConfirmationDesc": "Are you sure you want to join the $roomName$ community?",
"couldntFindServerMatching": "Couldn't find the corresponding opengroup server",
"couldntFindServerMatching": "Couldn't find the corresponding Community server",
"enterSessionIDOrONSName": "Enter Session ID or ONS name",
"startNewConversationBy...": "Start a new conversation by entering someone's Session ID or share your Session ID with them.",
"loading": "Loading...",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "session-desktop",
"productName": "Session",
"description": "Private messaging from your desktop",
"version": "1.10.7",
"version": "1.10.8",
"license": "GPL-3.0",
"author": {
"name": "Oxen Labs",
Expand Down
9 changes: 5 additions & 4 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ window.clipboard = clipboard;

window.getSeedNodeList = () =>
window.sessionFeatureFlags.useTestNet
? ['http://public.loki.foundation:38157']
? ['http://seed2.getsession.org:38157']
: [
'https://storage.seed1.loki.network:4433/',
'https://storage.seed3.loki.network:4433/',
'https://public.loki.foundation:4433/',
// Note: for each of the seed nodes, the cert pinned is the one provided on the port 4443 and not the 4433, because the 4443 is a 10year one
'https://seed1.getsession.org:4443/',
'https://seed2.getsession.org:4443/',
'https://seed3.getsession.org:4443/',
];

const { locale: localFromEnv } = config;
Expand Down
2 changes: 1 addition & 1 deletion ts/components/SessionInboxView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ExpirationTimerOptions } from '../util/expiringMessages';
import moment from 'moment';
import styled from 'styled-components';

// Default to the locale from env. It will be overriden if moment
// Default to the locale from env. It will be overridden if moment
// does not recognize it with what moment knows which is the closest.
// i.e. es-419 will return 'es'.
// We just need to use what we got from moment in getLocale on the updateLocale below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const sha512FromPubkey = async (pubkey: string): Promise<string> => {
.join('');
};

// do not do this on every avatar, just cache the values so we can reuse them accross the app
// do not do this on every avatar, just cache the values so we can reuse them across the app
// key is the pubkey, value is the hash
const cachedHashes = new Map<string, number>();

Expand Down
2 changes: 1 addition & 1 deletion ts/components/basic/SessionDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SessionIcon, SessionIconType } from '../icon';

import { SessionDropdownItem, SessionDropDownItemType } from './SessionDropdownItem';

// THIS IS DROPDOWN ACCORDIAN STYLE OPTIONS SELECTOR ELEMENT, NOT A CONTEXTMENU
// THIS IS DROPDOWN ACCORDION STYLE OPTIONS SELECTOR ELEMENT, NOT A CONTEXTMENU

type Props = {
label: string;
Expand Down
2 changes: 1 addition & 1 deletion ts/components/basic/SessionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const SessionInput = (props: Props) => {
data-testid={inputDataTestId}
onChange={updateInputValue}
className={classNames(enableShowHide ? 'session-input-floating-label-show-hide' : '')}
// just incase onChange isn't triggered
// just in case onChange isn't triggered
onBlur={updateInputValue}
onKeyPress={event => {
if (event.key === 'Enter' && props.onEnterPressed) {
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/composition/CompositionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class CompositionBoxInner extends React.Component<Props, State> {
// than the message was sent without the link preview.
// So be sure to reset the staged link preview so it is not sent with the next message.

// if we were not aborted, it's probably just an error on the fetch. Nothing to do excpet mark the fetch as done (with errors)
// if we were not aborted, it's probably just an error on the fetch. Nothing to do except mark the fetch as done (with errors)

if (aborted) {
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const MINIMUM_LINK_PREVIEW_IMAGE_WIDTH = THUMBNAIL_SIDE;

type Props = {
messageId: string;
isDetailView?: boolean; // when the detail is shown for a message, we disble click and some other stuff
isDetailView?: boolean; // when the detail is shown for a message, we disable click and some other stuff
};

export const Message = (props: Props) => {
Expand Down
38 changes: 27 additions & 11 deletions ts/components/dialog/EditProfileDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ChangeEvent } from 'react';
import React, { ChangeEvent, MouseEvent } from 'react';
import { QRCode } from 'react-qr-svg';

import { Avatar, AvatarSize } from '../avatar/Avatar';
Expand All @@ -21,29 +21,45 @@ import { sanitizeSessionUsername } from '../../session/utils/String';
import { setLastProfileUpdateTimestamp } from '../../util/storage';
import { ConversationTypeEnum } from '../../models/conversationAttributes';
import { MAX_USERNAME_BYTES } from '../../session/constants';
import styled from 'styled-components';
import { saveQRCode } from '../../util/saveQRCode';

interface State {
profileName: string;
updatedProfileName: string;
oldAvatarPath: string;
newAvatarObjectUrl: string | null;
mode: 'default' | 'edit' | 'qr';
loading: boolean;
}
const handleSaveQRCode = (event: MouseEvent) => {
event.preventDefault();
saveQRCode('session-id', '220px', '220px', 'var(--white-color)', 'var(--black-color)');
};

const StyledQRView = styled.div`
cursor: pointer;
`;

const QRView = ({ sessionID }: { sessionID: string }) => {
return (
<div className="qr-image">
<StyledQRView
aria-label={window.i18n('clickToTrustContact')}
title={window.i18n('clickToTrustContact')}
className="qr-image"
onClick={handleSaveQRCode}
>
<QRCode
value={sessionID}
bgColor="var(--white-color)"
fgColor="var(--black-color)"
level="L"
/>
</div>
</StyledQRView>
);
};

interface State {
profileName: string;
updatedProfileName: string;
oldAvatarPath: string;
newAvatarObjectUrl: string | null;
mode: 'default' | 'edit' | 'qr';
loading: boolean;
}

export class EditProfileDialog extends React.Component<{}, State> {
private readonly convo: ConversationModel;

Expand Down
2 changes: 1 addition & 1 deletion ts/components/dialog/OnionStatusPathDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const OnionPathModalInner = () => {
{nodes.map((snode: Snode | any) => {
let labelText = snode.label
? snode.label
: `${countryLookup.byIso(ip2country(snode.ip))?.country}`;
: countryLookup.byIso(ip2country(snode.ip))?.country;
if (!labelText) {
labelText = window.i18n('unknownCountry');
}
Expand Down
33 changes: 25 additions & 8 deletions ts/components/dialog/SessionSeedModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { MouseEvent, useEffect, useState } from 'react';

import { ToastUtils } from '../../session/utils';
import { matchesHash } from '../../util/passwordUtils';
Expand All @@ -12,6 +12,7 @@ import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/S
import { SessionWrapperModal } from '../SessionWrapperModal';
import { getCurrentRecoveryPhrase } from '../../util/storage';
import styled from 'styled-components';
import { saveQRCode } from '../../util/saveQRCode';

interface PasswordProps {
setPasswordValid: (val: boolean) => any;
Expand Down Expand Up @@ -90,15 +91,25 @@ interface SeedProps {
onClickCopy?: () => any;
}

const StyledRecoveryPhrase = styled.i`
margin-bottom: var(--margins-md);
`;
const StyledRecoveryPhrase = styled.i``;

const StyledQRImage = styled.div`
width: fit-content;
margin: 0 auto;
margin: 0 auto var(--margins-lg);
cursor: pointer;
`;

const handleSaveQRCode = (event: MouseEvent) => {
event.preventDefault();
saveQRCode(
'session-recovery-phrase',
'220px',
'220px',
'var(--white-color)',
'var(--black-color)'
);
};

const Seed = (props: SeedProps) => {
const { recoveryPhrase, onClickCopy } = props;
const i18n = window.i18n;
Expand Down Expand Up @@ -132,16 +143,22 @@ const Seed = (props: SeedProps) => {
{i18n('recoveryPhraseSavePromptMain')}
</p>

<StyledQRImage
aria-label={window.i18n('clickToTrustContact')}
title={window.i18n('clickToTrustContact')}
className="qr-image"
onClick={handleSaveQRCode}
>
<QRCode value={hexEncodedSeed} bgColor={bgColor} fgColor={fgColor} level="L" />
</StyledQRImage>

<StyledRecoveryPhrase
data-testid="recovery-phrase-seed-modal"
className="session-modal__text-highlight"
>
{recoveryPhrase}
</StyledRecoveryPhrase>
</div>
<StyledQRImage className="qr-image">
<QRCode value={hexEncodedSeed} bgColor={bgColor} fgColor={fgColor} level="L" />
</StyledQRImage>
<div
className="session-modal__button-group"
style={{ justifyContent: 'center', width: '100%' }}
Expand Down

0 comments on commit e2d3767

Please sign in to comment.