A bunch of fixes after the 5.0 launch (#133)

* Fix SSL validation

* Minor bug fixes

* Update appveyor

* Fix select colors

* Updated Dockerfile
This commit is contained in:
Gregory Schier
2017-04-05 19:30:28 -07:00
committed by GitHub
parent 3d5700cb96
commit 24dfa98df0
13 changed files with 126 additions and 4180 deletions

View File

@@ -1,8 +1,7 @@
FROM ubuntu:14.04
RUN mkdir -p /insomnia
RUN mkdir -p /insomnia /insomnia-tmp
WORKDIR /insomnia
COPY . /insomnia
RUN sudo apt-get update

View File

@@ -5,7 +5,6 @@ if (reboot) {
import fs from 'fs';
import Raven from 'raven';
import request from 'request';
import path from 'path';
import electron from 'electron';
import * as packageJSON from './package.json';
@@ -37,8 +36,6 @@ const UPDATE_URLS = {
win32: `https://downloads.insomnia.rest/win`
};
const DOWNLOAD_URL = 'http://download.insomnia.rest';
let localStorage = null;
let mainWindow = null;
@@ -87,24 +84,7 @@ function checkForUpdates () {
return;
}
if (IS_LINUX) {
try {
request.get(UPDATE_URLS.linux, null, (err, response) => {
if (err) {
ravenClient.captureError(err);
return;
}
if (response.statusCode === 200) {
showDownloadModal(response.body);
} else {
// No update available (should be STATUS=204)
}
});
} catch (e) {
ravenClient.captureException(e);
}
} else {
if (!IS_LINUX) {
try {
autoUpdater.setFeedURL(UPDATE_URLS[process.platform]);
autoUpdater.checkForUpdates();
@@ -153,26 +133,6 @@ function trackEvent (...args) {
window.webContents.send('analytics-track-event', args);
}
function showDownloadModal (version) {
hasPromptedForUpdates = true;
dialog.showMessageBox({
type: 'info',
buttons: ['Download', 'Later'],
defaultId: 0,
cancelId: 1,
title: 'Insomnia Update Available',
message: `Exciting news!\n\nVersion ${version} of Insomnia is now available.\n\n\n~Gregory`
}, id => {
if (id === 0) {
console.log('-- Installing Update --');
shell.openExternal(DOWNLOAD_URL);
} else {
console.log('-- Cancel Update --');
}
});
}
ipcMain.on('check-for-updates', () => {
console.log('-- Checking for Updates --');
checkForUpdates();
@@ -521,13 +481,13 @@ function createWindow () {
position: 'before=help',
submenu: [{
label: 'Reload',
accelerator: 'Command+R',
accelerator: 'CmdOrCtrl+R',
click: function () {
mainWindow.reload();
}
}, {
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
accelerator: 'Alt+CmdOrCtrl+I',
click: function () {
mainWindow.toggleDevTools();
}

View File

@@ -155,9 +155,6 @@ export function _actuallySendCurl (renderedRequest, workspace, settings) {
resolve(Object.assign({
parentId: renderedRequest._id,
timeline: timeline,
elapsedTime: curl.getInfo(Curl.info.TOTAL_TIME) * 1000,
bytesRead: curl.getInfo(Curl.info.SIZE_DOWNLOAD),
url: curl.getInfo(Curl.info.EFFECTIVE_URL),
settingSendCookies: renderedRequest.settingSendCookies,
settingStoreCookies: renderedRequest.settingStoreCookies
}, patch));
@@ -166,6 +163,9 @@ export function _actuallySendCurl (renderedRequest, workspace, settings) {
// Setup the cancellation logic
cancelRequestFunction = () => {
respond({
elapsedTime: curl.getInfo(Curl.info.TOTAL_TIME) * 1000,
bytesRead: curl.getInfo(Curl.info.SIZE_DOWNLOAD),
url: curl.getInfo(Curl.info.EFFECTIVE_URL),
statusMessage: 'Cancelled',
error: 'Request was cancelled'
});
@@ -178,6 +178,7 @@ export function _actuallySendCurl (renderedRequest, workspace, settings) {
curl.setOpt(Curl.option.CUSTOMREQUEST, renderedRequest.method);
curl.setOpt(Curl.option.FOLLOWLOCATION, settings.followRedirects);
curl.setOpt(Curl.option.SSL_VERIFYHOST, settings.validateSSL ? 2 : 0);
curl.setOpt(Curl.option.SSL_VERIFYPEER, settings.validateSSL ? 1 : 0);
curl.setOpt(Curl.option.TIMEOUT_MS, settings.timeout); // 0 for no timeout
curl.setOpt(Curl.option.VERBOSE, true); // True so debug function works
curl.setOpt(Curl.option.NOPROGRESS, false); // False so progress function works
@@ -459,8 +460,9 @@ export function _actuallySendCurl (renderedRequest, workspace, settings) {
curlHeaders = curlHeaders[curlHeaders.length - 1];
// Collect various things
const statusCode = curlHeaders.result.code || 0;
const statusMessage = curlHeaders.result.reason || 'Unknown';
const result = curlHeaders && curlHeaders.result;
const statusCode = result ? result.code : 0;
const statusMessage = result ? result.reason : 'Unknown';
// Collect the headers
const headers = [];
@@ -524,7 +526,10 @@ export function _actuallySendCurl (renderedRequest, workspace, settings) {
body,
contentType,
statusCode,
statusMessage
statusMessage,
elapsedTime: curl.getInfo(Curl.info.TOTAL_TIME) * 1000,
bytesRead: curl.getInfo(Curl.info.SIZE_DOWNLOAD),
url: curl.getInfo(Curl.info.EFFECTIVE_URL)
});
// Close the request

View File

@@ -1,11 +1,11 @@
{
"private": true,
"name": "insomnia",
"version": "5.0.0",
"version": "5.0.1",
"productName": "Insomnia",
"longName": "Insomnia REST Client",
"description": "A simple and beautiful REST API client",
"homepage": "http://insomnia.rest",
"description": "Debug APIs like a human, not a robot",
"homepage": "https://insomnia.rest",
"author": "Insomnia <support@insomnia.rest>",
"main": "main.js",
"dependencies": {

View File

@@ -120,8 +120,13 @@ async function _highlightNunjucksTags (render) {
showModal(NunjucksVariableModal, {
template: mark.__template,
onDone: template => {
const {from, to} = mark.find();
this.replaceRange(template, from, to);
const pos = mark.find();
if (pos) {
const {from, to} = pos;
this.replaceRange(template, from, to);
} else {
console.warn('Tried to replace mark that did not exist', mark);
}
}
});
});

View File

@@ -180,6 +180,10 @@ class OneLineEditor extends PureComponent {
return;
}
if (!this._input) {
return;
}
if (this._input.hasFocus()) {
const start = this._input.getSelectionStart();
const end = this._input.getSelectionEnd();

View File

@@ -23,11 +23,19 @@ class KeyValueEditorRow extends PureComponent {
}
focusNameEnd () {
this._nameInput.focusEnd();
if (this._nameInput) {
this._nameInput.focusEnd();
} else {
console.warn('Unable to focus non-existing nameInput');
}
}
focusValueEnd () {
this._valueInput.focusEnd();
if (this._valueInput) {
this._valueInput.focusEnd();
} else {
console.warn('Unable to focus non-existing valueInput');
}
}
setDragDirection (dragDirection) {
@@ -179,82 +187,82 @@ class KeyValueEditorRow extends PureComponent {
</div>
<div className="form-control form-control--wide wide form-control--underlined">
{pair.type === 'file' ? (
<FileInputButton
ref={this._setValueInputRef}
showFileName
className="btn btn--clicky wide ellipsis txt-sm no-margin"
path={pair.fileName || ''}
onChange={this._handleFileNameChange}
/>
) : (
<OneLineEditor
ref={this._setValueInputRef}
readOnly={readOnly}
forceInput={forceInput}
type={valueInputType || 'text'}
placeholder={valuePlaceholder || 'Value'}
defaultValue={pair.value}
onChange={this._handleValueChange}
onBlur={this._handleBlurValue}
onKeyDown={this._handleKeyDown}
onFocus={this._handleFocusValue}
render={handleRender}
getRenderContext={handleGetRenderContext}
getAutocompleteConstants={this._handleAutocompleteValues}
/>
)}
<FileInputButton
ref={this._setValueInputRef}
showFileName
className="btn btn--clicky wide ellipsis txt-sm no-margin"
path={pair.fileName || ''}
onChange={this._handleFileNameChange}
/>
) : (
<OneLineEditor
ref={this._setValueInputRef}
readOnly={readOnly}
forceInput={forceInput}
type={valueInputType || 'text'}
placeholder={valuePlaceholder || 'Value'}
defaultValue={pair.value}
onChange={this._handleValueChange}
onBlur={this._handleBlurValue}
onKeyDown={this._handleKeyDown}
onFocus={this._handleFocusValue}
render={handleRender}
getRenderContext={handleGetRenderContext}
getAutocompleteConstants={this._handleAutocompleteValues}
/>
)}
</div>
{multipart ? (
!hideButtons ? (
<Dropdown right>
<DropdownButton className="tall">
<i className="fa fa-caret-down"></i>
</DropdownButton>
<DropdownItem onClick={this._handleTypeChange} value="text">
Text
</DropdownItem>
<DropdownItem onClick={this._handleTypeChange} value="file">
File
</DropdownItem>
</Dropdown>
) : (
<button>
<i className="fa fa-empty"/>
</button>
)
) : null
!hideButtons ? (
<Dropdown right>
<DropdownButton className="tall">
<i className="fa fa-caret-down"></i>
</DropdownButton>
<DropdownItem onClick={this._handleTypeChange} value="text">
Text
</DropdownItem>
<DropdownItem onClick={this._handleTypeChange} value="file">
File
</DropdownItem>
</Dropdown>
) : (
<button>
<i className="fa fa-empty"/>
</button>
)
) : null
}
{!hideButtons ? (
<Button onClick={this._handleDisableChange}
value={!pair.disabled}
title={pair.disabled ? 'Enable item' : 'Disable item'}>
{pair.disabled
? <i className="fa fa-square-o"/>
: <i className="fa fa-check-square-o"/>
}
</Button>
) : (
<button><i className="fa fa-empty"/></button>
)}
<Button onClick={this._handleDisableChange}
value={!pair.disabled}
title={pair.disabled ? 'Enable item' : 'Disable item'}>
{pair.disabled
? <i className="fa fa-square-o"/>
: <i className="fa fa-check-square-o"/>
}
</Button>
) : (
<button><i className="fa fa-empty"/></button>
)}
{!noDelete ? (
!hideButtons ? (
<PromptButton key={Math.random()}
tabIndex={-1}
confirmMessage=" "
addIcon
onClick={this._handleDelete}
title="Delete item">
<i className="fa fa-trash-o"/>
</PromptButton>
) : (
<button>
<i className="fa fa-empty"/>
</button>
)
) : null}
!hideButtons ? (
<PromptButton key={Math.random()}
tabIndex={-1}
confirmMessage=" "
addIcon
onClick={this._handleDelete}
title="Delete item">
<i className="fa fa-trash-o"/>
</PromptButton>
) : (
<button>
<i className="fa fa-empty"/>
</button>
)
) : null}
</div>
</li>
);

View File

@@ -1,5 +1,6 @@
import React, {PropTypes, PureComponent} from 'react';
import autobind from 'autobind-decorator';
import Input from '../codemirror/one-line-editor';
@autobind
class VariableEditor extends PureComponent {
@@ -69,10 +70,7 @@ class VariableEditor extends PureComponent {
<div>
<div className="form-control form-control--outlined">
<label>Environment Variable
<select ref={this._setSelectRef}
value={value}
defaultValue={null}
onChange={this._handleChange}>
<select ref={this._setSelectRef} value={value} onChange={this._handleChange}>
<option value={`{{ 'my custom template logic' | urlencode }}`}>
-- Custom --
</option>
@@ -86,7 +84,13 @@ class VariableEditor extends PureComponent {
</div>
{isOther ? (
<div className="form-control form-control--outlined">
<input type="text" defaultValue={value} onChange={this._handleChange}/>
<Input
forceEditor
mode="nunjucks"
type="text"
defaultValue={value}
onChange={this._update}
/>
</div>
) : null}
<div className="form-control form-control--outlined">

View File

@@ -252,6 +252,11 @@ button {
white-space: nowrap;
}
option {
background-color: var(--color-bg);
color: var(--color-font);
}
textarea.no-resize {
resize: none;
}

View File

@@ -1,7 +1,5 @@
image: Visual Studio 2015
build: off
deploy: off
#---------------------------------#
# environment configuration #
@@ -51,6 +49,6 @@ test_script:
# global handlers #
#---------------------------------#
#build_script:
# - npm run build-n-package:win
# - ps: ls .\dist\win\* | % { Push-AppveyorArtifact $_.FullName }
deploy_script:
- npm run build-n-package:win
- ps: ls .\dist\win\* | % { Push-AppveyorArtifact $_.FullName }

4043
cacert.pem
View File

File diff suppressed because it is too large Load Diff

View File

@@ -5,5 +5,6 @@ services:
command: 'bash -c "npm install && npm run build-n-package:linux"'
volumes:
- './dist/linux:/insomnia/dist'
- '.:/insomnia'
environment:
- 'NODE_ENV=development'

View File

@@ -5,7 +5,7 @@
"description": "Insomnia App",
"main": "main.js",
"licence": "GNU AGPLv3",
"homepage": "http://insomnia.rest",
"homepage": "https://insomnia.rest",
"repository": {
"type": "git",
"url": "https://github.com/gschier/insomnia"