Lots of fixes....
This commit is contained in:
@@ -57,7 +57,7 @@ export class AdbClientService {
|
|||||||
devices: ADBDevice[];
|
devices: ADBDevice[];
|
||||||
displayDevices: ADBDevice[];
|
displayDevices: ADBDevice[];
|
||||||
deviceName: string;
|
deviceName: string;
|
||||||
connectionCss: any;
|
connectionCss: string = "connection-status-unauthorized";
|
||||||
obbRegex = /[a-z]{4,5}.[0-9]{1,}.([A-z0-9.]{1,}).obb/;
|
obbRegex = /[a-z]{4,5}.[0-9]{1,}.([A-z0-9.]{1,}).obb/;
|
||||||
freespace = {
|
freespace = {
|
||||||
available: '',
|
available: '',
|
||||||
@@ -85,13 +85,25 @@ export class AdbClientService {
|
|||||||
this.setConnectionCssClass();
|
this.setConnectionCssClass();
|
||||||
}
|
}
|
||||||
setConnectionCssClass() {
|
setConnectionCssClass() {
|
||||||
this.connectionCss = {
|
switch ( this.deviceStatus ) {
|
||||||
'connection-status-connected': this.deviceStatus === ConnectionStatus.CONNECTED,
|
case ConnectionStatus.CONNECTED:
|
||||||
'connection-status-unauthorized': this.deviceStatus === ConnectionStatus.UNAUTHORIZED,
|
this.connectionCss = 'connection-status-connected';
|
||||||
'connection-status-disconnected': this.deviceStatus === ConnectionStatus.DISCONNECTED,
|
break;
|
||||||
'connection-status-too-many': this.deviceStatus === ConnectionStatus.LINUX_PERMS,
|
case ConnectionStatus.UNAUTHORIZED:
|
||||||
'connection-status-dev-mode': this.deviceStatus === ConnectionStatus.DEV_MODE,
|
this.connectionCss = 'connection-status-unauthorized';
|
||||||
};
|
break;
|
||||||
|
case ConnectionStatus.DISCONNECTED:
|
||||||
|
this.connectionCss = 'connection-status-disconnected';
|
||||||
|
break;
|
||||||
|
case ConnectionStatus.LINUX_PERMS:
|
||||||
|
this.connectionCss = 'connection-status-too-many';
|
||||||
|
break;
|
||||||
|
case ConnectionStatus.DEV_MODE:
|
||||||
|
this.connectionCss = 'connection-status-dev-mode';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.connectionCss = 'connection-status-unauthorized';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diagBegin() {
|
diagBegin() {
|
||||||
@@ -147,13 +159,19 @@ export class AdbClientService {
|
|||||||
command = command.substr(3);
|
command = command.substr(3);
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const cmd = '"' + this.appService.path.join(this.adbPath, this.getAdbBinary()) + '" -s ' + this.deviceSerial + ' ' + command
|
||||||
this.appService.exec(
|
this.appService.exec(
|
||||||
'"' + this.appService.path.join(this.adbPath, this.getAdbBinary()) + '" -s ' + this.deviceSerial + ' ' + command,
|
cmd,
|
||||||
function(err, stdout, stderr) {
|
function(err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
if (stderr) return reject(stderr);
|
if (stderr) {
|
||||||
|
// Monkey always reports the Args/Commands on stderr, so ignore it if that is all that it is...
|
||||||
|
if (cmd.indexOf("shell monkey -p") === -1 || stderr.indexOf("data=\"android.intent.category.LAUNCHER\"") !== stderr.length - 40) {
|
||||||
|
return reject(stderr);
|
||||||
|
}
|
||||||
|
}
|
||||||
return resolve(stdout);
|
return resolve(stdout);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -246,13 +264,22 @@ export class AdbClientService {
|
|||||||
((p.substr(0, 10) !== 'com.oculus' &&
|
((p.substr(0, 10) !== 'com.oculus' &&
|
||||||
p.substr(0, 11) !== 'com.android' &&
|
p.substr(0, 11) !== 'com.android' &&
|
||||||
p.substr(0, 11) !== 'android.ext' &&
|
p.substr(0, 11) !== 'android.ext' &&
|
||||||
|
p.substr(0, 8) !== 'com.meta' &&
|
||||||
p !== 'android' &&
|
p !== 'android' &&
|
||||||
p.substr(0, 12) !== 'com.qualcomm' &&
|
p.substr(0, 12) !== 'com.qualcomm' &&
|
||||||
p !== 'com.facebook.system' &&
|
p !== 'com.facebook.system' &&
|
||||||
p !== 'oculus.platform' &&
|
p !== 'oculus.platform' &&
|
||||||
p !== 'com.svox.pico' &&
|
p !== 'com.svox.pico' &&
|
||||||
p !== 'org.codeaurora.bluetooth') ||
|
p !== 'org.codeaurora.bluetooth' &&
|
||||||
p === 'com.oculus.DogCorp')
|
p !== 'com.facebook.wearable.system.location.proxy' &&
|
||||||
|
p !== 'com.facebook.arvr.quillplayer' &&
|
||||||
|
p !== 'com.facebook.wearable.system.location.service' &&
|
||||||
|
p !== 'com.facebook.spatial_persistence_service' &&
|
||||||
|
p !== 'meta.skymap.service'
|
||||||
|
) ||
|
||||||
|
p === 'com.oculus.DogCorp' ||
|
||||||
|
p === 'com.meta.samples.crypticcabinet'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// if (this.devicePackages.indexOf('com.apkinstaller.ApkInstaller') > -1 ) {
|
// if (this.devicePackages.indexOf('com.apkinstaller.ApkInstaller') > -1 ) {
|
||||||
@@ -338,7 +365,7 @@ export class AdbClientService {
|
|||||||
}
|
}
|
||||||
this.displayDevices = this.devices;
|
this.displayDevices = this.devices;
|
||||||
})();
|
})();
|
||||||
document.getElementById('connection-status').className = 'connection-status-' + status;
|
document.getElementById('connection-status').className = this.connectionCss;
|
||||||
switch (this.deviceStatus) {
|
switch (this.deviceStatus) {
|
||||||
case ConnectionStatus.LINUX_PERMS:
|
case ConnectionStatus.LINUX_PERMS:
|
||||||
this.deviceStatusMessage = 'Warning: no permissions. ADB udev rules missing.';
|
this.deviceStatusMessage = 'Warning: no permissions. ADB udev rules missing.';
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
// this.telemetry.telemetry({ event: 'install-sidequest-apk', installType: telemEvent, oldVersion });
|
// this.telemetry.telemetry({ event: 'install-sidequest-apk', installType: telemEvent, oldVersion });
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
try {
|
try {
|
||||||
throw new Error('bypass_sdk_download');
|
|
||||||
await this.getLatestApk();
|
await this.getLatestApk();
|
||||||
await this.downloadAPK();
|
await this.downloadAPK();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
arrow_drop_down
|
arrow_drop_down
|
||||||
</i>
|
</i>
|
||||||
<div class="connection-status-outer left">
|
<div class="connection-status-outer left">
|
||||||
<div id="connection-status" class="connection-status-unauthorized"
|
<div id="connection-status" [class]="adbService.connectionCss"
|
||||||
data-position="bottom" [ngClass]="adbService.connectionCss" mTooltip [attr.data-tooltip]="adbService.lastErrorMessage||'Device connection status.'">
|
data-position="bottom" [ngClass]="adbService.connectionCss" mTooltip [attr.data-tooltip]="adbService.lastErrorMessage||'Device connection status.'">
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -434,15 +434,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container>
|
||||||
<h4 class="section-title">SideQuest Stuff </h4>
|
<h4 class="section-title">SideQuest Stuff </h4>
|
||||||
<div class="section-container card z-depth-2">
|
<div class="section-container card z-depth-2">
|
||||||
|
|
||||||
<h5 class="section-title">SideQuest Folders</h5>
|
<h5 class="section-title">SideQuest Folders</h5>
|
||||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||||
<h4 class="description-section">
|
<h4 class="description-section">
|
||||||
This changes the resolution of captured videos on the Quest
|
This allows you to open a folder in your file explorer.
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div class="button-section">
|
<div class="button-section">
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<p>If you are still having trouble then please visit our support community on SideQuest.</p>
|
<p>If you are still having trouble then please visit our support community on SideQuest.</p>
|
||||||
<div class="pure-material-button-contained extra-margin-bottom" (click)="appService.opn('https://sdq.st/support')">Open Support Community</div>
|
<div class="pure-material-button-contained extra-margin-bottom" (click)="appService.opn('https://sdq.st/support')">Open Support Community</div>
|
||||||
<br>
|
<br>
|
||||||
|
<ng-container *nfIf="false">
|
||||||
|
TODO: This site is no longer active -- find another way....
|
||||||
<p *ngIf="adb.diagnostics?.usb && adb.diagnostics.usb.log">If instructed to upload logs by a SideQuest support person, please click this button.</p>
|
<p *ngIf="adb.diagnostics?.usb && adb.diagnostics.usb.log">If instructed to upload logs by a SideQuest support person, please click this button.</p>
|
||||||
<div *ngIf="adb.diagnostics?.usb && adb.diagnostics.usb.log" class="pure-material-button-contained extra-margin-bottom" (click)="uploadLogs();">{{'Upload Logs'}}</div>
|
<div *ngIf="adb.diagnostics?.usb && adb.diagnostics.usb.log" class="pure-material-button-contained extra-margin-bottom" (click)="uploadLogs();">{{'Upload Logs'}}</div>
|
||||||
<div *ngIf="link">
|
<div *ngIf="link">
|
||||||
@@ -23,6 +25,7 @@
|
|||||||
<h3>{{link}}</h3>
|
<h3>{{link}}</h3>
|
||||||
<div class="pure-material-button-contained button-margin-bottom" (click)="copyToClipboard()">Copy to Clipboard</div>
|
<div class="pure-material-button-contained button-margin-bottom" (click)="copyToClipboard()">Copy to Clipboard</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
<div id="thankYou">
|
<div id="thankYou">
|
||||||
<ng-container *ngIf="link">Thank you!</ng-container>
|
<ng-container *ngIf="link">Thank you!</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ export class SetupGuideComponent implements OnInit {
|
|||||||
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
|
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
|
||||||
.join('&');
|
.join('&');
|
||||||
try {
|
try {
|
||||||
const ftch = (window as any).require('node-fetch');
|
const resp = await fetch('https://api.teknik.io/v1/Paste', {
|
||||||
const resp = await ftch('https://api.teknik.io/v1/Paste', {
|
|
||||||
body: formData,
|
body: formData,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: true,
|
||||||
header: {color: "sidetestvr", text: "Side Test VR"},
|
header: {color: "sidetestvr", text: "Side Test VR"},
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://sidetestvr.com',
|
web_url: 'https://sidetestvr.com',
|
||||||
|
|||||||
+113
-43
@@ -9,11 +9,11 @@ const download = require('./download');
|
|||||||
const extract = require('extract-zip');
|
const extract = require('extract-zip');
|
||||||
|
|
||||||
const Readable = require('stream').Readable;
|
const Readable = require('stream').Readable;
|
||||||
const adb = require('@devicefarmer/adbkit').Adb;
|
const Adb = require('@devicefarmer/adbkit').Adb;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const request = require('request');
|
const request = require('request');
|
||||||
const progress = require('request-progress');
|
//const progress = require('request-progress');
|
||||||
//without this, there's a bug in electron that makes facebook pages ruin everything, see https://github.com/electron/electron/issues/25469
|
//without this, there's a bug in electron that makes facebook pages ruin everything, see https://github.com/electron/electron/issues/25469
|
||||||
app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy');
|
app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy');
|
||||||
|
|
||||||
@@ -43,8 +43,27 @@ const makeDeferred = () => {
|
|||||||
return deferred;
|
return deferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ReadableStreamClone extends Readable {
|
||||||
|
constructor(readableStream, options?) {
|
||||||
|
super(options);
|
||||||
|
readableStream.on('data', chunk => {
|
||||||
|
this.push(chunk);
|
||||||
|
});
|
||||||
|
|
||||||
|
readableStream.on('end', () => {
|
||||||
|
this.push(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
readableStream.on('error', err => {
|
||||||
|
this.emit('error', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public _read() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class ADB {
|
class ADB {
|
||||||
client= null;
|
client = null;
|
||||||
_logcat;
|
_logcat;
|
||||||
adbPath;
|
adbPath;
|
||||||
_clientSetup = makeDeferred();
|
_clientSetup = makeDeferred();
|
||||||
@@ -52,7 +71,7 @@ class ADB {
|
|||||||
setupAdb(adbPath, cb, ecb) {
|
setupAdb(adbPath, cb, ecb) {
|
||||||
if (this.client) return;
|
if (this.client) return;
|
||||||
this.adbPath = adbPath;
|
this.adbPath = adbPath;
|
||||||
this.client = adb.createClient({
|
this.client = Adb.createClient({
|
||||||
bin: adbPath,
|
bin: adbPath,
|
||||||
});
|
});
|
||||||
this._clientSetup.resolve();
|
this._clientSetup.resolve();
|
||||||
@@ -74,7 +93,7 @@ class ADB {
|
|||||||
},
|
},
|
||||||
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
||||||
};
|
};
|
||||||
request(options, (error, response, body) => {
|
request(url, options, (error, response, body) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -141,7 +160,7 @@ class ADB {
|
|||||||
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
rejectUnauthorized: process.env.NODE_ENV !== 'dev',
|
||||||
json: { token: token },
|
json: { token: token },
|
||||||
};
|
};
|
||||||
request(options, (error, response, body) => {
|
request(options.url, options, (error, response, body) => {
|
||||||
if (!error && body.data && body.data.apps && body.data.apps.length) {
|
if (!error && body.data && body.data.apps && body.data.apps.length) {
|
||||||
let tasks = [];
|
let tasks = [];
|
||||||
for (let i = 0; i < body.data.apps.length; i++) {
|
for (let i = 0; i < body.data.apps.length; i++) {
|
||||||
@@ -185,8 +204,9 @@ class ADB {
|
|||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
if (!this._logcat) this.endLogcat();
|
if (!this._logcat) this.endLogcat();
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.openLogcat(serial, { clear: true })
|
device
|
||||||
|
.openLogcat({ clear: true })
|
||||||
.then(logcat => {
|
.then(logcat => {
|
||||||
this._logcat = logcat;
|
this._logcat = logcat;
|
||||||
logcat.include(tag, priority).on('entry', entry => scb(entry));
|
logcat.include(tag, priority).on('entry', entry => scb(entry));
|
||||||
@@ -197,8 +217,8 @@ class ADB {
|
|||||||
installRemote(serial, path, cb, ecb) {
|
installRemote(serial, path, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.installRemote(serial, path)
|
device.installRemote(path)
|
||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -206,7 +226,7 @@ class ADB {
|
|||||||
async install(serial, apkpath, isLocal, cb, scb, ecb) {
|
async install(serial, apkpath, isLocal, cb, scb, ecb) {
|
||||||
await this._clientSetup.promise;
|
await this._clientSetup.promise;
|
||||||
|
|
||||||
console.log('installapk');
|
console.log('installapk', apkpath, isLocal);
|
||||||
let stopUpdate;
|
let stopUpdate;
|
||||||
|
|
||||||
installErrorCallback = e => {
|
installErrorCallback = e => {
|
||||||
@@ -214,6 +234,7 @@ class ADB {
|
|||||||
ecb(e);
|
ecb(e);
|
||||||
console.log(e, stopUpdate);
|
console.log(e, stopUpdate);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
let found;
|
let found;
|
||||||
@@ -232,8 +253,41 @@ class ADB {
|
|||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
stream = fs.createReadStream(apkpath);
|
stream = fs.createReadStream(apkpath);
|
||||||
} else {
|
} else {
|
||||||
|
const response = await fetch(apkpath + '?t=' + Date.now());
|
||||||
|
if (!response.ok || response.body == null) {
|
||||||
|
console.log(response.statusText, response.status, response.headers);
|
||||||
|
return ecb('Unable to fetch package');
|
||||||
|
}
|
||||||
|
|
||||||
|
let size = parseInt(response.headers.get('Content-Length') || '0', 10);
|
||||||
|
if (size <= 0) {
|
||||||
|
// Approximate app size in case we cannot get the size from the server
|
||||||
|
size = 30_000_000;
|
||||||
|
}
|
||||||
|
let bytesRead = 0;
|
||||||
|
let webStream = Readable.fromWeb(response.body);
|
||||||
|
stream = new ReadableStreamClone(webStream);
|
||||||
|
let progress = new ReadableStreamClone(webStream);
|
||||||
|
|
||||||
|
progress.on('data', chunk => {
|
||||||
|
bytesRead += chunk.length;
|
||||||
|
const percentage = Math.round(Math.min(bytesRead / size, 1) * 100);
|
||||||
|
if (!stopUpdate) {
|
||||||
|
scb({percent: percentage});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
progress.on('end', () => {
|
||||||
|
if (!stopUpdate) {
|
||||||
|
scb({
|
||||||
|
percent: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
stream = new Readable().wrap(
|
stream = new Readable().wrap(
|
||||||
progress(request(apkpath), {
|
progress(request(apkpath, undefined, undefined), {
|
||||||
throttle: 60,
|
throttle: 60,
|
||||||
})
|
})
|
||||||
.on('progress', state => {
|
.on('progress', state => {
|
||||||
@@ -242,15 +296,17 @@ class ADB {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
|
console.log("Downloaded")
|
||||||
if (!stopUpdate) {
|
if (!stopUpdate) {
|
||||||
scb({
|
scb({
|
||||||
percent: 1,
|
percent: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
); */
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
const isInvalidURI = e && typeof e.message === 'string' && e.message.startsWith('Invalid URI "');
|
const isInvalidURI = e && typeof e.message === 'string' && e.message.startsWith('Invalid URI "');
|
||||||
if (isInvalidURI) {
|
if (isInvalidURI) {
|
||||||
return ecb("Can't download file. Invalid URL:");
|
return ecb("Can't download file. Invalid URL:");
|
||||||
@@ -258,16 +314,19 @@ class ADB {
|
|||||||
return ecb(e);
|
return ecb(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.client
|
|
||||||
.install(serial, stream)
|
const device = this.client.getDevice(serial);
|
||||||
|
device
|
||||||
|
.install(stream)
|
||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => { console.error("error installing", e); ecb(e) });
|
||||||
}
|
}
|
||||||
uninstall(serial, packageName, cb, ecb) {
|
uninstall(serial, packageName, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.uninstall(serial, packageName)
|
device
|
||||||
|
.uninstall(packageName)
|
||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -275,8 +334,10 @@ class ADB {
|
|||||||
clear(serial, packageName, cb, ecb) {
|
clear(serial, packageName, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
|
||||||
.clear(serial, packageName)
|
const device = this.client.getDevice(serial);
|
||||||
|
device
|
||||||
|
.clear(packageName)
|
||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -303,8 +364,9 @@ class ADB {
|
|||||||
tcpip(serial, cb, ecb) {
|
tcpip(serial, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.tcpip(serial, 5555)
|
device
|
||||||
|
.tcpip(5555)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
console.log(r);
|
console.log(r);
|
||||||
cb(r);
|
cb(r);
|
||||||
@@ -318,8 +380,9 @@ class ADB {
|
|||||||
usb(serial, cb, ecb) {
|
usb(serial, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.usb(serial)
|
device
|
||||||
|
.usb()
|
||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -336,7 +399,9 @@ class ADB {
|
|||||||
setProperties(serial, command, cb, ecb) {
|
setProperties(serial, command, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
|
||||||
|
const device = this.client.getDevice(serial);
|
||||||
|
device
|
||||||
.transport(serial)
|
.transport(serial)
|
||||||
.then(function(transport) {
|
.then(function(transport) {
|
||||||
return new SetPropertiesCommand(transport).execute(command);
|
return new SetPropertiesCommand(transport).execute(command);
|
||||||
@@ -350,8 +415,9 @@ class ADB {
|
|||||||
getPackages(serial, cb, ecb) {
|
getPackages(serial, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.getPackages(serial)
|
device
|
||||||
|
.getPackages()
|
||||||
.then(res => cb(res))
|
.then(res => cb(res))
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -359,9 +425,10 @@ class ADB {
|
|||||||
shell(serial, command, cb, ecb) {
|
shell(serial, command, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.shell(serial, command)
|
device
|
||||||
.then(adb.util.readAll)
|
.shell(command)
|
||||||
|
.then(Adb.util.readAll)
|
||||||
.then(res => cb(res.toString()))
|
.then(res => cb(res.toString()))
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}).catch(e => ecb(e));
|
}).catch(e => ecb(e));
|
||||||
@@ -369,8 +436,9 @@ class ADB {
|
|||||||
readdir(serial, path, cb, ecb) {
|
readdir(serial, path, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.readdir(serial, path)
|
device
|
||||||
|
.readdir(path)
|
||||||
.then(res =>
|
.then(res =>
|
||||||
res
|
res
|
||||||
.map(r => {
|
.map(r => {
|
||||||
@@ -387,8 +455,9 @@ class ADB {
|
|||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
|
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.push(serial, fs.createReadStream(path), savePath)
|
device
|
||||||
|
.push(fs.createReadStream(path), savePath)
|
||||||
.then(transfer => {
|
.then(transfer => {
|
||||||
let _stats, autoCancel;
|
let _stats, autoCancel;
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
@@ -420,8 +489,9 @@ class ADB {
|
|||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
|
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
.pull(serial, path)
|
device
|
||||||
|
.pull(path)
|
||||||
.then(transfer => {
|
.then(transfer => {
|
||||||
transfer.on('progress', stats => {
|
transfer.on('progress', stats => {
|
||||||
scb(stats);
|
scb(stats);
|
||||||
@@ -442,7 +512,8 @@ class ADB {
|
|||||||
stat(serial, path, cb, ecb) {
|
stat(serial, path, cb, ecb) {
|
||||||
this._clientSetup.promise.then(() => {
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
const device = this.client.getDevice(serial);
|
||||||
|
device
|
||||||
.stat(serial, path)
|
.stat(serial, path)
|
||||||
.then(res => cb(res))
|
.then(res => cb(res))
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
@@ -807,10 +878,9 @@ function setupApp() {
|
|||||||
event.sender.send('extract-progress', { stats, token });
|
event.sender.send('extract-progress', { stats, token });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
err => {
|
).catch(err => {
|
||||||
event.sender.send('extract-file', { token });
|
event.sender.send('extract-file', { token });
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('automatic-update', (event, arg) => {
|
ipcMain.on('automatic-update', (event, arg) => {
|
||||||
@@ -822,13 +892,13 @@ function setupApp() {
|
|||||||
});
|
});
|
||||||
ipcMain.on('adb-command', (event, arg) => {
|
ipcMain.on('adb-command', (event, arg) => {
|
||||||
const success = d => {
|
const success = d => {
|
||||||
// console.log(" ", arg.command, "Success", d)
|
//console.log(" ", arg.command, "Success", d)
|
||||||
if (!event.sender.isDestroyed()) {
|
if (!event.sender.isDestroyed()) {
|
||||||
event.sender.send('adb-command', { command: arg.command, resp: d, uuid: arg.uuid });
|
event.sender.send('adb-command', { command: arg.command, resp: d, uuid: arg.uuid });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const reject = e => {
|
const reject = e => {
|
||||||
// console.log(" ", arg.command, "reject", e)
|
//console.log(" ", arg.command, "reject", e)
|
||||||
if (!event.sender.isDestroyed()) {
|
if (!event.sender.isDestroyed()) {
|
||||||
event.sender.send('adb-command', { command: arg.command, error: e, uuid: arg.uuid });
|
event.sender.send('adb-command', { command: arg.command, error: e, uuid: arg.uuid });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ if (!__fs.existsSync(outputPath)) {
|
|||||||
var stats = entry.fileName;
|
var stats = entry.fileName;
|
||||||
// console.log(stats);
|
// console.log(stats);
|
||||||
},
|
},
|
||||||
},
|
}).catch(
|
||||||
function(err) {
|
(err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
}
|
}
|
||||||
@@ -58,8 +58,8 @@ if (!__fs.existsSync(outputPath)) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}, 5000);
|
}, 5000);
|
||||||
})
|
})
|
||||||
.catch(function(e) {
|
.catch(function(e) {
|
||||||
|
|||||||
+4
-2
@@ -11,6 +11,7 @@
|
|||||||
"concurrently": "concurrently",
|
"concurrently": "concurrently",
|
||||||
"start": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev electron .\" \"cd desktop-app && ng serve --port 4205\"",
|
"start": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev electron .\" \"cd desktop-app && ng serve --port 4205\"",
|
||||||
"start:test": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=test electron .\" \"cd desktop-app && ng serve -c test --port 4205\"",
|
"start:test": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=test electron .\" \"cd desktop-app && ng serve -c test --port 4205\"",
|
||||||
|
"start:sidetest": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=test electron .\" \"cd desktop-app && ng serve -c test --port 4205\"",
|
||||||
"start:test2": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=test2 electron .\" \"cd desktop-app && ng serve -c test2 --port 4205\"",
|
"start:test2": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=test2 electron .\" \"cd desktop-app && ng serve -c test2 --port 4205\"",
|
||||||
"start:local": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=local electron .\" \"cd desktop-app && ng serve -c local --port 4205\"",
|
"start:local": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=local electron .\" \"cd desktop-app && ng serve -c local --port 4205\"",
|
||||||
"start:localhost": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=localhost electron .\" \"cd desktop-app && ng serve -c localhost --port 4205\"",
|
"start:localhost": "concurrently \"yarn electron-build && yarn platform-tools && wait-on http-get://localhost:4205/ && cross-env NODE_ENV=dev SQ_ENV_CFG=localhost electron .\" \"cd desktop-app && ng serve -c localhost --port 4205\"",
|
||||||
@@ -18,8 +19,9 @@
|
|||||||
"dist": "yarn electron-build && yarn platform-tools && yarn app-build && env-cmd --silent electron-builder --publish onTagOrDraft",
|
"dist": "yarn electron-build && yarn platform-tools && yarn app-build && env-cmd --silent electron-builder --publish onTagOrDraft",
|
||||||
"build:win": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --win",
|
"build:win": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --win",
|
||||||
"build:linux": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --linux",
|
"build:linux": "yarn electron-build && yarn platform-tools && yarn app-build && cross-env NODE_ENV=production electron-builder --linux",
|
||||||
"dist-test": "yarn electron-build && yarn platform-tools && yarn app-build-test && cross-env SQ_ENV_CFG=test electron-builder",
|
"dist-test": "yarn electron-build && yarn platform-tools && yarn app-build-test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
||||||
"dist-fried": "yarn electron-build && yarn platform-tools && yarn app-build-fried && cross-env SQ_ENV_CFG=fried electron-builder",
|
"dist-sidetest": "yarn electron-build && yarn platform-tools && yarn app-build-test && cross-env NODE_ENV=production SQ_ENV_CFG=test electron-builder",
|
||||||
|
"dist-fried": "yarn electron-build && yarn platform-tools && yarn app-build-fried && cross-env NODE_ENV=production SQ_ENV_CFG=fried electron-builder",
|
||||||
"dist-localhost": "yarn electron-build && yarn platform-tools && yarn app-build-localhost && cross-env SQ_ENV_CFG=localhost electron-builder --linux",
|
"dist-localhost": "yarn electron-build && yarn platform-tools && yarn app-build-localhost && cross-env SQ_ENV_CFG=localhost electron-builder --linux",
|
||||||
"angular": "cd desktop-app && ng serve --port 4205",
|
"angular": "cd desktop-app && ng serve --port 4205",
|
||||||
"angular:test": "cd desktop-app && ng serve -c test --port 4205",
|
"angular:test": "cd desktop-app && ng serve -c test --port 4205",
|
||||||
|
|||||||
Reference in New Issue
Block a user