Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install arduino-create-agent-js-client --save
```js
import Daemon from 'arduino-create-agent-js-client';

const daemon = new Daemon('https://builder.arduino.cc/v3/boards');
const daemon = new Daemon();

daemon.agentFound.subscribe(status => {
// true / false
Expand Down
2 changes: 1 addition & 1 deletion demo/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const scrollToBottom = (target) => {
}
};

const daemon = new Daemon('https://builder.arduino.cc/v3/boards', chromeExtensionID);
const daemon = new Daemon(chromeExtensionID);

const handleUpload = () => {
const target = {
Expand Down
4 changes: 2 additions & 2 deletions src/chrome-app-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import Daemon from './daemon';
const POLLING_INTERVAL = 2000;

export default class ChromeOsDaemon extends Daemon {
constructor(boardsUrl, chromeExtensionId) {
super(boardsUrl);
constructor(chromeExtensionId) {
super();
this.channel = null;

this.openChannel(() => this.channel.postMessage({
Expand Down
6 changes: 3 additions & 3 deletions src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import { takeUntil, filter, startWith, first, distinctUntilChanged } from 'rxjs/
const POLLING_INTERVAL = 1500;

export default class Daemon {
constructor(boardsUrl = 'https://builder.arduino.cc/v3/boards') {
this.BOARDS_URL = boardsUrl;
constructor() {
this.UPLOAD_NOPE = 'UPLOAD_NOPE';
this.UPLOAD_DONE = 'UPLOAD_DONE';
this.UPLOAD_ERROR = 'UPLOAD_ERROR';
Expand Down Expand Up @@ -112,8 +111,9 @@ export default class Daemon {

this.closeSerialMonitor(target.port);

const IS_DEV = window.location.hostname.indexOf('-dev') !== -1 || window.location.hostname.indexOf('local') !== -1 ? '-dev' : '';
// Fetch command line for the board
fetch(`${this.BOARDS_URL}/${target.board}/compute`, {
fetch(`https://builder${IS_DEV}.arduino.cc/v3/boards/${target.board}/compute`, {
method: 'POST',
body: JSON.stringify({ action: 'upload', verbose })
})
Expand Down
4 changes: 2 additions & 2 deletions src/socket-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ if (browser.name !== 'chrome' && browser.name !== 'firefox') {
}

export default class SocketDaemon extends Daemon {
constructor(boardsUrl) {
super(boardsUrl);
constructor() {
super();
this.selectedProtocol = PROTOCOL.HTTP;
this.socket = null;
this.pluginURL = null;
Expand Down