Rebase to master when repo went private
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
|
||||
describe('AdbClientService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: AdbClientService = TestBed.get(AdbClientService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
|
||||
.add-to-drag {
|
||||
width: 100%;
|
||||
padding: 1em;
|
||||
border: 2px dashed #3f3f3f;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.spinner,
|
||||
.spinner-drag {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10;
|
||||
display: none;
|
||||
}
|
||||
.spinner-background {
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border-top-left-radius: 40px;
|
||||
z-index: 9;
|
||||
}
|
||||
#beatView{
|
||||
width: 100%;
|
||||
height: calc(100% - 35px);
|
||||
top: 35px;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
z-index: 8;
|
||||
background:#0c0c0c;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<app-header></app-header>
|
||||
<div class="app-container full-height">
|
||||
<!--<app-side-menu></app-side-menu>-->
|
||||
<app-content class="full-height"></app-content>
|
||||
</div>
|
||||
|
||||
<app-loading-spinner #spinner></app-loading-spinner>
|
||||
<app-status-bar #status (getHelp)="getHelpModal.openModal(); helpStatus = $event"></app-status-bar>
|
||||
<webview id="beatView" #webview src="https://sidequestvr.com" allowpopups
|
||||
[ngStyle]="{'left':webService.isWebviewOpen?'0':'-100%'}" class="bsaber-webview"></webview>
|
||||
|
||||
<mz-modal #getHelpModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Get Help</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
We have a great community on discord and we have already faced most problems there. Please reach out on discord with the following error.<br><br>
|
||||
<div class="code">
|
||||
{{helpStatus}}
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="center-align">
|
||||
<div class="btn pink-button waves-effect waves-light" (click)="statusService.copyStatus();statusService.showStatus('Copied to your clipboard!')">Copy To Clipboard</div><br><br>
|
||||
<div class="btn pink-button waves-effect waves-light" (click)="appService.opn('https://discord.gg/r38T5rR')">Open Discord</div><br><br>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'desktop-app'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('desktop-app');
|
||||
});
|
||||
|
||||
it('should render title in a h1 tag', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to desktop-app!');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Component, isDevMode, ViewChild } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { WebviewService } from './webview.service';
|
||||
import { DragAndDropService } from './drag-and-drop.service';
|
||||
import { ElectronService } from './electron.service';
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css'],
|
||||
})
|
||||
export class AppComponent {
|
||||
@ViewChild('spinner', { static: false }) spinner;
|
||||
@ViewChild('status', { static: false }) status;
|
||||
@ViewChild('webview', { static: false }) webview;
|
||||
helpStatus: string;
|
||||
devMode: boolean;
|
||||
constructor(
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
public statusService: StatusBarService,
|
||||
private adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public webService: WebviewService,
|
||||
public dragService: DragAndDropService,
|
||||
private electronService: ElectronService
|
||||
) {
|
||||
this.devMode = isDevMode();
|
||||
}
|
||||
ngOnInit() {
|
||||
this.adbService
|
||||
.setupAdb()
|
||||
.then(() => this.appService.downloadScrCpyBinary())
|
||||
.then(() => this.adbService.connectedStatus())
|
||||
.then(() => {
|
||||
if (!localStorage.getItem('first_run')) {
|
||||
localStorage.setItem('first_run', 'true');
|
||||
this.statusService.showStatus(
|
||||
'Thanks for downloading SideQuest! Please click "Setup" on the top menu to begin and then "Sign Up" to get app updates, remote installing and more!'
|
||||
);
|
||||
}
|
||||
|
||||
this.dragService.setupDragAndDrop(this.webview.nativeElement);
|
||||
});
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.spinnerService.setSpinner(this.spinner);
|
||||
this.statusService.setStatus(this.status);
|
||||
this.webService.setWebView(this.webview.nativeElement);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { AppComponent } from './app.component';
|
||||
import { ContentComponent } from './content/content.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { MzButtonModule, MzCheckboxModule, MzModalModule, MzTooltipModule } from 'ngx-materialize';
|
||||
import { DragulaModule } from 'ng2-dragula';
|
||||
import { HeaderComponent } from './header/header.component';
|
||||
import { StatusBarComponent } from './status-bar/status-bar.component';
|
||||
import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { SetupComponent } from './setup/setup.component';
|
||||
import { AppRoutes } from './app.routes';
|
||||
import { LoadingSpinnerSmallComponent } from './loading-spinner-small/loading-spinner-small.component';
|
||||
import { PackagesComponent } from './packages/packages.component';
|
||||
import { PackageItemComponent } from './package-item/package-item.component';
|
||||
import { ToolsComponent } from './tools/tools.component';
|
||||
import { LinkComponent } from './link/link.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SanitizeHtmlPipe } from './sanitize-html.pipe';
|
||||
import { WebviewComponent } from './webview/webview.component';
|
||||
import { WebviewDirective } from './webview.directive';
|
||||
import { FilesComponent } from './files/files.component';
|
||||
import { ColorPickerModule } from 'ngx-color-picker';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { CurrentTasksComponent } from './current-tasks/current-tasks.component';
|
||||
import { CurrentTaskItemComponent } from './current-task-item/current-task-item.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
ContentComponent,
|
||||
HeaderComponent,
|
||||
StatusBarComponent,
|
||||
LoadingSpinnerComponent,
|
||||
SetupComponent,
|
||||
LoadingSpinnerSmallComponent,
|
||||
PackagesComponent,
|
||||
PackageItemComponent,
|
||||
ToolsComponent,
|
||||
LinkComponent,
|
||||
SanitizeHtmlPipe,
|
||||
WebviewComponent,
|
||||
WebviewDirective,
|
||||
FilesComponent,
|
||||
CurrentTasksComponent,
|
||||
CurrentTaskItemComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
DragulaModule.forRoot(),
|
||||
FormsModule,
|
||||
RouterModule.forRoot(AppRoutes, { useHash: true }),
|
||||
MzTooltipModule,
|
||||
MzModalModule,
|
||||
MzButtonModule,
|
||||
HttpClientModule,
|
||||
MzCheckboxModule,
|
||||
ColorPickerModule,
|
||||
BrowserAnimationsModule,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { SetupComponent } from './setup/setup.component';
|
||||
import { Routes } from '@angular/router';
|
||||
import { PackagesComponent } from './packages/packages.component';
|
||||
import { ToolsComponent } from './tools/tools.component';
|
||||
import { WebviewComponent } from './webview/webview.component';
|
||||
import { FilesComponent } from './files/files.component';
|
||||
import { CurrentTasksComponent } from './current-tasks/current-tasks.component';
|
||||
|
||||
export const AppRoutes: Routes = [
|
||||
{ path: 'setup', component: SetupComponent },
|
||||
{ path: 'tasks', component: CurrentTasksComponent },
|
||||
{ path: 'packages', component: PackagesComponent },
|
||||
{ path: 'packages/:packageName', component: PackagesComponent },
|
||||
{ path: 'tools', component: ToolsComponent },
|
||||
{ path: 'webview', component: WebviewComponent },
|
||||
{ path: 'device-files', component: FilesComponent },
|
||||
{ path: '**', component: WebviewComponent },
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AppService } from './app.service';
|
||||
|
||||
describe('AppService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: AppService = TestBed.get(AppService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,371 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { WebviewService } from './webview.service';
|
||||
import { FilesComponent } from './files/files.component';
|
||||
import { HeaderComponent } from './header/header.component';
|
||||
declare let __dirname, process;
|
||||
export enum FolderType {
|
||||
MAIN,
|
||||
ADB,
|
||||
BSABER,
|
||||
BSABER_BACKUPS,
|
||||
APK_BACKUPS,
|
||||
DATA_BACKUPS,
|
||||
QUEST_SABER_PATCH,
|
||||
APP_BACKUP,
|
||||
SONG_FOLDER,
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AppService {
|
||||
showSearch: boolean;
|
||||
showBrowserBar: boolean;
|
||||
showCustomActions: boolean;
|
||||
showTaskActions: boolean;
|
||||
updateAvailable: boolean;
|
||||
showRepo: boolean;
|
||||
isFilesOpen: boolean;
|
||||
isPackagesOpen: boolean;
|
||||
isSettingsOpen: boolean;
|
||||
isTasksOpen: boolean;
|
||||
hideNSFW: boolean;
|
||||
filesComponent: FilesComponent;
|
||||
appData: string;
|
||||
fs: any;
|
||||
path: any;
|
||||
nativeApp: any;
|
||||
remote: any;
|
||||
electron: any;
|
||||
os: any;
|
||||
request: any;
|
||||
progress: any;
|
||||
Readable: any;
|
||||
opn: any;
|
||||
spawn: any;
|
||||
md5: any;
|
||||
semver: any;
|
||||
exec: any;
|
||||
execSync: any;
|
||||
uuidv4: any;
|
||||
ping: any;
|
||||
crypto: any;
|
||||
titleEle: HTMLElement;
|
||||
webService: WebviewService;
|
||||
currentTheme: string = 'dark';
|
||||
versionName: string;
|
||||
showBack: boolean = false;
|
||||
backupPath: string;
|
||||
scrcpyBinaryPath: string;
|
||||
downloadResolves: any = {};
|
||||
extractResolves: any = {};
|
||||
headerComponent: HeaderComponent;
|
||||
constructor(private spinnerService: LoadingSpinnerService) {
|
||||
this.path = (<any>window).require('path');
|
||||
this.fs = (<any>window).require('fs');
|
||||
this.request = (<any>window).require('request');
|
||||
this.progress = (<any>window).require('request-progress');
|
||||
this.os = (<any>window).require('os');
|
||||
this.Readable = (<any>window).require('stream').Readable;
|
||||
this.opn = (<any>window).require('opn');
|
||||
this.md5 = (<any>window).require('md5');
|
||||
this.spawn = (<any>window).require('child_process').spawn;
|
||||
this.semver = (<any>window).require('semver');
|
||||
this.crypto = (<any>window).require('crypto');
|
||||
this.electron = (<any>window).require('electron');
|
||||
this.remote = this.electron.remote;
|
||||
this.nativeApp = this.electron.remote.app;
|
||||
this.appData = this.path.join(this.nativeApp.getPath('appData'), 'SideQuest');
|
||||
this.exec = (<any>window).require('child_process').exec;
|
||||
this.execSync = (<any>window).require('child_process').execSync;
|
||||
this.uuidv4 = (<any>window).require('uuid/v4');
|
||||
this.ping = (<any>window).require('ping');
|
||||
this.makeFolders();
|
||||
let theme = localStorage.getItem('theme');
|
||||
if (theme && theme === 'light') {
|
||||
this.currentTheme = 'light';
|
||||
}
|
||||
this.hideNSFW = !!localStorage.getItem('hideNSFW');
|
||||
this.backupPath = localStorage.getItem('backup-path');
|
||||
if (!this.backupPath) {
|
||||
this.backupPath = this.path.join(this.appData, 'backups');
|
||||
localStorage.setItem('backup-path', this.backupPath);
|
||||
}
|
||||
this.versionName = 'v' + this.remote.app.getVersion();
|
||||
this.electron.ipcRenderer.on('extract-file', (event, data) => {
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].resolve();
|
||||
delete this.extractResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('extract-progress', (event, data) => {
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].scb(data.stats);
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-url', (event, data) => {
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].resolve();
|
||||
delete this.downloadResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-progress', (event, data) => {
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].scb(data.stats);
|
||||
}
|
||||
});
|
||||
}
|
||||
extract(path, options, callback, task?) {
|
||||
return this.extractFileAPI(options.dir, path, task).then(callback);
|
||||
}
|
||||
extractFileAPI(directory, filename, task?) {
|
||||
return new Promise(resolve => {
|
||||
let token = this.uuidv4();
|
||||
this.extractResolves[token] = {
|
||||
scb: stats => {
|
||||
if (task) {
|
||||
task.status = 'Extracting... ' + stats;
|
||||
}
|
||||
},
|
||||
resolve,
|
||||
};
|
||||
this.electron.ipcRenderer.send('extract-file', { token, directory, filename });
|
||||
});
|
||||
}
|
||||
getBase64Image(imagePath: string) {
|
||||
try {
|
||||
return (
|
||||
'data:image/' + (<any>imagePath).split('.').pop() + ';base64,' + this.fs.readFileSync(imagePath).toString('base64')
|
||||
);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
resetTop() {
|
||||
this.showSearch = false;
|
||||
this.showBrowserBar = false;
|
||||
this.showCustomActions = false;
|
||||
this.showTaskActions = false;
|
||||
this.showRepo = false;
|
||||
this.isFilesOpen = false;
|
||||
this.isPackagesOpen = false;
|
||||
this.isSettingsOpen = false;
|
||||
this.isTasksOpen = false;
|
||||
}
|
||||
doesFileExist(path) {
|
||||
try {
|
||||
return this.fs.existsSync(path);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
setWebviewService(webService: WebviewService) {
|
||||
this.webService = webService;
|
||||
}
|
||||
setTitleEle(ele: HTMLElement) {
|
||||
this.titleEle = ele;
|
||||
}
|
||||
setTitle(title: string) {
|
||||
if (this.titleEle) {
|
||||
this.titleEle.innerHTML = title;
|
||||
}
|
||||
}
|
||||
isTheme(theme: string) {
|
||||
return this.currentTheme === theme;
|
||||
}
|
||||
setTheme(theme: string) {
|
||||
this.currentTheme = theme;
|
||||
localStorage.setItem('theme', theme === 'dark' ? 'dark' : 'light');
|
||||
}
|
||||
getThemeCssClass(prefix: string, isButton?: boolean) {
|
||||
let classes = {};
|
||||
classes[prefix + '-dark-theme'] = this.isTheme('dark');
|
||||
classes[prefix + '-light-theme'] = this.isTheme('light');
|
||||
if (isButton || prefix === 'button') {
|
||||
classes['waves-dark'] = true;
|
||||
classes['waves-light'] = false;
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
openFolder(folder: FolderType, packageName?: string) {
|
||||
switch (folder) {
|
||||
case FolderType.MAIN:
|
||||
this.electron.shell.openItem(this.appData);
|
||||
break;
|
||||
case FolderType.BSABER:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'bsaber'));
|
||||
break;
|
||||
case FolderType.BSABER_BACKUPS:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'bsaber-backups'));
|
||||
break;
|
||||
case FolderType.ADB:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'platform-tools'));
|
||||
break;
|
||||
case FolderType.APK_BACKUPS:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'backups'));
|
||||
break;
|
||||
case FolderType.DATA_BACKUPS:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'bsaber-data-backups'));
|
||||
break;
|
||||
case FolderType.QUEST_SABER_PATCH:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'saber-quest-patch', 'questsaberpatch'));
|
||||
break;
|
||||
case FolderType.APP_BACKUP:
|
||||
this.electron.shell.openItem(this.path.join(this.backupPath, packageName));
|
||||
break;
|
||||
case FolderType.SONG_FOLDER:
|
||||
this.electron.shell.openItem(this.path.join(this.appData, 'bsaber', packageName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
seedSources() {
|
||||
if (!this.fs.existsSync(this.path.join(this.appData, 'sources.txt'))) {
|
||||
let sourcesPath = this.path.join(__dirname, 'assets', 'sources.txt');
|
||||
if (!this.fs.existsSync(sourcesPath)) {
|
||||
sourcesPath = this.path.join(process.cwd(), 'desktop-app', 'src', 'assets', 'sources.txt');
|
||||
}
|
||||
this.fs.createReadStream(sourcesPath).pipe(this.fs.createWriteStream(this.path.join(this.appData, 'sources.txt')));
|
||||
}
|
||||
}
|
||||
makeFolders() {
|
||||
return this.mkdir(this.appData)
|
||||
.then(() => this.mkdir(this.path.join(this.appData, 'backups')))
|
||||
.then(() => this.mkdir(this.path.join(this.appData, 'tmp')))
|
||||
.then(() => {});
|
||||
}
|
||||
async mkdir(path) {
|
||||
return new Promise(resolve => {
|
||||
this.fs.mkdir(path, { recursive: true }, resolve);
|
||||
});
|
||||
}
|
||||
setExecutable(path) {
|
||||
return new Promise(resolve => {
|
||||
const ls = this.spawn('chmod', ['+x', path]);
|
||||
ls.on('close', code => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
async downloadFile(winUrl, linUrl, macUrl, getPath, task?) {
|
||||
let downloadUrl = linUrl;
|
||||
switch (this.os.platform()) {
|
||||
case 'win32':
|
||||
downloadUrl = winUrl;
|
||||
break;
|
||||
case 'darwin':
|
||||
downloadUrl = macUrl;
|
||||
break;
|
||||
case 'linux':
|
||||
downloadUrl = linUrl;
|
||||
break;
|
||||
}
|
||||
let downloadPath = getPath(downloadUrl);
|
||||
return this.downloadFileAPI(downloadUrl, this.path.dirname(downloadPath), this.path.basename(downloadPath), task).then(
|
||||
() => downloadPath
|
||||
);
|
||||
}
|
||||
downloadFileAPI(url, directory, filename, task?) {
|
||||
// Send request to application thread to download a file. Store the callback for the response.
|
||||
return new Promise(resolve => {
|
||||
let token = this.uuidv4();
|
||||
this.downloadResolves[token] = {
|
||||
scb: stats => {
|
||||
if (task) {
|
||||
task.status = 'Downloading... ' + stats + '%';
|
||||
}
|
||||
},
|
||||
resolve,
|
||||
};
|
||||
this.electron.ipcRenderer.send('download-url', { token, url, directory, filename });
|
||||
});
|
||||
}
|
||||
getUserAgent() {
|
||||
const nodeString = `NodeJs/${(<any>window).process.version}`;
|
||||
const packageString = 'OpenStoreVR';
|
||||
const computerString = `Hostname/${this.os.hostname()} Platform/${this.os.platform()} PlatformVersion/${this.os.release()}`;
|
||||
return `${packageString} ${nodeString} ${computerString}`;
|
||||
}
|
||||
|
||||
runScrCpy(options: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let command =
|
||||
'"' +
|
||||
this.scrcpyBinaryPath +
|
||||
'" --crop ' +
|
||||
options.crop +
|
||||
' ' +
|
||||
' -b ' +
|
||||
options.bit_rate +
|
||||
' ' +
|
||||
(options.max_size ? ' --max-fps ' + options.max_fps + ' ' : '') +
|
||||
(options.max_size ? ' --max-size ' + options.max_size + ' ' : '') +
|
||||
(options.always_on_top ? '--always-on-top' : '') +
|
||||
' ' +
|
||||
(options.fullscreen ? '-f' : '') +
|
||||
' ' +
|
||||
(options.no_control ? '-n' : '') +
|
||||
' --window-title "SideQuest Stream"';
|
||||
console.log(command);
|
||||
this.exec(command, function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
return reject({ err, stderr, command });
|
||||
}
|
||||
resolve(stdout);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
downloadScrCpyBinary() {
|
||||
if (this.os.platform() === 'win32') {
|
||||
this.spinnerService.showLoader();
|
||||
let task = { status: 'Downloading/Extracting ScrCpy...' };
|
||||
this.spinnerService.setMessage('', task);
|
||||
let url = 'https://github.com/Genymobile/scrcpy/releases/download/v1.11/scrcpy-win64-v1.11.zip';
|
||||
let downloadPath = this.path.join(this.appData, 'scrcpy', 'scrcpy.exe');
|
||||
if (this.doesFileExist(downloadPath)) {
|
||||
this.scrcpyBinaryPath = downloadPath;
|
||||
this.spinnerService.hideLoader();
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.downloadFile(
|
||||
url,
|
||||
url,
|
||||
url,
|
||||
() => {
|
||||
return this.path.join(this.appData, 'scrcpy.zip');
|
||||
},
|
||||
task
|
||||
).then((path: any) => {
|
||||
let callback = error => {
|
||||
if (error) return reject(error);
|
||||
this.fs.unlink(path, err => {
|
||||
// if(err) return reject(err);
|
||||
this.spinnerService.hideLoader();
|
||||
resolve(path.split('.')[0]);
|
||||
});
|
||||
};
|
||||
|
||||
this.extract(path, { dir: this.path.join(this.appData, 'scrcpy') }, callback);
|
||||
this.scrcpyBinaryPath = downloadPath;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
deleteFolderRecursive(path) {
|
||||
if (this.fs.existsSync(path)) {
|
||||
this.fs.readdirSync(path).forEach(file => {
|
||||
let curPath = path + '/' + file;
|
||||
if (this.fs.lstatSync(curPath).isDirectory()) {
|
||||
// recurse
|
||||
this.deleteFolderRecursive(curPath);
|
||||
} else {
|
||||
// delete file
|
||||
this.fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
this.fs.rmdirSync(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AudicaService } from './audica.service';
|
||||
|
||||
describe('AudicaService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: AudicaService = TestBed.get(AudicaService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { AppService } from './app.service';
|
||||
import { ProcessBucketService } from './process-bucket.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AudicaService {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
private appService: AppService,
|
||||
private processService: ProcessBucketService
|
||||
) {}
|
||||
|
||||
downloadSong(downloadUrl, adbService) {
|
||||
return this.processService.addItem('song_download', async task => {
|
||||
let parts = downloadUrl.split('/');
|
||||
let zipPath = this.appService.path.join(this.appService.appData, this.appService.path.basename(downloadUrl));
|
||||
let ws = this.appService.fs.createWriteStream(zipPath);
|
||||
//let name = parts[parts.length - 1].split('.')[0];
|
||||
const requestOptions = {
|
||||
timeout: 30000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
};
|
||||
task.status = 'Saving to Audica...';
|
||||
return new Promise((resolve, reject) => {
|
||||
let request = this.appService
|
||||
.progress(this.appService.request(downloadUrl, requestOptions), { throttle: 50 })
|
||||
.on('error', error => {
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save item... ' + error.toString();
|
||||
reject(error);
|
||||
})
|
||||
.on('progress', state => {
|
||||
task.status = 'Saving to Audica... ' + Math.round(state.percent * 100) + '%';
|
||||
})
|
||||
.on('response', response => {
|
||||
var regexp = /filename=\"(.*)\"/gi;
|
||||
var _regResult = regexp.exec(response.headers['content-disposition']);
|
||||
if (_regResult && _regResult.length) {
|
||||
zipPath = this.appService.path.join(this.appService.appData, _regResult[1]);
|
||||
}
|
||||
request.pipe(this.appService.fs.createWriteStream(zipPath));
|
||||
})
|
||||
.on('end', async () => {
|
||||
let ext = this.appService.path.extname(zipPath).toLowerCase();
|
||||
let basename = this.appService.path.basename(zipPath);
|
||||
await adbService.uploadFile(
|
||||
[
|
||||
{
|
||||
name: zipPath,
|
||||
savePath: '/sdcard/Audica/' + basename,
|
||||
},
|
||||
],
|
||||
task
|
||||
);
|
||||
task.status = 'Saved! ' + basename;
|
||||
this.appService.fs.unlink(zipPath, err => {
|
||||
if (err) console.warn(err);
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BeatOnService } from './beat-on.service';
|
||||
|
||||
describe('BeatOnService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: BeatOnService = TestBed.get(BeatOnService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,298 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { AppService } from './app.service';
|
||||
import { ProcessBucketService } from './process-bucket.service';
|
||||
|
||||
interface BeatOnStatus {
|
||||
CurrentStatus: string;
|
||||
IsBeatSaberInstalled: boolean;
|
||||
}
|
||||
export interface HostSetupEvent {
|
||||
SetupEvent: SetupEventType;
|
||||
Message: string;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
export enum SetupEventType {
|
||||
Step1Complete = 'Step1Complete',
|
||||
Step2Complete = 'Step2Complete',
|
||||
Step3Complete = 'Step3Complete',
|
||||
Error = 'Error',
|
||||
StatusMessage = 'StatusMessage',
|
||||
}
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class BeatOnService {
|
||||
beatOnEnabled: boolean;
|
||||
UpgradeRestoreAvailable: boolean;
|
||||
beatOnPID: string;
|
||||
websocket: WebSocket;
|
||||
beatOnStatus: BeatOnStatus = {
|
||||
CurrentStatus: '',
|
||||
IsBeatSaberInstalled: false,
|
||||
};
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
private appService: AppService,
|
||||
private processService: ProcessBucketService
|
||||
) {}
|
||||
setupBeatOn(adbService) {
|
||||
this.spinnerService.showLoader();
|
||||
return this.beatOnStep(adbService, '1')
|
||||
.then(() => this.spinnerService.setMessage('Uninstalling APK'))
|
||||
.then(() => adbService.uninstallAPK('com.beatgames.beatsaber'))
|
||||
.then(() => this.spinnerService.showLoader())
|
||||
.then(() => this.beatOnStep(adbService, '2?skipuninstall'))
|
||||
.then(() => this.beatOnStep(adbService, '3?skipinstall'))
|
||||
.then(() => this.spinnerService.setMessage('Installing APK'))
|
||||
.then(() => {
|
||||
setTimeout(
|
||||
() =>
|
||||
adbService
|
||||
.adbCommand('installRemote', {
|
||||
serial: adbService.deviceSerial,
|
||||
path: '/sdcard/Android/data/com.weloveoculus.BMBF/cache/beatsabermod.apk',
|
||||
})
|
||||
.then(() =>
|
||||
adbService.setPermission('com.beatgame.beatsaber', 'android.permission.WRITE_EXTERNAL_STORAGE')
|
||||
)
|
||||
.then(() =>
|
||||
adbService.setPermission('com.beatgame.beatsaber', 'android.permission.READ_EXTERNAL_STORAGE')
|
||||
)
|
||||
.then(() => {
|
||||
this.spinnerService.hideLoader();
|
||||
this.statusService.showStatus('Installed!');
|
||||
})
|
||||
.catch(e => {
|
||||
this.spinnerService.hideLoader();
|
||||
this.statusService.showStatus(e.message ? e.message : e.code ? e.code : e.toString(), true);
|
||||
}),
|
||||
4000
|
||||
);
|
||||
});
|
||||
}
|
||||
beatOnRequest(adbService, endpoint: string, method: string = 'GET') {
|
||||
return this.http.get('http://' + adbService.deviceIp + ':50000/host/' + endpoint).toPromise();
|
||||
}
|
||||
beatOnStep(adbService, step: string) {
|
||||
return this.http
|
||||
.post('http://' + adbService.deviceIp + ':50000/host/mod/install/step' + step, '')
|
||||
.toPromise()
|
||||
.then(r => console.log(r));
|
||||
}
|
||||
checkHasRestore(adbService) {
|
||||
this.beatOnRequest(adbService, 'mod/startupstatus').then(
|
||||
(r: any) => (this.UpgradeRestoreAvailable = r.UpgradeRestoreAvailable)
|
||||
);
|
||||
}
|
||||
confirmRestore(adbService) {
|
||||
return this.http
|
||||
.post('http://' + adbService.deviceIp + ':50000/host/beatsaber/config/restore?configtype=committed', '')
|
||||
.toPromise()
|
||||
.then(() => this.http.post('http://' + adbService.deviceIp + ':50000/host/beatsaber/commitconfig', '').toPromise());
|
||||
}
|
||||
checkIsBeatOnRunning(adbService) {
|
||||
return adbService
|
||||
.adbCommand('shell', {
|
||||
serial: adbService.deviceSerial,
|
||||
command: 'pidof com.weloveoculus.BMBF',
|
||||
})
|
||||
.then(res => {
|
||||
this.beatOnEnabled = !!res;
|
||||
this.beatOnPID = res;
|
||||
})
|
||||
.then(() => {
|
||||
if (this.beatOnEnabled && adbService.deviceIp) {
|
||||
return this.beatOnRequest(adbService, 'mod/status').then((body: BeatOnStatus) => {
|
||||
this.beatOnStatus = body;
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
// this.statusService.showStatus(
|
||||
// 'Your PC and quest should be on the same network! Try to Ping your Quest IP address. ' +
|
||||
// (e.message ? e.message : e.code ? e.code : e.toString()),
|
||||
// true
|
||||
// );
|
||||
});
|
||||
}
|
||||
async syncSongs(adbService) {
|
||||
this.spinnerService.setMessage('Restoring Backup...');
|
||||
this.spinnerService.showLoader();
|
||||
let packageBackupPath = this.appService.path.join(this.appService.appData, 'bsaber');
|
||||
if (this.appService.fs.existsSync(packageBackupPath)) {
|
||||
adbService.localFiles = [];
|
||||
await adbService
|
||||
.getLocalFoldersRecursive(packageBackupPath)
|
||||
.then(() => {
|
||||
adbService.localFiles.forEach(file => {
|
||||
file.savePath = this.appService.path.posix.join(
|
||||
'/sdcard/BeatOnData/CustomSongs/',
|
||||
file.name
|
||||
.replace(packageBackupPath, '')
|
||||
.split('\\')
|
||||
.join('/')
|
||||
);
|
||||
});
|
||||
return adbService.uploadFile(adbService.localFiles.filter(f => f.__isFile));
|
||||
})
|
||||
.then(() =>
|
||||
this.http.post('http://' + adbService.deviceIp + ':50000/host/beatsaber/reloadsongfolders', '').toPromise()
|
||||
)
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.spinnerService.hideLoader();
|
||||
this.statusService.showStatus('Songs synced OK!');
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setBeatOnPermission(adbService) {
|
||||
return adbService
|
||||
.adbCommand('shell', {
|
||||
serial: adbService.deviceSerial,
|
||||
command: 'pm grant com.weloveoculus.BMBF android.permission.READ_EXTERNAL_STORAGE',
|
||||
})
|
||||
.then(() =>
|
||||
adbService.adbCommand('shell', {
|
||||
serial: adbService.deviceSerial,
|
||||
command: 'pm grant com.weloveoculus.BMBF android.permission.WRITE_EXTERNAL_STORAGE',
|
||||
})
|
||||
);
|
||||
}
|
||||
setupBeatOnSocket(adbService) {
|
||||
if (!adbService.deviceIp) {
|
||||
console.log("Can't connect, no wifi IP.");
|
||||
return;
|
||||
}
|
||||
if (this.websocket != null && this.websocket.readyState === WebSocket.OPEN) {
|
||||
console.log('HostMessageService.openSocket called, but the connection is already open.');
|
||||
return;
|
||||
}
|
||||
if (this.websocket != null) this.websocket.close();
|
||||
|
||||
this.websocket = new WebSocket('ws://' + adbService.deviceIp + ':50001');
|
||||
this.websocket.onopen = (ev: Event) => {
|
||||
console.log('Connection opened');
|
||||
};
|
||||
//
|
||||
this.websocket.onmessage = (ev: MessageEvent) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
let msgStr = <string>reader.result;
|
||||
let msgEvent: HostSetupEvent = JSON.parse(msgStr);
|
||||
if (msgEvent.Message) {
|
||||
this.spinnerService.setMessage(msgEvent.Message);
|
||||
} else {
|
||||
// console.log(`Unknown host message: ${msgStr}`);
|
||||
}
|
||||
};
|
||||
reader.readAsText(ev.data);
|
||||
};
|
||||
//
|
||||
this.websocket.onclose = (ev: Event) => {
|
||||
console.log('Connection was closed, reconnecting in several seconds...');
|
||||
};
|
||||
//
|
||||
this.websocket.onerror = (ev: Event) => {
|
||||
console.log('WEBSOCKET ERROR OH NOOOOO!');
|
||||
};
|
||||
}
|
||||
|
||||
downloadSong(downloadUrl, adbService) {
|
||||
return this.processService.addItem('song_download', async task => {
|
||||
let parts = downloadUrl.split('/');
|
||||
let zipPath = this.appService.path.join(this.appService.appData, this.appService.uuidv4() + '.zip');
|
||||
//let name = parts[parts.length - 1].split('.')[0];
|
||||
const requestOptions = {
|
||||
timeout: 30000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
};
|
||||
task.status = 'Saving to BMBF...';
|
||||
return new Promise((resolve, reject) => {
|
||||
if (
|
||||
adbService.deviceIp &&
|
||||
this.beatOnEnabled &&
|
||||
this.beatOnPID &&
|
||||
this.beatOnStatus.CurrentStatus === 'ModInstalled'
|
||||
) {
|
||||
this.appService
|
||||
.progress(this.appService.request(downloadUrl, requestOptions), { throttle: 50 })
|
||||
.on('error', error => {
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save song... ' + error.toString();
|
||||
reject(error);
|
||||
})
|
||||
.on('progress', state => {
|
||||
task.status = 'Saving to BMBF... ' + Math.round(state.percent * 100) + '%';
|
||||
})
|
||||
.on('end', () => {
|
||||
let formData = {
|
||||
file: {
|
||||
value: this.appService.fs.createReadStream(zipPath),
|
||||
options: {
|
||||
filename: parts[parts.length - 1],
|
||||
contentType: 'application/zip',
|
||||
},
|
||||
},
|
||||
};
|
||||
let options = {
|
||||
url: 'http://' + adbService.deviceIp + ':50000/host/beatsaber/upload',
|
||||
method: 'POST',
|
||||
formData: formData,
|
||||
};
|
||||
let timeoutCheck = setTimeout(() => {
|
||||
if (task.fail_once) {
|
||||
task.fail_once = false;
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save song... Timeout';
|
||||
reject(task.status);
|
||||
} else {
|
||||
task.fail_once = true;
|
||||
task.running = false;
|
||||
task.status = 'Waiting...';
|
||||
resolve();
|
||||
}
|
||||
}, 30000);
|
||||
this.appService
|
||||
.progress(this.appService.request(options), { throttle: 50 })
|
||||
.on('error', error => {
|
||||
clearTimeout(timeoutCheck);
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save song... ' + error.toString();
|
||||
reject(error);
|
||||
})
|
||||
.on('progress', state => {
|
||||
clearTimeout(timeoutCheck);
|
||||
task.status = 'Uploading To Beat On... ' + Math.round(state.percent * 100) + '%';
|
||||
})
|
||||
.on('end', () => {
|
||||
clearTimeout(timeoutCheck);
|
||||
this.appService.fs.unlink(zipPath, err => {
|
||||
task.status = 'Saved! ' + downloadUrl;
|
||||
resolve(parts[parts.length - 1].split('.')[0]);
|
||||
});
|
||||
});
|
||||
})
|
||||
.pipe(this.appService.fs.createWriteStream(zipPath));
|
||||
} else {
|
||||
reject(
|
||||
new Error(
|
||||
'Cant reach the unicorns, this is most likely caused by a network issue. Please open BeatOn/BMBF inside the headset or from a browser at http://' +
|
||||
adbService.deviceIp +
|
||||
':50000.'
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
.body-content {
|
||||
height: calc(100% - 200px);
|
||||
width: 100%;
|
||||
background: #f0f0f0;
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
height: calc(100% - 200px);
|
||||
padding-top: 1em;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
overflow: auto;
|
||||
transition: background-color 350ms ease-out;
|
||||
background-color:#0c0c0c;
|
||||
}
|
||||
/*.content-dark-theme{*/
|
||||
/*background-color:#211c23;*/
|
||||
/*}*/
|
||||
/*.content-light-theme{*/
|
||||
/*background-color:#f0f0f0;*/
|
||||
/*}*/
|
||||
.loader-initial {
|
||||
border: 16px solid #f3f3f3; /* Light grey */
|
||||
border-top: 16px solid #0094ca; /* Blue */
|
||||
border-radius: 50%;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
animation: spin 2s linear infinite;
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="content" [ngClass]="{'content-dark-theme':appService.currentTheme === 'dark','content-light-theme':appService.currentTheme === 'light'}">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ContentComponent } from './content.component';
|
||||
|
||||
describe('ContentComponent', () => {
|
||||
let component: ContentComponent;
|
||||
let fixture: ComponentFixture<ContentComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ContentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { RepoService } from '../repo.service';
|
||||
import { AppService } from '../app.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-content',
|
||||
templateUrl: './content.component.html',
|
||||
styleUrls: ['./content.component.css']
|
||||
})
|
||||
export class ContentComponent implements OnInit {
|
||||
constructor(repoService:RepoService, public appService:AppService) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
.menu-chip{
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="col s10 package-height chip-padding package-item relative">
|
||||
<div class="chip pointer margin-right menu-chip truncate"
|
||||
[ngClass]="{'pink-button' : task.running, 'white-text' : task.running || task.failed || task.succeeded, 'orange' : task.failed, 'green' : task.succeeded}"
|
||||
mz-tooltip [tooltip]="task.running ? 'This task is running' : task.failed ? 'This task has failed' : task.succeeded ? 'This task succeeded' : 'This task is waiting'"
|
||||
position="bottom" [innerHTML]="'<i class=material-icons>' + task.icon + '</i>' + task.status">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s2 package-height centered package-item">
|
||||
<i *ngIf="task.status === 'Waiting...'||(task.running&&!task.succeeded&&!task.failed)" class="material-icons red-text cursor settings" (click)="task.running?processService.skipCurrent(task):deleteItem()">close</i>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CurrentTaskItemComponent } from './current-task-item.component';
|
||||
|
||||
describe('CurrentTaskItemComponent', () => {
|
||||
let component: CurrentTaskItemComponent;
|
||||
let fixture: ComponentFixture<CurrentTaskItemComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CurrentTaskItemComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CurrentTaskItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ProcessBucketService } from '../process-bucket.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-current-task-item',
|
||||
templateUrl: './current-task-item.component.html',
|
||||
styleUrls: ['./current-task-item.component.css'],
|
||||
})
|
||||
export class CurrentTaskItemComponent implements OnInit {
|
||||
@Input() task;
|
||||
constructor(private processService: ProcessBucketService) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
deleteItem() {
|
||||
this.processService.tasks = this.processService.tasks.filter(t => t !== this.task);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="container">
|
||||
<h4 *ngIf="!processService.tasks.length" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">No tasks running...</h4>
|
||||
|
||||
<div class="row" *ngIf="processService.tasks.length">
|
||||
<app-current-task-item *ngFor="let task of processService.tasks;" [task]="task"></app-current-task-item>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CurrentTasksComponent } from './current-tasks.component';
|
||||
|
||||
describe('CurrentTasksComponent', () => {
|
||||
let component: CurrentTasksComponent;
|
||||
let fixture: ComponentFixture<CurrentTasksComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CurrentTasksComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CurrentTasksComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
import { ProcessBucketService } from '../process-bucket.service';
|
||||
import { AppService } from '../app.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-current-tasks',
|
||||
templateUrl: './current-tasks.component.html',
|
||||
styleUrls: ['./current-tasks.component.css'],
|
||||
})
|
||||
export class CurrentTasksComponent implements OnInit {
|
||||
constructor(public processService: ProcessBucketService, public appService: AppService) {
|
||||
this.appService.resetTop();
|
||||
appService.webService.isWebviewOpen = false;
|
||||
this.appService.showTaskActions = true;
|
||||
appService.isTasksOpen = true;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Current Tasks');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DragAndDropService } from './drag-and-drop.service';
|
||||
|
||||
describe('DragAndDropService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: DragAndDropService = TestBed.get(DragAndDropService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
import { WebviewService } from './webview.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DragAndDropService {
|
||||
message: string;
|
||||
isDragging: boolean;
|
||||
constructor(
|
||||
private adbService: AdbClientService,
|
||||
private appService: AppService,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
private webService: WebviewService
|
||||
) {}
|
||||
setupDragAndDrop(ele) {
|
||||
let dragTimeout;
|
||||
document.body.ondragover = () => {
|
||||
clearTimeout(dragTimeout);
|
||||
this.message = this.appService.isFilesOpen ? 'Drop files to upload!' : 'Drop the file here to install!';
|
||||
this.isDragging = true;
|
||||
return false;
|
||||
};
|
||||
|
||||
document.body.ondragleave = () => {
|
||||
dragTimeout = setTimeout(() => {
|
||||
this.isDragging = false;
|
||||
}, 1000);
|
||||
return false;
|
||||
};
|
||||
|
||||
document.body.ondragend = () => {
|
||||
this.isDragging = false;
|
||||
return false;
|
||||
};
|
||||
|
||||
document.body.ondrop = async e => {
|
||||
if (!this.isDragging) return;
|
||||
this.isDragging = false;
|
||||
e.preventDefault();
|
||||
if (this.appService.isFilesOpen && this.appService.filesComponent) {
|
||||
return this.appService.filesComponent.uploadFilesFromList(
|
||||
Object.keys(e.dataTransfer.files).map(i => (e.dataTransfer.files[i] as any).path)
|
||||
);
|
||||
}
|
||||
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
||||
let file = e.dataTransfer.files[i] as any;
|
||||
let filepath = file.path;
|
||||
if (['.apk', '.obb'].includes(this.appService.path.extname(filepath))) {
|
||||
if (this.appService.path.extname(filepath) === '.apk') {
|
||||
await this.adbService.installAPK(filepath, true);
|
||||
} else {
|
||||
await this.adbService.installLocalObb(filepath);
|
||||
}
|
||||
} else {
|
||||
this.statusService.showStatus('Unrecognised File: ' + filepath, true);
|
||||
}
|
||||
}
|
||||
this.spinnerService.hideLoader();
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectronService } from './electron.service';
|
||||
|
||||
describe('ElectronService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: ElectronService = TestBed.get(ElectronService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,262 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
import { RepoService } from './repo.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
import { WebviewService } from './webview.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { BeatOnService } from './beat-on.service';
|
||||
import { SynthriderService } from './synthrider.service';
|
||||
import { SongBeaterService } from './song-beater.service';
|
||||
import { AudicaService } from './audica.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ElectronService {
|
||||
isInstalledLauncher: boolean;
|
||||
isInstallingLauncher: boolean;
|
||||
constructor(
|
||||
private appService: AppService,
|
||||
private repoService: RepoService,
|
||||
private statusService: StatusBarService,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private adbService: AdbClientService,
|
||||
private webviewService: WebviewService,
|
||||
private beatonService: BeatOnService,
|
||||
private router: Router,
|
||||
private synthriderService: SynthriderService,
|
||||
private songbeaterService: SongBeaterService,
|
||||
private audicaService: AudicaService
|
||||
) {
|
||||
this.setupIPC();
|
||||
}
|
||||
async installFirefoxMultiple(urls) {
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
await this.adbService.installFile(
|
||||
urls[i],
|
||||
'/sdcard/Android/data/org.mozilla.vrbrowser/files/skybox/',
|
||||
i + 1,
|
||||
urls.length
|
||||
);
|
||||
}
|
||||
}
|
||||
async installSynthridersMultiple(urls) {
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
await this.synthriderService.downloadSong(urls[i], this.adbService);
|
||||
}
|
||||
}
|
||||
async installMultiple(urls) {
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
const etx = urls[i]
|
||||
.split('?')[0]
|
||||
.split('.')
|
||||
.pop()
|
||||
.toLowerCase();
|
||||
switch (etx) {
|
||||
case 'obb':
|
||||
await this.adbService.installObb(urls[i], i + 1, urls.length);
|
||||
break;
|
||||
default:
|
||||
await this.adbService.installAPK(urls[i], false, false, i + 1, urls.length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setupIPC() {
|
||||
this.appService.electron.ipcRenderer.on('pre-open-url', (event, data) => {
|
||||
this.spinnerService.showLoader();
|
||||
this.spinnerService.setMessage('Do you want to install this file?<br><br>' + data.name);
|
||||
this.spinnerService.setupConfirm().then(() => {
|
||||
switch (this.appService.path.extname(data.name)) {
|
||||
case '.zip':
|
||||
this.adbService.installZip(data.url, 0, 0, true);
|
||||
break;
|
||||
case '.obb':
|
||||
this.adbService.installObb(data.url);
|
||||
break;
|
||||
case '.apk':
|
||||
this.adbService.installAPK(data.url);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.appService.electron.ipcRenderer.on('update-status', (event, data) => {
|
||||
if (data.status === 'checking-for-update') {
|
||||
this.statusService.showStatus('Checking for an update...');
|
||||
} else if (data.status === 'update-available') {
|
||||
this.statusService.showStatus(
|
||||
'Update Available to version ' +
|
||||
data.info.version +
|
||||
'. Click Update Available at the top to get the latest version.'
|
||||
);
|
||||
this.appService.updateAvailable = true;
|
||||
} else if (data.status === 'no-update') {
|
||||
this.statusService.showStatus('You are on the most recent version of SideQuest.');
|
||||
this.appService.updateAvailable = false;
|
||||
} else if (data.status === 'error') {
|
||||
this.statusService.showStatus('Error checking for update.', true);
|
||||
} else if (data.status === 'downloading') {
|
||||
console.log(data.status);
|
||||
} else if (data.status === 'update-downloaded') {
|
||||
console.log(data.status);
|
||||
}
|
||||
});
|
||||
this.appService.electron.ipcRenderer.on('open-url', (event, data) => {
|
||||
if (data) {
|
||||
let url = data.split('#');
|
||||
switch (url[0]) {
|
||||
case 'sidequest://unload/':
|
||||
this.adbService.uninstallAPK(url[1]);
|
||||
break;
|
||||
case 'sidequest://sideload-multi/':
|
||||
try {
|
||||
let urls = JSON.parse(
|
||||
data
|
||||
.replace('sidequest://sideload-multi/#', '')
|
||||
.split('%22,%22')
|
||||
.join('","')
|
||||
.split('[%22')
|
||||
.join('["')
|
||||
.split('%22]')
|
||||
.join('"]')
|
||||
);
|
||||
this.installMultiple(urls);
|
||||
this.statusService.showStatus('Installing app... See the tasks screen for more info.');
|
||||
} catch (e) {
|
||||
this.statusService.showStatus('Could not parse install url: ' + data, true);
|
||||
}
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
case 'sidequest://sideload/':
|
||||
this.adbService.installAPK(url[1]);
|
||||
break;
|
||||
case 'sidequest://launcher/':
|
||||
if (!this.isLauncherInstalled()) {
|
||||
this.installLauncher();
|
||||
} else {
|
||||
this.statusService.showStatus('Launcher already installed!');
|
||||
}
|
||||
break;
|
||||
case 'sidequest://songbeater/':
|
||||
this.statusService.showStatus('SongBeater download started... See the tasks screen for more info.');
|
||||
this.songbeaterService.downloadSong(url[1], this.adbService);
|
||||
break;
|
||||
case 'sidequest://audica/':
|
||||
this.statusService.showStatus('Audica download started... See the tasks screen for more info.');
|
||||
this.audicaService.downloadSong(url[1], this.adbService);
|
||||
break;
|
||||
case 'sidequest://synthriders/':
|
||||
this.statusService.showStatus('SynthRiders download started... See the tasks screen for more info.');
|
||||
this.synthriderService.downloadSong(url[1], this.adbService);
|
||||
break;
|
||||
case 'sidequest://synthriders-multi/':
|
||||
this.statusService.showStatus('SynthRiders download started... See the tasks screen for more info.');
|
||||
try {
|
||||
let urls = JSON.parse(
|
||||
data
|
||||
.replace('sidequest://synthriders-multi/#', '')
|
||||
.split('%22,%22')
|
||||
.join('","')
|
||||
.split('[%22')
|
||||
.join('["')
|
||||
.split('%22]')
|
||||
.join('"]')
|
||||
);
|
||||
this.installSynthridersMultiple(urls);
|
||||
} catch (e) {
|
||||
this.statusService.showStatus('Could not parse install url: ' + data, true);
|
||||
}
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
case 'sidequest://bsaber/':
|
||||
this.statusService.showStatus('Song download started... See the tasks screen for more info.');
|
||||
if (~this.adbService.devicePackages.indexOf('com.playito.songbeater')) {
|
||||
this.spinnerService.showLoader();
|
||||
this.spinnerService.setMessage('Send this to Song Beater instead of BMBF?<br><br>' + data);
|
||||
this.spinnerService
|
||||
.setupConfirm()
|
||||
.then(() => {
|
||||
this.songbeaterService.downloadSong(url[1], this.adbService);
|
||||
})
|
||||
.catch(() => {
|
||||
this.beatonService.downloadSong(url[1], this.adbService);
|
||||
});
|
||||
} else {
|
||||
this.beatonService.downloadSong(url[1], this.adbService);
|
||||
}
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
case 'sidequest://firefox-skybox/':
|
||||
this.statusService.showStatus(
|
||||
'Firefox Reality Skybox download started... See the tasks screen for more info.'
|
||||
);
|
||||
try {
|
||||
let urls = JSON.parse(
|
||||
data
|
||||
.replace('sidequest://firefox-skybox/#', '')
|
||||
.split('%22,%22')
|
||||
.join('","')
|
||||
.split('[%22')
|
||||
.join('["')
|
||||
.split('%22]')
|
||||
.join('"]')
|
||||
);
|
||||
this.installFirefoxMultiple(urls);
|
||||
} catch (e) {
|
||||
this.statusService.showStatus('Could not parse install url: ' + data, true);
|
||||
}
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
case 'sidequest://bsaber-multi/':
|
||||
try {
|
||||
let urls = JSON.parse(
|
||||
data
|
||||
.replace('sidequest://bsaber-multi/#', '')
|
||||
.split('%22,%22')
|
||||
.join('","')
|
||||
.split('[%22')
|
||||
.join('["')
|
||||
.split('%22]')
|
||||
.join('"]')
|
||||
);
|
||||
(async () => {
|
||||
this.spinnerService.showLoader();
|
||||
this.spinnerService.setMessage('Saving to BMBF...');
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
await this.beatonService.downloadSong(urls[i], this.adbService);
|
||||
}
|
||||
this.statusService.showStatus('Item Downloaded Ok!!');
|
||||
this.spinnerService.hideLoader();
|
||||
})();
|
||||
} catch (e) {
|
||||
this.statusService.showStatus('Could not parse install url: ' + data, true);
|
||||
}
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
default:
|
||||
this.statusService.showStatus('Custom protocol not recognised: ' + (data || ''), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isLauncherInstalled() {
|
||||
this.isInstalledLauncher =
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper2') &&
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper') &&
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.launcher');
|
||||
return this.isInstalledLauncher;
|
||||
}
|
||||
installLauncher() {
|
||||
this.isInstallingLauncher = true;
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper.apk');
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper2.apk');
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestLauncher.apk');
|
||||
this.isInstallingLauncher = false;
|
||||
this.isInstalledLauncher = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
.breadcrumb-wrapper{
|
||||
position: fixed;
|
||||
top: 200px;
|
||||
}
|
||||
|
||||
.drag-indicator{
|
||||
font-size: 2rem;
|
||||
line-height: 3rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.selected{
|
||||
background: #e93c96;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.save-icon{
|
||||
margin-right: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<div *ngIf="isConnected()">
|
||||
<br><br><br>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div *ngIf="!isConnected()">
|
||||
<h4
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
No device connected...</h4>
|
||||
|
||||
</div>
|
||||
<div *ngIf="isConnected()">
|
||||
<div *ngIf="!files.length">
|
||||
<h4
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
No files here...</h4>
|
||||
|
||||
</div>
|
||||
<div *ngFor="let file of files" class="vertical-align cursor"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="file" (click)="selectFile($event, file); $event.stopPropagation()">
|
||||
<div class="right">
|
||||
<span *ngIf="file.icon !== 'folder'">{{file.size|number:'1.2-2'}}MB | </span>{{file.time|date:'short'}}
|
||||
|
||||
<i class="material-icons cursor white-text drag-indicator save-icon"
|
||||
(click)="filesToBeSaved = [file]; filesModal.openModal();">save</i>
|
||||
<i class="material-icons cursor orange-text drag-indicator right delete"
|
||||
(click)="filesToBeDeleted = [file]; confirmModal.openModal()">close</i>
|
||||
</div>
|
||||
<div>
|
||||
<i class="material-icons medium vertical-align"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">{{file.icon}}</i>{{file.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
</div>
|
||||
<div class="fixed-action-btn" #fixedAction *ngIf="isConnected()">
|
||||
<a class="btn-floating btn-large pink lightn-2" mz-tooltip position="left" tooltip="Add a file.">
|
||||
<i class="large material-icons">add</i>
|
||||
</a>
|
||||
<ul>
|
||||
<li mz-tooltip position="left" tooltip="Copy file to this folder" (click)="uploadFiles()"><a
|
||||
class="btn-floating purple"><i class="material-icons">insert_drive_file</i></a></li>
|
||||
<li mz-tooltip position="left" tooltip="Make folder in this folder" (click)="mkDirModal.openModal()"><a
|
||||
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" 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>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<mz-modal #mkDirModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Make Folder</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Please enter a folder name.
|
||||
<div class="input-field ">
|
||||
<input id="devicePaste" type="text" [(ngModel)]="folderName" autofocus />
|
||||
<label for="devicePaste">Folder Name</label>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="makeFolder()">Make Folder</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
<mz-modal #filesModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Save selected file(s) to your PC</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Pick a location on your PC to save the following file(s):<br><br>
|
||||
<div *ngFor="let file of filesToBeSaved">
|
||||
<div class="file">
|
||||
<div>
|
||||
<i class="material-icons cursor orange-text drag-indicator" (click)="filesToBeSaved.splice(filesToBeSaved.indexOf(file), 1);
|
||||
clearSelection([file]);
|
||||
filesToBeSaved.length === 0 && filesModal.closeModal()">close</i>
|
||||
{{file.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
<button mz-button class="pink-button" (click)="pickLocation()">Select Location</button><br><br>
|
||||
Current Location: {{adbService.savePath}}
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" mz-modal-close
|
||||
(click)="saveFiles(filesToBeSaved); clearSelection(filesToBeSaved)">Save To PC</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
<mz-modal #downloadMediaModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Save local media to your PC</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Pick a location on your PC to save screenshots and recordings:<br><br>
|
||||
<button mz-button class="pink-button" (click)="pickLocation()">Select Location</button><br><br>
|
||||
Current Location: {{adbService.savePath}}
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="downloadMedia()">Save To PC</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
<mz-modal #confirmModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Delete selected file(s)</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Are you sure you want to delete the selected file(s)? <br>
|
||||
<em>Click <i class="material-icons orange-text" style="font-size: 16px">close</i> to remove files</em>
|
||||
<br><br>
|
||||
<div *ngFor="let file of filesToBeDeleted">
|
||||
<div class="file">
|
||||
<div>
|
||||
<i class="material-icons cursor orange-text drag-indicator" (click)="filesToBeDeleted.splice(filesToBeDeleted.indexOf(file), 1);
|
||||
clearSelection([file]);
|
||||
filesToBeDeleted.length === 0 && confirmModal.closeModal()">close</i>
|
||||
{{file.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<h5><em>WARNING: This cannot be undone!!</em></h5>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="red" mz-modal-close
|
||||
(click)="deleteFiles(filesToBeDeleted); clearSelection(filesToBeDeleted)">Delete Items</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FilesComponent } from './files.component';
|
||||
|
||||
describe('FilesComponent', () => {
|
||||
let component: FilesComponent;
|
||||
let fixture: ComponentFixture<FilesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FilesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FilesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,378 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
import { AppService } from '../app.service';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
import { ProcessBucketService } from '../process-bucket.service';
|
||||
interface FileFolderListing {
|
||||
name: string;
|
||||
icon: string;
|
||||
size: number;
|
||||
time: Date;
|
||||
filePath: string;
|
||||
}
|
||||
interface BreadcrumbListing {
|
||||
name: string;
|
||||
path: string;
|
||||
}
|
||||
declare let M;
|
||||
@Component({
|
||||
selector: 'app-files',
|
||||
templateUrl: './files.component.html',
|
||||
styleUrls: ['./files.component.css'],
|
||||
})
|
||||
export class FilesComponent implements OnInit {
|
||||
@ViewChild('filesModal', { static: false }) filesModal;
|
||||
@ViewChild('fixedAction', { static: false }) fixedAction;
|
||||
@ViewChild('downloadMediaModal', { static: false }) downloadMediaModal;
|
||||
files: FileFolderListing[] = [];
|
||||
selectedFiles: FileFolderListing[] = [];
|
||||
filesToBeSaved: FileFolderListing[];
|
||||
filesToBeDeleted: FileFolderListing[];
|
||||
breadcrumbs: BreadcrumbListing[] = [];
|
||||
isOpen: boolean = false;
|
||||
currentPath: string;
|
||||
folderName: string;
|
||||
currentFile: FileFolderListing;
|
||||
quickSaveModels: string[] = ['Quest', 'Go'];
|
||||
constructor(
|
||||
public spinnerService: LoadingSpinnerService,
|
||||
public adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public statusService: StatusBarService,
|
||||
private processService: ProcessBucketService
|
||||
) {
|
||||
this.appService.resetTop();
|
||||
appService.filesComponent = this;
|
||||
appService.isFilesOpen = true;
|
||||
appService.webService.isWebviewOpen = false;
|
||||
}
|
||||
ngOnAfterViewInit() {
|
||||
M.FloatingActionButton.init(this.fixedAction.nativeElement, {});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Headset Files');
|
||||
}
|
||||
async makeFolder() {
|
||||
if (
|
||||
~this.files
|
||||
.filter(f => f.icon === 'folder')
|
||||
.map(f => f.name)
|
||||
.indexOf(this.folderName)
|
||||
) {
|
||||
return this.statusService.showStatus('A folder already exists with that name!!', true);
|
||||
} else {
|
||||
await this.adbService.makeDirectory(this.appService.path.posix.join(this.currentPath, this.folderName)).then(r => {
|
||||
this.folderName = '';
|
||||
this.open(this.currentPath);
|
||||
});
|
||||
}
|
||||
}
|
||||
selectFile(event: Event, file: FileFolderListing) {
|
||||
let fileElement = event.target as Element;
|
||||
|
||||
if (file.icon === 'folder' && !(fileElement.classList.contains('save-icon') || fileElement.classList.contains('delete'))) {
|
||||
this.selectedFiles.length = 0;
|
||||
this.open(this.appService.path.posix.join(this.currentPath, file.name));
|
||||
} else if (!fileElement.classList.contains('delete') && !fileElement.classList.contains('save-icon')) {
|
||||
while (!fileElement.classList.contains('file')) {
|
||||
fileElement = fileElement.parentElement;
|
||||
}
|
||||
|
||||
if (this.selectedFiles.includes(file)) {
|
||||
this.selectedFiles.splice(this.selectedFiles.indexOf(file), 1);
|
||||
fileElement.classList.remove('selected');
|
||||
} else {
|
||||
this.selectedFiles.push(file);
|
||||
fileElement.classList.add('selected');
|
||||
}
|
||||
}
|
||||
}
|
||||
clearSelection(files?: FileFolderListing[]) {
|
||||
if (files) {
|
||||
for (const file of files) {
|
||||
document
|
||||
.querySelectorAll('.file')
|
||||
.item(this.files.indexOf(file))
|
||||
.classList.remove('selected');
|
||||
this.selectedFiles = this.selectedFiles.filter(f => f !== file);
|
||||
}
|
||||
} else {
|
||||
document.querySelectorAll('.selected').forEach(element => {
|
||||
element.classList.remove('selected');
|
||||
});
|
||||
this.selectedFiles.length = 0;
|
||||
}
|
||||
}
|
||||
async uploadFolder(folder, files, task) {
|
||||
task.status = 'Restoring Folder... ' + folder;
|
||||
if (this.appService.fs.existsSync(folder)) {
|
||||
this.adbService.localFiles = [];
|
||||
await this.adbService
|
||||
.getLocalFoldersRecursive(folder)
|
||||
.then(() => {
|
||||
this.adbService.localFiles.forEach(file => {
|
||||
file.savePath = this.appService.path.posix.join(
|
||||
this.currentPath,
|
||||
file.name
|
||||
.replace(folder, this.appService.path.basename(folder))
|
||||
.split('\\')
|
||||
.join('/')
|
||||
);
|
||||
});
|
||||
return this.adbService.uploadFile(this.adbService.localFiles.filter(f => f.__isFile), task);
|
||||
})
|
||||
.then(() => setTimeout(() => this.uploadFile(files, task), 500));
|
||||
}
|
||||
}
|
||||
uploadFile(files, task): Promise<any> {
|
||||
if (!files.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const f = files.shift();
|
||||
const savePath = this.appService.path.posix.join(this.currentPath, this.appService.path.basename(f));
|
||||
if (!this.appService.fs.existsSync(f)) {
|
||||
return Promise.resolve().then(() => setTimeout(() => this.uploadFile(files, task), 500));
|
||||
}
|
||||
if (this.appService.fs.lstatSync(f).isDirectory()) {
|
||||
return new Promise(async resolve => {
|
||||
this.folderName = this.appService.path.basename(f);
|
||||
await this.makeFolder();
|
||||
await this.uploadFolder(f, files, task);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
return this.adbService
|
||||
.adbCommand('push', { serial: this.adbService.deviceSerial, path: f, savePath }, stats => {
|
||||
task.status =
|
||||
'File uploading: ' +
|
||||
this.appService.path.basename(f) +
|
||||
' ' +
|
||||
Math.round((stats.bytesTransferred / 1024 / 1024) * 100) / 100 +
|
||||
'MB';
|
||||
})
|
||||
.then(() => setTimeout(() => this.uploadFile(files, task), 500));
|
||||
}
|
||||
uploadFilesFromList(files: string[]) {
|
||||
if (files !== undefined && files.length) {
|
||||
return this.processService.addItem('restore_files', async task => {
|
||||
task.status = 'Starting Upload to ' + this.currentPath;
|
||||
this.uploadFile(files, task)
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.open(this.currentPath);
|
||||
task.status = 'Upload complete! ' + this.currentPath;
|
||||
this.statusService.showStatus('Files/Folders uploaded successfully!');
|
||||
}, 1500);
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e.toString(), true));
|
||||
});
|
||||
}
|
||||
}
|
||||
uploadFiles() {
|
||||
this.appService.electron.remote.dialog.showOpenDialog(
|
||||
{
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
},
|
||||
files => this.uploadFilesFromList(files)
|
||||
);
|
||||
}
|
||||
quickSaveSupported() {
|
||||
return this.quickSaveModels.includes(this.adbService.deviceModel);
|
||||
}
|
||||
async downloadMedia() {
|
||||
let paths = [];
|
||||
let media: FileFolderListing[] = [];
|
||||
|
||||
if (this.adbService.deviceModel === 'Quest' || this.adbService.deviceModel === 'Go') {
|
||||
paths = ['/sdcard/Oculus/Screenshots', '/sdcard/Oculus/VideoShots'];
|
||||
}
|
||||
|
||||
for (const path of paths) {
|
||||
await this.readdir(path).then(dirContents => {
|
||||
media = media.concat(dirContents.filter(file => file.icon !== 'folder'));
|
||||
});
|
||||
}
|
||||
|
||||
this.saveFiles(media);
|
||||
}
|
||||
deleteFiles(files: FileFolderListing[]) {
|
||||
for (const file of files) {
|
||||
this.deleteFile(file);
|
||||
}
|
||||
|
||||
this.statusService.showStatus(files.length + ' Item(s) Deleted!!');
|
||||
}
|
||||
deleteFile(file: FileFolderListing) {
|
||||
this.adbService
|
||||
.adbCommand('shell', { serial: this.adbService.deviceSerial, command: 'rm "' + file.filePath + '" -r' })
|
||||
.then(r => {
|
||||
this.files.splice(this.files.indexOf(file), 1);
|
||||
});
|
||||
}
|
||||
saveFiles(files: FileFolderListing[]) {
|
||||
this.filesModal.closeModal();
|
||||
for (const file of files) {
|
||||
if (file.icon !== 'folder') {
|
||||
this.saveFile(file);
|
||||
} else {
|
||||
this.saveFolder(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
saveFile(file: FileFolderListing) {
|
||||
const savePath = this.appService.path.join(this.adbService.savePath, file.name);
|
||||
const path = file.filePath;
|
||||
return this.processService.addItem('save_files', async task => {
|
||||
return this.adbService
|
||||
.adbCommand('pull', { serial: this.adbService.deviceSerial, path, savePath }, stats => {
|
||||
task.status =
|
||||
'File downloading: ' +
|
||||
this.appService.path.basename(savePath) +
|
||||
' - ' +
|
||||
Math.round(stats.bytesTransferred / 1024 / 1024) +
|
||||
' / ' +
|
||||
file.size +
|
||||
' MB';
|
||||
})
|
||||
.then(() => {
|
||||
task.status = 'Files Saved to ' + savePath + '!!';
|
||||
this.statusService.showStatus('File (' + file.name + ') Saved OK!');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e.toString(), true));
|
||||
});
|
||||
}
|
||||
saveFolder(file: FileFolderListing) {
|
||||
this.filesModal.closeModal();
|
||||
const savePath = this.appService.path.join(this.adbService.savePath, file.name);
|
||||
const path = file.filePath;
|
||||
this.adbService.files = [];
|
||||
return this.processService.addItem('save_files', async task => {
|
||||
return this.adbService
|
||||
.getFoldersRecursive(path)
|
||||
.then(() => this.appService.mkdir(savePath))
|
||||
.then(
|
||||
() =>
|
||||
(this.adbService.files = this.adbService.files.map(f => {
|
||||
f.saveName = this.appService.path.join(savePath, f.name.replace(path, ''));
|
||||
return f;
|
||||
}))
|
||||
)
|
||||
.then(() => this.adbService.makeFolder(this.adbService.files.filter(f => !f.__isFile)))
|
||||
.then(() => this.adbService.downloadFile(this.adbService.files.filter(f => f.__isFile), task))
|
||||
.then(() => this.statusService.showStatus('Folder Saved OK!'));
|
||||
});
|
||||
}
|
||||
pickLocation() {
|
||||
this.appService.electron.remote.dialog.showOpenDialog(
|
||||
{
|
||||
properties: ['openDirectory'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
},
|
||||
files => {
|
||||
if (files !== undefined && files.length === 1) {
|
||||
this.adbService.savePath = files[0];
|
||||
this.adbService.setSavePath();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
isConnected() {
|
||||
const isConnected = this.adbService.deviceStatus === ConnectionStatus.CONNECTED;
|
||||
if (isConnected && !this.isOpen) {
|
||||
this.isOpen = true;
|
||||
this.open('/sdcard/');
|
||||
}
|
||||
return isConnected;
|
||||
}
|
||||
getCrumb(path: string) {
|
||||
const parts = path.split('/');
|
||||
const name = parts.pop();
|
||||
const parentPath = parts.join('/');
|
||||
if (parts.length > 0) {
|
||||
this.getCrumb(parentPath);
|
||||
}
|
||||
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.getCrumb(
|
||||
this.currentPath
|
||||
.split('/')
|
||||
.filter(d => d)
|
||||
.join('/')
|
||||
);
|
||||
if (!this.isConnected()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
this.readdir(path).then(dirContents => {
|
||||
this.files = dirContents;
|
||||
this.files.sort(function(a, b) {
|
||||
const textA = a.name.toUpperCase();
|
||||
const textB = b.name.toUpperCase();
|
||||
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() {
|
||||
this.appService.electron.remote.shell.openItem(this.adbService.savePath);
|
||||
}
|
||||
async readdir(path: String) {
|
||||
let dirContents: FileFolderListing[];
|
||||
await this.adbService.adbCommand('readdir', { serial: this.adbService.deviceSerial, path }).then(files => {
|
||||
dirContents = files.map(file => {
|
||||
const name = file.name;
|
||||
const size = Math.round((file.size / 1024 / 1024) * 100) / 100;
|
||||
const time = file.mtime;
|
||||
const filePath = this.appService.path.posix.join(path, file.name);
|
||||
let icon = 'folder';
|
||||
if (file.__isFile) {
|
||||
const fileParts = file.name.split('.');
|
||||
const extension = (fileParts[fileParts.length - 1] || '').toLowerCase();
|
||||
switch (extension) {
|
||||
case 'gif':
|
||||
case 'png':
|
||||
case 'jpeg':
|
||||
case 'jpg':
|
||||
icon = 'photo';
|
||||
break;
|
||||
case 'wav':
|
||||
case 'ogg':
|
||||
case 'mp3':
|
||||
icon = 'music_note';
|
||||
break;
|
||||
case 'avi':
|
||||
case 'mp4':
|
||||
icon = 'ondemand_video';
|
||||
break;
|
||||
case 'txt':
|
||||
case 'docx':
|
||||
case 'doc':
|
||||
icon = 'receipt';
|
||||
break;
|
||||
case 'pptx':
|
||||
case 'ppt':
|
||||
icon = 'picture_in_picture';
|
||||
break;
|
||||
case 'xlsx':
|
||||
case 'xls':
|
||||
icon = 'grid_on';
|
||||
break;
|
||||
default:
|
||||
icon = 'receipt';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return { name, icon, size, time, filePath };
|
||||
});
|
||||
});
|
||||
return dirContents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
|
||||
#connection-refresh,
|
||||
#connection-refresh-loading {
|
||||
display: none;
|
||||
}
|
||||
.title-menu-container{
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0px;
|
||||
-webkit-app-region: no-drag;
|
||||
vertical-align: middle;
|
||||
z-index: 999;
|
||||
}
|
||||
.title-menu-container i{
|
||||
margin-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#device-settings {
|
||||
font-size: 1.2rem;
|
||||
vertical-align:top;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.browser-input {
|
||||
width: calc(100% - 200px);
|
||||
display: inline-block;
|
||||
margin-right: 13px;
|
||||
margin-left: 13px
|
||||
}
|
||||
.margin-left{
|
||||
margin-left: 1em;
|
||||
}
|
||||
.pointer{
|
||||
cursor: pointer;
|
||||
}
|
||||
.process-badge{
|
||||
border-radius: 4px;
|
||||
padding: 0 3px;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
margin-left: -36px;
|
||||
vertical-align: super;
|
||||
width: 29px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
#browser-bar {
|
||||
position: absolute;
|
||||
top: 65px;
|
||||
left: 400px;
|
||||
width: calc(100% - 487px);
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.synthrideerz{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.topper{
|
||||
background: #202225;
|
||||
height: 35px;
|
||||
width: 100%;
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
.logo img{
|
||||
height: 90px;
|
||||
position:absolute;
|
||||
top: 55px;
|
||||
left: 20px;
|
||||
transition: 0.35s;
|
||||
}
|
||||
|
||||
#nav-mobile{
|
||||
margin-left: 60px;
|
||||
}
|
||||
.top-banner{
|
||||
background: #100e11 url(../../assets/images/TopBack.png) bottom right no-repeat;
|
||||
background-size: cover;
|
||||
height: 170px;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #8f8f8f;
|
||||
transition: 0.35s;
|
||||
}
|
||||
.spider-image{
|
||||
margin-top: 50px;
|
||||
margin-left: -17px;
|
||||
position: relative;
|
||||
z-index: 99999;
|
||||
}
|
||||
.over-menu{
|
||||
position:absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
}
|
||||
.top-buttons{
|
||||
position: absolute;
|
||||
top: 120px;
|
||||
left: 120px;
|
||||
}
|
||||
.header {
|
||||
height: 205px;
|
||||
/*background: #312249 url(../../assets/images/bg-header.png) left bottom no-repeat;*/
|
||||
position: relative;
|
||||
-webkit-user-select: none;
|
||||
border-top-right-radius: 12px;
|
||||
border-top-left-radius: 12px;
|
||||
/*overflow:hidden;*/
|
||||
}
|
||||
.header-title{
|
||||
position:absolute;
|
||||
top: 40px;
|
||||
left: 115px;
|
||||
font-size: 2.5rem;
|
||||
margin-top: 0.4em;
|
||||
margin-left: 1em;
|
||||
color: #ffffff;
|
||||
font-family: 'PT Sans', sans-serif;
|
||||
}
|
||||
.apk-install {
|
||||
font-size: 0.9rem;
|
||||
position: absolute;
|
||||
top: 150px;
|
||||
left: 140px;
|
||||
color: #ffffff;
|
||||
font-family: 'PT Sans', sans-serif;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.filter {
|
||||
width: 200px;
|
||||
}
|
||||
.filters {
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
left: 60px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.search {
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
right: -10px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.search-box {
|
||||
width: 400px;
|
||||
}
|
||||
.search-button-margin {
|
||||
margin-right: 2em;
|
||||
margin-left: 1em;
|
||||
}
|
||||
.content-section {
|
||||
border: 1px solid #dde1e2;
|
||||
background: white;
|
||||
}
|
||||
.content-section-header {
|
||||
border-bottom: 1px solid #dde1e2;
|
||||
padding: 1em 2em;
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
text-transform: capitalize;
|
||||
height: 60px;
|
||||
}
|
||||
.content-section-inner {
|
||||
padding: 1em;
|
||||
}
|
||||
.content-padding {
|
||||
padding: 2em;
|
||||
}
|
||||
#connection-status-message {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
float: left;
|
||||
margin-left: 30px;
|
||||
margin-top: -2px;
|
||||
color: white;
|
||||
}
|
||||
#connection-status-container{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 8px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.connection-device-select{
|
||||
vertical-align: top;
|
||||
}
|
||||
#connection-status {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.connection-status-connected {
|
||||
background-color: #4caf50;
|
||||
}
|
||||
.connection-status-unauthorized {
|
||||
background-color: #ff9800;
|
||||
}
|
||||
.connection-status-disconnected {
|
||||
background-color: #f44336;
|
||||
}
|
||||
.connection-status-too-many {
|
||||
background-color: #9c27b0;
|
||||
}
|
||||
.beast-saber-buttons{
|
||||
width: calc(100% - 500px);
|
||||
}
|
||||
.add-repo,
|
||||
.sync-songs,
|
||||
.sync-songs-now,
|
||||
.beast-saber-buttons,
|
||||
.back-webserver{
|
||||
position: absolute;
|
||||
top: 115px;
|
||||
right: 120px;
|
||||
text-decoration:none;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.update-available {
|
||||
margin-top: -16px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.sync-songs{
|
||||
right: 15px;
|
||||
}
|
||||
.fixed-height{
|
||||
height: 120px;
|
||||
}
|
||||
.sync-songs-now,.beast-saber-buttons {
|
||||
top: 83px;
|
||||
right: 73px;
|
||||
text-align: right;
|
||||
}
|
||||
.beaton-icon{
|
||||
height: 22px;
|
||||
margin-right: 8px;
|
||||
cursor: pointer;
|
||||
vertical-align: initial;
|
||||
|
||||
}
|
||||
.update-repo,
|
||||
.delete-repo,
|
||||
.restore-backup {
|
||||
padding-top: 4px;
|
||||
}
|
||||
.edit-repo {
|
||||
font-size: 14px;
|
||||
}
|
||||
.browser-loading {
|
||||
transform: scale(0.3);
|
||||
}
|
||||
.bookmark{
|
||||
margin-right: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.logo {
|
||||
background: transparent url('../../assets/images/score-logo.png') center center no-repeat;
|
||||
background-size: 110px 110px;
|
||||
width: 135px;
|
||||
height: 150px;
|
||||
-webkit-user-select: none;
|
||||
cursor: pointer;
|
||||
border-top-left-radius: 5px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.top-dnd-backing{
|
||||
position:absolute;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
.padding-top{
|
||||
padding-top: 2em;
|
||||
}
|
||||
.drop-message{
|
||||
position:absolute;
|
||||
top: 16px;
|
||||
left: 16px;
|
||||
width: 300px;
|
||||
height: 120px;
|
||||
z-index: 9999;
|
||||
}
|
||||
.top-menu-bar-icon-down{
|
||||
display: none;
|
||||
}
|
||||
.user-menu-back{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
z-index: 998;
|
||||
display:none;
|
||||
}
|
||||
.user-menu{
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 240px;
|
||||
width: 220px;
|
||||
z-index: 999;
|
||||
overflow: hidden;
|
||||
transition: height 250ms;
|
||||
background: #4e555b;
|
||||
text-align: center;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
border-radius: 3px;
|
||||
display: none;
|
||||
}
|
||||
.browser-menu{
|
||||
right: 400px;
|
||||
}
|
||||
.device-menu{
|
||||
right: initial;
|
||||
left: 16px;
|
||||
width: 300px;
|
||||
}
|
||||
.code{
|
||||
|
||||
}
|
||||
.command-menu{
|
||||
width: 240px;
|
||||
}
|
||||
.smaller-menu{
|
||||
top: 44px;
|
||||
}
|
||||
.top-badge{
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
right: 42px;
|
||||
}
|
||||
.smaller-badge{
|
||||
top: 20px;
|
||||
right: 38px;
|
||||
}
|
||||
|
||||
.smaller-buttons-avatar{
|
||||
margin-top: 2px;
|
||||
}
|
||||
.avatar-menu{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: inline-block;
|
||||
border-radius: 20px;
|
||||
vertical-align: middle;
|
||||
border: 3px solid #312249;
|
||||
}
|
||||
.smaller-buttons-avatar .avatar-menu{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
.avatar-menu-margin{
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.top-buttons-avatar{
|
||||
margin-top: 20px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.fav-manage-icon{
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.drag-indicator, .delete-button{
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
top: 5px;
|
||||
font-size: 2rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.delete-button{
|
||||
left: initial;
|
||||
right: -20px;
|
||||
}
|
||||
.fav-padding{
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.logcat-block{
|
||||
height: 520px;
|
||||
overflow: auto;
|
||||
}
|
||||
.logcat-small{
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.logcat-smaller{
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
.browser-menu-image{
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
vertical-align: text-top;
|
||||
margin-right: 15px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
@media only screen and (max-width: 1023px){
|
||||
.top-menu-bar-icon {
|
||||
display: none;
|
||||
}
|
||||
.browser-menu {
|
||||
right: 25px;
|
||||
}
|
||||
.top-menu-bar-icon-down{
|
||||
display: inline-block;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
height: 35px;
|
||||
background-color: #004a7f;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-family: Arial;
|
||||
font-size: 14px;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
animation: glowing 1500ms infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes glowing {
|
||||
0% {
|
||||
background-color: #b20000;
|
||||
-webkit-box-shadow: 0 0 3px #b20000;
|
||||
}
|
||||
50% {
|
||||
background-color: #ff0000;
|
||||
-webkit-box-shadow: 0 0 40px #ff0000;
|
||||
}
|
||||
100% {
|
||||
background-color: #b20000;
|
||||
-webkit-box-shadow: 0 0 3px #b20000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,624 @@
|
||||
<div class="header">
|
||||
<div class="top-dnd-backing">
|
||||
<div class="topper"></div>
|
||||
<div class="top-banner">
|
||||
<div>
|
||||
<!--<div class="header-title">SideQuest</div>-->
|
||||
<!--<div class="apk-install">Make it your own</div>-->
|
||||
<a href="#/" class="logo">
|
||||
<!--<img src="assets/images/logo-large icony.png"/>-->
|
||||
<img src="assets/images/new-logo.png" />
|
||||
<!--<img class="spider-image" src="https://i.giphy.com/media/V3sjIPOXgP5Zu/giphy.webp"/>-->
|
||||
</a>
|
||||
</div>
|
||||
<div class="top-buttons hide-on-med-and-down">
|
||||
</div>
|
||||
<div class="well well-lg drop-message center-align" *ngIf="dragAndDropService.isDragging">
|
||||
<h5>Drop file(s) here!</h5>
|
||||
<br />
|
||||
<span class="spinner-loading-message" [innerHTML]="dragAndDropService.message"></span>
|
||||
</div>
|
||||
<!--<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.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>
|
||||
<div class="apk-install" *ngIf="appService.isTasksOpen">Manage tasks for installing, <br>downloading and uploading
|
||||
from your headset.</div>
|
||||
<!--<div class="apk-install" *ngIf="appService.showCustomActions">Special thanks to-->
|
||||
<!--<app-link url="https://github.com/trishume/QuestSaberPatch" text="@trishume"></app-link>,-->
|
||||
<!--<app-link url="https://github.com/ATechAdventurer" text="@ATechAdventurer"></app-link>,<br>-->
|
||||
<!--<app-link url="https://www.reddit.com/u/drewbaumann/" text="@drewbaumann"></app-link>,-->
|
||||
<!--<app-link url="https://www.reddit.com/u/motokochan/" text="@motokochan"></app-link>-->
|
||||
<!--and of course-->
|
||||
<!--<app-link url="https://bsaber.com/members/elliotttate/" text="@elliotttate"></app-link>-->
|
||||
<!--for beat saber efforts.-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="user-menu-back" (click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none'"
|
||||
#userMenuBack></div>
|
||||
<div class="user-menu-back" (click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none'"
|
||||
#browserMenuBack></div>
|
||||
<div class="user-menu-back" (click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none'"
|
||||
#commandMenuBack></div>
|
||||
|
||||
<div class="user-menu-back" (click)="deviceMenu.style.display = 'none';deviceMenuBack.style.display = 'none'"
|
||||
#deviceMenuBack></div>
|
||||
<div class="user-menu device-menu" #deviceMenu>
|
||||
<ng-container *ngFor="let device of adbService.displayDevices">
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="deviceMenu.style.display = 'none';deviceMenuBack.style.display = 'none';adbService.deviceSerial = device.id;adbService.updateConnectedStatus()"
|
||||
>[{{device.id}}] {{device.deviceName}}</div><br>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="title-menu-container">
|
||||
<!--<img mz-tooltip-->
|
||||
<!--(click)="openBeatOn()"-->
|
||||
<!--class="material-icons no-outline beaton-icon"-->
|
||||
<!--src="{{beatonService.beatOnEnabled?'assets/images/beaton.png':'assets/images/beatoff.png'}}"-->
|
||||
<!--position="bottom" tooltip="BeatOn mods & custom songs on Beat Saber"/>-->
|
||||
|
||||
<div class="user-menu command-menu" #commandMenu>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none';adbModal.openModal()"
|
||||
><i class="material-icons left">input</i>Custom Command</div><br>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none';favoriteType = 'commandFavourites';favouriteMax = 20;favoritePathType = 'Command';manageFavs.openModal()"
|
||||
><i class="material-icons left">edit</i>Manage</div><br>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none';logcatModal.openModal()"
|
||||
><i class="material-icons left">toc</i>Logcat</div><br>
|
||||
<ng-container *ngFor="let favourite of favourites.commandFavourites">
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="commandMenu.style.display = 'none';commandMenuBack.style.display = 'none';adbService.runAdbCommand(favourite.uri); adbModal.openModal()"
|
||||
><img *ngIf="favourite.icon" class="left browser-menu-image" src="{{favourite.icon}}"/>{{favourite.name}}</div><br>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="user-menu browser-menu" #browserMenu>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none';webService.loadUrl('https://sidequestvr.com')"
|
||||
routerLink="/webview"><i class="material-icons left">home</i>Home</div><br>
|
||||
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none';bookmarksModal.openModal()"
|
||||
routerLink="/webview"><i class="material-icons left">public</i>Go to url</div><br>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none';favoriteType = 'browserFavourites';favouriteMax = 20;favoritePathType = 'Url';manageFavs.openModal()"
|
||||
><i class="material-icons left">edit</i>Manage</div><br>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="addCurrentFavourite()"
|
||||
><i class="material-icons left">add</i>Add Current</div><br>
|
||||
<ng-container *ngFor="let favourite of favourites.browserFavourites">
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text truncate"
|
||||
(click)="browserMenu.style.display = 'none';browserMenuBack.style.display = 'none';webService.loadUrl(favourite.uri)"
|
||||
routerLink="/webview"><img *ngIf="favourite.icon" class="left browser-menu-image" src="{{favourite.icon}}"/>{{favourite.name}}</div><br>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="user-menu" #userMenu>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';webService.loadUrl('https://sidequestvr.com')"
|
||||
routerLink="/webview"><i class="material-icons left">home</i>Home</div><br>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
*ngIf="isConnected()&&osPlatform === 'win32'"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';scrcpyModal.openModal();">
|
||||
<i class="material-icons left">live_tv</i>Streaming</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text" *ngIf="adbService.deviceIp"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';wifiModal.openModal()"><i
|
||||
class="material-icons left">wifi</i>Wifi</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';selectAppToInstall()"><i
|
||||
class="material-icons left">archive</i>Select APK</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';" routerLink="/device-files"><i
|
||||
class="material-icons left">folder</i>File Explorer</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';" routerLink="packages"><i
|
||||
class="material-icons left">apps</i>My Apps</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';" routerLink="tools"><i
|
||||
class="material-icons left">build</i>Tools</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';adbModal.openModal()"><i
|
||||
class="material-icons left">input</i>ADB Commands</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';logcatModal.openModal()"><i
|
||||
class="material-icons left">input</i>ADB Logcat</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';openDebugger()"><i
|
||||
class="material-icons left">bug_report</i>Debugger</div>
|
||||
<div class="btn-flat waves-light waves-light full-width center-align white-text" routerLink="webview"
|
||||
(click)="userMenu.style.display = 'none';userMenuBack.style.display = 'none';webService.loadUrl('http://tee.pub/lic/L295azlpJYk')">
|
||||
<i class="material-icons left">storefront</i>GiftShop</div>
|
||||
</div>
|
||||
<app-link *ngIf="appService.updateAvailable"
|
||||
class="waves-effect waves-light btn-flat update-available link small-button warning" (click)="updateAvailable()"
|
||||
text="Update"></app-link>
|
||||
<i mz-tooltip class="material-icons white-text no-outline top-menu-bar-icon-down" position="bottom" tooltip="Menu"
|
||||
(click)="userMenu.style.display = 'block';userMenuBack.style.display = 'block'">
|
||||
arrow_drop_down
|
||||
</i>
|
||||
<i mz-tooltip routerLink="/webview" (click)="webService.back()"
|
||||
class="material-icons white-text no-outline" position="bottom" tooltip="Back">
|
||||
arrow_back
|
||||
</i>
|
||||
<i mz-tooltip *ngIf="!webService.isWebviewLoading" (click)="browserMenu.style.display = 'block';browserMenuBack.style.display = 'block'"
|
||||
class="material-icons white-text no-outline" position="bottom" tooltip="Web Browser">
|
||||
public
|
||||
</i>
|
||||
<div mz-tooltip *ngIf="webService.isWebviewLoading" class="loader-tiny" position="bottom"
|
||||
tooltip="Web Browser Loading..."></div>
|
||||
<i mz-tooltip routerLink="/webview" (click)="webService.forward()"
|
||||
class="material-icons white-text no-outline" position="bottom" tooltip="Forward">
|
||||
arrow_forward
|
||||
</i>
|
||||
<i mz-tooltip *ngIf="isConnected()&&osPlatform === 'win32'" (click)="scrcpyModal.openModal();"
|
||||
class="material-icons white-text no-outline top-menu-bar-icon" position="bottom"
|
||||
tooltip="Stream from your headset to your PC with ScrCpy.">
|
||||
live_tv
|
||||
</i>
|
||||
<i mz-tooltip *ngIf="adbService.deviceIp" (click)="wifiModal.openModal()"
|
||||
class="material-icons no-outline top-menu-bar-icon"
|
||||
[ngClass]="{'green-text':adbService.wifiEnabled,'white-text':!adbService.wifiEnabled}" position="bottom"
|
||||
tooltip="Enable wireless mode. (Experimental)">
|
||||
wifi
|
||||
</i>
|
||||
<i mz-tooltip #mainLogo (click)="selectAppToInstall()"
|
||||
class="material-icons white-text no-outline top-menu-bar-icon" position="bottom"
|
||||
tooltip="Install APK file from folder on computer.">
|
||||
archive
|
||||
</i>
|
||||
<i mz-tooltip class="material-icons white-text no-outline top-menu-bar-icon" routerLink="/device-files"
|
||||
position="bottom" tooltip="Manage files on the headset.">
|
||||
folder
|
||||
</i>
|
||||
<i routerLink="packages" mz-tooltip class="material-icons white-text no-outline top-menu-bar-icon"
|
||||
position="bottom" tooltip="Currently installed apps">
|
||||
apps
|
||||
</i>
|
||||
<i routerLink="tasks" mz-tooltip class="material-icons white-text no-outline" position="bottom"
|
||||
tooltip="Running {{processService.left_length}} tasks.">
|
||||
playlist_add_check
|
||||
</i><span routerLink="tasks" mz-tooltip *ngIf="processService.left_length" position="bottom"
|
||||
tooltip="Running {{processService.left_length}} tasks."
|
||||
class="process-badge pink-button">{{processService.left_length>100?'99+':processService.left_length}}</span>
|
||||
<span routerLink="tasks" mz-tooltip *ngIf="!processService.left_length&&processService.failed_length"
|
||||
position="bottom" tooltip="{{processService.failed_length}} failed tasks."
|
||||
class="process-badge pink-button red">{{processService.failed_length>100?'99+':processService.failed_length}}</span>
|
||||
<i id="device-settings" routerLink="tools" mz-tooltip
|
||||
class="material-icons white-text no-outline top-menu-bar-icon" position="bottom"
|
||||
tooltip="Device settings & tools">
|
||||
build
|
||||
</i>
|
||||
<i mz-tooltip (click)="commandMenu.style.display = 'block';commandMenuBack.style.display = 'block'" class="material-icons white-text no-outline top-menu-bar-icon"
|
||||
position="bottom" tooltip="Run ADB commands">
|
||||
input
|
||||
</i>
|
||||
<i (click)="openDebugger()" id="open-debugger" mz-tooltip class="material-icons white-text top-menu-bar-icon"
|
||||
position="bottom" tooltip="Open debugger">
|
||||
bug_report
|
||||
</i>
|
||||
<i (click)="minimizeApp()" mz-tooltip class="material-icons white-text no-outline" position="bottom"
|
||||
tooltip="Minimize SideQuest.">
|
||||
minimize
|
||||
</i>
|
||||
<i (click)="maximizeApp()" mz-tooltip class="material-icons white-text no-outline" position="bottom"
|
||||
tooltip="Toggle Maximize.">
|
||||
aspect_ratio
|
||||
</i>
|
||||
<i (click)="closeAppModal.openModal()" mz-tooltip class="material-icons white-text no-outline" position="bottom"
|
||||
tooltip="Close SideQuest.">
|
||||
close
|
||||
</i>
|
||||
</div>
|
||||
<div id="connection-status-container">
|
||||
<i mz-tooltip class="material-icons white-text no-outline connection-device-select pointer"
|
||||
*ngIf="adbService.devices && adbService.devices.length > 1"
|
||||
(click)="deviceMenu.style.display = 'block';deviceMenuBack.style.display = 'block'"
|
||||
position="bottom" tooltip="Select Device">
|
||||
arrow_drop_down
|
||||
</i>
|
||||
<div id="connection-status" class="connection-status-unauthorized" mz-tooltip
|
||||
position="bottom" [ngClass]="adbService.connectionCss" [tooltip]="'Device connection status.'">
|
||||
<div id="connection-status-message" [innerHTML]="appService.versionName+' '+adbService.deviceStatusMessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="appService.showBrowserBar" class="beast-saber-buttons">
|
||||
<a class="waves-effect waves-light synthrideerz"
|
||||
(click)="webService.loadUrl('https://synthriderz.com/beatmaps/recent')">
|
||||
<img src="assets/images/Synth.png" class="responsive-img" /></a>
|
||||
</div>
|
||||
<div *ngIf="appService.isFilesOpen" class="beast-saber-buttons">
|
||||
<ng-container *ngFor="let favourite of favourites.fileFavourites">
|
||||
<a href="javascript:void(0)" class="waves-effect waves-light synthrideerz margin-right"
|
||||
(click)="appService.filesComponent.open(favourite.uri)"
|
||||
mz-tooltip tooltip="{{favourite.name}}">
|
||||
<img *ngIf="favourite.icon" src="{{favourite.icon}}" class="responsive-img" /></a>
|
||||
</ng-container>
|
||||
<ng-container>
|
||||
<a href="javascript:void(0)" class="btn-floating pink-button waves-effect waves-light" mz-tooltip tooltip="Manage"
|
||||
(click)="manageFavs.openModal(); favouriteMax = 10; favoritePathType = 'Url';"><i class="material-icons">add</i></a>
|
||||
</ng-container>
|
||||
|
||||
</div>
|
||||
<div class="sync-songs" *ngIf="appService.showTaskActions">
|
||||
<div class="waves-effect waves-light btn small-button pink-button" mz-tooltip position="bottom"
|
||||
tooltip="Clear out the finished tasks." (click)="processService.clearDone()">
|
||||
Clear Done
|
||||
</div>
|
||||
|
||||
<div class="waves-effect waves-light btn small-button pink-button" mz-tooltip position="bottom"
|
||||
tooltip="Restart the failed tasks." (click)="processService.retryFailed()">
|
||||
Retry Failed
|
||||
</div>
|
||||
|
||||
<div class="waves-effect waves-light btn small-button pink-button" mz-tooltip position="bottom"
|
||||
tooltip="Clear out the failed tasks." (click)="processService.clearFailed()">
|
||||
Clear Failed
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="searchFilterContainer" *ngIf="appService.showSearch">
|
||||
<div class="search" *ngIf="false">
|
||||
<div class="input-field inline search-box">
|
||||
<input id="searchBox" class="input-dark-theme" type="text" />
|
||||
<label for="searchBox" class="active label-dark-theme">
|
||||
Search
|
||||
</label>
|
||||
</div>
|
||||
<a class="waves-effect waves-dark btn search-button-margin white black-text">search</a>
|
||||
<a class="waves-effect waves-dark btn search-button-margin white black-text" (click)="selectAppToInstall()">Pick
|
||||
APK/OBB</a>
|
||||
</div>
|
||||
<div class="filters" style="display: none">
|
||||
<div class="input-field inline filter ">
|
||||
<select id="filterDropdown">
|
||||
<option>All</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mz-modal #bookmarksModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Web Browser</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
<div class="center-align">
|
||||
<h5>Custom Url</h5>
|
||||
<div class="input-field inline browser-input">
|
||||
<input id="web_address" type="text" [(ngModel)]="webService.currentAddress" (keyup)="gogo($event)"
|
||||
placeholder="Address" />
|
||||
<label class="active label-dark-theme" for="web_address">
|
||||
Address
|
||||
</label>
|
||||
</div>
|
||||
<a class="waves-effect waves-dark btn search-button-margin white black-text" routerLink="/webview"
|
||||
(click)="webService.loadUrl(webService.currentAddress);" mz-modal-close>Open</a>
|
||||
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close routerLink="/webview" (click)="webService.loadUrl('https://sidequestvr.com');" >SideQuest Home</button>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #wifiModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Wireless</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
<div class="center-align">
|
||||
Enable wifi mode to install apps wirelessly.<br>
|
||||
<div class="chip">Experimental</div>
|
||||
<br><br><br>
|
||||
<i mz-tooltip class="material-icons large cursor" [ngClass]="{'green-text':adbService.wifiEnabled}"
|
||||
(click)="adbService.wifiEnabled=!adbService.wifiEnabled;adbService.toggleWifiMode()" position="bottom"
|
||||
tooltip="Enable wireless mode. (Experimental)">
|
||||
wifi
|
||||
</i>
|
||||
<br>
|
||||
<br>
|
||||
<div>
|
||||
<h5>Device IP:</h5>
|
||||
{{adbService.deviceIp}}<br>
|
||||
<a class="waves-effect waves-dark btn search-button-margin white black-text" mz-modal-close
|
||||
(click)="connectWifi()">Connect</a>
|
||||
<br><br>
|
||||
<a class="waves-effect waves-dark btn search-button-margin white black-text" mz-modal-close
|
||||
(click)="adbCommandToRun = 'adb disconnect';runAdbCommand()">Reset</a>
|
||||
</div>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<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>
|
||||
<h4>ADB Logcat</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Select your options and click start to begin receiving logcat messages.
|
||||
<br><br>
|
||||
<div class="button-section">
|
||||
<div class="code logcat-block">
|
||||
<div *ngIf="!currentLogCat.length">
|
||||
{{isStarted ? 'Waiting for messages...' : 'Click start to begin streaming logcat messages.'}}
|
||||
</div>
|
||||
<div *ngFor="let logcat of currentLogCat">
|
||||
<div class="row no-margin">
|
||||
<div class="col s2 logcat-smaller green-text no-padding">{{logcat.date}}: {{priorities[logcat.priority]}}</div>
|
||||
<div class="col s2 logcat-smaller purple-text no-padding">{{logcat.tid}}/{{logcat.pid}} {{logcat.tag}} </div>
|
||||
<div class="col s8 logcat-small no-padding"
|
||||
[ngClass]="{'red-text': logcat.priority === 6, 'orange-text': logcat.priority === 5}" [innerHTML]="logcat.message">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="row">
|
||||
<div class="col s6">
|
||||
<input id="logcatSearch" type="text" [(ngModel)]="logcatSearch" placeholder="Search/Tag Filter" />
|
||||
</div>
|
||||
<div class="col s3">
|
||||
<select class="browser-default" [(ngModel)]="logcatPriority">
|
||||
<option disabled>Priority</option>
|
||||
<option value="unknown">unknown</option>
|
||||
<option value="default">default</option>
|
||||
<option value="verbose">verbose</option>
|
||||
<option value="debug">debug</option>
|
||||
<option value="info">info</option>
|
||||
<option value="warn">warn</option>
|
||||
<option value="error">error</option>
|
||||
<option value="fatal">fatal</option>
|
||||
<option value="silent">silent</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col s3"><button mz-button class="green" (click)="startLogcat(); isStarted = true;">{{isStarted?'Restart':'Start'}}</button></div>
|
||||
</div>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
|
||||
<mz-modal #safeModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Harmful Content Detected!!</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
|
||||
<img class="right margin-left" src="assets/images/bigman.gif" style="width: 430px"/>
|
||||
WARNING: We have stopped this install because it may may harm your device.
|
||||
<br><br>
|
||||
If you continue with the install you risk the following:<br><br>
|
||||
- Causing physical damage to your headset.<br>
|
||||
- Having your personal information stolen ( including tracking your movments in VR )<br>
|
||||
- Being banned from the Oculus platform.<br>
|
||||
- Loosing access to developer/experimental mode on your headset.<br>
|
||||
- Loosing access to your content library including paid games and apps.<br>
|
||||
- Being banned from creating Oculus Accounts in the future.<br>
|
||||
- Being reported to the police for illegal activites.<br>
|
||||
- Starving poor developers to death.<br><br>
|
||||
You can click "Back to Safety" and the harmful content will not make it onto your device.
|
||||
<br><br>
|
||||
Thank you and have a great day!
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button mz-modal-close [flat]="true" (click)="safeResolve('DoInstall')">Continue ( Not Recommended )</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="safeResolve('DontInstall')">Back to Safety</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
<mz-modal #adbModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Run ADB Command</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Run an ADB command from here to be able to see the output. Use this to troubleshoot issues or perform advanced
|
||||
operations.
|
||||
|
||||
<br><br>
|
||||
<div class="button-section">
|
||||
<div class="input-field">
|
||||
<input id="adbCommand" type="text" [(ngModel)]="adbCommandToRun" placeholder="Command To Run..." />
|
||||
</div>
|
||||
<code>
|
||||
<pre *ngIf="adbService.adbResponse">{{adbService.adbResponse}}</pre>
|
||||
</code>
|
||||
</div>
|
||||
<br>
|
||||
<ng-container *ngFor="let favourite of favourites.commandFavourites">
|
||||
<span class="chip margin-right pointer" (click)="adbService.runAdbCommand(favourite.uri)"><img *ngIf="favourite.icon" src="{{favourite.icon}}"/>{{favourite.name}}</span>
|
||||
</ng-container>
|
||||
<br><br>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" (click)="runAdbCommand()">Run Command</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
<mz-modal #closeAppModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Close SideQuest</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Are you sure you want to close SideQuest? This will cancel any running tasks.
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Cancel</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="closeApp()">Exit SideQuest Now</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #scrcpyModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Stream Options</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
<div class="row">
|
||||
<div class="col s6 fixed-height">
|
||||
Always On Top
|
||||
<div class="grey-text small">
|
||||
Make scrcpy window always on top (above other windows).
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" [(ngModel)]="scrcpy_options.always_on_top" />
|
||||
<span class="lever"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
Bit Rate
|
||||
<div class="grey-text small">
|
||||
Encode the video at the given bit-rate, expressed in bits/s. Unit suffixes are supported: 'K' (x1000) and 'M'
|
||||
(x1000000).
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 input-field fixed-height">
|
||||
<input id="bit_rate_" [(ngModel)]="scrcpy_options.bit_rate" type="text" />
|
||||
<label for="bit_rate_" class="active">Bit Rate</label>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
Crop
|
||||
<div class="grey-text small">
|
||||
Crop the device screen on the server. The values are expressed in the device natural orientation (typically,
|
||||
portrait for a phone, landscape for a tablet). Any MaxSize value is computed on the cropped size.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 input-field fixed-height">
|
||||
<input id="crop_" [(ngModel)]="scrcpy_options.crop" type="text" />
|
||||
<label for="crop_" class="active">Crop</label>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
Fullscreen
|
||||
<div class="grey-text small">
|
||||
Start in fullscreen.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" [(ngModel)]="scrcpy_options.fullscreen" />
|
||||
<span class="lever"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
No Input
|
||||
<div class="grey-text small">
|
||||
Disable device control (mirror the device in read-only).
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" [(ngModel)]="scrcpy_options.no_control" />
|
||||
<span class="lever"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
Max FPS
|
||||
<div class="grey-text small">
|
||||
Limit the frame rate of screen capture. 0 is unlimited.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 input-field fixed-height">
|
||||
<input id="max_fps_" [(ngModel)]="scrcpy_options.max_fps" type="text" />
|
||||
<label for="max_fps_" class="active">Max FPS</label>
|
||||
</div>
|
||||
<div class="col s6 fixed-height">
|
||||
Max Size
|
||||
<div class="grey-text small">
|
||||
Limit both the width and height of the video to value. The other dimension is computed so that the device
|
||||
aspect-ratio is preserved. 0 is unlimited.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s6 input-field fixed-height">
|
||||
<input id="max_size_" [(ngModel)]="scrcpy_options.max_size" type="text" />
|
||||
<label for="max_size_" class="active">Max Size</label>
|
||||
</div>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="left margin-left"><br>Put your headset on before clicking Start Stream</div>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="runscrcpy()">Start Stream</button>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #manageFavs [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<button mz-button class="right pink-button" (click)="showAddFavourite = !showAddFavourite">{{showAddFavourite? 'Hide' : 'Add New'}}</button>
|
||||
<h4>Manage Favourites</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Manage your favourites here. If you need to undo click RESET at the bottom. When you are done click SAVE.<br><br>
|
||||
<ng-container *ngIf="!favouriteImportExport">
|
||||
<ng-container *ngIf="showAddFavourite"> <h5>Add New</h5>
|
||||
<hr>
|
||||
<div class="no-margin" *ngIf="this.favourites[favoriteType].length >= favouriteMax">
|
||||
You cannot add any more. Please remove some first.
|
||||
</div>
|
||||
<div class="row no-margin" *ngIf="this.favourites[favoriteType].length < favouriteMax">
|
||||
<div class="col s3"><input type="text" placeholder="Name" [(ngModel)]="favoriteName"/></div>
|
||||
<div class="col s4"><input type="text" placeholder="{{favoritePathType}}" [(ngModel)]="favoriteUri"/></div>
|
||||
<div class="col s4"><input type="text" placeholder="Icon Url" [(ngModel)]="favoriteIcon"/></div>
|
||||
<div class="col s1"><i class="material-icons green-text fav-manage-icon pointer"
|
||||
(click)="addToFavorites(favoriteType, favoriteName, favoriteUri, favoriteIcon)">add</i></div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="row fav-padding">
|
||||
<div class="col s4">Name</div>
|
||||
<div class="col s4">{{favoritePathType}}</div>
|
||||
<div class="col s4">Icon Url</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="no-margin" *ngIf="!this.favourites[favoriteType].length">
|
||||
Nothing added here yet, add something below.
|
||||
<br><br>
|
||||
</div>
|
||||
<div dragula="SONGS" [(dragulaModel)]="this.favourites[favoriteType]" >
|
||||
<div class="row fav-padding relative" *ngFor="let fav of this.favourites[favoriteType]; let i = index">
|
||||
<i class="material-icons drag-indicator grey-text">drag_indicator</i>
|
||||
<div class="col s4"><input type="text" [(ngModel)]="fav.name"/></div>
|
||||
<div class="col s4"><input type="text" [(ngModel)]="fav.uri"/></div>
|
||||
<div class="col s4"><input type="text" [(ngModel)]="fav.icon"/></div>
|
||||
<i class="material-icons delete-button orange-text" (click)="removeFromFavourites(favoriteType, i)">close</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close (click)="resetFavourites(favoriteType); showAddFavourite = false;">Cancel</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="saveFavourites(favoriteType); showAddFavourite = false;">Save</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
|
||||
describe('HeaderComponent', () => {
|
||||
let component: HeaderComponent;
|
||||
let fixture: ComponentFixture<HeaderComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HeaderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,310 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
import { AppService, FolderType } from '../app.service';
|
||||
import { WebviewService } from '../webview.service';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
import { RepoService } from '../repo.service';
|
||||
import { BeatOnService } from '../beat-on.service';
|
||||
import { DragAndDropService } from '../drag-and-drop.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { ProcessBucketService } from '../process-bucket.service';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
interface ReplaceText {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
declare const process;
|
||||
interface FavouriteItem {
|
||||
name: string;
|
||||
uri: string;
|
||||
icon?: string;
|
||||
}
|
||||
interface LogCatEntry {
|
||||
date: string;
|
||||
message: string;
|
||||
pid: number;
|
||||
tid: number;
|
||||
tag: string;
|
||||
priority: number;
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.css'],
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
@ViewChild('header', { static: false }) header;
|
||||
@ViewChild('bookmarksModal', { static: false }) bookmarksModal;
|
||||
@ViewChild('beatOnModal', { static: false }) beatOnModal;
|
||||
@ViewChild('mainLogo', { static: false }) mainLogo;
|
||||
@ViewChild('safeModal', { static: false }) safeModal;
|
||||
safeResolve: any = val => val;
|
||||
folder = FolderType;
|
||||
addrepoUrl: string = '';
|
||||
colorA: string;
|
||||
colorB: string;
|
||||
beatOnLoading: boolean;
|
||||
isAlive: boolean = true;
|
||||
isAliveChecking: boolean = false;
|
||||
replaceText: ReplaceText[] = [];
|
||||
addkey: string;
|
||||
addvalue: string;
|
||||
adbCommandToRun: string;
|
||||
osPlatform: string;
|
||||
favourites: {
|
||||
browserFavourites: FavouriteItem[];
|
||||
fileFavourites: FavouriteItem[];
|
||||
commandFavourites: FavouriteItem[];
|
||||
} = {
|
||||
browserFavourites: [],
|
||||
fileFavourites: [],
|
||||
commandFavourites: [],
|
||||
};
|
||||
favoriteName: string;
|
||||
favoriteUri: string;
|
||||
favoriteIcon: string;
|
||||
favoriteType = 'fileFavourites';
|
||||
favoritePathType = 'Path';
|
||||
favouriteImportExport: boolean;
|
||||
favouriteMax: number;
|
||||
scrcpy_options: any = {
|
||||
always_on_top: false,
|
||||
bit_rate: '8000000',
|
||||
crop: '1280:720:1500:350',
|
||||
no_control: true,
|
||||
fullscreen: false,
|
||||
max_size: '0',
|
||||
max_fps: '0',
|
||||
};
|
||||
// BAG = 'FAVS';
|
||||
subs = new Subscription();
|
||||
logcatTag: string = '';
|
||||
logcatSearch: string = '';
|
||||
logcatPriority: string = 'debug';
|
||||
priorities = {
|
||||
0: 'unknown',
|
||||
1: 'default',
|
||||
2: 'verbose',
|
||||
3: 'debug',
|
||||
4: 'info',
|
||||
5: 'warn',
|
||||
6: 'error',
|
||||
7: 'fatal',
|
||||
8: 'silent',
|
||||
};
|
||||
currentLogCat: LogCatEntry[] = [];
|
||||
isStarted: boolean;
|
||||
showAddFavourite: boolean;
|
||||
constructor(
|
||||
public adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public webService: WebviewService,
|
||||
public spinnerService: LoadingSpinnerService,
|
||||
public statusService: StatusBarService,
|
||||
public repoService: RepoService,
|
||||
public beatonService: BeatOnService,
|
||||
public dragAndDropService: DragAndDropService,
|
||||
// private dragulaService: DragulaService,
|
||||
public router: Router,
|
||||
public processService: ProcessBucketService
|
||||
) {
|
||||
this.osPlatform = this.appService.os.platform();
|
||||
this.resetFavourites('browserFavourites');
|
||||
this.resetFavourites('fileFavourites');
|
||||
this.resetFavourites('commandFavourites');
|
||||
this.appService.headerComponent = this;
|
||||
}
|
||||
resetFavourites(type: string) {
|
||||
let defaultFavs;
|
||||
switch (type) {
|
||||
case 'commandFavourites':
|
||||
defaultFavs = `[
|
||||
{"name":"List Devices", "uri": "adb devices", "icon": ""},
|
||||
{"name":"Enable USB ADB", "uri": "adb usb", "icon": ""},
|
||||
{"name":"Disconnect Everything", "uri": "adb disconnect", "icon": ""},
|
||||
{"name":"Reset ADB", "uri": "adb kill-server", "icon": ""},
|
||||
{"name":"Reboot Headset", "uri": "adb reboot", "icon": ""}
|
||||
]`;
|
||||
break;
|
||||
case 'browserFavourites':
|
||||
defaultFavs = '[]';
|
||||
break;
|
||||
case 'fileFavourites':
|
||||
defaultFavs = `[
|
||||
{"name":"SynthRiders", "uri": "/sdcard/Android/data/com.kluge.SynthRiders/files/CustomSongs/", "icon": "https://i.imgur.com/LjK7Z3o.png"},
|
||||
{"name":"Song Beater", "uri": "/sdcard/Android/data/com.playito.songbeater/CustomSongs/", "icon": "https://i.imgur.com/dOx0OEl.png"},
|
||||
{"name":"VRtuos", "uri": "/sdcard/Android/data/com.PavelMarceluch.VRtuos/files/Midis/", "icon": "https://i.imgur.com/7G0OpJi.png"},
|
||||
{"name":"Audica", "uri": "/sdcard/Audica/", "icon": "https://i.imgur.com/40sUjye.png"},
|
||||
{"name":"OhShape", "uri": "/sdcard/OhShape/Songs/", "icon": "https://i.imgur.com/yIu0sSQ.png"},
|
||||
{"name":"Oculus", "uri": "/sdcard/Oculus/", "icon": "https://i.imgur.com/LORDvYK.png"}
|
||||
]`;
|
||||
}
|
||||
this.favourites[type] = localStorage.getItem(type) || defaultFavs;
|
||||
this.favourites[type] = JSON.parse(this.favourites[type]);
|
||||
}
|
||||
|
||||
removeFromFavourites(type: string, index: number) {
|
||||
this.favourites[type] = this.favourites[type].filter((f, i) => i !== index);
|
||||
}
|
||||
|
||||
addToFavorites(type: string, name: string, uri: string, icon: string) {
|
||||
const favourite = { name, uri, icon };
|
||||
const favouriteList = this.favourites[type];
|
||||
if (favouriteList) {
|
||||
favouriteList.push(favourite);
|
||||
}
|
||||
}
|
||||
|
||||
saveFavourites(type: string) {
|
||||
localStorage.setItem(type, JSON.stringify(this.favourites[type]));
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
runAdbCommand() {
|
||||
return this.adbService.runAdbCommand(this.adbCommandToRun);
|
||||
}
|
||||
connectWifi() {
|
||||
this.adbCommandToRun = 'adb tcpip 5555';
|
||||
this.adbService.deviceStatusMessage = 'Attempting wifi connection...';
|
||||
(this.isConnected() ? this.runAdbCommand() : Promise.resolve()).then(() => {
|
||||
setTimeout(() => {
|
||||
this.adbCommandToRun = 'adb connect ' + this.adbService.deviceIp + ':5555';
|
||||
this.runAdbCommand();
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
isConnected() {
|
||||
return this.adbService.deviceStatus === ConnectionStatus.CONNECTED;
|
||||
}
|
||||
|
||||
updateAvailable() {
|
||||
if (process.platform == 'win32') {
|
||||
this.spinnerService.setMessage('Downloading update...');
|
||||
this.spinnerService.showLoader();
|
||||
this.appService.electron.ipcRenderer.send('automatic-update', {});
|
||||
} else {
|
||||
this.appService.opn('https://sidequestvr.com/#/download');
|
||||
}
|
||||
}
|
||||
|
||||
startLogcat() {
|
||||
this.currentLogCat.length = 0;
|
||||
this.adbService.adbCommand(
|
||||
'logcat',
|
||||
{ serial: this.adbService.deviceSerial, tag: '*', priority: this.logcatPriority },
|
||||
stats => {
|
||||
stats.message = stats.message
|
||||
.split('\n')
|
||||
.join('<br>')
|
||||
.split('\t')
|
||||
.join(' ');
|
||||
if (this.logcatSearch) {
|
||||
if (!!~stats.message.indexOf(this.logcatSearch) || !!~stats.tag.indexOf(this.logcatSearch)) {
|
||||
this.currentLogCat.unshift(stats);
|
||||
}
|
||||
} else {
|
||||
this.currentLogCat.unshift(stats);
|
||||
}
|
||||
if (this.currentLogCat.length > 200) {
|
||||
this.currentLogCat.length = 200;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
stopLogcat() {
|
||||
this.adbService.adbCommand('endLogcat');
|
||||
}
|
||||
|
||||
runscrcpy() {
|
||||
this.appService
|
||||
.runScrCpy(this.scrcpy_options)
|
||||
.then(() => this.statusService.showStatus('Stream closed.'))
|
||||
.catch(e => this.statusService.showStatus('ScrCpy Error: ' + JSON.stringify(e), true));
|
||||
}
|
||||
|
||||
gogo(e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.webService.loadUrl(this.webService.currentAddress);
|
||||
this.bookmarksModal.closeModal();
|
||||
}
|
||||
}
|
||||
addCurrentFavourite() {
|
||||
this.appService.request(
|
||||
'https://i.olsh.me/allicons.json?url=' + this.webService.currentAddress,
|
||||
(error, response, body) => {
|
||||
let json: any = {};
|
||||
try {
|
||||
json = JSON.parse(response.body);
|
||||
} catch (e) {}
|
||||
this.favourites.browserFavourites.unshift({
|
||||
name: this.webService.getTitle(),
|
||||
uri: this.webService.currentAddress,
|
||||
icon: json && json.icons && json.icons.length ? json.icons[0].url : '',
|
||||
});
|
||||
this.saveFavourites('browserFavourites');
|
||||
}
|
||||
);
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
//this.appService.setTitleEle(this.header.nativeElement);
|
||||
//this.dragAndDropService.setupDragAndDrop(this.mainLogo.nativeElement);
|
||||
}
|
||||
closeApp() {
|
||||
this.appService.remote.getCurrentWindow().close();
|
||||
}
|
||||
pingHeadset() {
|
||||
this.isAlive = true;
|
||||
}
|
||||
minimizeApp() {
|
||||
this.appService.remote.getCurrentWindow().minimize();
|
||||
}
|
||||
maximizeApp() {
|
||||
const win = this.appService.remote.getCurrentWindow();
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
}
|
||||
openDebugger() {
|
||||
this.appService.remote.getCurrentWindow().toggleDevTools();
|
||||
}
|
||||
selectAppToInstall() {
|
||||
this.appService.electron.remote.dialog.showOpenDialog(
|
||||
{
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
},
|
||||
files => {
|
||||
files.forEach(filepath => {
|
||||
this.adbService.savePath = this.appService.path.dirname(filepath);
|
||||
let install = this.adbService.installMultiFile(filepath);
|
||||
if (install) {
|
||||
install.catch(e => {
|
||||
this.statusService.showStatus(e.toString(), true);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
confirmRestore() {
|
||||
this.spinnerService.showLoader();
|
||||
this.spinnerService.setMessage('Restoring BMBF<br>Please Wait...');
|
||||
this.beatonService.confirmRestore(this.adbService).then(r => {
|
||||
this.spinnerService.hideLoader();
|
||||
this.statusService.showStatus('BMBF Restored Successfully!!');
|
||||
this.beatOnModal.openModal();
|
||||
this.beatonService.checkHasRestore(this.adbService);
|
||||
});
|
||||
}
|
||||
installAPK(name: string) {
|
||||
return this.adbService.installAPK(this.appService.path.join(this.appService.appData, name), true, true);
|
||||
}
|
||||
removeText(text) {
|
||||
this.replaceText = this.replaceText.filter(d => d !== text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<span class="link" [ngClass]="{'link-white':appService.currentTheme === 'dark' && !isDark}" (click)="open()">{{text}}</span>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LinkComponent } from './link.component';
|
||||
|
||||
describe('LinkComponent', () => {
|
||||
let component: LinkComponent;
|
||||
let fixture: ComponentFixture<LinkComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LinkComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LinkComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { AppService } from '../app.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-link',
|
||||
templateUrl: './link.component.html',
|
||||
styleUrls: ['./link.component.css']
|
||||
})
|
||||
export class LinkComponent implements OnInit {
|
||||
@Input('url') url:string;
|
||||
@Input('text') text:string;
|
||||
@Input('isDark') isDark:boolean;
|
||||
constructor(public appService:AppService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
open(){
|
||||
console.log(this.url);
|
||||
this.appService.opn(this.url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<div class="loader-small"></div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoadingSpinnerSmallComponent } from './loading-spinner-small.component';
|
||||
|
||||
describe('LoadingSpinnerSmallComponent', () => {
|
||||
let component: LoadingSpinnerSmallComponent;
|
||||
let fixture: ComponentFixture<LoadingSpinnerSmallComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoadingSpinnerSmallComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoadingSpinnerSmallComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loading-spinner-small',
|
||||
templateUrl: './loading-spinner-small.component.html',
|
||||
styleUrls: ['./loading-spinner-small.component.css']
|
||||
})
|
||||
export class LoadingSpinnerSmallComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
|
||||
describe('LoadingSpinnerService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: LoadingSpinnerService = TestBed.get(LoadingSpinnerService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LoadingSpinnerService {
|
||||
spinner: LoadingSpinnerComponent;
|
||||
constructor() {}
|
||||
setSpinner(spinner: LoadingSpinnerComponent) {
|
||||
this.spinner = spinner;
|
||||
}
|
||||
setMessage(message, task?) {
|
||||
if (this.spinner) {
|
||||
// if(this.processService.tasks.length){
|
||||
// this.processService.tasks[0].status = message;
|
||||
// }
|
||||
this.spinner.loadingMessage = message;
|
||||
this.spinner.loadingTask = task;
|
||||
}
|
||||
}
|
||||
showDrag() {
|
||||
if (this.spinner) {
|
||||
this.spinner.isLoading = false;
|
||||
this.spinner.isActive = true;
|
||||
}
|
||||
}
|
||||
showLoader() {
|
||||
if (this.spinner) {
|
||||
this.spinner.isLoading = this.spinner.isActive = true;
|
||||
}
|
||||
}
|
||||
hideLoader() {
|
||||
if (this.spinner) {
|
||||
this.spinner.isLoading = this.spinner.isActive = false;
|
||||
this.spinner.loadingTask = null;
|
||||
}
|
||||
}
|
||||
setupConfirm() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.spinner.isConfirm = true;
|
||||
this.spinner.confirmResolve = resolve;
|
||||
this.spinner.confirmReject = reject;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
.spinner,
|
||||
.spinner-drag {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10;
|
||||
max-width: 500px;
|
||||
}
|
||||
.spinner-background {
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
.well {
|
||||
min-height: 20px;
|
||||
padding: 19px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #e3e3e3;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.well-lg {
|
||||
padding: 24px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="spinner text-center" *ngIf="isActive" >
|
||||
<div class="well well-lg">
|
||||
<div *ngIf="isLoading&&!isConfirm" class="loader-initial"></div>
|
||||
<h5 *ngIf="!isLoading" >Drop file(s) here!</h5>
|
||||
<br />
|
||||
<span class="spinner-loading-message truncate" [innerHTML]="loadingTask ? loadingTask.status : loadingMessage"></span>
|
||||
<div *ngIf="isConfirm">
|
||||
<br><br>
|
||||
<a class="btn waves-effect waves-light red" (click)="cancel()">Cancel</a>
|
||||
<a class="btn waves-effect waves-light pink-button" (click)="confirm()">Continue</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isActive" class="spinner-background"></div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoadingSpinnerComponent } from './loading-spinner.component';
|
||||
|
||||
describe('LoadingSpinnerComponent', () => {
|
||||
let component: LoadingSpinnerComponent;
|
||||
let fixture: ComponentFixture<LoadingSpinnerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoadingSpinnerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoadingSpinnerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loading-spinner',
|
||||
templateUrl: './loading-spinner.component.html',
|
||||
styleUrls: ['./loading-spinner.component.css'],
|
||||
})
|
||||
export class LoadingSpinnerComponent implements OnInit {
|
||||
isActive: boolean;
|
||||
isConfirm: boolean;
|
||||
isLoading: boolean;
|
||||
loadingMessage: string;
|
||||
loadingTask: any;
|
||||
confirmResolve: () => void;
|
||||
confirmReject: () => void;
|
||||
constructor(private spinnerService: LoadingSpinnerService, public changes: ChangeDetectorRef) {
|
||||
spinnerService.setSpinner(this);
|
||||
}
|
||||
ngOnInit() {}
|
||||
confirm() {
|
||||
if (this.confirmResolve) {
|
||||
this.confirmResolve();
|
||||
}
|
||||
this.isConfirm = false;
|
||||
this.confirmResolve = null;
|
||||
this.confirmReject = null;
|
||||
this.spinnerService.hideLoader();
|
||||
}
|
||||
cancel() {
|
||||
if (this.confirmReject) {
|
||||
this.confirmReject();
|
||||
}
|
||||
this.isConfirm = false;
|
||||
this.confirmResolve = null;
|
||||
this.confirmReject = null;
|
||||
this.spinnerService.hideLoader();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.package-height {
|
||||
height: 40px;
|
||||
}
|
||||
.package-item{
|
||||
border-bottom: 1px solid #cfcfcf;
|
||||
}
|
||||
.settings{
|
||||
font-size: 2.7rem;
|
||||
float: right;
|
||||
}
|
||||
.chip-padding {
|
||||
padding-top: 3px !important;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="col s10 package-height chip-padding package-item">
|
||||
<span class="chip"><img *ngIf="package.icon" [src]="package.icon">{{package.name?package.name:package.packageName}}</span>
|
||||
</div>
|
||||
<div class="col s2 package-height centered package-item">
|
||||
<i class="material-icons cursor grey-text settings" (click)="openSettings()">settings</i>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PackageItemComponent } from './package-item.component';
|
||||
|
||||
describe('PackageItemComponent', () => {
|
||||
let component: PackageItemComponent;
|
||||
let fixture: ComponentFixture<PackageItemComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PackageItemComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PackageItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { RepoService } from '../repo.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-package-item',
|
||||
templateUrl: './package-item.component.html',
|
||||
styleUrls: ['./package-item.component.css'],
|
||||
})
|
||||
export class PackageItemComponent implements OnInit {
|
||||
@Input('package') package: any;
|
||||
@Output('settings') settings = new EventEmitter();
|
||||
constructor(public repoService: RepoService) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
openSettings() {
|
||||
this.settings.emit({ package: this.package });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
.restore-backup {
|
||||
padding-top: 4px;
|
||||
}
|
||||
.restore-backup i{
|
||||
font-size: 2em;
|
||||
margin-left: 6px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
.show-all {
|
||||
margin-top: 25px;
|
||||
}
|
||||
.small-text{
|
||||
font-size: 0.7rem;
|
||||
line-height: 25px;
|
||||
}
|
||||
#SearchPackage{
|
||||
color: white!important;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
<div class="container">
|
||||
|
||||
<div *ngIf="!isConnected()">
|
||||
<h4
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
No device connected...</h4>
|
||||
</div>
|
||||
<div *ngIf="isConnected()">
|
||||
<div class="row">
|
||||
<div class="input-field col s9">
|
||||
<input id="SearchPackage" [(ngModel)]="search" type="text" />
|
||||
<label for="SearchPackage">Search package</label>
|
||||
</div>
|
||||
<div class="col s3 right-align show-all">
|
||||
<div class="switch">
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="show_all" (change)="setShowAll()" />
|
||||
<span class="lever"></span>
|
||||
Show All
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button" (click)="backupEverything.openModal()">
|
||||
Backup/Restore All</div>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button margin-right" mzTooltip
|
||||
[tooltip]="'Current backup location: ' + appService.backupPath" position="bottom"
|
||||
(click)="pickLocation.openModal()">Change Backup Location</div>
|
||||
<br><br>
|
||||
<div class="row">
|
||||
<ng-container *ngFor="let package of myApps;">
|
||||
<app-package-item *ngIf="!search
|
||||
|| (package.name && package.name.indexOf(search)) > -1
|
||||
|| package.packageName.indexOf(search) > -1" [package]="package"
|
||||
(settings)="currentPackage = $event;appSettingsModal.openModal();getCurrentInstalledInfo()">
|
||||
</app-package-item>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<mz-modal #appSettingsModal [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>App Settings</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
|
||||
|
||||
<br>
|
||||
<div class="row no-margin">
|
||||
<div class="col s7">
|
||||
|
||||
<span class="chip">
|
||||
<img *ngIf="currentPackage.package.icon" [src]="currentPackage.package.icon">
|
||||
{{currentPackage.package.name?currentPackage.package.name:currentPackage.package.packageName}}
|
||||
</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>APK Backups</h4>
|
||||
Backup your APK file from your device.<br><br>
|
||||
<a class="waves-effect waves-light btn backup-this-package margin-right"
|
||||
(click)="backupApk(currentPackage.package.packageName)">Backup APK File</a>
|
||||
<a class="waves-effect waves-light btn"
|
||||
(click)="appService.openFolder(folder.APP_BACKUP,currentPackage.package.packageName)">Open Backups</a><br><br>
|
||||
<div class="row" *ngFor="let backup of backups">
|
||||
<div class="col s1">
|
||||
<div class="chip cursor restore-backup tooltipped" data-position="right" data-tooltip="Restore this backup"
|
||||
(click)="installBackupApk(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>
|
||||
<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">
|
||||
|
||||
<h4>Manage App</h4>
|
||||
<a class="waves-effect waves-light btn green" (click)="launchApp()">Launch App</a><br><br>
|
||||
<a class="waves-effect waves-light btn orange " (click)="forceClose()">Force Close App</a><br><br>
|
||||
<a class="waves-effect waves-light btn orange " (click)="clearData()">Clear App Data</a><br><br>
|
||||
<a class="waves-effect waves-light btn red " (click)="uninstallApk()">Uninstall App</a><br><br>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<h4>Permissions</h4>
|
||||
<div>{{perms && !perms.length ? 'No permissions for this app...' : 'Manage permissions for this app.'}}</div>
|
||||
<br>
|
||||
<div class="row no-margin" *ngFor="let perm of perms">
|
||||
<div class="col s8 small-text">
|
||||
{{perm.display_permission}}
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<div class="switch move-up">
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="perm.enabled" (change)="setPerm(perm)" />
|
||||
<span class="lever"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
|
||||
<mz-modal #backupEverything [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button"
|
||||
(click)="isBackingUp = !isBackingUp;getMyBackups()">{{isBackingUp?'Change To Restore':'Change To Backup'}}</div>
|
||||
{{isBackingUp?'Backup':'Restore'}} Everything
|
||||
</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
{{!isBackingUp?'WARNING: This will copy the latest available backup for each app to your device including the APK and the data files. It may overwrite existing files! This cannot be undone.':''}}
|
||||
<br *ngIf="!isBackingUp"><br *ngIf="!isBackingUp">
|
||||
This process can take a long time to complete, please do not restart SideQuest while the operation is running.
|
||||
Select which apps you want to backup/restore:
|
||||
<div class="clearfix"></div>
|
||||
<div class="waves-effect right waves-light btn pink-button small-button" (click)="selectAll()">Select All</div>
|
||||
<div class="waves-effect right waves-light btn pink-button small-button margin-right" (click)="deSelectAll()">
|
||||
Deselect All</div>
|
||||
<div class="clearfix"></div><br>
|
||||
|
||||
<ng-container *ngIf="!isBackingUp">
|
||||
<div class="row no-margin" *ngFor="let package of myBackups">
|
||||
<div class="col s9">
|
||||
<span class="chip">{{package.name}}</span>
|
||||
</div>
|
||||
<div class="col s3">
|
||||
<div class="switch">
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="package.isRestore" />
|
||||
<span class="lever"></span>
|
||||
Restore
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="isBackingUp">
|
||||
<div class="row no-margin" *ngFor="let package of myApps">
|
||||
<div class="col s9">
|
||||
<span class="chip"><img *ngIf="package.icon"
|
||||
[src]="package.icon">{{package.name?package.name:package.packageName}}</span>
|
||||
</div>
|
||||
<div class="col s3">
|
||||
<div class="switch">
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="package.backupAll" />
|
||||
<span class="lever"></span>
|
||||
Backup
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button"
|
||||
(click)="(isBackingUp?backupAll():restoreAll()); backupEverything.closeModal()">{{isBackingUp?'Run Backup':'Run Restore'}}</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #pickLocation [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Set the save location for backup data.</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
<ng-container>
|
||||
Pick a location on your PC to save backup files:<br><br>
|
||||
<button mz-button class="pink-button" (click)="pickBackupLocation()">Select Location</button><br><br>
|
||||
Current Location: {{appService.backupPath}}
|
||||
</ng-container>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Done</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PackagesComponent } from './packages.component';
|
||||
|
||||
describe('PackagesComponent', () => {
|
||||
let component: PackagesComponent;
|
||||
let fixture: ComponentFixture<PackagesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PackagesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PackagesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,272 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
import { AppService, FolderType } from '../app.service';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { RepoService } from '../repo.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-packages',
|
||||
templateUrl: './packages.component.html',
|
||||
styleUrls: ['./packages.component.css'],
|
||||
})
|
||||
export class PackagesComponent implements OnInit {
|
||||
@ViewChild('appSettingsModal', { static: false }) appSettingsModal;
|
||||
|
||||
folder = FolderType;
|
||||
currentPackage: any = { package: { packageName: '', name: '', icon: '' }, versionCode: 0 };
|
||||
routerPackage: string;
|
||||
backups: string[];
|
||||
dataBackups: string[];
|
||||
myApps: any[];
|
||||
myBackups: any[];
|
||||
isBackingUp = true;
|
||||
isOpen: boolean;
|
||||
sub: Subscription;
|
||||
show_all: boolean;
|
||||
search: string;
|
||||
savePath: string;
|
||||
perms: any;
|
||||
constructor(
|
||||
public adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public spinnerService: LoadingSpinnerService,
|
||||
public statusService: StatusBarService,
|
||||
private repoService: RepoService,
|
||||
router: Router,
|
||||
route: ActivatedRoute
|
||||
) {
|
||||
appService.webService.isWebviewOpen = false;
|
||||
appService.resetTop();
|
||||
appService.isPackagesOpen = true;
|
||||
this.appService.setTitle('Installed Apps');
|
||||
this.sub = router.events.subscribe(val => {
|
||||
if (val instanceof NavigationEnd) {
|
||||
this.routerPackage = route.snapshot.paramMap.get('packageName');
|
||||
}
|
||||
});
|
||||
this.show_all = !!localStorage.getItem('packages_show_all');
|
||||
}
|
||||
|
||||
setShowAll() {
|
||||
if (this.show_all) {
|
||||
localStorage.setItem('packages_show_all', 'true');
|
||||
} else {
|
||||
localStorage.removeItem('packages_show_all');
|
||||
}
|
||||
this.isOpen = false;
|
||||
}
|
||||
|
||||
deSelectAll() {
|
||||
if (this.isBackingUp) {
|
||||
this.myApps.forEach(a => (a.backupAll = false));
|
||||
} else {
|
||||
this.myBackups.forEach(a => (a.isRestore = false));
|
||||
}
|
||||
}
|
||||
|
||||
selectAll() {
|
||||
if (this.isBackingUp) {
|
||||
this.myApps.forEach(a => (a.backupAll = true));
|
||||
} else {
|
||||
this.myBackups.forEach(a => (a.isRestore = true));
|
||||
}
|
||||
}
|
||||
|
||||
setPerm(perm) {
|
||||
this.adbService.setPermission(this.currentPackage.package.packageName, perm.permission, !perm.enabled);
|
||||
}
|
||||
|
||||
pickBackupLocation() {
|
||||
this.appService.electron.remote.dialog.showOpenDialog(
|
||||
{
|
||||
properties: ['openDirectory'],
|
||||
defaultPath: this.appService.backupPath,
|
||||
},
|
||||
files => {
|
||||
if (files !== undefined && files.length === 1) {
|
||||
this.appService.backupPath = files[0];
|
||||
localStorage.setItem('backup-path', this.appService.backupPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
backupAll() {
|
||||
this.myApps
|
||||
.filter(d => d.backupAll)
|
||||
.forEach(d => {
|
||||
this.backupApk(d.packageName).then(() => this.backupData(d.packageName));
|
||||
});
|
||||
this.statusService.showStatus('Backing up all the selected apps. Check the Tasks screen for more information.');
|
||||
}
|
||||
|
||||
restoreAll() {
|
||||
this.myBackups
|
||||
.filter(d => d.isRestore)
|
||||
.forEach((d: any) => {
|
||||
if (d.dataBackups.length) {
|
||||
this.adbService.restoreDataBackup(d.name, this.showBackupFileName(d.dataBackups[0]));
|
||||
}
|
||||
if (d.backups.length) {
|
||||
this.adbService.installAPK(d.backups[0], true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
isConnected() {
|
||||
let isConnected = this.adbService.deviceStatus === ConnectionStatus.CONNECTED;
|
||||
if (isConnected && !this.isOpen) {
|
||||
this.isOpen = true;
|
||||
this.adbService
|
||||
.getPackages(this.show_all)
|
||||
.then(() => {
|
||||
this.myApps = this.adbService.devicePackages
|
||||
.map(p => {
|
||||
if (this.repoService.allApps[p]) {
|
||||
return {
|
||||
name: this.repoService.allApps[p].name,
|
||||
icon: this.repoService.allApps[p].icon,
|
||||
packageName: p,
|
||||
};
|
||||
}
|
||||
return {
|
||||
packageName: p,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => {
|
||||
let textA = (a.name || a.packageName).toUpperCase();
|
||||
let textB = (b.name || b.packageName).toUpperCase();
|
||||
return textA < textB ? -1 : textA > textB ? 1 : 0;
|
||||
});
|
||||
this.myApps.forEach(p => {
|
||||
if (this.routerPackage && p.packageName === this.routerPackage) {
|
||||
this.currentPackage.package = p;
|
||||
}
|
||||
});
|
||||
|
||||
if (
|
||||
this.currentPackage.package.packageName &&
|
||||
~this.adbService.devicePackages.indexOf(this.currentPackage.package.packageName)
|
||||
) {
|
||||
this.appSettingsModal.openModal();
|
||||
} else if (this.currentPackage.package.packageName) {
|
||||
this.statusService.showStatus(
|
||||
'App not installed...' + (this.currentPackage.package ? this.currentPackage.package.packageName : ''),
|
||||
true
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.statusService.showStatus(
|
||||
'Warning: Cannot retrieve information from the headset, try another USB cable or port. Try a USB2 port.',
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
return isConnected;
|
||||
}
|
||||
ngAfterViewInit() {}
|
||||
|
||||
async getBackupFiles(file) {
|
||||
file.isDirectory = this.appService.fs.lstatSync(file.path).isDirectory();
|
||||
if (file.isDirectory) {
|
||||
file.backups = await this.adbService.getBackups(file.name);
|
||||
file.dataBackups = await this.adbService.getDataBackups(file.name);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
getMyBackups() {
|
||||
if (this.isBackingUp) return;
|
||||
let backupPath = this.appService.path.join(this.appService.backupPath);
|
||||
let backups = this.appService.fs
|
||||
.readdirSync(backupPath)
|
||||
.map(file => ({ name: file, path: this.appService.path.join(backupPath, file), isRestore: false }));
|
||||
Promise.all(backups.map((file: any) => this.getBackupFiles(file))).then(files => {
|
||||
this.myBackups = files.filter((file: any) => {
|
||||
return file.isDirectory && (file.backups.length || file.dataBackups.length);
|
||||
});
|
||||
});
|
||||
}
|
||||
getCurrentInstalledInfo() {
|
||||
this.adbService
|
||||
.getBackups(this.currentPackage.package.packageName)
|
||||
.then(backups => (this.backups = backups))
|
||||
.then(() => this.adbService.getAppVersionCode(this.currentPackage.package.packageName))
|
||||
.then(version => (this.currentPackage.versionCode = version))
|
||||
.then(() => this.adbService.getPackagePermissions(this.currentPackage.package.packageName))
|
||||
.then(perms => {
|
||||
perms.forEach((p: any) => {
|
||||
const perm_split = p.permission.split('.');
|
||||
p.display_permission = perm_split[perm_split.length - 1];
|
||||
});
|
||||
this.perms = perms;
|
||||
})
|
||||
.then(() => this.adbService.getDataBackups(this.currentPackage.package.packageName))
|
||||
.then(dataBackups => (this.dataBackups = dataBackups));
|
||||
}
|
||||
async backupApk(packageName: string) {
|
||||
this.appSettingsModal.closeModal();
|
||||
let location = await this.adbService.getPackageLocation(packageName);
|
||||
this.adbService.backupPackage(location, packageName).then(savePath => {
|
||||
// if (
|
||||
// packageName === this.bsaberService.beatSaberPackage &&
|
||||
// !this.bsaberService.backupExists()
|
||||
// ) {
|
||||
// this.appService.fs.copyFileSync(savePath, this.appService.path.join(this.appService.appData, 'bsaber-base.apk'));
|
||||
// this.appService.fs.copyFileSync(
|
||||
// savePath,
|
||||
// this.appService.path.join(this.appService.appData, 'bsaber-base_patched.apk')
|
||||
// );
|
||||
// }
|
||||
});
|
||||
}
|
||||
backupData(packageName) {
|
||||
this.appSettingsModal.closeModal();
|
||||
this.adbService.makeDataBackup(packageName);
|
||||
}
|
||||
showBackupFileName(file) {
|
||||
return this.appService.path.basename(file);
|
||||
}
|
||||
restoreBackup(backup: string) {
|
||||
this.appSettingsModal.closeModal();
|
||||
this.adbService
|
||||
.restoreDataBackup(this.currentPackage.package.packageName, backup)
|
||||
.then(() => this.statusService.showStatus('Backup restored ok!!'));
|
||||
}
|
||||
installBackupApk(filePath) {
|
||||
this.appSettingsModal.closeModal();
|
||||
this.adbService.installAPK(filePath, true);
|
||||
}
|
||||
uninstallApk() {
|
||||
this.appSettingsModal.closeModal();
|
||||
this.adbService.uninstallAPK(this.currentPackage.package.packageName);
|
||||
}
|
||||
launchApp() {
|
||||
this.adbService.launchApp(this.currentPackage.package.packageName);
|
||||
}
|
||||
forceClose() {
|
||||
this.adbService
|
||||
.adbCommand('shell', {
|
||||
serial: this.adbService.deviceSerial,
|
||||
command: 'am force-stop ' + this.currentPackage.package.packageName,
|
||||
})
|
||||
.then(r => {
|
||||
this.statusService.showStatus('Force Close Sent!!');
|
||||
});
|
||||
}
|
||||
clearData() {
|
||||
this.adbService
|
||||
.adbCommand('clear', {
|
||||
serial: this.adbService.deviceSerial,
|
||||
packageName: this.currentPackage.package.packageName,
|
||||
})
|
||||
.then(r => {
|
||||
this.statusService.showStatus('Clear Data Sent!!');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProcessBucketService } from './process-bucket.service';
|
||||
|
||||
describe('ProcessBucketService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: ProcessBucketService = TestBed.get(ProcessBucketService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,147 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
export interface ProcessTask {
|
||||
key: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
status?: string;
|
||||
running?: boolean;
|
||||
fail_once?: boolean;
|
||||
percent?: string;
|
||||
failed?: boolean;
|
||||
succeeded?: boolean;
|
||||
cancelled?: boolean;
|
||||
resolve: (task: ProcessTask) => Promise<void>;
|
||||
}
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ProcessBucketService {
|
||||
tasks: ProcessTask[];
|
||||
is_running: boolean;
|
||||
left_length: number;
|
||||
failed_length: number;
|
||||
constructor(private statusService: StatusBarService) {
|
||||
this.tasks = [];
|
||||
this.processBucket();
|
||||
}
|
||||
|
||||
addItem(name, resolve) {
|
||||
const key = (<any>window).require('uuid/v4')();
|
||||
const status = 'Waiting...';
|
||||
let icon = 'list';
|
||||
let _name = 'app install';
|
||||
switch (name) {
|
||||
case 'song_download':
|
||||
icon = 'library_music';
|
||||
_name = 'song download';
|
||||
break;
|
||||
case 'file_install':
|
||||
_name = 'file install';
|
||||
icon = 'cloud_download';
|
||||
break;
|
||||
case 'apk_install':
|
||||
icon = 'cloud_download';
|
||||
_name = 'app install';
|
||||
break;
|
||||
case 'apk_uninstall':
|
||||
icon = 'remove_circle_outline';
|
||||
_name = 'app uninstall';
|
||||
break;
|
||||
case 'backup_package':
|
||||
icon = 'move_to_inbox';
|
||||
_name = 'app backup';
|
||||
break;
|
||||
case 'save_files':
|
||||
icon = 'archive';
|
||||
_name = 'app data backup';
|
||||
break;
|
||||
case 'restore_files':
|
||||
icon = 'unarchive';
|
||||
_name = 'app data restore';
|
||||
break;
|
||||
}
|
||||
if (!this.tasks.length) {
|
||||
this.statusService.showStatus('Starting ' + _name + '...');
|
||||
}
|
||||
this.tasks.push({
|
||||
key,
|
||||
name,
|
||||
icon,
|
||||
status,
|
||||
resolve,
|
||||
});
|
||||
this.left_length = this.tasks.filter(t => t.status === 'Waiting...').length;
|
||||
}
|
||||
|
||||
async processBucket() {
|
||||
const objects = this.tasks.filter(t => t.status === 'Waiting...');
|
||||
const timeout = new Promise(resolve => setTimeout(() => resolve(), 1000));
|
||||
this.left_length = objects.length;
|
||||
if (objects.length) {
|
||||
this.is_running = true;
|
||||
let task = objects[0];
|
||||
task.running = true;
|
||||
await task
|
||||
.resolve(task)
|
||||
.then(() => {
|
||||
task.succeeded = true;
|
||||
if (!task.cancelled) {
|
||||
return timeout.then(() => this.processBucket());
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
task.running = false;
|
||||
task.status = e.message ? e.message : e.code ? e.code : e.toString();
|
||||
task.failed = true;
|
||||
this.statusService.showStatus(task.status, true);
|
||||
if (!task.cancelled) {
|
||||
return timeout.then(() => this.processBucket());
|
||||
}
|
||||
});
|
||||
this.tasks = this.tasks.filter(t => t !== task);
|
||||
} else {
|
||||
let failed = this.tasks.filter(t => t.failed);
|
||||
this.failed_length = failed.length;
|
||||
let hasFailed = !!this.failed_length;
|
||||
if (this.is_running) {
|
||||
this.statusService.showStatus(
|
||||
hasFailed
|
||||
? this.failed_length > 1
|
||||
? 'Multiple tasks failed. Check the tasks screen for more info.'
|
||||
: 'A task failed. Check the tasks screen for more info. ' + failed[0].status
|
||||
: 'All tasks completed! ',
|
||||
hasFailed
|
||||
);
|
||||
}
|
||||
this.is_running = false;
|
||||
await timeout.then(() => this.processBucket());
|
||||
}
|
||||
}
|
||||
|
||||
async skipCurrent(task) {
|
||||
if (!task.succeeded) {
|
||||
task.cancelled = true;
|
||||
this.tasks = this.tasks.filter(t => t !== task);
|
||||
const timeout = new Promise(resolve => setTimeout(() => resolve(), 1000));
|
||||
await timeout.then(() => this.processBucket());
|
||||
}
|
||||
}
|
||||
|
||||
retryFailed() {
|
||||
this.tasks.forEach(t => {
|
||||
if (t.failed) {
|
||||
t.status = 'Waiting...';
|
||||
t.failed = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
clearDone() {
|
||||
this.tasks = this.tasks.filter(t => !t.succeeded);
|
||||
}
|
||||
|
||||
clearFailed() {
|
||||
this.tasks = this.tasks.filter(t => !t.failed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RepoService } from './repo.service';
|
||||
|
||||
describe('RepoService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: RepoService = TestBed.get(RepoService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RepoService {
|
||||
allApps: any = {};
|
||||
indexUrl: string = 'https://the-expanse.github.io/SideQuestRepos/';
|
||||
constructor(private appService: AppService) {
|
||||
this.getAppIndex();
|
||||
}
|
||||
getAppIndex() {
|
||||
this.appService.request(this.indexUrl);
|
||||
return new Promise((resolve, reject) => {
|
||||
this.appService.request(this.indexUrl + 'app-index.json', (error, response, body) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
} else {
|
||||
try {
|
||||
let body = JSON.parse(response.body);
|
||||
Object.keys(body).forEach(packageName => {
|
||||
this.allApps[packageName] = body[packageName];
|
||||
this.allApps[packageName].icon = this.indexUrl + this.allApps[packageName].icon;
|
||||
});
|
||||
resolve();
|
||||
} catch (e) {
|
||||
return reject('JSON parse Error');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SafeSideService } from './safe-side.service';
|
||||
|
||||
describe('SafeSideService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: SafeSideService = TestBed.get(SafeSideService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { AppService } from './app.service';
|
||||
import { environment } from './../environments/environment';
|
||||
|
||||
interface CheckSubmissionResponse {
|
||||
found: boolean;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SafeSideService {
|
||||
constructor(private appService: AppService, private http: HttpClient) {}
|
||||
|
||||
async checkAPK(updateStatus: (string) => void, filePath: string): Promise<boolean> {
|
||||
const hash = await this.computeFileHash(updateStatus, filePath);
|
||||
const url = `${environment.safeSideApiUrl}/check-app-hash/${hash}`;
|
||||
updateStatus('Checking APK against blacklist...');
|
||||
const response = await this.http.get<CheckSubmissionResponse>(url).toPromise();
|
||||
return response.found;
|
||||
}
|
||||
async computeFileHash(updateStatus: (string) => void, filePath: string): Promise<string> {
|
||||
const fileSize = await this.computeFileSize(filePath);
|
||||
return new Promise((resolve, reject) => {
|
||||
let bytesRead: number = 0;
|
||||
const fd = this.appService.fs.createReadStream(filePath);
|
||||
const hash = this.appService.crypto.createHash('md5');
|
||||
hash.setEncoding('hex');
|
||||
fd.on('data', chunk => {
|
||||
bytesRead += chunk.length;
|
||||
const percentage = this.formattedPercentageComplete(bytesRead, fileSize);
|
||||
updateStatus(`Computing APK hash (${percentage})...`);
|
||||
});
|
||||
fd.on('end', () => {
|
||||
updateStatus(`Computing APK hash (100%)...`);
|
||||
hash.end();
|
||||
resolve(hash.read());
|
||||
});
|
||||
fd.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
fd.pipe(hash);
|
||||
});
|
||||
}
|
||||
async computeFileSize(filePath: string): Promise<number> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.appService.fs.stat(filePath, (err, stats) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(stats.size);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
formattedPercentageComplete(amount: number, total: number): string {
|
||||
const percentage = Math.round(Math.min(amount / total, 1) * 100);
|
||||
return `${percentage}%`;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { SanitizeHtmlPipe } from './sanitize-html.pipe';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
describe('SanitizeHtmlPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new SanitizeHtmlPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
|
||||
@Pipe({
|
||||
name: 'sanitizeHtml'
|
||||
})
|
||||
export class SanitizeHtmlPipe implements PipeTransform {
|
||||
|
||||
constructor(private _sanitizer:DomSanitizer) {
|
||||
}
|
||||
|
||||
transform(v:string):SafeHtml {
|
||||
return this._sanitizer.bypassSecurityTrustHtml(v);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
.setup-content{
|
||||
padding: 2em;
|
||||
}
|
||||
.setup-image {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<div class="row">
|
||||
<div class="col s12 m6">
|
||||
<div class="setup-content" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="section-title">
|
||||
Step 1: Create Organisation
|
||||
</div>
|
||||
<div>
|
||||
Put the Oculus Headset in developer mode to be able to sideload to the Headset. To do this,
|
||||
you have to be a registered "developer". This process is free. Go to
|
||||
<app-link url="https://dashboard.oculus.com"
|
||||
text="dashboard.oculus.com"></app-link>
|
||||
on your PC and create an 'organization'. You'll be asked to accept the developer agreement.
|
||||
</div>
|
||||
<br><br>
|
||||
<img class="setup-image" src="assets/images/CreateOrganisation.png" />
|
||||
<img class="setup-image" src="assets/images/OculusDashboardDeveloperCreate.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12 m6">
|
||||
<div class="setup-content" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="section-title">
|
||||
Step 2: Install Drivers ( Windows Only - skip this on Mac / Linux )
|
||||
</div>
|
||||
<div>
|
||||
Install the driver software for your device. Go to
|
||||
<app-link url="https://developer.oculus.com/downloads/package/oculus-go-adb-drivers/"
|
||||
text="developer.oculus.com"></app-link>
|
||||
on your PC and download the drivers for your headset. The Oculus Go drivers work for the
|
||||
quest also. To install the drivers extract the zip folder, right click the
|
||||
<div class="chip">android_winusb.inf</div>
|
||||
file and click install.
|
||||
</div>
|
||||
<br><br>
|
||||
<img class="setup-image" src="assets/images/ADB Drivers.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-fix"></div>
|
||||
<div class="row">
|
||||
<div class="col s12 m6">
|
||||
<div class="setup-content" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="section-title">
|
||||
Step 3: Enable Developer Mode and Reboot
|
||||
</div>
|
||||
<p>
|
||||
Now that you’re a "developer", open the Oculus app on your smartphone or tablet. In the
|
||||
Settings tab, tap on the Go headset and tap 'More settings'. In the list, you should now see
|
||||
Developer Mode. Once you have enabled developer mode it is a good idea to reboot your headset
|
||||
to be able to see it on the device.
|
||||
</p>
|
||||
<br><br>
|
||||
<img class="setup-image" src="assets/images/OculusAppDevModeSteps.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s12 m6">
|
||||
<div class="setup-content" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="section-title">
|
||||
Step 4: Connect USB Cable and Allow USB Debugging
|
||||
</div>
|
||||
<div>
|
||||
Now its time to connect the USB cable. Once you are connected you will have to allow USB
|
||||
debugging access on your headset. If you put your headset on at this point you will see
|
||||
something like the below. You should also select 'Always allow from this computer' to prevent
|
||||
this message from coming up every time you connect.
|
||||
</div>
|
||||
<br><br>
|
||||
<img class="setup-image" src="assets/images/allow-auth.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-fix"></div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="setup-content" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="section-title" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Step 5: Install App Launcher
|
||||
</div>
|
||||
<div [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Install a launcher to make finding apps easier on your headset. This launcher will be found in
|
||||
the library under 'Unknown Sources' on the menu on the left. Open it to find all the apps that
|
||||
have been installed on your device.
|
||||
</div><br>
|
||||
<span class="chip" *ngIf="isLauncherInstalled()">SideQuest Launcher Installed!</span>
|
||||
<app-loading-spinner-small *ngIf="isInstallingLauncher"></app-loading-spinner-small>
|
||||
<div class="waves-effect waves-light btn pink-button"
|
||||
*ngIf="!isInstalledLauncher&&!isInstallingLauncher"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="installLauncher()">
|
||||
Install App Launcher
|
||||
</div>
|
||||
<br><br>
|
||||
<div [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
You will then be able to install apps to your headset and open them from the launcher. You can
|
||||
find it in the side menu of the library under the Unknown Sources section called
|
||||
<span class="chip">SideQuest - TV</span> and <span class="chip">SideQuest - Home</span>. This will show you all the apps on the device even hidden
|
||||
ones you would otherwise not see.
|
||||
</div><br>
|
||||
<span class="chip" *ngIf="isExpanseInstalled()">The Expanse VR Installed!</span>
|
||||
<app-loading-spinner-small *ngIf="isInstallingExpanse"></app-loading-spinner-small>
|
||||
<div class="waves-effect waves-light btn pink-button"
|
||||
*ngIf="!isInstalledExpanse&&!isInstallingExpanse"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="installExpanse()">
|
||||
Install Your First App - The Expanse
|
||||
</div><br><br>
|
||||
<div [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
If you want to install your own APK files just drag and drop them over this window.
|
||||
</div>
|
||||
<div [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Check your antivirus hasn't blocked some parts of the ADB download - this has happened for some
|
||||
with Avast antivirus in particular. <br />If you have any problems or want to say hi drop us a
|
||||
line on discord - <app-link url="https://discord.gg/HNnDPSu" text="discord"></app-link>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-fix"></div>
|
||||
<div class="row" style="display: none;">
|
||||
<div class="col s12">
|
||||
<div class="section-title" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
App Developers Link to your apps!
|
||||
</div>
|
||||
<div style="text-align: center" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Use our custom protocol to be able to install APK files, add repos and even load custom beat
|
||||
saber songs direct from your website.
|
||||
</div>
|
||||
<span
|
||||
class="chip"
|
||||
mz-tooltip
|
||||
position="right"
|
||||
tooltip="Example: sidequest://repo#https://example.com/fdroid/repo"
|
||||
>sidequest://repo#URL_OF_REPO</span
|
||||
><br />
|
||||
<span
|
||||
class="chip tooltipped"
|
||||
data-position="right"
|
||||
data-tooltip="Example: sidequest://sideload#https://example.com/file.apk"
|
||||
>sidequest://sideload#URL_OF_APK</span
|
||||
><br />
|
||||
<span
|
||||
class="chip tooltipped"
|
||||
data-position="right"
|
||||
data-tooltip="Example: sidequest://bsaber#12345-12345 or sidequest://bsaber#https://example.com/12345-12345.zip"
|
||||
>sidequest://bsaber#URL_OR_ID_OF_SONG</span
|
||||
><br />
|
||||
<br /><br />
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<div class="input-field inline browser-input">
|
||||
<input id="protocol_url" type="text" placeholder="Address" />
|
||||
<label class="active" for="protocol_url">Address</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field col 4">
|
||||
<select id="protocol_type">
|
||||
<option selected>repo</option>
|
||||
<option>sideload</option>
|
||||
<option>bsaber</option>
|
||||
</select>
|
||||
<label>Link Type</label>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<a href="#" class="waves-effect waves-light btn">Copy Embed Code</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SetupComponent } from './setup.component';
|
||||
|
||||
describe('SetupComponent', () => {
|
||||
let component: SetupComponent;
|
||||
let fixture: ComponentFixture<SetupComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SetupComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SetupComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AppService } from '../app.service';
|
||||
import { AdbClientService } from '../adb-client.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-setup',
|
||||
templateUrl: './setup.component.html',
|
||||
styleUrls: ['./setup.component.css'],
|
||||
})
|
||||
export class SetupComponent implements OnInit {
|
||||
isInstallingLauncher: boolean;
|
||||
isInstalledLauncher: boolean;
|
||||
isInstallingExpanse: boolean;
|
||||
isInstalledExpanse: boolean;
|
||||
constructor(public appService: AppService, private adbService: AdbClientService) {
|
||||
appService.webService.isWebviewOpen = false;
|
||||
this.appService.resetTop();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Setup for Sideloading');
|
||||
}
|
||||
|
||||
isExpanseInstalled() {
|
||||
this.isInstalledExpanse = !!~this.adbService.devicePackages.indexOf('app.theexpanse.app');
|
||||
return this.isInstalledExpanse;
|
||||
}
|
||||
|
||||
isLauncherInstalled() {
|
||||
this.isInstalledLauncher =
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper2') &&
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper') &&
|
||||
!!~this.adbService.devicePackages.indexOf('com.sidequest.launcher');
|
||||
return this.isInstalledLauncher;
|
||||
}
|
||||
|
||||
installLauncher() {
|
||||
this.isInstallingLauncher = true;
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper.apk');
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper2.apk');
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestLauncher.apk');
|
||||
this.isInstallingLauncher = false;
|
||||
this.isInstalledLauncher = true;
|
||||
}
|
||||
installExpanse() {
|
||||
this.isInstallingExpanse = true;
|
||||
this.adbService.installAPK('https://cdn.theexpanse.app/TheExpanse.apk');
|
||||
this.isInstallingExpanse = false;
|
||||
this.isInstalledExpanse = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SongBeaterService } from './song-beater.service';
|
||||
|
||||
describe('SongBeaterService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: SongBeaterService = TestBed.get(SongBeaterService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { AppService } from './app.service';
|
||||
import { ProcessBucketService } from './process-bucket.service';
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SongBeaterService {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
private appService: AppService,
|
||||
private processService: ProcessBucketService
|
||||
) {}
|
||||
async moveSongToDevice(packageBackupPath, adbService, task, name) {
|
||||
if (this.appService.fs.existsSync(packageBackupPath)) {
|
||||
adbService.localFiles = [];
|
||||
await adbService
|
||||
.getLocalFoldersRecursive(packageBackupPath)
|
||||
.then(
|
||||
(): any => {
|
||||
adbService.localFiles.forEach(file => {
|
||||
console.log(
|
||||
packageBackupPath,
|
||||
file.name
|
||||
.replace(packageBackupPath, '')
|
||||
.split('\\')
|
||||
.join('/')
|
||||
);
|
||||
file.savePath = this.appService.path.posix.join(
|
||||
'/sdcard/Android/data/com.playito.songbeater/CustomSongs',
|
||||
name,
|
||||
file.name
|
||||
.replace(packageBackupPath, '')
|
||||
.split('\\')
|
||||
.join('/')
|
||||
);
|
||||
});
|
||||
return adbService.uploadFile(adbService.localFiles.filter(f => f.__isFile), task);
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
task.succeeded = true;
|
||||
this.statusService.showStatus('Synced to Song Beater OK!');
|
||||
});
|
||||
}
|
||||
}
|
||||
downloadSong(downloadUrl, adbService) {
|
||||
let parts = downloadUrl.split('/');
|
||||
let zipPath = this.appService.path.join(this.appService.appData, parts[parts.length - 1]);
|
||||
let name = parts[parts.length - 1].split('.')[0];
|
||||
const requestOptions = {
|
||||
timeout: 30000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
};
|
||||
return this.processService.addItem('song_download', async task => {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.appService
|
||||
.progress(this.appService.request(downloadUrl, requestOptions), { throttle: 300 })
|
||||
.on('error', error => {
|
||||
reject(error);
|
||||
})
|
||||
.on('progress', state => {
|
||||
this.spinnerService.setMessage('Saving to SongBeater... ' + Math.round(state.percent * 100) + '%');
|
||||
})
|
||||
.on('end', () => {
|
||||
let dir = this.appService.path.join(this.appService.appData, 'temp', name);
|
||||
this.appService.fs.mkdir(dir, () => {
|
||||
this.appService.extract(zipPath, { dir: dir }, error => {
|
||||
this.appService.fs.unlink(zipPath, err => {
|
||||
if (error) {
|
||||
this.appService.deleteFolderRecursive(dir);
|
||||
reject(error);
|
||||
} else {
|
||||
this.moveSongToDevice(dir, adbService, task, name)
|
||||
.then(() => {
|
||||
task.status = 'Saved to Song Beater!';
|
||||
return this.appService.deleteFolderRecursive(dir);
|
||||
})
|
||||
.then(() => resolve());
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.pipe(this.appService.fs.createWriteStream(zipPath));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
|
||||
describe('StatusBarService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: StatusBarService = TestBed.get(StatusBarService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
import { StatusBarComponent } from './status-bar/status-bar.component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class StatusBarService {
|
||||
status: StatusBarComponent;
|
||||
hideTimeout: any;
|
||||
constructor(private appService: AppService) {}
|
||||
setStatus(status: StatusBarComponent) {
|
||||
this.status = status;
|
||||
}
|
||||
showStatus(message: string, isWarning?: boolean) {
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.status.statusMessage = message;
|
||||
this.status.isWarning = isWarning;
|
||||
this.status.isActive = true;
|
||||
if (!isWarning) {
|
||||
this.hideTimeout = setTimeout(() => {
|
||||
this.status.isActive = false;
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
hideStatus() {
|
||||
this.status.isActive = this.status.showDiscord = false;
|
||||
}
|
||||
copyStatus() {
|
||||
this.appService.electron.clipboard.writeText(this.status.statusMessage);
|
||||
this.status.showDiscord = true;
|
||||
this.showStatus(
|
||||
'Copied to your clipboard! Please post this in our discord server in the #general channel: https://discord.gg/r38T5rR'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
.status-bar {
|
||||
background-color: #4caf50;
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: white;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.status-bar-warning {
|
||||
background-color: #ff9800;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="status-bar" [ngClass]="{'status-bar-warning':isWarning}" *ngIf="isActive">
|
||||
<i class="material-icons right white-text cursor" (click)="statusService.hideStatus()" mz-tooltip position="top"
|
||||
tooltip="Close this status.">close</i>
|
||||
<div *ngIf="isWarning" class="right btn small-button green" (click)="getHelp.emit(statusMessage)">Get Help</div>
|
||||
<span class="status-message truncate" [innerHTML]="statusMessage | sanitizeHtml">
|
||||
|
||||
</span>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StatusBarComponent } from './status-bar.component';
|
||||
|
||||
describe('StatusBarComponent', () => {
|
||||
let component: StatusBarComponent;
|
||||
let fixture: ComponentFixture<StatusBarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ StatusBarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(StatusBarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-status-bar',
|
||||
templateUrl: './status-bar.component.html',
|
||||
styleUrls: ['./status-bar.component.css'],
|
||||
})
|
||||
export class StatusBarComponent implements OnInit {
|
||||
isWarning: boolean;
|
||||
isActive: boolean;
|
||||
showDiscord: boolean;
|
||||
statusMessage: string;
|
||||
@Output() getHelp = new EventEmitter();
|
||||
constructor(public statusService: StatusBarService) {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SynthriderService } from './synthrider.service';
|
||||
|
||||
describe('SynthriderService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: SynthriderService = TestBed.get(SynthriderService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LoadingSpinnerService } from './loading-spinner.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ProcessBucketService } from './process-bucket.service';
|
||||
import { StatusBarService } from './status-bar.service';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SynthriderService {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
private appService: AppService,
|
||||
private processService: ProcessBucketService
|
||||
) {}
|
||||
|
||||
downloadSong(downloadUrl, adbService) {
|
||||
return this.processService.addItem('song_download', async task => {
|
||||
let parts = downloadUrl.split('/');
|
||||
let zipPath = this.appService.path.join(this.appService.appData, this.appService.path.basename(downloadUrl));
|
||||
let ws = this.appService.fs.createWriteStream(zipPath);
|
||||
//let name = parts[parts.length - 1].split('.')[0];
|
||||
const requestOptions = {
|
||||
timeout: 30000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
};
|
||||
task.status = 'Saving to SynthRiders...';
|
||||
return new Promise((resolve, reject) => {
|
||||
let request = this.appService
|
||||
.progress(this.appService.request(downloadUrl, requestOptions), { throttle: 50 })
|
||||
.on('error', error => {
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save item... ' + error.toString();
|
||||
reject(error);
|
||||
})
|
||||
.on('progress', state => {
|
||||
task.status = 'Saving to SynthRiders... ' + Math.round(state.percent * 100) + '%';
|
||||
})
|
||||
.on('response', response => {
|
||||
var regexp = /filename=\"(.*)\"/gi;
|
||||
var _regResult = regexp.exec(response.headers['content-disposition']);
|
||||
if (_regResult && _regResult.length) {
|
||||
zipPath = this.appService.path.join(this.appService.appData, _regResult[1]);
|
||||
}
|
||||
request.pipe(this.appService.fs.createWriteStream(zipPath));
|
||||
})
|
||||
.on('end', async () => {
|
||||
let ext = this.appService.path.extname(zipPath).toLowerCase();
|
||||
let basename = this.appService.path.basename(zipPath);
|
||||
await adbService.uploadFile(
|
||||
[
|
||||
{
|
||||
name: zipPath,
|
||||
savePath:
|
||||
'/sdcard/Android/data/com.kluge.SynthRiders/files/' +
|
||||
(ext.toLowerCase() === '.synth'
|
||||
? 'CustomSongs/'
|
||||
: ext.toLowerCase() === '.stagequest'
|
||||
? 'CustomStages/'
|
||||
: 'Mods/') +
|
||||
basename,
|
||||
},
|
||||
],
|
||||
task
|
||||
);
|
||||
task.status = 'Saved! ' + basename;
|
||||
this.appService.fs.unlink(zipPath, err => {
|
||||
if (err) console.warn(err);
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
.button-section{
|
||||
margin-top: 1em;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
.side-quest-version{
|
||||
position:relative;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<div class="container"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="side-quest-version">
|
||||
SideQuest Version: {{appService.versionName}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
SideQuest Folders</div>
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="appService.openFolder(folder.MAIN)">
|
||||
Open Main App Folder
|
||||
</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="appService.openFolder(folder.APK_BACKUPS)">
|
||||
Open APK Backup Folder
|
||||
</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="appService.openFolder(folder.ADB)">
|
||||
Open ADB Folder
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Pavlov Settings</div>
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setPavlovPermission()">Grant Pavlov Permissions</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="changePavlov.openModal()">Change Pavlov Name </div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Chromatic Aberration</div>
|
||||
This will enable/disable chromatic aberration.
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCa(CA.APP)">Default</div>
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCa(CA.APP)">App Selected</div>
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCa(CA.ON)">On</div>
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCa(CA.OFF)">Off</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Guardian</div>
|
||||
This will enable/disable the guardian.
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setGuardian(GU.ON)">ON</div>
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setGuardian(GU.OFF)">OFF</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Paste Text to your device</div>
|
||||
If there is a text input field focussed on your headset you can paste / type text in here to have SideQuest type
|
||||
it out on your headset. Good for long passwords you don't want to have to type on a virtual keyboard.
|
||||
<div class="button-section">
|
||||
<div class="input-field ">
|
||||
<input id="devicePaste"
|
||||
[ngClass]="{'input-dark-theme':appService.currentTheme === 'dark','input-light-theme':appService.currentTheme === 'light'}"
|
||||
[type]="isPassword?'password':'text'" [(ngModel)]="textToSend" />
|
||||
<label for="devicePaste"
|
||||
[ngClass]="{'label-dark-theme':appService.currentTheme === 'dark','label-light-theme':appService.currentTheme === 'light'}">Text
|
||||
to Paste</label>
|
||||
</div>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Text
|
||||
<input type="checkbox" [(ngModel)]="isPassword" />
|
||||
<span class="lever"></span>
|
||||
Password
|
||||
</label>
|
||||
</div>
|
||||
<div class="waves-effect waves-light btn paste-text-button right pink-button" (click)="pasteToDevice()"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}">
|
||||
Send</div>
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Set FFR ( Fixed Foveated Rendering ) level
|
||||
</div>
|
||||
This will change how the view is rendered in the outer edges of the viewscreen for each eye. Higher is better
|
||||
performance, lower is better quality. This gets reset when you reboot the device.
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.MEDIUM)">Default</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.OFF)">Off</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.LOW)">Low</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.MEDIUM)">Medium</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.HIGH)">High</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setFFR(FFR.HIGH_TOP)">High Top</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Set Video Capture Size</div>
|
||||
This changes the resolution of captured videos on the Quest
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCR(CR._480)">480</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCR(CR._720)">720</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setCR(CR._1080)">1080</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Set CPU and GPU level</div>
|
||||
This can improve performance for 2D apps & games.
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setGPU(GPU._2)">Default</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setGPU(GPU._2)">Level 2</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setGPU(GPU._4)">Level 4</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Default Texture Size</div>
|
||||
This will change how high quality some of the in game textures are rendered at.
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._1024)">Default</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._512)">512</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._768)">768</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._1024)">1024</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._1280)">1280</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._1536)">1536</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._2048)">2048</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._2560)">2560</div>
|
||||
<div class="waves-effect waves-light btn set-sso margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSSO(SSO._3072)">3072</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Capture Video Bitrate ( Go Only )</div>
|
||||
This will increase the quality of captured videos on Oculus Go.
|
||||
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn set-svb margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSVB(SVB._5Mbps)">Default</div>
|
||||
<div class="waves-effect waves-light btn set-svb margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSVB(SVB._5Mbps)">5Mbps</div>
|
||||
<div class="waves-effect waves-light btn set-svb margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSVB(SVB._15Mbps)">15Mbps</div>
|
||||
<div class="waves-effect waves-light btn set-svb margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setSVB(SVB._25Mbps)">25Mbps</div>
|
||||
</div>
|
||||
<!-- <div class="section-title" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">Video Recording Resolution ( Go Only )</div>-->
|
||||
<!-- This will increase the resolution of captured videos on Oculus Go.-->
|
||||
<!-- <div class="button-section">-->
|
||||
<!-- <div class="waves-effect waves-light btn set-svr margin-bottom margin-right pink-button"-->
|
||||
<!-- [ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}" (click)="setSVR(SVR._1024)">Default</div>-->
|
||||
<!-- <div class="waves-effect waves-light btn set-svr margin-bottom margin-right pink-button"-->
|
||||
<!-- [ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}" (click)="setSVR(SVR._1024)">1024</div>-->
|
||||
<!-- <div class="waves-effect waves-light btn set-svr margin-bottom margin-right pink-button"-->
|
||||
<!-- [ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}" (click)="setSVR(SVR._1536)">1536</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="section-title" [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">Destroy The World</div>-->
|
||||
<!-- Click this to release all the goblins and endanger the future of humanity. Do not do this!-->
|
||||
<!-- <div class="button-section">-->
|
||||
<!-- <div class="switch">-->
|
||||
<!-- <label>-->
|
||||
<!-- Bad-->
|
||||
<!-- <input type="checkbox" [(ngModel)]="appService.hideNSFW" (change)="setHideNSFW()"/>-->
|
||||
<!-- <span class="lever"></span>-->
|
||||
<!-- Safe-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<mz-modal #changePavlov [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Change Pavlov Name</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Enter a name to set in Pavlov
|
||||
<br />
|
||||
<div class="input-field repo-url">
|
||||
<input id="repoUrl" type="text" [(ngModel)]="pavlovName" />
|
||||
<label for="repoUrl">Name</label>
|
||||
</div>
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="setPavlovName()">Save</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToolsComponent } from './tools.component';
|
||||
|
||||
describe('ToolsComponent', () => {
|
||||
let component: ToolsComponent;
|
||||
let fixture: ComponentFixture<ToolsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ToolsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ToolsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,260 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AppService, FolderType } from '../app.service';
|
||||
import { AdbClientService } from '../adb-client.service';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
import { RepoService } from '../repo.service';
|
||||
enum FFR {
|
||||
OFF,
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
HIGH_TOP,
|
||||
}
|
||||
enum GPU {
|
||||
_2,
|
||||
_4,
|
||||
}
|
||||
enum GU {
|
||||
ON,
|
||||
OFF,
|
||||
}
|
||||
enum CA {
|
||||
APP,
|
||||
OFF,
|
||||
ON,
|
||||
}
|
||||
enum SSO {
|
||||
_512,
|
||||
_768,
|
||||
_1024,
|
||||
_1280,
|
||||
_1536,
|
||||
_2048,
|
||||
_2560,
|
||||
_3072,
|
||||
}
|
||||
enum SVR {
|
||||
_1024,
|
||||
_1536,
|
||||
}
|
||||
enum CR {
|
||||
_480,
|
||||
_720,
|
||||
_1080,
|
||||
}
|
||||
enum SVB {
|
||||
_5Mbps,
|
||||
_15Mbps,
|
||||
_25Mbps,
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-tools',
|
||||
templateUrl: './tools.component.html',
|
||||
styleUrls: ['./tools.component.css'],
|
||||
})
|
||||
export class ToolsComponent implements OnInit {
|
||||
folder = FolderType;
|
||||
isPassword: boolean;
|
||||
textToSend: string;
|
||||
_textToSend: string[];
|
||||
FFR = FFR;
|
||||
SVR = SVR;
|
||||
SVB = SVB;
|
||||
SSO = SSO;
|
||||
GU = GU;
|
||||
CA = CA;
|
||||
CR = CR;
|
||||
GPU = GPU;
|
||||
pavlovName;
|
||||
constructor(
|
||||
public appService: AppService,
|
||||
public adbService: AdbClientService,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
private statusService: StatusBarService,
|
||||
public repoService: RepoService
|
||||
) {
|
||||
this.appService.resetTop();
|
||||
appService.webService.isWebviewOpen = false;
|
||||
appService.isSettingsOpen = true;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Device Settings & Tools');
|
||||
}
|
||||
setFFR(ffr: FFR) {
|
||||
let value: number = 0;
|
||||
switch (ffr) {
|
||||
case FFR.LOW:
|
||||
value = 1;
|
||||
break;
|
||||
case FFR.MEDIUM:
|
||||
value = 2;
|
||||
break;
|
||||
case FFR.HIGH:
|
||||
value = 3;
|
||||
break;
|
||||
case FFR.HIGH_TOP:
|
||||
value = 4;
|
||||
break;
|
||||
}
|
||||
this.adbService.runAdbCommand('adb shell debug.oculus.foveation.level ' + value).then(() => {
|
||||
this.statusService.showStatus('Fixed Foveated Rendering set OK!!');
|
||||
});
|
||||
}
|
||||
setGPU(gpu: GPU) {
|
||||
let value = gpu === GPU._2 ? 2 : 4;
|
||||
this.adbService
|
||||
.runAdbCommand('adb shell setprop debug.oculus.cpuLevel ' + value)
|
||||
.then(() => this.adbService.runAdbCommand('adb shell setprop debug.oculus.gpuLevel ' + value))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('CPU/GPU level set OK!!');
|
||||
});
|
||||
}
|
||||
setGuardian(guardian: GU) {
|
||||
this.adbService.runAdbCommand('adb shell setprop debug.oculus.guardian_pause ' + (guardian === GU.ON ? 1 : 0)).then(() => {
|
||||
this.statusService.showStatus('Guardian pause set OK!!');
|
||||
});
|
||||
}
|
||||
setCa(ca: CA) {
|
||||
this.adbService
|
||||
.runAdbCommand('adb shell setprop debug.oculus.forceChroma ' + (ca === CA.ON ? 1 : ca === CA.APP ? -1 : 0))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Chromatic Aberration set OK!!');
|
||||
});
|
||||
}
|
||||
setSSO(sso: SSO) {
|
||||
let value: number = 0;
|
||||
switch (sso) {
|
||||
case SSO._512:
|
||||
value = 512;
|
||||
break;
|
||||
case SSO._768:
|
||||
value = 768;
|
||||
break;
|
||||
case SSO._1024:
|
||||
value = 1024;
|
||||
break;
|
||||
case SSO._1280:
|
||||
value = 1280;
|
||||
break;
|
||||
case SSO._1536:
|
||||
value = 1536;
|
||||
break;
|
||||
case SSO._2048:
|
||||
value = 2048;
|
||||
break;
|
||||
case SSO._2560:
|
||||
value = 2560;
|
||||
break;
|
||||
case SSO._3072:
|
||||
value = 3072;
|
||||
break;
|
||||
}
|
||||
|
||||
this.adbService
|
||||
.runAdbCommand('adb shell setprop debug.oculus.textureWidth ' + value)
|
||||
.then(() => this.adbService.runAdbCommand('adb shell setprop debug.oculus.textureHeight ' + value))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Texture Resolution set OK!!');
|
||||
});
|
||||
}
|
||||
setSVB(svb: SVB) {
|
||||
let value: number = 5000000;
|
||||
switch (svb) {
|
||||
case SVB._5Mbps:
|
||||
value = 5000000;
|
||||
break;
|
||||
case SVB._15Mbps:
|
||||
value = 15000000;
|
||||
break;
|
||||
case SVB._25Mbps:
|
||||
value = 25000000;
|
||||
break;
|
||||
}
|
||||
this.adbService.runAdbCommand('adb shell setprop debug.oculus.videoBitrate ' + value).then(() => {
|
||||
this.statusService.showStatus('Video Bitrate set OK!!');
|
||||
});
|
||||
}
|
||||
setCR(svr: CR) {
|
||||
let width: number = 1280;
|
||||
let height: number = 720;
|
||||
switch (svr) {
|
||||
case CR._480:
|
||||
width = 640;
|
||||
height = 480;
|
||||
break;
|
||||
case CR._720:
|
||||
width = 1280;
|
||||
height = 720;
|
||||
break;
|
||||
case CR._1080:
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
break;
|
||||
}
|
||||
this.adbService
|
||||
.runAdbCommand('adb shell setprop debug.oculus.capture.width ' + width)
|
||||
.then(() => this.adbService.runAdbCommand('adb shell setprop debug.oculus.capture.height ' + height))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Capture Resolution set OK!!');
|
||||
});
|
||||
}
|
||||
setSVR(svr: SVR) {
|
||||
let value: number = 1024;
|
||||
switch (svr) {
|
||||
case SVR._1024:
|
||||
value = 1024;
|
||||
break;
|
||||
case SVR._1536:
|
||||
value = 1536;
|
||||
break;
|
||||
}
|
||||
this.adbService.runAdbCommand('adb shell setprop debug.oculus.videoResolution ' + value).then(() => {
|
||||
this.statusService.showStatus('Video Resolution set OK!!');
|
||||
});
|
||||
}
|
||||
setPavlovPermission() {
|
||||
return this.adbService
|
||||
.setPermission('com.vankrupt.pavlov', 'android.permission.RECORD_AUDIO')
|
||||
.then(() => this.adbService.setPermission('com.vankrupt.pavlov', 'android.permission.READ_EXTERNAL_STORAGE'))
|
||||
.then(() => this.adbService.setPermission('com.vankrupt.pavlov', 'android.permission.WRITE_EXTERNAL_STORAGE'));
|
||||
}
|
||||
setPavlovName() {
|
||||
this.adbService.adbCommand('shell', {
|
||||
serial: this.adbService.deviceSerial,
|
||||
command: 'echo ' + this.pavlovName + ' > /sdcard/pavlov.name.txt',
|
||||
});
|
||||
}
|
||||
pasteToDevice() {
|
||||
this._textToSend = this.textToSend.split('');
|
||||
this.textToSend = '';
|
||||
|
||||
this.spinnerService.setMessage('Setting Text...');
|
||||
this.spinnerService.showLoader();
|
||||
this.inputCharacters()
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Text sent to the device!!');
|
||||
this.spinnerService.hideLoader();
|
||||
})
|
||||
.catch(e => {
|
||||
this.statusService.showStatus(e.toString(), true);
|
||||
this.spinnerService.hideLoader();
|
||||
});
|
||||
}
|
||||
inputCharacters() {
|
||||
let character = this._textToSend.shift();
|
||||
return this.adbService.runAdbCommand('adb shell input text "' + character + '"').then(() => {
|
||||
if (this._textToSend.length) {
|
||||
return this.inputCharacters();
|
||||
}
|
||||
});
|
||||
}
|
||||
setHideNSFW() {
|
||||
if (this.appService.hideNSFW) {
|
||||
localStorage.setItem('hideNSFW', 'true');
|
||||
} else {
|
||||
localStorage.removeItem('hideNSFW');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { WebviewDirective } from './webview.directive';
|
||||
|
||||
describe('WebviewDirective', () => {
|
||||
it('should create an instance', () => {
|
||||
const directive = new WebviewDirective();
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Directive } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: 'webview'
|
||||
})
|
||||
export class WebviewDirective {
|
||||
|
||||
constructor() { }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WebviewService } from './webview.service';
|
||||
|
||||
describe('WebviewService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: WebviewService = TestBed.get(WebviewService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class WebviewService {
|
||||
webView: any;
|
||||
isWebviewOpen: boolean;
|
||||
currentAddress: string = 'https://sidequestvr.com';
|
||||
isWebviewLoading: boolean = false;
|
||||
isLoaded = () => {};
|
||||
constructor(private appService: AppService) {
|
||||
appService.setWebviewService(this);
|
||||
}
|
||||
setWebView(webView) {
|
||||
this.webView = webView;
|
||||
this.setupWebview();
|
||||
}
|
||||
setupWebview() {
|
||||
let customCss = `
|
||||
::-webkit-scrollbar {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
background: #e0e0e0;
|
||||
}
|
||||
::-webkit-scrollbar-corner {
|
||||
background: #cfcfcf;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #ed4e7a;
|
||||
}
|
||||
.-sidequest{
|
||||
background-image: url('https://i.imgur.com/Hy2oclv.png');
|
||||
background-size: 12.814px 15px;
|
||||
}
|
||||
.bsaber-tooltip.-sidequest::after {
|
||||
content: "Add to SideQuest";
|
||||
}
|
||||
.-sidequest-remove{
|
||||
background-image: url('https://i.imgur.com/5ZPR9L1.png');
|
||||
background-size: 15px 15px;
|
||||
}
|
||||
.bsaber-tooltip.-sidequest-remove::after {
|
||||
content: "Remove Custom Level";
|
||||
}`;
|
||||
this.webView.addEventListener('did-start-loading', e => {
|
||||
//this.currentAddress = this.webView.getURL();
|
||||
this.isWebviewLoading = true;
|
||||
this.webView.insertCSS(customCss);
|
||||
});
|
||||
this.webView.addEventListener('did-navigate-in-page', () => {
|
||||
this.currentAddress = this.webView.getURL();
|
||||
});
|
||||
this.webView.addEventListener('did-stop-loading', async e => {
|
||||
this.currentAddress = this.webView.getURL();
|
||||
this.isWebviewLoading = false;
|
||||
this.webView.insertCSS(customCss);
|
||||
this.isLoaded();
|
||||
this.webView.openDevTools();
|
||||
});
|
||||
}
|
||||
back() {
|
||||
if (this.webView.canGoBack()) {
|
||||
this.webView.goBack();
|
||||
}
|
||||
}
|
||||
forward() {
|
||||
if (this.webView.canGoForward()) {
|
||||
this.webView.goForward();
|
||||
}
|
||||
}
|
||||
getTitle() {
|
||||
return this.webView.getTitle();
|
||||
}
|
||||
send() {
|
||||
this.webView.loadURL(this.currentAddress);
|
||||
}
|
||||
loadUrl(url: string) {
|
||||
if (!/^(?:f|ht)tps?\:\/\//.test(url)) {
|
||||
url = 'https://' + url;
|
||||
}
|
||||
this.currentAddress = url;
|
||||
this.webView.loadURL(url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WebviewComponent } from './webview.component';
|
||||
|
||||
describe('WebviewComponent', () => {
|
||||
let component: WebviewComponent;
|
||||
let fixture: ComponentFixture<WebviewComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WebviewComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WebviewComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WebviewService } from '../webview.service';
|
||||
import { AppService } from '../app.service';
|
||||
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
@Component({
|
||||
selector: 'app-webview',
|
||||
templateUrl: './webview.component.html',
|
||||
styleUrls: ['./webview.component.css'],
|
||||
})
|
||||
export class WebviewComponent implements OnInit {
|
||||
constructor(webService: WebviewService, appService: AppService, router: Router, route: ActivatedRoute) {
|
||||
appService.resetTop();
|
||||
webService.isWebviewOpen = true;
|
||||
appService.showBrowserBar = true;
|
||||
appService.setTitle('<img src="assets/images/logo-textual.png" class="logo-img"/>');
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
||||
Reference in New Issue
Block a user