Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit d2ce1f4

Browse files
authored
Merge pull request #3247 from withspectrum/2.4.4
2.4.4
2 parents 1f70fa1 + 4eb8677 commit d2ce1f4

File tree

19 files changed

+367
-293
lines changed

19 files changed

+367
-293
lines changed

.circleci/config.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,6 @@ jobs:
136136
name: Deploy and alias Hyperion
137137
command: npx now-cd --alias "alpha=hyperion.alpha.spectrum.chat" --team spaceprogram
138138

139-
deploy_desktop:
140-
<<: *js_defaults
141-
docker:
142-
- image: circleci/node:8
143-
steps:
144-
- attach_workspace:
145-
at: ~/spectrum
146-
- run:
147-
name: Build and release desktop app
148-
command: yarn run release:desktop
149-
150139
# Run eslint, flow etc.
151140
test_static_js:
152141
<<: *js_defaults
@@ -225,10 +214,3 @@ workflows:
225214
filters:
226215
branches:
227216
only: alpha
228-
- deploy_desktop:
229-
requires:
230-
- test_static_js
231-
- test_web
232-
filters:
233-
branches:
234-
only: alpha

desktop/deployment.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Desktop App Deployment
22

3-
We have semi-continuous deployment set up for the desktop app. Here's how it works:
3+
1. Packages the desktop app for all operating systems and upload them to GitHub as a draft release with the following command:
44

5-
## Automatic
5+
```
6+
GH_TOKEN=xyz123 yarn run release:desktop
7+
```
68

7-
1. We merge the latest changes from `alpha` to `production`
8-
2. This prompts a CircleCI build, which packages the desktop app for all operating systems and uploads them to GitHub as a draft release. That looks something like this:
9+
> Note: GH_TOKEN has to be a valid GitHub personal token. You can get one from your user settings.
10+
> Note for employees: You will find the company GitHub token in 1Password under the entry for "Spectrum GitHub Bot"
11+
12+
2. You'll then have a draft release on GitHub that looks something like this:
913

1014
![screen shot 2018-05-30 at 15 42 22](https://user-images.githubusercontent.com/7525670/40724411-4b5fe9ec-6421-11e8-8e4b-d0df96b46f72.png)
1115

@@ -19,11 +23,3 @@ We have semi-continuous deployment set up for the desktop app. Here's how it wor
1923

2024
As soon as it's published, the app will prompt existing users to upgrade to the newest version and download and install it for them.
2125

22-
## Manual
23-
24-
You can also do a manual deploy of the desktop apps. You will need to get a GitHub token from your personal GitHub settings, then run the following command:
25-
26-
```
27-
GH_TOKEN=asdf123 yarn run release:desktop
28-
```
29-

desktop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"main": "src/main.js",
1212
"private": true,
1313
"dependencies": {
14+
"electron-context-menu": "^0.9.1",
1415
"electron-is-dev": "^0.3.0",
1516
"electron-log": "^2.2.14",
1617
"electron-updater": "^2.21.4",

desktop/src/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module.exports = {
1111
APP_VERSION: app.getVersion(),
1212
APP_REMOTE_URL: 'https://spectrum.chat/login',
1313
APP_DEV_URL: 'http://localhost:3000/login',
14+
APP_REMOTE_HOME_URL: 'https://spectrum.chat',
15+
APP_DEV_HOME_URL: 'http://localhost:3000',
1416

1517
GITHUB_URL: 'https://github.com/withspectrum/spectrum',
1618
GITHUB_URL_LICENSE:

desktop/src/main.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// @flow
22
const electron = require('electron');
33
const windowStateKeeper = require('electron-window-state');
4-
const { app, BrowserWindow } = electron;
4+
const { app, BrowserWindow, shell } = electron;
55
const isDev = require('electron-is-dev');
6+
const contextMenu = require('electron-context-menu');
67

78
const FIFTEEN_MINUTES = 900000;
89

@@ -73,7 +74,13 @@ function createWindow() {
7374
mainWindow && mainWindow.show();
7475
});
7576

77+
contextMenu();
7678
mainWindowState.manage(mainWindow);
79+
80+
mainWindow.webContents.on('new-window', (event, url) => {
81+
event.preventDefault();
82+
shell.openExternal(url);
83+
});
7784
}
7885

7986
// This method will be called when Electron has finished
@@ -99,15 +106,3 @@ app.on('activate', () => {
99106
createWindow();
100107
}
101108
});
102-
103-
app.on('web-contents-created', (event, wc) => {
104-
wc.on('before-input-event', (event, input) => {
105-
if (input.key === ']' && input.meta && !input.shift && !input.control) {
106-
if (wc.canGoForward()) wc.goForward();
107-
}
108-
109-
if (input.key === '[' && input.meta && !input.shift && !input.control) {
110-
if (wc.canGoBack()) wc.goBack();
111-
}
112-
});
113-
});

