Skip to content

Commit

Permalink
Merge branch 'release/v3.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jan 25, 2021
2 parents 47f5d95 + ff17a6e commit a63a2c9
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
Expand Down
10 changes: 7 additions & 3 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
export const IS_WINDOWS =
navigator && navigator.platform && navigator.platform.startsWith('Win');
export const INPUT_FILTER_DELAY = 300; // ms, dalay before filtering projects, libs, platorms
export const PLATFORMIO_API_ENDPOINT = 'http://api.platformio.org';
export const PLATFORMIO_API_ENDPOINT = 'https://api.platformio.org';

let wsrpc = 'ws://127.0.0.1:8008/wsrpc';
let pathname = window.location ? window.location.pathname : '/';
if (pathname[pathname.length - 1] !== '/') {
pathname += '/';
}
let wsrpc = `ws://127.0.0.1:8008${pathname}wsrpc`;
if (process.env.NODE_ENV === 'production' && window.location && window.location.host) {
wsrpc = `ws://${window.location.host}/wsrpc`;
wsrpc = `ws://${window.location.host}${pathname}wsrpc`;
}
export const BACKEND_ENDPOINT = wsrpc;
6 changes: 5 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
theme = 'dark';
};
var link = document.createElement('link');
link.href = './themes/' + workspace + '-' + theme + '.css';
var pathname = (window.location? window.location.pathname : '/');
if (pathname[pathname.length - 1] !== '/') {
pathname += '/';
}
link.href = pathname + 'themes/' + workspace + '-' + theme + '.css';
link.type = 'text/css';
link.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(link);
Expand Down
20 changes: 10 additions & 10 deletions app/modules/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { call, put, select, take, takeLatest } from 'redux-saga/effects';
import { deleteEntity, updateEntity } from '../../store/actions';
import { notifyError, notifySuccess, osOpenUrl } from '../core/actions';

import { apiFetchData } from '../../store/api';
import { backendFetchData } from '../../store/backend';
import { inIframe } from '../core/helpers';
import jsonrpc from 'jsonrpc-lite';
import { message } from 'antd';
Expand Down Expand Up @@ -74,7 +74,7 @@ function* watchLoadAccountInfo() {
}

