Fixes for Upgrade, ability to pull latest sidequest app from site, added permissions, added additional environmental support.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const { notarize } = require('electron-notarize');
|
const { notarize } = require('@electron/notarize');
|
||||||
|
|
||||||
exports.default = async function notarizing(context) {
|
exports.default = async function notarizing(context) {
|
||||||
const { electronPlatformName, appOutDir } = context;
|
const { electronPlatformName, appOutDir } = context;
|
||||||
|
|||||||
@@ -121,6 +121,46 @@
|
|||||||
"aot": false,
|
"aot": false,
|
||||||
"extractLicenses": true,
|
"extractLicenses": true,
|
||||||
"vendorChunk": false
|
"vendorChunk": false
|
||||||
|
},
|
||||||
|
"localhost": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.localhost.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": false,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false
|
||||||
|
},
|
||||||
|
"fried": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.fried.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": false,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": ""
|
"defaultConfiguration": ""
|
||||||
@@ -142,6 +182,12 @@
|
|||||||
},
|
},
|
||||||
"local": {
|
"local": {
|
||||||
"buildTarget": "desktop-app:build:local"
|
"buildTarget": "desktop-app:build:local"
|
||||||
|
},
|
||||||
|
"fried": {
|
||||||
|
"buildTarget": "desktop-app:build:fried"
|
||||||
|
},
|
||||||
|
"localhost": {
|
||||||
|
"buildTarget": "desktop-app:build:localhost"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export class AdbClientService {
|
|||||||
pollInterval: number = 1000 * 1;
|
pollInterval: number = 1000 * 1;
|
||||||
savePath: string;
|
savePath: string;
|
||||||
isTransferring: boolean;
|
isTransferring: boolean;
|
||||||
|
skipStatusUpdates: boolean = false;
|
||||||
adbResolves: any;
|
adbResolves: any;
|
||||||
files: any;
|
files: any;
|
||||||
localFiles: any;
|
localFiles: any;
|
||||||
@@ -390,16 +391,17 @@ export class AdbClientService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boundConnectedStatus: any = null;
|
||||||
async connectedStatus() {
|
async connectedStatus() {
|
||||||
|
if (!this.boundConnectedStatus) { this.boundConnectedStatus = this.connectedStatus.bind(this); }
|
||||||
let now = performance.now();
|
let now = performance.now();
|
||||||
if (now - this.lastConnectionCheck < this.pollInterval || this.isTransferring)
|
if (now - this.lastConnectionCheck < this.pollInterval || this.isTransferring || this.skipStatusUpdates) {
|
||||||
return requestAnimationFrame(this.connectedStatus.bind(this));
|
return requestAnimationFrame(this.boundConnectedStatus);
|
||||||
|
}
|
||||||
this.lastConnectionCheck = now;
|
this.lastConnectionCheck = now;
|
||||||
return this.adbCommand('listDevices')
|
return this.adbCommand('listDevices')
|
||||||
.then((devices: any) => {
|
.then((devices: any) => {
|
||||||
console.log("d1", devices);
|
return devices.filter(device => device.type !== 'offline')
|
||||||
let f = devices.filter(device => device.type !== 'offline')
|
|
||||||
return f;
|
|
||||||
})
|
})
|
||||||
.then(async devices => {
|
.then(async devices => {
|
||||||
if (devices.length > 1 && this.justChangedMPT) {
|
if (devices.length > 1 && this.justChangedMPT) {
|
||||||
@@ -416,10 +418,10 @@ export class AdbClientService {
|
|||||||
this.appVersionCode = await this.getAppVersion(true);
|
this.appVersionCode = await this.getAppVersion(true);
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
requestAnimationFrame(this.connectedStatus.bind(this));
|
requestAnimationFrame(this.boundConnectedStatus);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.warn(err, err.stack);
|
console.error("Wrong Install Error:", err, err.stack);
|
||||||
alert(
|
alert(
|
||||||
this.appService.os.platform() === 'win32'
|
this.appService.os.platform() === 'win32'
|
||||||
? `It looks like there is something wrong with your install.
|
? `It looks like there is something wrong with your install.
|
||||||
@@ -429,6 +431,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
adbCommand(command: string, settings?, callback?) {
|
adbCommand(command: string, settings?, callback?) {
|
||||||
const uuid = this.appService.uuidv4();
|
const uuid = this.appService.uuidv4();
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
@@ -441,6 +444,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
const { clipboard } = (window as any).require('electron');
|
const { clipboard } = (window as any).require('electron');
|
||||||
clipboard.writeText(value);
|
clipboard.writeText(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAppVersion(isCode: boolean): Promise<string | null> {
|
async getAppVersion(isCode: boolean): Promise<string | null> {
|
||||||
const versionInfo = await this.runAdbCommand('shell dumpsys package ' + this.VR_APP_PACKAGE, true);
|
const versionInfo = await this.runAdbCommand('shell dumpsys package ' + this.VR_APP_PACKAGE, true);
|
||||||
this.notInstalled = versionInfo.includes('Unable to find package');
|
this.notInstalled = versionInfo.includes('Unable to find package');
|
||||||
@@ -459,7 +463,6 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
await this.appService.seedPlatformTools();
|
await this.appService.seedPlatformTools();
|
||||||
}
|
}
|
||||||
this.appService.electron.ipcRenderer.on('adb-command', (event, arg: any) => {
|
this.appService.electron.ipcRenderer.on('adb-command', (event, arg: any) => {
|
||||||
console.log("result", arg.uuid, arg.status, arg.error, arg.resp)
|
|
||||||
if (this.adbResolves[arg.uuid]) {
|
if (this.adbResolves[arg.uuid]) {
|
||||||
if (arg.status && this.adbResolves[arg.uuid].callback) {
|
if (arg.status && this.adbResolves[arg.uuid].callback) {
|
||||||
this.adbResolves[arg.uuid].callback(arg.status);
|
this.adbResolves[arg.uuid].callback(arg.status);
|
||||||
@@ -481,6 +484,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
this.lastErrorMessage = e.toString();
|
this.lastErrorMessage = e.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isAdbDownloaded() {
|
isAdbDownloaded() {
|
||||||
try {
|
try {
|
||||||
let downloaded = true;
|
let downloaded = true;
|
||||||
@@ -504,6 +508,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setPermission(packageName: string, permission: string, isRevoke?: boolean) {
|
setPermission(packageName: string, permission: string, isRevoke?: boolean) {
|
||||||
return this.adbCommand('shell', {
|
return this.adbCommand('shell', {
|
||||||
serial: this.deviceSerial,
|
serial: this.deviceSerial,
|
||||||
@@ -512,6 +517,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
this.statusService.showStatus('Permission set OK!!');
|
this.statusService.showStatus('Permission set OK!!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doesFileExist(path) {
|
doesFileExist(path) {
|
||||||
try {
|
try {
|
||||||
return this.appService.fs.existsSync(path);
|
return this.appService.fs.existsSync(path);
|
||||||
@@ -519,6 +525,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAdbBinary() {
|
getAdbBinary() {
|
||||||
if (this.appService.os.platform() === 'win32') {
|
if (this.appService.os.platform() === 'win32') {
|
||||||
return 'adb.exe';
|
return 'adb.exe';
|
||||||
@@ -526,6 +533,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return 'adb';
|
return 'adb';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilenameDate() {
|
getFilenameDate() {
|
||||||
return JSON.stringify(new Date())
|
return JSON.stringify(new Date())
|
||||||
.split('"')
|
.split('"')
|
||||||
@@ -534,6 +542,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
.join('-')
|
.join('-')
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
getPackageLocation(packageName) {
|
getPackageLocation(packageName) {
|
||||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'pm list packages -f ' + packageName }).then(res => {
|
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'pm list packages -f ' + packageName }).then(res => {
|
||||||
let parts = res.split(':');
|
let parts = res.split(':');
|
||||||
@@ -544,6 +553,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async makeBackupFolders(packageName: string) {
|
async makeBackupFolders(packageName: string) {
|
||||||
let mainBackupPath = this.appService.path.join(this.appService.backupPath, packageName);
|
let mainBackupPath = this.appService.path.join(this.appService.backupPath, packageName);
|
||||||
return this.appService
|
return this.appService
|
||||||
@@ -551,6 +561,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
.then(() => this.appService.mkdir(this.appService.path.join(mainBackupPath, 'apks')))
|
.then(() => this.appService.mkdir(this.appService.path.join(mainBackupPath, 'apks')))
|
||||||
.then(() => this.appService.mkdir(this.appService.path.join(mainBackupPath, 'data')));
|
.then(() => this.appService.mkdir(this.appService.path.join(mainBackupPath, 'data')));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBackups(packageName: string) {
|
async getBackups(packageName: string) {
|
||||||
await this.makeBackupFolders(packageName);
|
await this.makeBackupFolders(packageName);
|
||||||
let backupPath = this.appService.path.join(this.appService.backupPath, packageName, 'apks');
|
let backupPath = this.appService.path.join(this.appService.backupPath, packageName, 'apks');
|
||||||
@@ -560,6 +571,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
.filter(file => !this.appService.fs.lstatSync(file).isDirectory() && this.appService.path.extname(file) === '.apk')
|
.filter(file => !this.appService.fs.lstatSync(file).isDirectory() && this.appService.path.extname(file) === '.apk')
|
||||||
.reverse();
|
.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataBackups(packageName: string) {
|
async getDataBackups(packageName: string) {
|
||||||
await this.makeBackupFolders(packageName);
|
await this.makeBackupFolders(packageName);
|
||||||
let backupPath = this.appService.path.join(this.appService.backupPath, packageName, 'data');
|
let backupPath = this.appService.path.join(this.appService.backupPath, packageName, 'data');
|
||||||
@@ -604,6 +616,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
installAPK(
|
installAPK(
|
||||||
filePath: string,
|
filePath: string,
|
||||||
isLocal?: boolean,
|
isLocal?: boolean,
|
||||||
@@ -646,6 +659,9 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
if (filePath.indexOf('com.weloveoculus.BMBF') > -1) {
|
if (filePath.indexOf('com.weloveoculus.BMBF') > -1) {
|
||||||
return this.beatonService.setBeatOnPermission(this);
|
return this.beatonService.setBeatOnPermission(this);
|
||||||
}
|
}
|
||||||
|
if (filePath.indexOf('quest.side.vr') > -1) {
|
||||||
|
return this.addVRPermissions();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(async e => {
|
.catch(async e => {
|
||||||
if (deleteAfter) {
|
if (deleteAfter) {
|
||||||
@@ -685,6 +701,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
name
|
name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstallAPK(pkg) {
|
uninstallAPK(pkg) {
|
||||||
return this.processService.addItem('apk_uninstall', task => {
|
return this.processService.addItem('apk_uninstall', task => {
|
||||||
task.status = 'Uninstalling ' + pkg + '...';
|
task.status = 'Uninstalling ' + pkg + '...';
|
||||||
@@ -706,12 +723,14 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
.catch(e => Promise.reject(e.message ? e.message : e.code ? e.code : e.toString() + pkg));
|
.catch(e => Promise.reject(e.message ? e.message : e.code ? e.code : e.toString() + pkg));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
makeFolder(files) {
|
makeFolder(files) {
|
||||||
if (!files.length) return null;
|
if (!files.length) return null;
|
||||||
let f: any = files.shift();
|
let f: any = files.shift();
|
||||||
this.spinnerService.setMessage('Making folder: <br>' + f.saveName);
|
this.spinnerService.setMessage('Making folder: <br>' + f.saveName);
|
||||||
return this.appService.mkdir(f.saveName).then(() => this.makeFolder(files));
|
return this.appService.mkdir(f.saveName).then(() => this.makeFolder(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFile(files, task) {
|
downloadFile(files, task) {
|
||||||
if (!files.length) return;
|
if (!files.length) return;
|
||||||
let f: any = files.shift();
|
let f: any = files.shift();
|
||||||
@@ -724,6 +743,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
'MB';
|
'MB';
|
||||||
}).then(r => this.downloadFile(files, task));
|
}).then(r => this.downloadFile(files, task));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFoldersRecursive(root: string) {
|
async getFoldersRecursive(root: string) {
|
||||||
return this.getFolders(root).then(entries => {
|
return this.getFolders(root).then(entries => {
|
||||||
entries.forEach(f => {
|
entries.forEach(f => {
|
||||||
@@ -739,6 +759,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return recurse();
|
return recurse();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLocalFoldersRecursive(root: string) : Promise<void> {
|
async getLocalFoldersRecursive(root: string) : Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.appService.fs.readdir(root, async (err, entries) => {
|
this.appService.fs.readdir(root, async (err, entries) => {
|
||||||
@@ -757,6 +778,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadFile(files, task) {
|
async uploadFile(files, task) {
|
||||||
if (!files.length) return;
|
if (!files.length) return;
|
||||||
let f: any = files.shift();
|
let f: any = files.shift();
|
||||||
@@ -765,6 +787,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
task.status = 'File uploading: ' + f.name + ' ' + Math.round((stats.bytesTransferred / 1024 / 1024) * 100) / 100 + 'MB';
|
task.status = 'File uploading: ' + f.name + ' ' + Math.round((stats.bytesTransferred / 1024 / 1024) * 100) / 100 + 'MB';
|
||||||
}).then(r => this.uploadFile(files, task));
|
}).then(r => this.uploadFile(files, task));
|
||||||
}
|
}
|
||||||
|
|
||||||
async launchYurOverlay() {
|
async launchYurOverlay() {
|
||||||
await this.adbCommand('shell', {
|
await this.adbCommand('shell', {
|
||||||
serial: this.deviceSerial,
|
serial: this.deviceSerial,
|
||||||
@@ -775,6 +798,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
command: 'am startservice com.yur.fitquest/.service.YURCounterService',
|
command: 'am startservice com.yur.fitquest/.service.YURCounterService',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async restoreDataBackup(packageName: string, folderName: string) {
|
async restoreDataBackup(packageName: string, folderName: string) {
|
||||||
return this.processService.addItem('restore_files', async task => {
|
return this.processService.addItem('restore_files', async task => {
|
||||||
task.status = 'Transferring Files...';
|
task.status = 'Transferring Files...';
|
||||||
@@ -823,6 +847,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async makeDataBackup(packageName: string) {
|
async makeDataBackup(packageName: string) {
|
||||||
return this.processService.addItem('save_files', async task => {
|
return this.processService.addItem('save_files', async task => {
|
||||||
task.status = 'Starting Backup...';
|
task.status = 'Starting Backup...';
|
||||||
@@ -881,15 +906,18 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasSDFolder(name: string, packageName: string) {
|
async hasSDFolder(name: string, packageName: string) {
|
||||||
let folders = await this.getFolders('/sdcard/Android/' + name + '/');
|
let folders = await this.getFolders('/sdcard/Android/' + name + '/');
|
||||||
return !!~folders.map(d => d.name).indexOf(packageName);
|
return !!~folders.map(d => d.name).indexOf(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFolders(root) {
|
async getFolders(root) {
|
||||||
return this.adbCommand('readdir', { serial: this.deviceSerial, path: root }).catch(e =>
|
return this.adbCommand('readdir', { serial: this.deviceSerial, path: root }).catch(e =>
|
||||||
this.statusService.showStatus('Error: ' + e.toString() + ' while reading path ' + root, true)
|
this.statusService.showStatus('Error: ' + e.toString() + ' while reading path ' + root, true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
installFile(url, destinationFolder: string, number?: number, total?: number) {
|
installFile(url, destinationFolder: string, number?: number, total?: number) {
|
||||||
return this.processService.addItem('file_install', async task => {
|
return this.processService.addItem('file_install', async task => {
|
||||||
return this.appService
|
return this.appService
|
||||||
@@ -905,6 +933,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
.then((_path: string) => this.installLocalFile(_path, destinationFolder, false, null, number, total, task));
|
.then((_path: string) => this.installLocalFile(_path, destinationFolder, false, null, number, total, task));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
installLocalFile(
|
installLocalFile(
|
||||||
filepath: string,
|
filepath: string,
|
||||||
destinationFolder: string,
|
destinationFolder: string,
|
||||||
@@ -962,6 +991,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
installZip(url, number?: number, total?: number, deleteAfter?: boolean) {
|
installZip(url, number?: number, total?: number, deleteAfter?: boolean) {
|
||||||
return this.processService.addItem('file_install', async task => {
|
return this.processService.addItem('file_install', async task => {
|
||||||
return this.appService
|
return this.appService
|
||||||
@@ -991,6 +1021,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
installObb(url, number?: number, total?: number, name?: string) {
|
installObb(url, number?: number, total?: number, name?: string) {
|
||||||
return this.processService.addItem(
|
return this.processService.addItem(
|
||||||
'file_install',
|
'file_install',
|
||||||
@@ -1022,6 +1053,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
name
|
name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
installLocalObb(filepath: string, dontCatchError = false, cb = null, number?: number, total?: number, task?, name?: string) {
|
installLocalObb(filepath: string, dontCatchError = false, cb = null, number?: number, total?: number, task?, name?: string) {
|
||||||
let filename = this.appService.path.basename(filepath);
|
let filename = this.appService.path.basename(filepath);
|
||||||
let match = filename.match(this.obbRegex);
|
let match = filename.match(this.obbRegex);
|
||||||
@@ -1059,6 +1091,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
async installLocalZip(filepath, dontCatchError, cb, task?, deleteAfter?) : Promise<void> {
|
async installLocalZip(filepath, dontCatchError, cb, task?, deleteAfter?) : Promise<void> {
|
||||||
const typeBasedActions = {
|
const typeBasedActions = {
|
||||||
'.apk': filepath => {
|
'.apk': filepath => {
|
||||||
@@ -1116,6 +1149,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanUpFolder(folderPath = this.appService.path.join(this.appService.appData, 'tmp')) {
|
cleanUpFolder(folderPath = this.appService.path.join(this.appService.appData, 'tmp')) {
|
||||||
this.appService.fs.readdir(folderPath, (readErr, files) => {
|
this.appService.fs.readdir(folderPath, (readErr, files) => {
|
||||||
files.forEach((val, index) => {
|
files.forEach((val, index) => {
|
||||||
@@ -1183,6 +1217,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
return { permission, enabled };
|
return { permission, enabled };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFreeSpace() {
|
async getFreeSpace() {
|
||||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'df -h' }).then(data => {
|
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'df -h' }).then(data => {
|
||||||
data = data.split(' ').filter(d => d);
|
data = data.split(' ').filter(d => d);
|
||||||
@@ -1191,6 +1226,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
this.freespace.percent = data[data.length - 2];
|
this.freespace.percent = data[data.length - 2];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBatteryLevel() {
|
async getBatteryLevel() {
|
||||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'dumpsys battery' }).then(data => {
|
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'dumpsys battery' }).then(data => {
|
||||||
let batteryObject = {};
|
let batteryObject = {};
|
||||||
@@ -1209,9 +1245,51 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
|||||||
this.batteryLevel = batteryObject['level'];
|
this.batteryLevel = batteryObject['level'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDeviceModel() {
|
async getDeviceModel() {
|
||||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'getprop ro.product.model' }).then(
|
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'getprop ro.product.model' }).then(
|
||||||
data => (this.deviceModel = data.trim())
|
data => (this.deviceModel = data.trim())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async addVRPermissions() {
|
||||||
|
await this.adbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', { serial: this.deviceSerial });
|
||||||
|
await this.adbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', { serial: this.deviceSerial });
|
||||||
|
try {
|
||||||
|
const homedir = process.env.USERPROFILE || process.env.HOME;
|
||||||
|
if (this.appService.fs.existsSync(homedir + '/.android/adbkey')) {
|
||||||
|
let rawCertificate = this.appService.fs.readFileSync(homedir + '/.android/adbkey', 'utf8').toString();
|
||||||
|
rawCertificate = rawCertificate
|
||||||
|
.replace('-----BEGIN RSA PRIVATE KEY-----', '')
|
||||||
|
.replace('-----END RSA PRIVATE KEY-----', '');
|
||||||
|
rawCertificate = rawCertificate
|
||||||
|
.replace('-----BEGIN PRIVATE KEY-----', '')
|
||||||
|
.replace('-----END PRIVATE KEY-----', '');
|
||||||
|
rawCertificate = rawCertificate.replace(/\n|\r|\n\r|\r\n/g, '');
|
||||||
|
|
||||||
|
if (rawCertificate && rawCertificate.length) {
|
||||||
|
await this.adbCommand(
|
||||||
|
[
|
||||||
|
'shell',
|
||||||
|
'am',
|
||||||
|
'start',
|
||||||
|
'-a',
|
||||||
|
'android.intent.action.MAIN',
|
||||||
|
'-n',
|
||||||
|
'quest.side.vr/.SignInActivity',
|
||||||
|
'--es',
|
||||||
|
'CERTIFICATE',
|
||||||
|
rawCertificate,
|
||||||
|
].join(' '), { serial: this.deviceSerial }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error sending certificate to SideQuestVR', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.skipStatusUpdates = true;
|
||||||
|
await this.adbCommand('tcpip 5555', { serial: this.deviceSerial });
|
||||||
|
setTimeout(() => { this.skipStatusUpdates = false; }, 3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { AppService } from '../app.service';
|
import { AppService } from '../app.service';
|
||||||
import { AdbClientService } from '../adb-client.service';
|
import { AdbClientService } from '../adb-client.service';
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
declare const process;
|
declare const process;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
isOutOfDate: boolean;
|
isOutOfDate: boolean;
|
||||||
// the latest available version of the in-headset app
|
// the latest available version of the in-headset app
|
||||||
private latestAppVersion: string | null = null;
|
private latestAppVersion: string | null = null;
|
||||||
|
private appId: string | null = null;
|
||||||
constructor(public appService: AppService, public adb: AdbClientService) {}
|
constructor(public appService: AppService, public adb: AdbClientService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -47,36 +49,26 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getLatestApk() {
|
async getLatestApk() {
|
||||||
this.latestAppVersion = '28';
|
|
||||||
|
const request = (await fetch(environment.configuration.http_url + '/v2/apps/get-sidequest-apk', {
|
||||||
|
body: JSON.stringify({ package_name: 'quest.side.vr' }), method: 'POST',
|
||||||
|
headers: { "Content-Type": "application/json" }
|
||||||
|
}));
|
||||||
|
|
||||||
|
let json = await request.json();
|
||||||
|
this.appId = json.app_id;
|
||||||
|
this.latestAppVersion = json.version_code;
|
||||||
|
this.apkDownloadPath = json.url;
|
||||||
this.setOutOfDate();
|
this.setOutOfDate();
|
||||||
return;
|
|
||||||
|
|
||||||
const { apk, version } = await this.getExperimentalAPK();
|
|
||||||
if (apk.length) {
|
|
||||||
this.latestAppVersion = version;
|
|
||||||
this.setOutOfDate();
|
|
||||||
this.apkDownloadPath = apk[0].browser_download_url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getExperimentalAPK() {
|
|
||||||
const json = await fetch('https://api.github.com/repos/SideQuestVR/Lite/releases/latest');
|
|
||||||
const r = await json.json();
|
|
||||||
r.assets.reverse();
|
|
||||||
const apk = r.assets.filter(a => a.name.split('.').pop() === 'apk');
|
|
||||||
const versionFile = r.assets.filter(a => a.name.split('.').pop() === 'versionCode');
|
|
||||||
let version;
|
|
||||||
if (versionFile.length > 0) {
|
|
||||||
version = versionFile[0].name.split('.')[0];
|
|
||||||
}
|
|
||||||
return { apk, version };
|
|
||||||
}
|
|
||||||
|
|
||||||
async downloadExperimentalAPK() {
|
async downloadAPK() {
|
||||||
if (!this.apkDownloadPath) {
|
if (!this.apkDownloadPath) {
|
||||||
return Promise.reject('Could not download latest apk, please try again!');
|
return Promise.reject('Could not download latest apk, please try again!');
|
||||||
}
|
}
|
||||||
console.log('downloadExperimentalAPK', this.apkDownloadPath);
|
|
||||||
|
console.log('downloadAPK', this.appId);
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
@@ -123,9 +115,9 @@ 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_experimental');
|
throw new Error('bypass_sdk_download');
|
||||||
await this.getLatestApk();
|
await this.getLatestApk();
|
||||||
await this.downloadExperimentalAPK();
|
await this.downloadAPK();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// this.toast.show('Failed to download updated SQ apk, falling back to bundled apk. Are you online?', true);
|
// this.toast.show('Failed to download updated SQ apk, falling back to bundled apk. Are you online?', true);
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@@ -136,8 +128,8 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
// this.toast.show('SideQuest installed to headset!');
|
// this.toast.show('SideQuest installed to headset!');
|
||||||
// this.showConfetti = true;
|
// this.showConfetti = true;
|
||||||
this.adb.appVersionCode = await this.adb.getAppVersion(true);
|
this.adb.appVersionCode = await this.adb.getAppVersion(true);
|
||||||
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"');
|
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', true);
|
||||||
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"');
|
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', true);
|
||||||
try {
|
try {
|
||||||
const homedir = process.env.USERPROFILE || process.env.HOME;
|
const homedir = process.env.USERPROFILE || process.env.HOME;
|
||||||
if (this.appService.fs.existsSync(homedir + '/.android/adbkey')) {
|
if (this.appService.fs.existsSync(homedir + '/.android/adbkey')) {
|
||||||
@@ -163,7 +155,7 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
'--es',
|
'--es',
|
||||||
'CERTIFICATE',
|
'CERTIFICATE',
|
||||||
rawCertificate,
|
rawCertificate,
|
||||||
].join(' ')
|
].join(' '), true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +163,10 @@ export class HeaderBannerComponent implements OnInit {
|
|||||||
console.error('Error sending certificate to SideQuestVR', e);
|
console.error('Error sending certificate to SideQuestVR', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.adb.skipStatusUpdates = true;
|
||||||
await this.adb.runAdbCommand('tcpip 5555');
|
await this.adb.runAdbCommand('tcpip 5555');
|
||||||
|
setTimeout(() => { this.adb.skipStatusUpdates = false; }, 3000);
|
||||||
|
|
||||||
// this.telemetry.telemetry({ event: 'install-sidequest-apk-success',
|
// this.telemetry.telemetry({ event: 'install-sidequest-apk-success',
|
||||||
// installType: telemEvent, oldVersion, newVersion: this.adb.appVersionCode || null});
|
// installType: telemEvent, oldVersion, newVersion: this.adb.appVersionCode || null});
|
||||||
// setTimeout(() => {
|
// setTimeout(() => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="header">
|
<div id=header class="header">
|
||||||
<div class="top-bar">
|
<div class="top-bar">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<div class="topper"></div>
|
<div class="topper {{headerClass}}"></div>
|
||||||
<div class="user-menu-back" (click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none'"
|
<div class="user-menu-back" (click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none'"
|
||||||
#browserMenuBack></div>
|
#browserMenuBack></div>
|
||||||
<div class="user-menu-back" (click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none'"
|
<div class="user-menu-back" (click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none'"
|
||||||
@@ -16,6 +16,9 @@
|
|||||||
>[{{device.id}}] {{device.deviceName}}</div><br>
|
>[{{device.id}}] {{device.deviceName}}</div><br>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="sideenvironment {{headerClass}}">{{headerText}}</div>
|
||||||
|
|
||||||
<div class="title-menu-container">
|
<div class="title-menu-container">
|
||||||
<div class="user-menu command-menu" #commandMenu>
|
<div class="user-menu command-menu" #commandMenu>
|
||||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||||
@@ -52,7 +55,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="pure-material-button-contained slim update-available" *ngIf="appService.updateAvailable" (click)="updateAvailable()">Update Available</div>
|
<div class="pure-material-button-contained slim update-available" *ngIf="appService.updateAvailable" (click)="updateAvailable()">Update Available</div>
|
||||||
|
|
||||||
<!-- <app-link *ngIf="appService.updateAvailable"-->
|
|
||||||
|
<!-- <app-link *ngIf="appService.updateAvailable"-->
|
||||||
<!-- class="waves-effect waves-light btn-flat link small-button warning" (click)="updateAvailable()"-->
|
<!-- class="waves-effect waves-light btn-flat link small-button warning" (click)="updateAvailable()"-->
|
||||||
<!-- text="Update"></app-link>-->
|
<!-- text="Update"></app-link>-->
|
||||||
<i routerLink="/webview" (click)="doBack()"
|
<i routerLink="/webview" (click)="doBack()"
|
||||||
@@ -95,7 +99,7 @@
|
|||||||
apps
|
apps
|
||||||
</i>
|
</i>
|
||||||
<i routerLink="tasks" class="material-icons white-text no-outline" data-position="bottom"
|
<i routerLink="tasks" class="material-icons white-text no-outline" data-position="bottom"
|
||||||
mTooltip [attr.data-tooltip]="'Running' + processService.left_length + 'tasks.'">
|
mTooltip [attr.data-tooltip]="'Running ' + processService.left_length + ' tasks.'">
|
||||||
playlist_add_check
|
playlist_add_check
|
||||||
</i><span routerLink="tasks" *ngIf="processService.left_length" data-position="bottom"
|
</i><span routerLink="tasks" *ngIf="processService.left_length" data-position="bottom"
|
||||||
mTooltip data-tooltip="Running {{processService.left_length}} tasks."
|
mTooltip data-tooltip="Running {{processService.left_length}} tasks."
|
||||||
@@ -140,7 +144,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="top-dnd-backing">
|
<div class="top-dnd-backing">
|
||||||
|
|
||||||
<div class="top-banner">
|
<div class="top-banner">
|
||||||
<!-- <div>-->
|
<!-- <div>-->
|
||||||
<!-- <a href="#/" class="logo">-->
|
<!-- <a href="#/" class="logo">-->
|
||||||
|
|||||||
@@ -464,3 +464,26 @@ virtual-scroller{
|
|||||||
.footer-margin-right{
|
.footer-margin-right{
|
||||||
margin-right: 1em!important;
|
margin-right: 1em!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidetestvr {
|
||||||
|
background-color: darkgreen;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.friedquestvr {
|
||||||
|
background-color: darkred;
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.localtest {
|
||||||
|
background-color: darkblue;
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sideenvironment {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: calc(50% - 50px);
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ interface LogCatEntry {
|
|||||||
styleUrls: ['./header.component.scss'],
|
styleUrls: ['./header.component.scss'],
|
||||||
})
|
})
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
@ViewChild('header') header;
|
// @ViewChild('header') header;
|
||||||
@ViewChild('bookmarksModal') bookmarksModal;
|
@ViewChild('bookmarksModal') bookmarksModal;
|
||||||
@ViewChild('beatOnModal') beatOnModal;
|
// @ViewChild('beatOnModal') beatOnModal;
|
||||||
@ViewChild('mainLogo') mainLogo;
|
@ViewChild('mainLogo') mainLogo;
|
||||||
@ViewChild('safeModal') safeModal;
|
@ViewChild('safeModal') safeModal;
|
||||||
@ViewChild('manageFavs') manageFavs;
|
@ViewChild('manageFavs') manageFavs;
|
||||||
@@ -94,6 +94,8 @@ export class HeaderComponent implements OnInit {
|
|||||||
currentLogCat: LogCatEntry[] = [];
|
currentLogCat: LogCatEntry[] = [];
|
||||||
isStarted: boolean;
|
isStarted: boolean;
|
||||||
showAddFavourite: boolean;
|
showAddFavourite: boolean;
|
||||||
|
protected headerClass: string;
|
||||||
|
protected headerText: string;
|
||||||
constructor(
|
constructor(
|
||||||
public adbService: AdbClientService,
|
public adbService: AdbClientService,
|
||||||
public appService: AppService,
|
public appService: AppService,
|
||||||
@@ -111,6 +113,9 @@ export class HeaderComponent implements OnInit {
|
|||||||
this.resetFavourites('fileFavourites');
|
this.resetFavourites('fileFavourites');
|
||||||
this.resetFavourites('commandFavourites');
|
this.resetFavourites('commandFavourites');
|
||||||
this.appService.headerComponent = this;
|
this.appService.headerComponent = this;
|
||||||
|
this.headerClass = environment.header?.color || "";
|
||||||
|
this.headerText = environment.header?.text || "";
|
||||||
|
console.log('Header: ' + this.headerClass + ' ' + this.headerText);
|
||||||
}
|
}
|
||||||
doBack() {
|
doBack() {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true,
|
||||||
|
header: {color: "friedquestvr", text: "Fried Quest VR"},
|
||||||
|
configuration: {
|
||||||
|
web_url: 'https://friedquestvr.com',
|
||||||
|
ws_url: 'wss://ws.friedquestvr.com',
|
||||||
|
http_url: 'https://api.friedquestvr.com',
|
||||||
|
cdnUrl: 'https://cdn.friedquestvr.com',
|
||||||
|
shortenerUrl: 'https://links.friedquestvr.com'
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
header: {color: "localtest", text: "Local Test VR"},
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://sidequestvr.local',
|
web_url: 'https://sidequestvr.local',
|
||||||
ws_url: 'wss://ws.sidetestvr.local',
|
ws_url: 'wss://ws.sidetestvr.local',
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
header: {color: "localtest", text: "LocalHost Test VR"},
|
||||||
|
configuration: {
|
||||||
|
web_url: 'http://127.0.0.1:3005',
|
||||||
|
ws_url: 'ws://127.0.0.1:3008',
|
||||||
|
http_url: 'http://127.0.0.1:3000',
|
||||||
|
cdnUrl: 'http://127.0.0.1:3001',
|
||||||
|
shortenerUrl: 'http://127.0.0.1:3004',
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
|
header: null,
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://sidequestvr.com',
|
web_url: 'https://sidequestvr.com',
|
||||||
ws_url: 'wss://ws.sidequestvr.com',
|
ws_url: 'wss://ws.sidequestvr.com',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
header: {color: "sidetestvr", text: "Side Test VR"},
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://sidetestvr.com',
|
web_url: 'https://sidetestvr.com',
|
||||||
ws_url: 'wss://ws.sidetestvr.com',
|
ws_url: 'wss://ws.sidetestvr.com',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
header: {color: "sidetestvr", text: "Side Test VR"},
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://test.side.quest',
|
web_url: 'https://test.side.quest',
|
||||||
ws_url: 'wss://testws.side.quest',
|
ws_url: 'wss://testws.side.quest',
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
header: null, // {color: "sidetestvr", text: "Side Test VR"},
|
||||||
configuration: {
|
configuration: {
|
||||||
web_url: 'https://sidequestvr.com',
|
web_url: 'https://sidetestvr.com',
|
||||||
ws_url: 'wss://ws.sidequestvr.com',
|
ws_url: 'wss://ws.sidetestvr.com',
|
||||||
http_url: 'https://api.sidequestvr.com',
|
http_url: 'https://api.sidetestvr.com',
|
||||||
cdnUrl: 'https://cdn.sidequestvr.com',
|
cdnUrl: 'https://cdn.sidetestvr.com',
|
||||||
shortenerUrl: 'https://sdq.st',
|
shortenerUrl: 'https://sdq.st',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+305
-206
@@ -9,22 +9,17 @@ 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('adbkit');
|
const adb = require('@devicefarmer/adbkit').Adb;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const exec = require('child_process').exec;
|
|
||||||
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');
|
||||||
|
|
||||||
// const Readable = require('stream').Readable;
|
|
||||||
import { SetPropertiesCommand } from './setproperties';
|
import { SetPropertiesCommand } from './setproperties';
|
||||||
import { OPEN_IN_SYSTEM_BROWSER_DOMAINS } from './external-urls';
|
import { OPEN_IN_SYSTEM_BROWSER_DOMAINS } from './external-urls';
|
||||||
|
|
||||||
let has_port = process.argv.indexOf('--port');
|
|
||||||
let valid_port = has_port > -1 && process.argv[has_port + 1] && Number.isInteger(Number(process.argv[has_port + 1]));
|
|
||||||
|
|
||||||
let installErrorCallback;
|
let installErrorCallback;
|
||||||
|
|
||||||
process.on('uncaughtException', function(error) {
|
process.on('uncaughtException', function(error) {
|
||||||
@@ -35,19 +30,35 @@ process.on('uncaughtException', function(error) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const makeDeferred = () => {
|
||||||
|
const deferred = {promise: null, resolve: () => {} , reject: () => {}};
|
||||||
|
// @ts-ignore
|
||||||
|
deferred.promise = new Promise((resolve: Function, reject: Function): void => {
|
||||||
|
// @ts-ignore
|
||||||
|
deferred.resolve = resolve;
|
||||||
|
// @ts-ignore
|
||||||
|
deferred.reject = reject;
|
||||||
|
});
|
||||||
|
return deferred;
|
||||||
|
}
|
||||||
|
|
||||||
class ADB {
|
class ADB {
|
||||||
client;
|
client= null;
|
||||||
_logcat;
|
_logcat;
|
||||||
adbPath;
|
adbPath;
|
||||||
|
_clientSetup = makeDeferred();
|
||||||
|
|
||||||
setupAdb(adbPath, cb, ecb) {
|
setupAdb(adbPath, cb, ecb) {
|
||||||
if (this.client) return;
|
if (this.client) return;
|
||||||
this.adbPath = adbPath;
|
this.adbPath = adbPath;
|
||||||
let port = valid_port ? Number(process.argv[has_port + 1]) : process.env.ANDROID_ADB_SERVER_PORT || 5037;
|
|
||||||
this.client = adb.createClient({
|
this.client = adb.createClient({
|
||||||
bin: adbPath,
|
bin: adbPath,
|
||||||
});
|
});
|
||||||
|
this._clientSetup.resolve();
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkAPK(updateStatus: (string) => void, filePath: string): Promise<boolean> {
|
async checkAPK(updateStatus: (string) => void, filePath: string): Promise<boolean> {
|
||||||
const hash = await this.computeFileHash(updateStatus, filePath);
|
const hash = await this.computeFileHash(updateStatus, filePath);
|
||||||
const url = `${getEnvCfg().shortenerUrl || 'https://sdq.st'}/check-app-hash/${hash}`;
|
const url = `${getEnvCfg().shortenerUrl || 'https://sdq.st'}/check-app-hash/${hash}`;
|
||||||
@@ -171,26 +182,33 @@ class ADB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
logcat(serial, tag, priority, cb, scb, ecb) {
|
logcat(serial, tag, priority, cb, scb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
if (!this._logcat) this.endLogcat();
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
if (!this._logcat) this.endLogcat();
|
||||||
.openLogcat(serial, { clear: true })
|
this.client
|
||||||
.then(logcat => {
|
.openLogcat(serial, { clear: true })
|
||||||
this._logcat = logcat;
|
.then(logcat => {
|
||||||
logcat.include(tag, priority).on('entry', entry => scb(entry));
|
this._logcat = logcat;
|
||||||
})
|
logcat.include(tag, priority).on('entry', entry => scb(entry));
|
||||||
.catch(e => ecb(e));
|
})
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
installRemote(serial, path, cb, ecb) {
|
installRemote(serial, path, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.installRemote(serial, path)
|
this.client
|
||||||
.then(cb)
|
.installRemote(serial, path)
|
||||||
.catch(e => ecb(e));
|
.then(cb)
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
async install(serial, apkpath, isLocal, cb, scb, ecb) {
|
async install(serial, apkpath, isLocal, cb, scb, ecb) {
|
||||||
|
await this._clientSetup.promise;
|
||||||
|
|
||||||
console.log('installapk');
|
console.log('installapk');
|
||||||
let stopUpdate;
|
let stopUpdate;
|
||||||
|
|
||||||
installErrorCallback = e => {
|
installErrorCallback = e => {
|
||||||
stopUpdate = true;
|
stopUpdate = true;
|
||||||
ecb(e);
|
ecb(e);
|
||||||
@@ -245,160 +263,190 @@ class ADB {
|
|||||||
.then(cb)
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
uninstall(serial, packageName, cb, ecb) {
|
uninstall(serial, packageName, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.uninstall(serial, packageName)
|
this.client
|
||||||
.then(cb)
|
.uninstall(serial, packageName)
|
||||||
.catch(e => ecb(e));
|
.then(cb)
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
clear(serial, packageName, cb, ecb) {
|
clear(serial, packageName, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.clear(serial, packageName)
|
this.client
|
||||||
.then(cb)
|
.clear(serial, packageName)
|
||||||
.catch(e => ecb(e));
|
.then(cb)
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
disconnect(cb, ecb) {
|
disconnect(cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.disconnect()
|
this.client
|
||||||
.then(cb)
|
.disconnect()
|
||||||
.then(() => this.client.kill())
|
.then(cb)
|
||||||
.catch(e => ecb(e));
|
.then(() => this.client.kill())
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
connect(deviceIp, cb, ecb) {
|
connect(deviceIp, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.connect(deviceIp + ':5555')
|
this.client
|
||||||
.then(cb)
|
.connect(deviceIp + ':5555')
|
||||||
.catch(e => ecb(e));
|
.then(cb)
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
tcpip(serial, cb, ecb) {
|
tcpip(serial, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.tcpip(serial, 5555)
|
this.client
|
||||||
.then(r => {
|
.tcpip(serial, 5555)
|
||||||
console.log(r);
|
.then(r => {
|
||||||
cb(r);
|
console.log(r);
|
||||||
})
|
cb(r);
|
||||||
.catch(e => {
|
})
|
||||||
console.log(serial, e);
|
.catch(e => {
|
||||||
ecb(e);
|
console.log(serial, e);
|
||||||
});
|
ecb(e);
|
||||||
|
});
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
usb(serial, cb, ecb) {
|
usb(serial, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.usb(serial)
|
this.client
|
||||||
.then(cb)
|
.usb(serial)
|
||||||
.catch(e => ecb(e));
|
.then(cb)
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
listDevices(cb, ecb) {
|
listDevices(cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.listDevices()
|
this.client
|
||||||
.then(d => cb(d))
|
.listDevices()
|
||||||
.catch(e => ecb(e));
|
.then(d => cb(d))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
setProperties(serial, command, cb, ecb) {
|
setProperties(serial, command, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.transport(serial)
|
this.client
|
||||||
.then(function(transport) {
|
.transport(serial)
|
||||||
return new SetPropertiesCommand(transport).execute(command);
|
.then(function(transport) {
|
||||||
})
|
return new SetPropertiesCommand(transport).execute(command);
|
||||||
// this.client
|
})
|
||||||
// .setProperties(serial, command)
|
// this.client
|
||||||
.then(res => cb(res))
|
// .setProperties(serial, command)
|
||||||
.catch(e => ecb(e));
|
.then(res => cb(res))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
getPackages(serial, cb, ecb) {
|
getPackages(serial, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.getPackages(serial)
|
this.client
|
||||||
.then(res => cb(res))
|
.getPackages(serial)
|
||||||
.catch(e => ecb(e));
|
.then(res => cb(res))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
shell(serial, command, cb, ecb) {
|
shell(serial, command, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.shell(serial, command)
|
this.client
|
||||||
.then(adb.util.readAll)
|
.shell(serial, command)
|
||||||
.then(res => cb(res.toString()))
|
.then(adb.util.readAll)
|
||||||
.catch(e => ecb(e));
|
.then(res => cb(res.toString()))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
readdir(serial, path, cb, ecb) {
|
readdir(serial, path, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.readdir(serial, path)
|
this.client
|
||||||
.then(res =>
|
.readdir(serial, path)
|
||||||
res
|
.then(res =>
|
||||||
.map(r => {
|
res
|
||||||
r.__isFile = r.isFile();
|
.map(r => {
|
||||||
return r;
|
r.__isFile = r.isFile();
|
||||||
})
|
return r;
|
||||||
.filter(r => !(r.__isFile && r.name.lastIndexOf('\\') > -1))
|
})
|
||||||
)
|
.filter(r => !(r.__isFile && r.name.lastIndexOf('\\') > -1))
|
||||||
.then(res => cb(res))
|
)
|
||||||
.catch(e => ecb(e));
|
.then(res => cb(res))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
push(serial, path, savePath, cb, scb, ecb) {
|
push(serial, path, savePath, cb, scb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
|
||||||
.push(serial, fs.createReadStream(path), savePath)
|
if (!this.client) return ecb('Not connected.');
|
||||||
.then(transfer => {
|
this.client
|
||||||
let _stats, autocancel;
|
.push(serial, fs.createReadStream(path), savePath)
|
||||||
const interval = setInterval(() => {
|
.then(transfer => {
|
||||||
scb(_stats);
|
let _stats, autoCancel;
|
||||||
}, 1000);
|
const interval = setInterval(() => {
|
||||||
transfer.on('progress', stats => {
|
scb(_stats);
|
||||||
clearTimeout(autocancel);
|
}, 1000);
|
||||||
_stats = stats;
|
transfer.on('progress', stats => {
|
||||||
autocancel = setTimeout(() => {
|
clearTimeout(autoCancel);
|
||||||
|
_stats = stats;
|
||||||
|
autoCancel = setTimeout(() => {
|
||||||
|
clearInterval(interval);
|
||||||
|
cb();
|
||||||
|
}, 90000);
|
||||||
|
});
|
||||||
|
transfer.on('end', () => {
|
||||||
|
clearTimeout(autoCancel);
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
cb();
|
cb();
|
||||||
}, 90000);
|
});
|
||||||
});
|
transfer.on('error', e => {
|
||||||
transfer.on('end', () => {
|
ecb(e);
|
||||||
clearTimeout(autocancel);
|
});
|
||||||
clearInterval(interval);
|
})
|
||||||
cb();
|
.catch(e => {
|
||||||
});
|
|
||||||
transfer.on('error', e => {
|
|
||||||
ecb(e);
|
ecb(e);
|
||||||
});
|
});
|
||||||
})
|
}).catch(e => ecb(e));
|
||||||
.catch(e => {
|
|
||||||
ecb(e);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
pull(serial, path, savePath, cb, scb, ecb) {
|
pull(serial, path, savePath, cb, scb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
|
||||||
.pull(serial, path)
|
if (!this.client) return ecb('Not connected.');
|
||||||
.then(transfer => {
|
this.client
|
||||||
transfer.on('progress', stats => {
|
.pull(serial, path)
|
||||||
scb(stats);
|
.then(transfer => {
|
||||||
});
|
transfer.on('progress', stats => {
|
||||||
transfer.on('end', () => {
|
scb(stats);
|
||||||
cb();
|
});
|
||||||
});
|
transfer.on('end', () => {
|
||||||
transfer.on('error', e => {
|
cb();
|
||||||
|
});
|
||||||
|
transfer.on('error', e => {
|
||||||
|
ecb(e);
|
||||||
|
});
|
||||||
|
transfer.pipe(fs.createWriteStream(savePath));
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
ecb(e);
|
ecb(e);
|
||||||
});
|
});
|
||||||
transfer.pipe(fs.createWriteStream(savePath));
|
}).catch(e => ecb(e));
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
ecb(e);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
stat(serial, path, cb, ecb) {
|
stat(serial, path, cb, ecb) {
|
||||||
if (!this.client) return ecb('Not connected.');
|
this._clientSetup.promise.then(() => {
|
||||||
this.client
|
if (!this.client) return ecb('Not connected.');
|
||||||
.stat(serial, path)
|
this.client
|
||||||
.then(res => cb(res))
|
.stat(serial, path)
|
||||||
.catch(e => ecb(e));
|
.then(res => cb(res))
|
||||||
|
.catch(e => ecb(e));
|
||||||
|
}).catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +578,47 @@ function createWindow() {
|
|||||||
console.log('did create window fired');
|
console.log('did create window fired');
|
||||||
handleWindow(child);
|
handleWindow(child);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
child.webContents.session.on('select-usb-device', (event, details, callback) => {
|
||||||
|
// Add events to handle devices being added or removed before the callback on
|
||||||
|
// `select-usb-device` is called.
|
||||||
|
|
||||||
|
//event.preventDefault();
|
||||||
|
if (details.deviceList && details.deviceList.length > 0) {
|
||||||
|
// Meta Quest Device
|
||||||
|
if (details.deviceList[0].vendorId === 10291) {
|
||||||
|
callback(details.deviceList[0].deviceId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if (deviceToReturn) {
|
||||||
|
// callback(deviceToReturn.deviceId)
|
||||||
|
// } else {
|
||||||
|
// callback()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
child.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
|
||||||
|
console.log("SET PERMISSION CHECK HANDLER", permission, requestingOrigin, details)
|
||||||
|
if (permission === 'usb') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}) */
|
||||||
|
|
||||||
|
child.webContents.session.setDevicePermissionHandler((details) => {
|
||||||
|
if (details.deviceType === 'usb') {
|
||||||
|
if (details.device.vendorId === 10291) {
|
||||||
|
// Meta Oculus
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// TODO: Pico
|
||||||
|
console.log("SET DEVICE PERMISSION HANDLER FALSE", details)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
handleWindow(mainWindow);
|
handleWindow(mainWindow);
|
||||||
mainWindow.webContents.session.setUserAgent(mainWindow.webContents.session.getUserAgent() + ' SQ/' + app.getVersion());
|
mainWindow.webContents.session.setUserAgent(mainWindow.webContents.session.getUserAgent() + ' SQ/' + app.getVersion());
|
||||||
@@ -697,6 +786,8 @@ function setupApp() {
|
|||||||
mainWindow.webContents.send('info', text);
|
mainWindow.webContents.send('info', text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const adb = new ADB();
|
const adb = new ADB();
|
||||||
|
|
||||||
ipcMain.on('download-url', async (event, { url, token, directory, filename }) => {
|
ipcMain.on('download-url', async (event, { url, token, directory, filename }) => {
|
||||||
@@ -731,11 +822,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)
|
||||||
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)
|
||||||
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 });
|
||||||
}
|
}
|
||||||
@@ -745,68 +838,74 @@ function setupApp() {
|
|||||||
event.sender.send('adb-command', { command: arg.command, status: d, uuid: arg.uuid });
|
event.sender.send('adb-command', { command: arg.command, status: d, uuid: arg.uuid });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
switch (arg.command) {
|
// console.log("Running:", arg.command);
|
||||||
case 'installFromToken':
|
try {
|
||||||
adb.installFromToken(arg.settings.token, success, reject);
|
switch (arg.command) {
|
||||||
break;
|
case 'installFromToken':
|
||||||
case 'setupAdb':
|
adb.installFromToken(arg.settings.token, success, reject);
|
||||||
adb.setupAdb(arg.settings.adbPath, success, reject);
|
break;
|
||||||
break;
|
case 'setupAdb':
|
||||||
case 'endLogcat':
|
adb.setupAdb(arg.settings.adbPath, success, reject);
|
||||||
adb.endLogcat();
|
break;
|
||||||
success('Done.');
|
case 'endLogcat':
|
||||||
break;
|
adb.endLogcat();
|
||||||
case 'logcat':
|
success('Done.');
|
||||||
adb.logcat(arg.settings.serial, arg.settings.tag, arg.settings.priority, success, status, reject);
|
break;
|
||||||
break;
|
case 'logcat':
|
||||||
case 'listDevices':
|
adb.logcat(arg.settings.serial, arg.settings.tag, arg.settings.priority, success, status, reject);
|
||||||
adb.listDevices(success, reject);
|
break;
|
||||||
break;
|
case 'listDevices':
|
||||||
case 'getPackages':
|
adb.listDevices(success, reject);
|
||||||
adb.getPackages(arg.settings.serial, success, reject);
|
break;
|
||||||
break;
|
case 'getPackages':
|
||||||
case 'shell':
|
adb.getPackages(arg.settings.serial, success, reject);
|
||||||
adb.shell(arg.settings.serial, arg.settings.command, success, reject);
|
break;
|
||||||
break;
|
case 'shell':
|
||||||
case 'readdir':
|
adb.shell(arg.settings.serial, arg.settings.command, success, reject);
|
||||||
adb.readdir(arg.settings.serial, arg.settings.path, success, reject);
|
break;
|
||||||
break;
|
case 'readdir':
|
||||||
case 'push':
|
adb.readdir(arg.settings.serial, arg.settings.path, success, reject);
|
||||||
adb.push(arg.settings.serial, arg.settings.path, arg.settings.savePath, success, status, reject);
|
break;
|
||||||
break;
|
case 'push':
|
||||||
case 'pull':
|
adb.push(arg.settings.serial, arg.settings.path, arg.settings.savePath, success, status, reject);
|
||||||
adb.pull(arg.settings.serial, arg.settings.path, arg.settings.savePath, success, status, reject);
|
break;
|
||||||
break;
|
case 'pull':
|
||||||
case 'stat':
|
adb.pull(arg.settings.serial, arg.settings.path, arg.settings.savePath, success, status, reject);
|
||||||
adb.stat(arg.settings.serial, arg.settings.path, success, reject);
|
break;
|
||||||
break;
|
case 'stat':
|
||||||
case 'install':
|
adb.stat(arg.settings.serial, arg.settings.path, success, reject);
|
||||||
adb.install(arg.settings.serial, arg.settings.path, arg.settings.isLocal, success, status, reject);
|
break;
|
||||||
break;
|
case 'install':
|
||||||
case 'uninstall':
|
adb.install(arg.settings.serial, arg.settings.path, arg.settings.isLocal, success, status, reject);
|
||||||
adb.uninstall(arg.settings.serial, arg.settings.packageName, success, reject);
|
break;
|
||||||
break;
|
case 'uninstall':
|
||||||
case 'installRemote':
|
adb.uninstall(arg.settings.serial, arg.settings.packageName, success, reject);
|
||||||
adb.installRemote(arg.settings.serial, arg.settings.path, success, reject);
|
break;
|
||||||
break;
|
case 'installRemote':
|
||||||
case 'clear':
|
adb.installRemote(arg.settings.serial, arg.settings.path, success, reject);
|
||||||
adb.clear(arg.settings.serial, arg.settings.packageName, success, reject);
|
break;
|
||||||
break;
|
case 'clear':
|
||||||
case 'connect':
|
adb.clear(arg.settings.serial, arg.settings.packageName, success, reject);
|
||||||
adb.connect(arg.settings.deviceIp, success, reject);
|
break;
|
||||||
break;
|
case 'connect':
|
||||||
case 'disconnect':
|
adb.connect(arg.settings.deviceIp, success, reject);
|
||||||
adb.disconnect(success, reject);
|
break;
|
||||||
break;
|
case 'disconnect':
|
||||||
case 'usb':
|
adb.disconnect(success, reject);
|
||||||
adb.usb(arg.settings.serial, success, reject);
|
break;
|
||||||
break;
|
case 'usb':
|
||||||
case 'tcpip':
|
adb.usb(arg.settings.serial, success, reject);
|
||||||
adb.tcpip(arg.settings.serial, success, reject);
|
break;
|
||||||
break;
|
case 'tcpip':
|
||||||
case 'setProperties':
|
adb.tcpip(arg.settings.serial, success, reject);
|
||||||
adb.setProperties(arg.settings.serial, arg.settings.command, success, reject);
|
break;
|
||||||
break;
|
case 'setProperties':
|
||||||
|
adb.setProperties(arg.settings.serial, arg.settings.command, success, reject);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
reject(e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
export function getEnvCfg() {
|
export function getEnvCfg() {
|
||||||
switch (process.env['SQ_ENV_CFG']) {
|
switch (process.env['SQ_ENV_CFG']) {
|
||||||
case 'test':
|
case 'test':
|
||||||
@@ -16,6 +17,23 @@ export function getEnvCfg() {
|
|||||||
cdnUrl: 'https://testcdn.sidequestvr.com',
|
cdnUrl: 'https://testcdn.sidequestvr.com',
|
||||||
shortenerUrl: 'https://testlinks.side.quest',
|
shortenerUrl: 'https://testlinks.side.quest',
|
||||||
};
|
};
|
||||||
|
case 'fried':
|
||||||
|
case 'friedquest':
|
||||||
|
return {
|
||||||
|
web_url: 'https://friedquestvr.com',
|
||||||
|
ws_url: 'wss://ws.friedquestvr.com',
|
||||||
|
http_url: 'https://api.friedquestvr.com',
|
||||||
|
cdnUrl: 'https://cdn.friedquestvr.com',
|
||||||
|
shortenerUrl: 'https://links.friedquestvr.com',
|
||||||
|
};
|
||||||
|
case 'localhost':
|
||||||
|
return {
|
||||||
|
web_url: 'http://127.0.0.1:3005',
|
||||||
|
ws_url: 'ws://127.0.0.1:3008',
|
||||||
|
http_url: 'http://127.0.0.1:3000',
|
||||||
|
cdnUrl: 'http://127.0.0.1:3001',
|
||||||
|
shortenerUrl: 'http://127.0.0.1:3004',
|
||||||
|
};
|
||||||
case 'local':
|
case 'local':
|
||||||
return {
|
return {
|
||||||
web_url: 'https://sidequestvr.local',
|
web_url: 'https://sidequestvr.local',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const Command = require('adbkit/lib/adb/command');
|
const Command = require('@devicefarmer/adbkit/dist/src/adb/command').default;
|
||||||
const Protocol = require('adbkit/lib/adb/protocol');
|
const Protocol = require('@devicefarmer/adbkit/dist/src/adb/protocol').default;
|
||||||
|
|
||||||
const RE_KEYVAL = /^\[([\s\S]*?)\]: \[([\s\S]*?)\]\r?$/gm;
|
const RE_KEYVAL = /^\[([\s\S]*?)\]: \[([\s\S]*?)\]\r?$/gm;
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -13,11 +13,14 @@
|
|||||||
"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: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\"",
|
||||||
"postinstall": "electron-builder install-app-deps && cd desktop-app && yarn install",
|
"postinstall": "electron-builder install-app-deps && cd desktop-app && yarn install",
|
||||||
"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 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-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",
|
||||||
"angular:test2": "cd desktop-app && ng serve -c test2 --port 4205",
|
"angular:test2": "cd desktop-app && ng serve -c test2 --port 4205",
|
||||||
@@ -29,6 +32,8 @@
|
|||||||
"electron": "yarn electron-build && yarn electron-dev",
|
"electron": "yarn electron-build && yarn electron-dev",
|
||||||
"app-build": "cd desktop-app && ng build --prod --aot && cd ..",
|
"app-build": "cd desktop-app && ng build --prod --aot && cd ..",
|
||||||
"app-build-test": "cd desktop-app && ng build -c test --aot && cd ..",
|
"app-build-test": "cd desktop-app && ng build -c test --aot && cd ..",
|
||||||
|
"app-build-fried": "cd desktop-app && ng build -c fried --aot && cd ..",
|
||||||
|
"app-build-localhost": "cd desktop-app && ng build -c localhost --aot && cd ..",
|
||||||
"platform-tools": "node build-electron/platform-tools.js",
|
"platform-tools": "node build-electron/platform-tools.js",
|
||||||
"electron-build": "tsc",
|
"electron-build": "tsc",
|
||||||
"reset": "rm -rf node_modules && rm -rf desktop-app/node_modules && yarn install && cd desktop-app && yarn install"
|
"reset": "rm -rf node_modules && rm -rf desktop-app/node_modules && yarn install && cd desktop-app && yarn install"
|
||||||
@@ -102,7 +107,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^2.1.2",
|
"@electron/remote": "^2.1.2",
|
||||||
"@types/electron": "^1.6.10",
|
"@types/electron": "^1.6.10",
|
||||||
"adbkit": "^2.11.1",
|
"@devicefarmer/adbkit": "^3.2.6",
|
||||||
"adm-zip": "^0.5.10",
|
"adm-zip": "^0.5.10",
|
||||||
"bytenode": "^1.5.3",
|
"bytenode": "^1.5.3",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user