mirror of
https://github.com/thegecko/web-bluetooth-dfu.git
synced 2025-12-14 13:08:14 +08:00
Update deps and CircleCI v2
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,4 +5,3 @@ dist
|
|||||||
lib
|
lib
|
||||||
types
|
types
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
package-lock.json
|
|
||||||
|
|||||||
69
circle.yml
69
circle.yml
@@ -1,30 +1,45 @@
|
|||||||
machine:
|
version: 2
|
||||||
node:
|
|
||||||
version: 4.8.0
|
|
||||||
environment:
|
|
||||||
LIVE_BRANCH: gh-pages
|
|
||||||
|
|
||||||
compile:
|
jobs:
|
||||||
override:
|
build:
|
||||||
- npm run gulp
|
docker:
|
||||||
|
- image: circleci/node:4.8.0
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: npm install
|
||||||
|
- run: npm run build
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: ../
|
||||||
|
paths:
|
||||||
|
- project
|
||||||
|
|
||||||
test:
|
deploy:
|
||||||
override:
|
docker:
|
||||||
- exit 0
|
- image: circleci/node:4.8.0
|
||||||
|
steps:
|
||||||
|
- attach_workspace:
|
||||||
|
at: ../
|
||||||
|
- run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
|
||||||
|
- run: git config --global user.name thegecko
|
||||||
|
- run: git config --global user.email github@thegecko.org
|
||||||
|
- run: git add --force dist types docs
|
||||||
|
- run: git stash save
|
||||||
|
- run: git checkout gh-pages
|
||||||
|
- run: git merge master --no-commit
|
||||||
|
- run: git checkout stash -- .
|
||||||
|
- run: git commit --allow-empty --message "Automatic Deployment [skip ci]"
|
||||||
|
- run: git push
|
||||||
|
- run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
|
||||||
|
- run: npm publish || true
|
||||||
|
|
||||||
deployment:
|
workflows:
|
||||||
staging:
|
version: 2
|
||||||
branch: master
|
commit:
|
||||||
commands:
|
jobs:
|
||||||
- echo Syncing to $LIVE_BRANCH on GitHub...
|
- build
|
||||||
- git config --global user.name thegecko
|
- deploy:
|
||||||
- git config --global user.email github@thegecko.org
|
requires:
|
||||||
- git add --force dist lib types
|
- build
|
||||||
- git stash save
|
filters:
|
||||||
- git checkout $LIVE_BRANCH
|
branches:
|
||||||
- git merge master --no-commit
|
only: master
|
||||||
- git checkout stash -- .
|
|
||||||
- git commit --allow-empty --message "Automatic Deployment [skip ci]"
|
|
||||||
- git push
|
|
||||||
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
|
|
||||||
- npm publish || true
|
|
||||||
|
|||||||
@@ -31,98 +31,24 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<link href="https://fonts.googleapis.com/css?family=Raleway:400,600" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Raleway:400,600" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
html {
|
html { margin: 0; padding: 0; border: 0; }
|
||||||
margin: 0;
|
body { font-family: 'Raleway', sans-serif; color: #d7ecfb; background-color: #072b44; text-align: center; }
|
||||||
padding: 0;
|
h1 { font-weight: 400; }
|
||||||
border: 0;
|
strong { font-weight: 600; }
|
||||||
}
|
#drop { position: relative; margin: 20px auto; max-width: 500px; background-color: rgba(255, 255, 255, 0.10); padding: 100px 20px 80px 20px; outline: 2px dashed #072b44; outline-offset: -10px; }
|
||||||
body {
|
#drop.hover { outline-offset: -10px; background-color: rgba(255, 255, 255, 0.15); }
|
||||||
font-family: 'Raleway', sans-serif;
|
#icon { width: 100%; fill: #d7ecfb; margin-bottom: 30px; }
|
||||||
color: #d7ecfb;
|
#github { fill: #d7ecfb; }
|
||||||
background-color: #072b44;
|
#github:hover { fill: #8bb5ba; }
|
||||||
text-align: center;
|
#file { width: 0.1px; height: 0.1px; opacity: 0; z-index: -1; }
|
||||||
}
|
#label { cursor: pointer; }
|
||||||
h1 {
|
#label:hover strong { color: #8bb5ba; }
|
||||||
font-weight: 400;
|
#select { position: absolute; left: 0; right: 0; visibility: hidden; }
|
||||||
}
|
#button { font-size: 12px; color: inherit; margin: 20px auto; border: 0px; background-color: #1b679c; height: 30px; padding: 0 30px; border-radius: 4px; text-transform: uppercase; cursor: pointer; outline: none; }
|
||||||
strong {
|
#button:hover { background: #2674ab; }
|
||||||
font-weight: 600;
|
#status { margin: 20px auto; border: 1px solid #d7ecfb; width: 70%; height: 24px; visibility: hidden; }
|
||||||
}
|
#bar { background: #2674ab; width: 0%; height: 100%; }
|
||||||
#drop {
|
#transfer { width: 100%; line-height: 24px; margin-top: -24px; }
|
||||||
position: relative;
|
|
||||||
margin: 20px auto;
|
|
||||||
max-width: 500px;
|
|
||||||
background-color: rgba(255, 255, 255, 0.10);
|
|
||||||
padding: 100px 20px 80px 20px;
|
|
||||||
outline: 2px dashed #072b44;
|
|
||||||
outline-offset: -10px;
|
|
||||||
}
|
|
||||||
#drop.hover {
|
|
||||||
outline-offset: -10px;
|
|
||||||
background-color: rgba(255, 255, 255, 0.15);
|
|
||||||
}
|
|
||||||
#icon {
|
|
||||||
width: 100%;
|
|
||||||
fill: #d7ecfb;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
#github {
|
|
||||||
fill: #d7ecfb;
|
|
||||||
}
|
|
||||||
#github:hover {
|
|
||||||
fill: #8bb5ba;
|
|
||||||
}
|
|
||||||
#file {
|
|
||||||
width: 0.1px;
|
|
||||||
height: 0.1px;
|
|
||||||
opacity: 0;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
#label {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
#label:hover strong {
|
|
||||||
color: #8bb5ba;
|
|
||||||
}
|
|
||||||
#select {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
#button {
|
|
||||||
font-size: 12px;
|
|
||||||
color: inherit;
|
|
||||||
margin: 20px auto;
|
|
||||||
border: 0px;
|
|
||||||
background-color: #1b679c;
|
|
||||||
height: 30px;
|
|
||||||
padding: 0 30px;
|
|
||||||
border-radius: 4px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
cursor: pointer;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
#button:hover {
|
|
||||||
background: #2674ab;
|
|
||||||
}
|
|
||||||
#status {
|
|
||||||
margin: 20px auto;
|
|
||||||
border: 1px solid #d7ecfb;
|
|
||||||
width: 70%;
|
|
||||||
height: 24px;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
#bar {
|
|
||||||
background: #2674ab;
|
|
||||||
width: 0%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
#transfer {
|
|
||||||
width: 100%;
|
|
||||||
line-height: 24px;
|
|
||||||
margin-top: -24px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
5353
package-lock.json
generated
Normal file
5353
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "web-bluetooth-dfu",
|
"name": "web-bluetooth-dfu",
|
||||||
"version": "1.0.2",
|
"version": "1.1.0",
|
||||||
"description": "Device firmware update with Web Bluetooth",
|
"description": "Device firmware update with Web Bluetooth",
|
||||||
"homepage": "https://thegecko.github.io/web-bluetooth-dfu/",
|
"homepage": "https://thegecko.github.io/web-bluetooth-dfu/",
|
||||||
"author": "Rob Moran <github@thegecko.org>",
|
"author": "Rob Moran <github@thegecko.org>",
|
||||||
@@ -30,9 +30,11 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.8.0"
|
"node": ">=4.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^8.0.54",
|
"@types/node": "^8.0.54",
|
||||||
"@types/web-bluetooth": "0.0.4",
|
"@types/web-bluetooth": "0.0.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
"browserify": "^15.0.0",
|
"browserify": "^15.0.0",
|
||||||
"crc-32": "^1.0.2",
|
"crc-32": "^1.0.2",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
@@ -44,11 +46,11 @@
|
|||||||
"jszip": "^3.1.3",
|
"jszip": "^3.1.3",
|
||||||
"merge2": "^1.2.0",
|
"merge2": "^1.2.0",
|
||||||
"progress": "^2.0.0",
|
"progress": "^2.0.0",
|
||||||
"tslint": "^5.8.0",
|
"tslint": "5.8.0",
|
||||||
"tslint-eslint-rules": "^4.1.1",
|
"tslint-eslint-rules": "^4.1.1",
|
||||||
"typescript": "^2.6.2",
|
"typescript": "^2.6.2",
|
||||||
"vinyl-buffer": "^1.0.1",
|
"vinyl-buffer": "^1.0.1",
|
||||||
"vinyl-source-stream": "^2.0.0",
|
"vinyl-source-stream": "^2.0.0",
|
||||||
"webbluetooth": "^1.0.4"
|
"webbluetooth": "^1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ export class SecureDfu extends EventDispatcher {
|
|||||||
|
|
||||||
const value = new Uint8Array(size);
|
const value = new Uint8Array(size);
|
||||||
value.set(operation);
|
value.set(operation);
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
const data = new Uint8Array(buffer);
|
const data = new Uint8Array(buffer);
|
||||||
value.set(data, operation.length);
|
value.set(data, operation.length);
|
||||||
@@ -410,15 +411,12 @@ export class SecureDfu extends EventDispatcher {
|
|||||||
* @param uuids Optional alternative uuids for service, control, packet or button
|
* @param uuids Optional alternative uuids for service, control, packet or button
|
||||||
* @returns Promise containing the device
|
* @returns Promise containing the device
|
||||||
*/
|
*/
|
||||||
public requestDevice(
|
public requestDevice(buttonLess: boolean, filters: Array<BluetoothLEScanFilterInit>, uuids: UuidOptions = this.DEFAULT_UUIDS): Promise<BluetoothDevice> {
|
||||||
buttonLess: boolean,
|
|
||||||
filters: Array<BluetoothLEScanFilterInit>,
|
|
||||||
uuids: UuidOptions = this.DEFAULT_UUIDS
|
|
||||||
): Promise<BluetoothDevice> {
|
|
||||||
uuids = {
|
uuids = {
|
||||||
...this.DEFAULT_UUIDS,
|
...this.DEFAULT_UUIDS,
|
||||||
...uuids
|
...uuids
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!buttonLess && !filters) {
|
if (!buttonLess && !filters) {
|
||||||
filters = [ { services: [ uuids.service ] } ];
|
filters = [ { services: [ uuids.service ] } ];
|
||||||
}
|
}
|
||||||
@@ -450,6 +448,7 @@ export class SecureDfu extends EventDispatcher {
|
|||||||
...this.DEFAULT_UUIDS,
|
...this.DEFAULT_UUIDS,
|
||||||
...uuids
|
...uuids
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.gattConnect(device, uuids.service)
|
return this.gattConnect(device, uuids.service)
|
||||||
.then(characteristics => {
|
.then(characteristics => {
|
||||||
this.log(`found ${characteristics.length} characteristic(s)`);
|
this.log(`found ${characteristics.length} characteristic(s)`);
|
||||||
|
|||||||
Reference in New Issue
Block a user