try {
data = yield call(apiFetchData, {
data = yield call(backendFetchData, {
query: 'core.call',
params: [
['account', 'show', '--json-output', ...(extended ? [] : ['--offline'])]
Expand All @@ -96,7 +96,7 @@ function* watchLoadAccountInfo() {
function* watchLoginAccount() {
yield takeLatest(actions.LOGIN_ACCOUNT, function*({ username, password, onEnd }) {
try {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [['account', 'login', '--username', username, '--password', password]]
});
Expand Down Expand Up @@ -134,7 +134,7 @@ function* watchLoginWithProvider() {

function* loginAccountWithCode(client_id, code, redirectUri) {
try {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'account.call_client',
params: ['login_with_code', client_id, code, redirectUri]
});
Expand All @@ -150,7 +150,7 @@ function* watchLogoutAccount() {
yield takeLatest(actions.LOGOUT_ACCOUNT, function*() {
try {
yield put(updateEntity('accountInfo', {}));
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [['account', 'logout']]
});
Expand All @@ -174,7 +174,7 @@ function* watchRegisterAccount() {
}) {
let err = null;
try {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [
[
Expand Down Expand Up @@ -217,7 +217,7 @@ function* watchForgotAccount() {
yield takeLatest(actions.FORGOT_ACCOUNT, function*({ username, onEnd }) {
let err = null;
try {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [['account', 'forgot', '--username', username]]
});
Expand Down Expand Up @@ -249,7 +249,7 @@ function* watchPasswordAccount() {
}) {
let err = null;
try {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [
[
Expand Down Expand Up @@ -288,7 +288,7 @@ function* watchTokenAccount() {
if (regenerate) {
args.push('--regenerate');
}
const data = yield call(apiFetchData, {
const data = yield call(backendFetchData, {
query: 'core.call',
params: [args]
});
Expand Down Expand Up @@ -317,7 +317,7 @@ function* watchUpdateProfile() {
}) {
let err = null;
try {
const response = yield call(apiFetchData, {
const response = yield call(backendFetchData, {
query: 'core.call',
params: [
[
Expand Down
2 changes: 1 addition & 1 deletion app/modules/core/containers/code-beautifier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Icon, Spin } from 'antd';
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import hljs from 'highlight.js/lib/highlight';
import hljs from 'highlight.js/lib/core';
import { requestContent } from '../actions';
import { selectRequestedContent } from '../selectors';

Expand Down
38 changes: 23 additions & 15 deletions app/modules/core/sagas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ConsentRejectedError } from '@core/errors';
import React from 'react';
import URL from 'url-parse';
import { USER_CONSENTS_KEY } from '@core/constants';
import { apiFetchData } from '../../store/api';
import { backendFetchData } from '../../store/backend';
import { getStore } from '../../store/index';
import jsonrpc from 'jsonrpc-lite';
import qs from 'querystringify';
Expand Down Expand Up @@ -91,6 +91,14 @@ function* watchNotifyError() {
[
/Updating.+VCS.+recurse-submodules/g,
'https://github.com/platformio/platformio-home/issues/143'
],
[
/Error: Detected a whitespace character/g,
'https://github.com/platformio/platform-espressif32/issues/470'
],
[
/Error: Could not find the package/g,
'https://github.com/platformio/platformio-home/issues/2144'
]
];
for (const [regex, url] of knownIssues) {
Expand Down Expand Up @@ -191,36 +199,36 @@ function* watchOSRequests() {
const redirectWindow = window.open(url.toString(), '_blank');
redirectWindow.location;
} else {
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'os.open_url',
params: [url.toString()]
});
}
break;

case actions.OS_REVEAL_FILE:
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'os.reveal_file',
params: [action.path]
});
break;

case actions.OS_RENAME_FILE:
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'os.rename',
params: [action.src, action.dst]
});
break;

case actions.OS_COPY_FILE:
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'os.copy',
params: [action.src, action.dst]
});
break;

case actions.OS_MAKE_DIRS:
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'os.make_dirs',
params: [action.path]
});
Expand Down Expand Up @@ -265,7 +273,7 @@ function* watchRequestContent() {
}

if (!content) {
content = yield call(apiFetchData, {
content = yield call(backendFetchData, {
query: 'os.request_content',
params: [uri, data, headers, cacheValid]
});
Expand Down Expand Up @@ -297,7 +305,7 @@ function* watchOsFSGlob() {
return;
}
try {
items = yield call(apiFetchData, {
items = yield call(backendFetchData, {
query: 'os.glob',
params: [pathnames, rootDir]
});
Expand Down Expand Up @@ -328,7 +336,7 @@ function* watchLoadLogicalDevices() {
return;
}
try {
items = yield call(apiFetchData, {
items = yield call(backendFetchData, {
query: 'os.get_logical_devices'
});
yield put(updateEntity('logicalDevices', items));
Expand All @@ -347,7 +355,7 @@ function* watchOsListDir() {
items = {};
}
try {
const result = yield call(apiFetchData, {
const result = yield call(backendFetchData, {
query: 'os.list_dir',
params: [/^[A-Z]:$/.test(path) ? path + '\\' : path]
});
Expand All @@ -369,7 +377,7 @@ function* watchOsIsFile() {
items = {};
}
try {
const result = yield call(apiFetchData, {
const result = yield call(backendFetchData, {
query: 'os.is_file',
params: [path]
});
Expand All @@ -391,7 +399,7 @@ function* watchOsIsDir() {
items = {};
}
try {
const result = yield call(apiFetchData, {
const result = yield call(backendFetchData, {
query: 'os.is_dir',
params: [path]
});
Expand Down Expand Up @@ -428,21 +436,21 @@ function* watchToggleFavoriteFolder() {

function* watchOpenTextDocument() {
yield takeEvery(actions.OPEN_TEXT_DOCUMENT, function*({ path, line, column }) {
const is_file = yield call(apiFetchData, {
const is_file = yield call(backendFetchData, {
query: 'os.is_file',
params: [path]
});
if (!is_file) {
return message.error(`File does not exist on disk ${path}`);
}
try {
return yield call(apiFetchData, {
return yield call(backendFetchData, {
query: 'ide.open_text_document',
params: [getSessionId(), path, line, column]
});
} catch (err) {
console.warn(err);
return yield call(apiFetchData, {
return yield call(backendFetchData, {
query: 'os.open_file',
params: [path]
});
Expand Down
6 changes: 3 additions & 3 deletions app/modules/device/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as selectors from './selectors';
import { call, put, select, take } from 'redux-saga/effects';
import { deleteEntity, updateEntity } from '../../store/actions';

import { apiFetchData } from '../../store/api';
import { backendFetchData } from '../../store/backend';
import { notifyError } from '../core/actions';

function* watchLoadSerialDevices() {
Expand All @@ -37,7 +37,7 @@ function* watchLoadSerialDevices() {
}
yield call(function*() {
try {
items = yield call(apiFetchData, {
items = yield call(backendFetchData, {
query: 'core.call',
params: [['device', 'list', '--serial', '--json-output']]
});
Expand All @@ -61,7 +61,7 @@ function* watchLoadMDNSDevices() {
}
yield call(function*() {
try {
items = yield call(apiFetchData, {
items = yield call(backendFetchData, {
query: 'core.call',
params: [
['device', 'list', '--mdns', '--json-output'],
Expand Down
4 changes: 2 additions & 2 deletions app/modules/home/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as selectors from './selectors';

import { call, put, select, takeLatest } from 'redux-saga/effects';

import { apiFetchData } from '../../store/api';
import { backendFetchData } from '../../store/backend';
import { updateEntity } from '../../store/actions';

function* watchLoadLatestTweets() {
Expand All @@ -31,7 +31,7 @@ function* watchLoadLatestTweets() {
return;
}
try {
items = yield call(apiFetchData, {
items = yield call(backendFetchData, {
query: 'misc.load_latest_tweets',
params: [`https://news.platformio.org/tweets/${username}/data.json`]
});
Expand Down
10 changes: 5 additions & 5 deletions app/modules/inspect/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
selectSavedConfiguration
} from '@inspect/selectors';

import { apiFetchData } from '@store/api';
import { backendFetchData } from '@store/backend';
import { goTo } from '@core/helpers';
import jsonrpc from 'jsonrpc-lite';
import { selectProjectInfo } from '@project/selectors';
Expand All @@ -44,15 +44,15 @@ function* _updateMetric(name, projectDir, env, duration) {

function* _inspectMemory({ projectDir, env }) {
const start = Date.now();
yield call(apiFetchData, {
yield call(backendFetchData, {
query: 'core.call',
params: [
['run', '-d', projectDir, '-e', env, '-t', 'sizedata'],
{ force_subprocess: true }
]
});

const buildDir = yield call(apiFetchData, {
const buildDir = yield call(backendFetchData, {
query: 'project.config_call',
params: [
{ path: pathlib.join(projectDir, 'platformio.ini') },
Expand All @@ -62,7 +62,7 @@ function* _inspectMemory({ projectDir, env }) {
});
const sizedataPath = pathlib.join(buildDir, env, 'sizedata.json');

const jsonContent = yield call(apiFetchData, {
const jsonContent = yield call(backendFetchData, {
query: 'os.request_content',
params: [sizedataPath]
});
Expand All @@ -79,7 +79,7 @@ function* _inspectCode({ projectDir, env }) {
const start = Date.now();
let codeCheckResults;
try {
codeCheckResults = yield call(apiFetchData, {
codeCheckResults = yield call(backendFetchData, {
query: 'core.call',
params: [
['check', '-d', projectDir, '-e', env, '--json-output'],
Expand Down
Loading

0 comments on commit a63a2c9

Please sign in to comment.