desktop/src/menu.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
2-
const { dialog, Menu, MenuItem, shell } = require('electron');
2+
const { dialog, Menu, MenuItem, shell, clipboard } = require('electron');
33
const checkForUpdates = require('./autoUpdate');
4+
const isDev = require('electron-is-dev');
45

56
const CONFIG = require('./config');
67

@@ -41,6 +42,42 @@ const template = [
4142
{ role: 'quit' },
4243
],
4344
},
45+
{
46+
label: 'Go',
47+
submenu: [
48+
{
49+
label: 'Home',
50+
accelerator: 'CmdOrCtrl+Shift+H',
51+
click: function(item, focusedWindow) {
52+
if (focusedWindow) {
53+
focusedWindow.webContents.loadURL(
54+
isDev ? CONFIG.APP_DEV_HOME_URL : CONFIG.APP_REMOTE_HOME_URL
55+
);
56+
}
57+
},
58+
},
59+
{
60+
label: 'Forward',
61+
accelerator: 'CmdOrCtrl+]',
62+
click: function(item, focusedWindow) {
63+
if (focusedWindow) {
64+
const wc = focusedWindow.webContents;
65+
if (wc && wc.canGoForward()) wc.goForward();
66+
}
67+
},
68+
},
69+
{
70+
label: 'Back',
71+
accelerator: 'CmdOrCtrl+[',
72+
click: function(item, focusedWindow) {
73+
if (focusedWindow) {
74+
const wc = focusedWindow.webContents;
75+
if (wc && wc.canGoBack()) wc.goBack();
76+
}
77+
},
78+
},
79+
],
80+
},
4481
{
4582
label: 'Edit',
4683
submenu: [
@@ -131,6 +168,21 @@ const template = [
131168
},
132169
],
133170
},
171+
{
172+
label: 'Share',
173+
submenu: [
174+
{
175+
label: 'Copy link to current page',
176+
click: function(item, focusedWindow) {
177+
const url = focusedWindow.webContents.getURL();
178+
if (url) {
179+
clipboard.writeText(url);
180+
}
181+
},
182+
accelerator: 'CmdOrCtrl+S',
183+
},
184+
],
185+
},
134186
];
135187

