This commit is contained in:
Shane Harris
2020-08-17 13:31:48 +01:00
committed by Your Name
parent 98d137b963
commit 38a66bf43c
10 changed files with 66 additions and 40 deletions
Binary file not shown.
+2 -1
View File
@@ -904,7 +904,8 @@ export class AdbClientService {
}
installLocalObb(filepath: string, dontCatchError = false, cb = null, number?: number, total?: number, task?, name?: string) {
let filename = this.appService.path.basename(filepath);
let packageId = filename.match(/main.[0-9]{1,}.([a-z]{1,}.[A-z]{1,}.[A-z]{1,}).obb/)[1];
let packageId = filename.match(/main.[0-9]{1,}.([A-z0-9.]{1,}).obb/)[1];
console.log(packageId);
const showTotal = number && total ? '(' + number + '/' + total + ') ' : '';
if (!task) this.spinnerService.showLoader();
let p = this.runAdbCommand('adb push "' + filepath + '" /sdcard/Android/obb/' + packageId + '/' + filename);
+1
View File
@@ -134,6 +134,7 @@ export class ElectronService {
setupIPC() {
this.appService.electron.ipcRenderer.on('pre-open-url', (event, data) => {
console.log('here', data);
this.spinnerService.showLoader();
this.spinnerService.setMessage('Do you want to install this file?<br><br>' + data.name);
this.spinnerService.setupConfirm().then(() => {
@@ -1,6 +1,10 @@
.breadcrumb-wrapper{
position: fixed;
top: 200px;
top: 165px;
width: 100%;
height: auto;
z-index: 1;
line-height: 40px;
}
.drag-indicator{
@@ -1,15 +1,14 @@
<div *ngIf="isConnected()">
<br><br><br>
<div *ngIf="isConnected()" class="top-bar">
<nav class="pink lighten-2 breadcrumb-wrapper ">
<div class="nav-wrapper container">
<div class="col s12">
<a *ngFor="let breadcrumb of breadcrumbs" href="javascript:void(0)" class="breadcrumb"
(click)="open('/'+breadcrumb.path)">{{breadcrumb.name}}</a>
<a *ngFor="let breadcrumb of breadcrumbs; let i = index" href="javascript:void(0)" class="breadcrumb"
(click)="open('/'+breadcrumb.path)">{{breadcrumb.name}}<span *ngIf="i === breadcrumbs.length-1 && folderSize"> ({{folderSize}})</span> </a>
</div>
</div>
</nav>
</div>
<div class="container">
<div class="container files-section">
<div *ngIf="!isConnected()">
<h4
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
@@ -54,12 +53,13 @@
class="btn-floating blue"><i class="material-icons">folder</i></a></li>
<li mz-tooltip position="left" tooltip="Open current save location" (click)="openSaveLocation()"><a
class="btn-floating yellow darken-2"><i class="material-icons">folder</i></a></li>
<li *ngIf="selectedFiles.length > 0" mz-tooltip position="left" tooltip="Delete selected items"
(click)="filesToBeDeleted = selectedFiles; confirmModal.openModal()"><a class="btn-floating red darken-2"><i
class="material-icons">delete</i></a></li>
<li *ngIf="quickSaveSupported()" mz-tooltip position="left" tooltip="Save screenshots and recordings"
(click)="downloadMediaModal.openModal()"><a class="btn-floating green"><i class="material-icons">get_app</i></a>
</li>
<li *ngIf="selectedFiles.length > 0" class="divider"></li>
<li *ngIf="selectedFiles.length > 0" mz-tooltip position="left" tooltip="Delete selected items"
(click)="filesToBeDeleted = selectedFiles; confirmModal.openModal()"><a class="btn-floating red darken-2"><i
class="material-icons">delete</i></a></li>
<li *ngIf="selectedFiles.length > 0" mz-tooltip position="left" tooltip="Save selected items to computer"
(click)="filesToBeSaved = selectedFiles; filesModal.openModal()">
<a class="btn-floating orange"><i class="material-icons">get_app</i></a>
@@ -149,7 +149,7 @@
</div>
</div>
<br>
<h5><em>WARNING: This cannot be undone!!</em></h5>
WARNING: This cannot be undone!!
</mz-modal-content>
<mz-modal-footer>
<button mz-button [flat]="true" mz-modal-close>Close</button>
+12 -3
View File
@@ -33,6 +33,7 @@ export class FilesComponent implements OnInit {
isOpen: boolean = false;
currentPath: string;
folderName: string;
folderSize: string;
currentFile: FileFolderListing;
quickSaveModels: string[] = ['Quest', 'Go'];
constructor(
@@ -296,11 +297,10 @@ export class FilesComponent implements OnInit {
this.breadcrumbs.push({ path, name });
}
open(path: string) {
//this.spinnerService.showLoader();
//this.spinnerService.setMessage('Loading files...');
this.currentPath = path;
this.breadcrumbs = [];
this.selectedFiles.length = 0;
this.files.length = 0;
this.getCrumb(
this.currentPath
.split('/')
@@ -318,7 +318,6 @@ export class FilesComponent implements OnInit {
return textA < textB ? -1 : textA > textB ? 1 : 0;
});
this.files = this.files.filter(d => d.icon === 'folder').concat(this.files.filter(d => d.icon !== 'folder'));
//this.spinnerService.hideLoader();
});
}
openSaveLocation() {
@@ -326,6 +325,16 @@ export class FilesComponent implements OnInit {
}
async readdir(path: String) {
let dirContents: FileFolderListing[];
let isRoot = ['/sdcard/', 'sdcard', 'sdcard/', '/sdcard'].indexOf(path) > -1;
if (isRoot) {
this.folderSize = null;
} else {
this.folderSize = await this.adbService.adbCommand('shell', {
serial: this.adbService.deviceSerial,
command: 'du -sh "' + path + '"',
});
this.folderSize = this.folderSize.split('\t')[0];
}
await this.adbService.adbCommand('readdir', { serial: this.adbService.deviceSerial, path }).then(files => {
dirContents = files.map(file => {
const name = file.name;
@@ -21,8 +21,8 @@
<!--<div class="logo no-outline" (click)="webService.webView.loadURL('http://localhost:4201');" routerLink="webview"></div>-->
<!--<div class="header-title" #header><img src="assets/images/logo-textual.png" class="responsive-img"/></div>-->
<!--<div class="apk-install">Drag and drop your APK/OBB files <br>over this message to install!</div>-->
<div class="apk-install" *ngIf="appService.isFilesOpen">Manage the files on your headset.<br>Drag and drop to move
files onto your headset.</div>
<!--<div class="apk-install" *ngIf="appService.isFilesOpen">Manage the files on your headset.<br>Drag and drop to move-->
<!--files onto your headset.</div>-->
<div class="apk-install" *ngIf="appService.isPackagesOpen">Manage the apps on your headset.<br>Click Show All to
see all apps including system apps.</div>
<div class="apk-install" *ngIf="appService.isSettingsOpen">Manage settings on your headset.</div>
@@ -353,6 +353,7 @@
<mz-modal #logcatModal [fixedFooter]="true" [options]="{dismissible: false}">
<mz-modal-header>
<button mz-button class="right" [flat]="true" mz-modal-close (click)="stopLogcat(); currentLogCat.length = 0; isStarted = false;">Stop & Close</button>
<button mz-button class="right" [flat]="true" (click)="stopLogcat(); currentLogCat.length = 0; isStarted = false;">Stop Only</button>
<h4>ADB Logcat</h4>
</mz-modal-header>
<mz-modal-content>
@@ -574,7 +575,7 @@
<br><br>
</div>
<div class="col s12" *ngIf="osPlatform === 'linux'">
TO use ScrCpy on Linux you will need to install snap package manager with <span class="chip">sudo snap install scrcpy</span>
To use ScrCpy on Linux you will need to install snap package manager with <span class="chip">sudo snap install scrcpy</span>
</div>
</div>
</mz-modal-content>
@@ -57,6 +57,25 @@
</span><br>
<div *ngIf="currentPackage.package.name" class="small-text">{{currentPackage.package.packageName}}</div>
<div *ngIf="currentPackage.versionCode" class="small-text">Version: {{currentPackage.versionCode}}</div><br><br>
<h4>Game Data Backups</h4>
Backup data files from your SD Card for this app/game.<br><br>
<a class="waves-effect waves-light btn backup-this-package"
(click)="backupData(currentPackage.package.packageName)">Backup Game Data</a><br><br>
<div class="row" *ngFor="let backup of dataBackups">
<div class="col s3 m2 l1">
<div class="chip cursor restore-backup tooltipped" data-position="right" data-tooltip="Restore this backup"
(click)="restoreBackup(showBackupFileName(backup))">
<i class="material-icons">sync</i>
</div>
</div>
<div class="col s6 s10 l11">
<div class="chip">
<span class="backup-name">{{showBackupFileName(backup)}}</span>
</div>
</div>
</div>
<br><br>
<h4>APK Backups</h4>
Backup your APK file from your device.<br><br>
<a class="waves-effect waves-light btn backup-this-package margin-right"
@@ -77,24 +96,6 @@
</div>
</div>
<br><br>
<h4>Game Data Backups</h4>
Backup data files from your SD Card for this app/game.<br><br>
<a class="waves-effect waves-light btn backup-this-package"
(click)="backupData(currentPackage.package.packageName)">Backup Game Data</a><br><br>
<div class="row" *ngFor="let backup of dataBackups">
<div class="col s1">
<div class="chip cursor restore-backup tooltipped" data-position="right" data-tooltip="Restore this backup"
(click)="restoreBackup(showBackupFileName(backup))">
<i class="material-icons">sync</i>
</div>
</div>
<div class="col s11">
<div class="chip">
<span class="backup-name">{{showBackupFileName(backup)}}</span>
</div>
</div>
</div>
<br><br>
</div>
<div class="col s5">
@@ -12,6 +12,7 @@ export interface ProcessTask {
failed?: boolean;
succeeded?: boolean;
cancelled?: boolean;
reported?: boolean;
resolve: (task: ProcessTask) => Promise<void>;
}
@Injectable({
@@ -105,7 +106,8 @@ export class ProcessBucketService {
});
this.tasks = this.tasks.filter(t => t !== task);
} else {
let failed = this.tasks.filter(t => t.failed);
let failed = this.tasks.filter(t => t.failed && !t.reported);
failed.forEach(f => (f.reported = true));
this.failed_length = failed.length;
let hasFailed = !!this.failed_length;
if (this.is_running) {
+11 -4
View File
@@ -13,12 +13,14 @@ const request = require('request');
const progress = require('request-progress');
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;
setupAdb(adbPath, cb, ecb) {
if (this.client) return;
let port = valid_port ? Number(process.argv[has_port + 1]) : process.env.ANDROID_ADB_SERVER_PORT || 5037;
this.client = adb.createClient({
bin: adbPath,
});
@@ -427,7 +429,10 @@ function createWindow() {
mainWindow.webContents.session.on('will-download', (_evt, item, _webContents) => {
let url = item.getURL();
let urls = item.getURLChain();
let name = item.getFilename();
let etx = path.extname(url.split('?')[0]).toLowerCase();
let etx2 = urls.length ? path.extname(urls[0].split('?')[0]).toLowerCase() : etx;
if (~url.indexOf('https://beatsaver.com/cdn')) {
// beat saber mods /songs
mainWindow.webContents.send('open-url', 'sidequest://bsaber/#' + url);
@@ -440,12 +445,14 @@ function createWindow() {
} else if (etx === '.audica') {
// audica custom song format
mainWindow.webContents.send('open-url', 'sidequest://audica/#' + url);
} else if (etx === '.apk') {
} else if (etx === '.apk' || etx2 === '.apk') {
// any file ending with apk.
mainWindow.webContents.send('pre-open-url', url);
mainWindow.webContents.send('pre-open-url', { url, name });
BrowserWindow.getAllWindows()
.filter(b => b !== mainWindow)
.forEach(b => b.close());
} else if (~url.indexOf('ssl.hwcdn.net/') || ~url.indexOf('patreonusercontent.com/')) {
//itch.io & patreon
let name = item.getFilename();
mainWindow.webContents.send('pre-open-url', { url, name });
BrowserWindow.getAllWindows()
.filter(b => b !== mainWindow)