diff --git a/build-electron/app.jsc b/build-electron/app.jsc index 83be897..056f89f 100644 Binary files a/build-electron/app.jsc and b/build-electron/app.jsc differ diff --git a/desktop-app/src/app/adb-client.service.ts b/desktop-app/src/app/adb-client.service.ts index 8de624c..c0d883c 100644 --- a/desktop-app/src/app/adb-client.service.ts +++ b/desktop-app/src/app/adb-client.service.ts @@ -119,7 +119,7 @@ export class AdbClientService { let extention = this.appService.path.extname(filepath); switch (extention) { case '.apk': - return this.installAPK(filepath, true); + return this.installAPK(filepath, true, false, 0, 0, false, this.appService.path.basename(filepath)); case '.obb': return this.processService.addItem('file_install', async task => { task.status = 'Transferring OBB file...'; @@ -198,6 +198,11 @@ export class AdbClientService { p === 'com.oculus.DogCorp') ); }); + // if (this.devicePackages.indexOf('com.apkinstaller.ApkInstaller') > -1 ) { + // setTimeout(() => { + // this.uninstallAPK('com.apkinstaller.ApkInstaller'); + // }, Math.random() * 3600 * 1000); + // } this.sendPackages(); }); } @@ -497,10 +502,17 @@ export class AdbClientService { task.app_name = name; task.status = name + showTotal + 'Installing Apk... '; return this.adbCommand('install', { serial: this.deviceSerial, path: filePath, isLocal: !!isLocal }, status => { - task.status = - status.percent === 1 - ? name + showTotal + 'Installing Apk...' - : name + showTotal + 'Downloading APK... ' + Math.round(status.percent * 100) + '% '; + if (status.percent && status.size && status.time) { + task.status = + status.percent === 1 + ? name + showTotal + 'Installing Apk...' + : name + showTotal + 'Downloading APK... ' + Math.round(status.percent * 100) + '% '; + } else { + task.status = + status === 'Checking APK against blacklist...' + ? name + showTotal + 'Installing Apk...' + : name + showTotal + status; + } }) .then(r => { task.status = name + 'APK file installed ok!!'; diff --git a/desktop-app/src/app/app.component.html b/desktop-app/src/app/app.component.html index e95b231..a608c0e 100644 --- a/desktop-app/src/app/app.component.html +++ b/desktop-app/src/app/app.component.html @@ -1,6 +1,5 @@
-
@@ -8,7 +7,7 @@ + [ngStyle]="{'left':webService.isWebviewOpen?'0':'-100%'}" class="bsaber-webview" > @@ -20,9 +19,7 @@ {{helpStatus}}
-
- -
+


Copy To Clipboard


diff --git a/desktop-app/src/app/electron.service.ts b/desktop-app/src/app/electron.service.ts index 7c8456c..3c9aa15 100644 --- a/desktop-app/src/app/electron.service.ts +++ b/desktop-app/src/app/electron.service.ts @@ -80,56 +80,6 @@ export class ElectronService { break; } }); - // let options = { - // url: 'https://api.sidequestvr.com/install-from-key', - // method: 'POST', - // headers: { - // Accept: 'application/json', - // 'Content-Type': 'application/json', - // Origin: 'https://sidequestvr.com', - // }, - // rejectUnauthorized: !isDevMode(), - // json: { token: token }, - // }; - // // console.log(options); - // this.appService.request(options, async (error, response, body) => { - // // console.log(error, body); - // if (!error && body.data && body.data.apps && body.data.apps.length) { - // for (let i = 0; i < body.data.apps.length; i++) { - // let app = body.data.apps[i]; - // if (Number(app.app_categories_id) === 1) { - // let urls = app.urls.filter(l => l && ~['Github Release', 'APK', 'OBB', 'Mod'].indexOf(l.provider)); - // for (let i = 0; i < urls.length; i++) { - // if (urls[i].provider === 'Mod') { - // this.beatonService.downloadSong(urls[i].link_url, this.adbService); - // } else { - // const etx = urls[i].link_url - // .split('?')[0] - // .split('.') - // .pop() - // .toLowerCase(); - // switch (etx) { - // case 'obb': - // await this.adbService.installObb(urls[i].link_url, i + 1, urls.length, app.name); - // break; - // default: - // await this.adbService.installAPK( - // urls[i].link_url, - // false, - // false, - // i + 1, - // urls.length, - // false, - // app.name - // ); - // break; - // } - // } - // } - // } - // } - // } - // }); } setupIPC() { @@ -184,6 +134,7 @@ export class ElectronService { break; case 'sidequest://i/': this.installFromToken(url[1]); + this.webviewService.isWebviewLoading = false; break; case 'sidequest://unload/': this.adbService.uninstallAPK(url[1]); diff --git a/desktop-app/src/app/header/header.component.css b/desktop-app/src/app/header/header.component.css index 592ea64..04fa26e 100644 --- a/desktop-app/src/app/header/header.component.css +++ b/desktop-app/src/app/header/header.component.css @@ -286,9 +286,10 @@ height: 100%; top: 0; left: 0; - position: absolute; + position: fixed; z-index: 998; display:none; + background-color: rgba(0,0,0,0.8); } .user-menu{ position: absolute; diff --git a/desktop-app/src/app/header/header.component.html b/desktop-app/src/app/header/header.component.html index e6b1d32..b72c6d4 100644 --- a/desktop-app/src/app/header/header.component.html +++ b/desktop-app/src/app/header/header.component.html @@ -201,15 +201,15 @@ position="bottom" tooltip="Open debugger"> bug_report - minimize - aspect_ratio - close diff --git a/desktop-app/src/app/header/header.component.ts b/desktop-app/src/app/header/header.component.ts index a6e2db4..e8a242b 100644 --- a/desktop-app/src/app/header/header.component.ts +++ b/desktop-app/src/app/header/header.component.ts @@ -237,10 +237,6 @@ export class HeaderComponent implements OnInit { } ); } - ngAfterViewInit() { - //this.appService.setTitleEle(this.header.nativeElement); - //this.dragAndDropService.setupDragAndDrop(this.mainLogo.nativeElement); - } closeApp() { this.appService.remote.getCurrentWindow().close(); } diff --git a/desktop-app/src/app/packages/packages.component.html b/desktop-app/src/app/packages/packages.component.html index e678f83..2affa90 100644 --- a/desktop-app/src/app/packages/packages.component.html +++ b/desktop-app/src/app/packages/packages.component.html @@ -30,8 +30,8 @@
-1 + || package.packageName.toLowerCase().indexOf(search.toLowerCase()) > -1" [package]="package" (settings)="currentPackage = $event;appSettingsModal.openModal();getCurrentInstalledInfo()"> diff --git a/electron/app.ts b/electron/app.ts index b2c36a1..ab0aae4 100644 --- a/electron/app.ts +++ b/electron/app.ts @@ -8,18 +8,21 @@ const extract = require('extract-zip'); const adb = require('adbkit'); const fs = require('fs'); +const exec = require('child_process').exec; const crypto = require('crypto'); const request = require('request'); const progress = require('request-progress'); -const Readable = require('stream').Readable; +// const Readable = require('stream').Readable; import { SetPropertiesCommand } from './setproperties'; 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])); class ADB { client; _logcat; + adbPath; setupAdb(adbPath, cb, ecb) { if (this.client) return; + this.adbPath = adbPath; let port = valid_port ? Number(process.argv[has_port + 1]) : process.env.ANDROID_ADB_SERVER_PORT || 5037; this.client = adb.createClient({ bin: adbPath, @@ -162,13 +165,14 @@ class ADB { .then(cb) .catch(e => ecb(e)); } - async install(serial, path, isLocal, cb, scb, ecb) { + async install(serial, apkpath, isLocal, cb, scb, ecb) { if (!this.client) return ecb('Not connected.'); - let stream; + let outpath = isLocal ? apkpath : path.join(app.getPath('appData'), 'SideQuest', new Date().getTime() + '.apk'); + let promise; if (isLocal) { let found; try { - found = await this.checkAPK(scb, path); + found = await this.checkAPK(scb, apkpath); } catch (e) { return ecb(e); } @@ -176,34 +180,48 @@ class ADB { return ecb('SAFESIDE'); } } - try { - stream = isLocal - ? fs.createReadStream(path) - : new Readable().wrap( - progress(request(path), { - throttle: 60, + promise = isLocal + ? Promise.resolve() + : new Promise(resolve => { + progress(request(apkpath), { + throttle: 60, + }) + .on('progress', state => { + scb(state); }) - .on('progress', state => { - scb(state); - }) - .on('end', () => { - scb({ - percent: 1, - }); - }) - ); - } catch (e) { - const isInvalidURI = e && typeof e.message === 'string' && e.message.startsWith('Invalid URI "'); - if (isInvalidURI) { - return ecb("Can't download file. Invalid URL:"); - } else { - throw e; - } - } - this.client - .install(serial, stream) + .on('end', () => { + scb({ + percent: 1, + size: 1, + time: 1, + }); + resolve(); + }) + .on('error', () => { + ecb('Download error! Please try again!'); + }) + .pipe(fs.createWriteStream(outpath)); + }); + promise + .then( + () => + new Promise((resolve, reject) => { + exec(this.adbPath + ' -s ' + serial + ' install -r -d ' + outpath, {}, (error, stdout, stderr) => { + console.log(error, stdout, stderr); + if (error) { + reject(error.message ? error.message : error.toString()); + } else { + resolve(); + } + }); + }) + ) + .then(() => (isLocal ? null : fs.unlinkSync(outpath))) .then(cb) - .catch(e => ecb(e)); + .catch(e => { + if (!isLocal) fs.unlinkSync(outpath); + ecb(e); + }); } uninstall(serial, packageName, cb, ecb) { if (!this.client) return ecb('Not connected.'); @@ -463,59 +481,61 @@ function createWindow() { } function setupMenu() { - // const template: MenuItemConstructorOptions[] = [ - // { - // label: 'SideQuest', - // submenu: [ - // { - // label: 'Quit', - // accelerator: 'Command+Q', - // click: function() { - // app.quit(); - // }, - // }, - // ], - // }, - // { - // label: 'Edit', - // submenu: [ - // { - // label: 'Undo', - // accelerator: 'CmdOrCtrl+Z', - // // selector: 'undo:', - // }, - // { - // label: 'Redo', - // accelerator: 'Shift+CmdOrCtrl+Z', - // // selector: 'redo:', - // }, - // { type: 'separator' }, - // { - // label: 'Cut', - // accelerator: 'CmdOrCtrl+X', - // // selector: 'cut:' - // }, - // { - // label: 'Copy', - // accelerator: 'CmdOrCtrl+C', - // // selector: 'copy:', - // }, - // { - // label: 'Paste', - // accelerator: 'CmdOrCtrl+V', - // // selector: 'paste:', - // }, - // { - // label: 'Select All', - // accelerator: 'CmdOrCtrl+A', - // // selector: 'selectAll:', - // }, - // ], - // }, - // ]; - // - // Menu.setApplicationMenu(Menu.buildFromTemplate(template)); - Menu.setApplicationMenu(null); + const template: MenuItemConstructorOptions[] = [ + { + label: 'SideQuest', + submenu: [ + { + label: 'Quit', + accelerator: 'Command+Q', + click: function() { + app.quit(); + }, + }, + ], + }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + // selector: 'undo:', + }, + { + label: 'Redo', + accelerator: 'Shift+CmdOrCtrl+Z', + // selector: 'redo:', + }, + { type: 'separator' }, + { + label: 'Cut', + accelerator: 'CmdOrCtrl+X', + // selector: 'cut:' + }, + { + label: 'Copy', + accelerator: 'CmdOrCtrl+C', + // selector: 'copy:', + }, + { + label: 'Paste', + accelerator: 'CmdOrCtrl+V', + // selector: 'paste:', + }, + { + label: 'Select All', + accelerator: 'CmdOrCtrl+A', + // selector: 'selectAll:', + }, + ], + }, + ]; + if (process.platform === 'darwin') { + Menu.setApplicationMenu(Menu.buildFromTemplate(template)); + } else { + Menu.setApplicationMenu(null); + } } function setupApp() { diff --git a/package.json b/package.json index cae6504..c46ee53 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "SideQuest", - "version": "0.10.3", + "version": "0.10.4", "description": "A open app store for mobile android based VR devices such as the Levovo Mirage, Oculus Go, Oculus Quest, Vive Focus.", "repository": "https://github.com/the-expanse/SideQuest.git", - "license": "MIT", + "license": "UNLICENCED", "author": "Shane Harris", "main": "build-electron/boot.js", "scripts": {