136188
function showAbout() {

desktop/yarn.lock

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,21 @@ electron-builder@^20.8.1:
688688
update-notifier "^2.5.0"
689689
yargs "^11.0.0"
690690

691+
electron-context-menu@^0.9.1:
692+
version "0.9.1"
693+
resolved "https://registry.yarnpkg.com/electron-context-menu/-/electron-context-menu-0.9.1.tgz#ed4df20c080491c3c996abfcb363159946a38058"
694+
dependencies:
695+
electron-dl "^1.2.0"
696+
electron-is-dev "^0.1.1"
697+
698+
electron-dl@^1.2.0:
699+
version "1.12.0"
700+
resolved "https://registry.yarnpkg.com/electron-dl/-/electron-dl-1.12.0.tgz#328c7f12d3e458ed4ddc773d8ffc28d59ab35d2e"
701+
dependencies:
702+
ext-name "^5.0.0"
703+
pupa "^1.0.0"
704+
unused-filename "^1.0.0"
705+
691706
692707
version "4.3.4"
693708
resolved "https://registry.yarnpkg.com/electron-download-tf/-/electron-download-tf-4.3.4.tgz#b03740b2885aa2ad3f8784fae74df427f66d5165"
@@ -716,6 +731,10 @@ electron-download@^3.0.1:
716731
semver "^5.3.0"
717732
sumchecker "^1.2.0"
718733

734+
electron-is-dev@^0.1.1:
735+
version "0.1.2"
736+
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-0.1.2.tgz#8a1043e32b3a1da1c3f553dce28ce764246167e3"
737+
719738
electron-is-dev@^0.3.0:
720739
version "0.3.0"
721740
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-0.3.0.tgz#14e6fda5c68e9e4ecbeff9ccf037cbd7c05c5afe"
@@ -847,6 +866,19 @@ expand-brackets@^2.1.4:
847866
snapdragon "^0.8.1"
848867
to-regex "^3.0.1"
849868

869+
ext-list@^2.0.0:
870+
version "2.2.2"
871+
resolved "https://registry.yarnpkg.com/ext-list/-/ext-list-2.2.2.tgz#0b98e64ed82f5acf0f2931babf69212ef52ddd37"
872+
dependencies:
873+
mime-db "^1.28.0"
874+
875+
ext-name@^5.0.0:
876+
version "5.0.0"
877+
resolved "https://registry.yarnpkg.com/ext-name/-/ext-name-5.0.0.tgz#70781981d183ee15d13993c8822045c506c8f0a6"
878+
dependencies:
879+
ext-list "^2.0.0"
880+
sort-keys-length "^1.0.0"
881+
850882
extend-shallow@^2.0.1:
851883
version "2.0.1"
852884
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@@ -1345,6 +1377,10 @@ is-path-inside@^1.0.0:
13451377
dependencies:
13461378
path-is-inside "^1.0.1"
13471379

1380+
is-plain-obj@^1.0.0:
1381+
version "1.1.0"
1382+
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
1383+
13481384
is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
13491385
version "2.0.4"
13501386
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
@@ -1599,7 +1635,7 @@ micromatch@^3.1.4:
15991635
snapdragon "^0.8.1"
16001636
to-regex "^3.0.2"
16011637

1602-
mime-db@~1.33.0:
1638+
mime-db@^1.28.0, mime-db@~1.33.0:
16031639
version "1.33.0"
16041640
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
16051641

@@ -1657,6 +1693,10 @@ [email protected], mkdirp@^0.5.0, mkdirp@^0.5.1:
16571693
dependencies:
16581694
minimist "0.0.8"
16591695

1696+
modify-filename@^1.1.0:
1697+
version "1.1.0"
1698+
resolved "https://registry.yarnpkg.com/modify-filename/-/modify-filename-1.1.0.tgz#9a2dec83806fbb2d975f22beec859ca26b393aa1"
1699+
16601700
16611701
version "2.0.0"
16621702
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@@ -2032,6 +2072,10 @@ punycode@^2.1.0:
20322072
version "2.1.1"
20332073
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
20342074

2075+
pupa@^1.0.0:
2076+
version "1.0.0"
2077+
resolved "https://registry.yarnpkg.com/pupa/-/pupa-1.0.0.tgz#9a9568a5af7e657b8462a6e9d5328743560ceff6"
2078+
20352079
qs@~6.5.1:
20362080
version "6.5.2"
20372081
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
@@ -2303,6 +2347,18 @@ snapdragon@^0.8.1:
23032347
source-map-resolve "^0.5.0"
23042348
use "^3.1.0"
23052349

2350+
sort-keys-length@^1.0.0:
2351+
version "1.0.1"
2352+
resolved "https://registry.yarnpkg.com/sort-keys-length/-/sort-keys-length-1.0.1.tgz#9cb6f4f4e9e48155a6aa0671edd336ff1479a188"
2353+
dependencies:
2354+
sort-keys "^1.0.0"
2355+
2356+
sort-keys@^1.0.0:
2357+
version "1.1.2"
2358+
resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad"
2359+
dependencies:
2360+
is-plain-obj "^1.0.0"
2361+
23062362
source-map-resolve@^0.5.0:
23072363
version "0.5.2"
23082364
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259"
@@ -2623,6 +2679,13 @@ unset-value@^1.0.0:
26232679
has-value "^0.3.1"
26242680
isobject "^3.0.0"
26252681

2682+
unused-filename@^1.0.0:
2683+
version "1.0.0"
2684+
resolved "https://registry.yarnpkg.com/unused-filename/-/unused-filename-1.0.0.tgz#d340880f71ae2115ebaa1325bef05cc6684469c6"
2685+
dependencies:
2686+
modify-filename "^1.1.0"
2687+
path-exists "^3.0.0"
2688+
26262689
unzip-response@^2.0.1:
26272690
version "2.0.1"
26282691
resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// flow-typed signature: 77130022186123cfc81d76787330354e
2+
// flow-typed version: <<STUB>>/electron-window-state_vx.x.x/flow_v0.66.0
3+
4+
/**
5+
* This is an autogenerated libdef stub for:
6+
*
7+
* 'electron-window-state'
8+
*
9+
* Fill this stub out by replacing all the `any` types.
10+
*
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
13+
* https://github.com/flowtype/flow-typed
14+
*/
15+
16+
declare module 'electron-window-state' {
17+
declare module.exports: any;
18+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "2.4.3",
3+
"version": "2.4.4",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"babel-cli": "^6.24.1",

src/components/linkPreview/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class LinkPreview extends Component {
3737
size={this.props.size}
3838
padding={image}
3939
target="_blank"
40-
rel="noopener"
40+
rel="noopener noreferrer"
4141
href={url || trueUrl}
4242
margin={margin}
4343
>

0 commit comments

Comments
 (0)