Merge pull request #160 from SideQuestVR/hotfix/page_crashing
Hotfix/page crashing
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: "Install dependencies"
|
||||
run: yarn
|
||||
run: yarn install --network-timeout 1000000
|
||||
- name: "Build application"
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
|
||||
@@ -30,6 +30,7 @@ export class AdbClientService {
|
||||
lastConnectionCheck: number;
|
||||
deviceStatus: ConnectionStatus = ConnectionStatus.UNAUTHORIZED;
|
||||
deviceStatusMessage: string = 'Connecting...';
|
||||
lastErrorMessage: string = '';
|
||||
pollInterval: number = 1000 * 2;
|
||||
savePath: string;
|
||||
isTransferring: boolean;
|
||||
@@ -353,23 +354,31 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
});
|
||||
}
|
||||
async setupAdb() {
|
||||
if (!this.isAdbDownloaded()) {
|
||||
await this.appService.seedPlatformTools();
|
||||
}
|
||||
this.appService.electron.ipcRenderer.on('adb-command', (event, arg: any) => {
|
||||
if (this.adbResolves[arg.uuid]) {
|
||||
if (arg.status && this.adbResolves[arg.uuid].callback) {
|
||||
this.adbResolves[arg.uuid].callback(arg.status);
|
||||
} else if (arg.error) {
|
||||
this.adbResolves[arg.uuid].reject(arg.error);
|
||||
} else {
|
||||
this.adbResolves[arg.uuid].resolve(arg.resp);
|
||||
}
|
||||
try {
|
||||
if (!this.isAdbDownloaded()) {
|
||||
await this.appService.seedPlatformTools();
|
||||
}
|
||||
});
|
||||
this.adbCommand('setupAdb', {
|
||||
adbPath: this.appService.path.join(this.adbPath, this.getAdbBinary()),
|
||||
});
|
||||
this.appService.electron.ipcRenderer.on('adb-command', (event, arg: any) => {
|
||||
if (this.adbResolves[arg.uuid]) {
|
||||
if (arg.status && this.adbResolves[arg.uuid].callback) {
|
||||
this.adbResolves[arg.uuid].callback(arg.status);
|
||||
} else if (arg.error) {
|
||||
this.adbResolves[arg.uuid].reject(arg.error);
|
||||
} else {
|
||||
this.adbResolves[arg.uuid].resolve(arg.resp);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.adbCommand('setupAdb', {
|
||||
adbPath: this.appService.path.join(this.adbPath, this.getAdbBinary()),
|
||||
});
|
||||
this.lastErrorMessage = null;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.deviceStatus = ConnectionStatus.DISCONNECTED;
|
||||
this.deviceStatusMessage = 'ADB Setup Error';
|
||||
this.lastErrorMessage = e.toString();
|
||||
}
|
||||
}
|
||||
isAdbDownloaded() {
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<app-loading-spinner #spinner></app-loading-spinner>
|
||||
<app-status-bar #status (getHelp)="getHelpModal.openModal(); helpStatus = $event; setExterHelp()"></app-status-bar>
|
||||
<webview id="mainWebView" #webview httpreferrer="https://sdiequestvr.com" [attr.src]="webUrl" allowpopups [ngStyle]="{'left':webService.isWebviewOpen?'0':'-100%'}" class="bsaber-webview" partition='webview-partition'></webview>
|
||||
<webview id="mainWebView" #webview httpreferrer="https://sdiequestvr.com" [attr.src]="webUrl" allowpopups [ngStyle]="{'left':webService.isWebviewOpen?'0':'-100%'}" class="bsaber-webview"></webview>
|
||||
|
||||
<mz-modal #getHelpModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
|
||||
@@ -249,32 +249,42 @@ export class AppService {
|
||||
return sourcesPath;
|
||||
}
|
||||
seedPlatformTools() {
|
||||
return new Promise<void>(async resolve => {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
let sourcesPath = this.getPlatformToolsSeedPath();
|
||||
if (sourcesPath == null) {
|
||||
console.error('Unable to locate platform tools! Try reinstalling sidequest.');
|
||||
resolve();
|
||||
reject('Unable to locate platform tools! Try reinstalling sidequest.');
|
||||
return;
|
||||
}
|
||||
await this.mkdir(this.path.join(this.appData, 'platform-tools'));
|
||||
try {
|
||||
let files = this.fs.readdirSync(sourcesPath);
|
||||
let files: [] = this.fs.readdirSync(sourcesPath);
|
||||
//always copy the adb executable last so this will retry in the event some copying fails
|
||||
files.sort((a: string, b) => (a.endsWith('adb') || a.endsWith('adb.exe') ? 1 : -1));
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
this.fs.copyFileSync(
|
||||
this.path.join(sourcesPath, files[i]),
|
||||
this.path.join(this.appData, 'platform-tools', files[i])
|
||||
);
|
||||
try {
|
||||
this.fs.copyFileSync(
|
||||
this.path.join(sourcesPath, files[i]),
|
||||
this.path.join(this.appData, 'platform-tools', files[i])
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('Error copying platform tools file ' + files[i] + e);
|
||||
//if the file exists and isn't writeable, don't give up, have some hope it's just in use and is fine.
|
||||
if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools', files[i]))) {
|
||||
throw 'Error copying platform tools file: ' + e.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
||||
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() =>
|
||||
setTimeout(() => resolve(), 5000)
|
||||
setTimeout(() => resolve(), 8000)
|
||||
);
|
||||
} else {
|
||||
setTimeout(() => resolve(), 5000);
|
||||
setTimeout(() => resolve(), 8000);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error seeding platform tools! ', e);
|
||||
resolve();
|
||||
reject('Error seeding platform tools: ' + e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
arrow_drop_down
|
||||
</i>
|
||||
<div id="connection-status" class="connection-status-unauthorized" mz-tooltip
|
||||
position="bottom" [ngClass]="adbService.connectionCss" [tooltip]="'Device connection status.'">
|
||||
position="bottom" [ngClass]="adbService.connectionCss" [tooltip]="adbService.lastErrorMessage||'Device connection status.'">
|
||||
<div id="connection-status-message" [innerHTML]="appService.versionName+' '+adbService.deviceStatusMessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Injectable, isDevMode } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
import { environment } from '../environments/environment';
|
||||
import { OPEN_IN_SYSTEM_BROWSER_DOMAINS } from '../../../electron/external-urls';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -46,17 +45,6 @@ export class WebviewService {
|
||||
.bsaber-tooltip.-sidequest-remove::after {
|
||||
content: "Remove Custom Level";
|
||||
}`;
|
||||
let ses = this.appService.remote.session.fromPartition('webview-partition');
|
||||
ses.webRequest.onBeforeRequest((details, callback) => {
|
||||
let url = details.url;
|
||||
const extUrl = new URL(url).host.toLowerCase();
|
||||
if (OPEN_IN_SYSTEM_BROWSER_DOMAINS.includes(extUrl)) {
|
||||
this.appService.electron.shell.openExternal(url);
|
||||
callback({ cancel: true });
|
||||
} else {
|
||||
callback({});
|
||||
}
|
||||
});
|
||||
this.webView.addEventListener('did-start-loading', e => {
|
||||
this.isWebviewLoading = true;
|
||||
this.webView.insertCSS(customCss);
|
||||
|
||||
@@ -15,6 +15,8 @@ const exec = require('child_process').exec;
|
||||
const crypto = require('crypto');
|
||||
const request = require('request');
|
||||
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
|
||||
app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy');
|
||||
|
||||
// const Readable = require('stream').Readable;
|
||||
import { SetPropertiesCommand } from './setproperties';
|
||||
|
||||
Reference in New Issue
Block a user