Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3db80c27b |
@@ -1,41 +0,0 @@
|
||||
name: "Main workflow"
|
||||
on: [pull_request, push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.11.1'
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: "Install build deps on linux"
|
||||
run: |
|
||||
echo $RUNNER_OS;
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
sudo apt-get install libusb-1.0-0-dev
|
||||
sudo apt-get install libudev-dev
|
||||
fi
|
||||
shell: bash
|
||||
- name: "Install dependencies"
|
||||
run: yarn install --network-timeout 1000000
|
||||
- name: "Build application"
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASS }}
|
||||
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_ID_TEAM }}
|
||||
APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|
||||
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
|
||||
run: yarn dist
|
||||
@@ -1,47 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env
|
||||
|
||||
build/app
|
||||
build/platform-tools
|
||||
build-electron
|
||||
.idea
|
||||
.vscode
|
||||
dist
|
||||
/app
|
||||
desktop-app/sources/*.json
|
||||
tmp
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
|
||||
/build/experimental.apk
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
git update-index -g
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
yarn pretty-quick
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
yarn dist
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"tabWidth": 4,
|
||||
"printWidth": 132,
|
||||
"semi": true,
|
||||
"jsxBracketSameLine": true,
|
||||
"parser": "typescript",
|
||||
"singleQuote": true,
|
||||
"useTabs": false,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
language: node_js
|
||||
node_js: "10"
|
||||
env:
|
||||
- ELECTRON_CACHE=$HOME/.cache/electron
|
||||
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
||||
|
||||
- os: linux
|
||||
services: docker
|
||||
language: generic
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
- $HOME/.cache/electron
|
||||
- $HOME/.cache/electron-builder
|
||||
|
||||
script:
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
docker run --rm \
|
||||
`env | sed -n '/^[^\t]/s/=.*//p' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '` \
|
||||
-v ${PWD}:/project \
|
||||
-v ~/.cache/electron:/root/.cache/electron \
|
||||
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
|
||||
electronuserland/builder:wine \
|
||||
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn dist --linux --win"
|
||||
else
|
||||
yarn dist
|
||||
fi
|
||||
before_cache:
|
||||
- rm -rf $HOME/.cache/electron-builder/wine
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
||||
@@ -1,7 +0,0 @@
|
||||
Copyright 2019 SideQuest
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,82 +1,190 @@
|
||||
# SideQuest
|
||||
Below is the documentation of SideQuest with instructions for building and signing then application.
|
||||
# SideQuest 简体中文汉化工具包(sideQuest-cn)
|
||||
|
||||
### Build Steps
|
||||
把官方 SideQuest 桌面版(当前基线 **1.4.1**)汉化为简体中文,并产出可覆盖安装的 `.deb`。
|
||||
|
||||
Clone the repo
|
||||
**设计原则:不改任何上游源码。** 本目录是纯新增文件,`git merge` 主线时不会产生冲突;
|
||||
所有"改动"都发生在**已编译产物的补丁层**,且全部集中在 `build.js` 里,可随时重放。
|
||||
|
||||
To install the app dependencies
|
||||
```
|
||||
yarn install
|
||||
---
|
||||
|
||||
## 0. 为什么不是"从源码编译"
|
||||
|
||||
上游把新版(1.4.x 新架构:`dist-electron/` + `dist/sidequest-desktop/`)的开发放在**私有仓库**
|
||||
`SideQuestVR/SideQuestDesktop`;公开仓库 `SideQuestVR/SideQuest` 的 master 停在 2026-05-19 的
|
||||
`af2ac70`,仍是旧架构(`desktop-app/` + `electron/*.ts`),且 **v1.0.0~v1.4.1 十个 tag 全部指向
|
||||
同一个 commit**。也就是说公开源码里根本没有 1.4.1 的实现。
|
||||
|
||||
因此本工具包走的是 **"解包官方安装包 → 运行时字典注入 → 重新打包"** 路线:
|
||||
|
||||
* 不依赖源码,也不需要联网装依赖(asar 读写由 `asar.js` 纯 Node 实现)
|
||||
* 产物与官方二进制逐字节一致,只多了汉化层
|
||||
* 上游一旦发新版,重新 `unpack` + `all` 即可(见 §5)
|
||||
|
||||
---
|
||||
|
||||
## 0.1 仓库分支结构
|
||||
|
||||
本仓库有两类分支,用途不同:
|
||||
|
||||
| 分支 | 内容 | 用途 |
|
||||
| --- | --- | --- |
|
||||
| `main` | 只有本工具包 | 日常使用;补词条、重新构建都在这条线上 |
|
||||
| `upstream` | 完整的上游 SideQuest 代码与 git 历史(停在 `af2ac70` / 官方 1.4.1 基线) | 需要对照上游源码、对比差异或将来合并主线时用 |
|
||||
|
||||
因为工具包**直接给已编译产物打补丁**,不依赖上游源码,所以 `main` 不带上游代码也能独立工作。
|
||||
需要看上游代码时:`git switch upstream`,回到工具包:`git switch main`。
|
||||
|
||||
上游仓库以 `github` 为 remote 名保存:
|
||||
|
||||
```bash
|
||||
git fetch github # 拉取上游最新提交
|
||||
git log upstream..github/master # 看上游有哪些新提交
|
||||
```
|
||||
|
||||
To start the dev stack run
|
||||
```
|
||||
yarn start
|
||||
## 1. 目录内容
|
||||
|
||||
| 文件 | 说明 |
|
||||
| --- | --- |
|
||||
| `build.js` | 构建入口:`unpack` / `app` / `asar` / `deb` / `all` |
|
||||
| `asar.js` | 纯 Node 实现的 asar 打包/解包(无外部依赖) |
|
||||
| `engine.js` | **运行时汉化引擎**(注入到页面,翻译 DOM 文本与属性) |
|
||||
| `tail.js` | **主进程统一注入 hook**(追加到 `dist-electron/main.js` 末尾) |
|
||||
| `rules.json` | 动态文案正则规则(含 `$1` 捕获组) |
|
||||
| `dict-a…i.json` | 词典(共 ~1780 条;按提取批次分批,便于维护) |
|
||||
| `site.json` | 内嵌商店默认站点配置 |
|
||||
| `test-run.sh` | 隔离试运行(不动系统、不动真实配置) |
|
||||
| `stop-test.sh` | 停止试运行实例 |
|
||||
| `install.sh` | 覆盖安装(需 sudo,含哈希校验与自动备份) |
|
||||
| `verify.sh` | 安装后独立校验(不需要 sudo) |
|
||||
|
||||
---
|
||||
|
||||
## 2. 快速开始(完整流程)
|
||||
|
||||
```bash
|
||||
export SQ_ZH_HOME="$HOME/.sidequest-zh" # 工作目录,默认就是它;产物不落在仓库里
|
||||
|
||||
# ① 准备原版基线(只需一次):从官方 deb 解出原始 app 与打包结构
|
||||
node build.js unpack ~/Downloads/SideQuest-1.4.1.deb
|
||||
|
||||
# ② 构建:打补丁 → 出 asar → 出 deb
|
||||
node build.js all
|
||||
# 产物: $SQ_ZH_HOME/dist/SideQuest-1.4.1-zh.N-amd64.deb (+ .sha256)
|
||||
# $SQ_ZH_HOME/dist/app.asar.zh (+ .sha256)
|
||||
|
||||
# ③ 先试运行确认(推荐;完全隔离,不碰系统与真实配置)
|
||||
bash ./test-run.sh # 默认 9223 端口,10 秒后打印已加载页面
|
||||
bash ./stop-test.sh
|
||||
|
||||
# ④ 覆盖安装(需要交互式 sudo)
|
||||
sudo bash ./install.sh
|
||||
bash ./verify.sh # 装完后独立复核
|
||||
```
|
||||
|
||||
To build the angular app only
|
||||
```
|
||||
yarn app-build
|
||||
```
|
||||
`unpack` 也接受直接给 `app.asar`(此时只准备 app 基线,不产出 deb,适合只想换 asar 的场景)。
|
||||
|
||||
---
|
||||
|
||||
To build the electron app only
|
||||
```
|
||||
yarn build
|
||||
yarn build --mac
|
||||
yarn build --wlm
|
||||
```
|
||||
|
||||
To build the app & angular app (NOT for Raspberry Pi)
|
||||
```
|
||||
yarn dist
|
||||
```
|
||||
|
||||
To build the app & angular app on a Raspberry Pi
|
||||
```
|
||||
yarn dist --armv7l
|
||||
```
|
||||
|
||||
To re-launch electron if you accidentally close it
|
||||
```
|
||||
yarn electron
|
||||
```
|
||||
|
||||
To reset things
|
||||
```
|
||||
yarn reset
|
||||
```
|
||||
|
||||
## Windows Silent Install
|
||||
## 3. 汉化是怎么生效的
|
||||
|
||||
```
|
||||
"/S" for silent install and "/D=<path>"
|
||||
Electron 主进程 (dist-electron/main.js)
|
||||
└─ 末尾追加的 hook: app.on('web-contents-created', ...)
|
||||
└─ 对每个本地页面 (file:// 与 data:text/html) 注入 engine.js
|
||||
└─ 引擎遍历 DOM:文本节点 + placeholder/title/aria-label/alt
|
||||
+ MutationObserver 兜底 Angular 重渲染
|
||||
```
|
||||
|
||||
几个关键点:
|
||||
|
||||
* **为什么用主进程 hook 而不是改 HTML**:应用有 7 个 overlay 页面是以 `data:text/html`
|
||||
拼出来并带 `default-src 'none'` CSP 的,无法外链脚本;`index.html` 又没有 CSP。
|
||||
统一 hook 一次覆盖全部窗口(包括以后新增的),所以不需要逐个 HTML 注入。
|
||||
* **远程内容不注入**:内嵌商店(默认 `www.vrwanba.com`)是服务端渲染,属于另一个仓库的工作。
|
||||
* **幂等**:只做「英文 → 中文」替换,译文不会被再次翻译;规则带"替换结果不得再次命中"的守卫,
|
||||
因此可以安全处理 `1.2.3.4:5555 · last seen 5分钟前` 这种混排。
|
||||
* **不误伤**:`script` / `style` / `code` / `pre` / `svg` 子树整体跳过;
|
||||
`mat-icon`、`.material-icons` 跳过(图标用的是 ligature 字形名,翻了就变方块);
|
||||
支持 `translate="no"` 与 `data-sq-zh-skip` 显式豁免。
|
||||
* **组合文案**:Angular 会把 `说明 + (Default: X)` 拼进同一个文本节点,引擎会拆开分别翻译再拼回,
|
||||
而不是为每条说明写一条规则。
|
||||
|
||||
## Code Siging
|
||||
`build.js` 一共打了 4 类补丁,每处都要求**精确命中**,上游一变就直接报错而不是静默失效:
|
||||
|
||||
The app is built and signed/notorized with electron-builder/electron-notorize.
|
||||
Below are the required environment variables and their explanations.
|
||||
| 补丁 | 作用 | 禁用方式 |
|
||||
| --- | --- | --- |
|
||||
| 注入 hook + engine | 汉化本体 | — |
|
||||
| `updater.js` `supportsAppUpdates()` | 禁用官方自动更新,避免中文界面被官方英文版静默覆盖 | 启动时加 `SQ_ZH_ALLOW_UPDATES=1` |
|
||||
| `site.json` → `webUrl` + `STORE_HOSTS` | 切换内嵌商店默认站点(白名单必须同步,否则 `assertAllowedStoreUrl` 拒绝加载) | 改 `site.json` |
|
||||
| Angular en-US 语言数据 + `Intl.RelativeTimeFormat` | 日期/相对时间中文化(`2小时前`、`2026/10/11`) | — |
|
||||
|
||||
APPLE_ID - your apple id eg. someone@apple.com
|
||||
---
|
||||
|
||||
APPLE_ID_PASS - A app specific password - https://support.apple.com/en-gb/HT204397
|
||||
## 4. 回滚
|
||||
|
||||
APPLE_ID_TEAM - The app le Team ID found on the apple developer dashboard
|
||||
```bash
|
||||
# 恢复官方英文版
|
||||
sudo dpkg -i ~/Downloads/SideQuest-1.4.1.deb
|
||||
|
||||
CSC_LINK - The base64 encoded .p12 file ( Apple Developer ID cert ) as a string. Do not include the `-----BEGIN CERTIFICATE-----` or `-----END CERTIFICATE-----` parts just the base64 string.
|
||||
# 或者只还原 app.asar(install.sh 每次都会自动备份)
|
||||
sudo cp $SQ_ZH_HOME/backup/app.asar.before-install-<时间戳> /opt/SideQuest/resources/app.asar
|
||||
```
|
||||
|
||||
CSC_KEY_PASSWORD - The passphrase used when generating the .p12 file for mac.
|
||||
`install.sh` 不会触碰 `~/.config/SideQuestDesktop`(登录态、设备绑定、已记住的无线设备都在这里;
|
||||
商店会话在 `Partitions/sidequest-store`)。deb 的 `postrm` 也只删 `/usr/bin/sidequest` 软链。
|
||||
|
||||
GH_TOKEN - The github personal access token used to upload releases
|
||||
---
|
||||
|
||||
WIN_CSC_LINK - The base64 encoded .p12 file ( Windows Code Signing Cert ). as a string. Do not include the `-----BEGIN CERTIFICATE-----` or `-----END CERTIFICATE-----` parts just the base64 string.
|
||||
## 5. 上游发新版后怎么复用
|
||||
|
||||
WIN_CSC_KEY_PASSWORD - The passphrase used when generating the .p12 file for windows.
|
||||
```bash
|
||||
node build.js unpack ~/Downloads/SideQuest-<新版本>.deb
|
||||
node build.js all
|
||||
bash ./test-run.sh # 确认没有回退
|
||||
sudo bash ./install.sh
|
||||
```
|
||||
|
||||
Edit: Windows signing no longer works without a usb dongle because fuck the signing industry.
|
||||
`build.js` 会在补丁点找不到原始代码时直接失败并指出位置,此时按提示更新对应补丁即可
|
||||
(补丁函数集中在 `build.js` 的 `patch*()` 里,每个都自带失败诊断)。
|
||||
|
||||
You'll need this on the path to build for windows locally: C:\Users\USER\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\windows-10\x64
|
||||
补词条:改 `dict-*.json`(纯 JSON,键=英文原文,值=译文)或 `rules.json`(正则),
|
||||
然后 `node build.js all`。**不需要重新 unpack。**
|
||||
|
||||
---
|
||||
|
||||
## 6. 排查"某处没汉化"
|
||||
|
||||
1. 用 `test-run.sh` 起隔离实例,确认目标文本确实存在
|
||||
2. 若文本来自**动态拼接**(含变量),它通常是**单个文本节点**,需要写 `rules.json` 正则,
|
||||
而不是词典条目;反之若被插值切成多段,则要用词典条目
|
||||
3. 检查该元素是否命中豁免(图标 class / `code` / `pre` / `translate="no"`)
|
||||
4. 设备页、应用列表、文件列表里的**真实数据**(Android 目录名 `DCIM`、应用名 `WhatsApp`、
|
||||
`debug.hwui.*` 这类系统属性名)**故意不翻译**,翻译了反而看不懂、点不对
|
||||
|
||||
---
|
||||
|
||||
## 7. 已踩过的坑(都已在脚本里规避)
|
||||
|
||||
* **asar 不能走符号链接**:`resources/app.asar` 若是指向别处的软链,Electron 会静默加载失败
|
||||
(退出码 1、无任何报错)。试运行脚本因此强制用实体文件。
|
||||
* **`dpkg-deb --build` 的载荷根**:它把"除 `DEBIAN` 外的所有内容"当作载荷根。
|
||||
若把载荷放在 `data/` 子目录,装完会变成 `/data/opt/...`,**完全不会更新应用**。
|
||||
必须组装成 `<root>/DEBIAN` + `<root>/opt` + `<root>/usr`。
|
||||
* **权限要对齐**:构建根 755、`app.asar` 644,否则与原包逐项对比会不一致。
|
||||
* **压缩格式**:官方包用 `xz`,新版 dpkg 默认改成 `zstd`,需显式 `-Zxz` 保持一致。
|
||||
* **不要用 `pkill -f`**:模式会匹配到调用者自己的命令行(含 `busybox`/`bash` 的 cmdline),
|
||||
导致脚本被自己杀掉。本工具包一律用 `/proc/<pid>/exe` 精确匹配。
|
||||
* **Electron 子进程会继承监听 socket**:父进程退出后,`adb` 等子进程可能仍占着
|
||||
原来的调试端口,需要按 exe 清理。
|
||||
* **版本号语义**:用 `1.4.1-zh.N`。注意 semver 下 `1.4.1 > 1.4.1-zh.N`,所以即使
|
||||
重新启用更新器,官方版本也会把汉化版"降级"覆盖——这正是要禁用更新器的原因。
|
||||
|
||||
---
|
||||
|
||||
## 8. 当前状态
|
||||
|
||||
* 基线版本:**1.4.1**(阶段产物 `1.4.1-zh.3`)
|
||||
* 覆盖范围:应用外壳全部页面 —— 主页 / 侧载 / 文件 / 应用 / 串流 / 设备设置 / 调试(Logcat) /
|
||||
无线 / 全部 overlay 弹窗 / 命令面板 / 日期与相对时间
|
||||
* 实测结论:各页面除品牌名、设备型号、单位与系统属性名外,**无残留英文**
|
||||
* 不做:内嵌商店(远程服务端渲染)
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/* ============================================================================
|
||||
* 纯 Node 实现的 asar 读/写(无任何外部依赖)
|
||||
*
|
||||
* 为什么要自己实现:Electron 的 asar 格式非常简单且稳定(头部 Pickle + JSON
|
||||
* 目录表 + 连续文件数据),自己实现可以让整个汉化工具链在离线、无 node_modules
|
||||
* 的环境下继续可用,避免以后升级时还要联网装 @electron/asar。
|
||||
*
|
||||
* 格式(与 Electron/@electron/asar 完全一致):
|
||||
* [0..4) u32 = 4 —— sizePickle 的载荷长度
|
||||
* [4..8) u32 = headerPickleLen —— 头部 Pickle 总长度
|
||||
* [8..12) u32 = payloadLen —— headerPickle 内层载荷长度
|
||||
* [12..16) u32 = jsonLen —— JSON 目录表长度
|
||||
* [16..) JSON 目录表 + 对齐填充
|
||||
* [8 + headerPickleLen ..) —— 文件数据区
|
||||
*
|
||||
* 目录表节点:
|
||||
* 目录: { files: { 名称: 节点 } }
|
||||
* 文件: { size, offset(字符串,相对数据区起点), integrity:{algorithm,hash} }
|
||||
* 软链: { link: 目标 }
|
||||
* ==========================================================================*/
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const HEADER_OFFSET = 8; /* 文件数据区起点 = HEADER_OFFSET + headerPickleLen */
|
||||
|
||||
/* ----------------------------------------------------------------- 读取头部 */
|
||||
function readHeader(fd) {
|
||||
const head = Buffer.alloc(16);
|
||||
fs.readSync(fd, head, 0, 16, 0);
|
||||
const headerPickleLen = head.readUInt32LE(4);
|
||||
const jsonLen = head.readUInt32LE(12);
|
||||
const jsonBuf = Buffer.alloc(jsonLen);
|
||||
fs.readSync(fd, jsonBuf, 0, jsonLen, 16);
|
||||
return {
|
||||
header: JSON.parse(jsonBuf.toString('utf8')),
|
||||
dataStart: HEADER_OFFSET + headerPickleLen,
|
||||
};
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- 解包 */
|
||||
/**
|
||||
* 把 asar 解包到 outDir。
|
||||
* 注意:只处理普通文件、目录与软链;忽略 asar 的 unpacked 约定(本项目的 app
|
||||
* 未使用 unpacked 资源,build.asarUnpack 在旧架构下才用到)。
|
||||
*/
|
||||
function extract(asarPath, outDir) {
|
||||
const fd = fs.openSync(asarPath, 'r');
|
||||
try {
|
||||
const { header, dataStart } = readHeader(fd);
|
||||
let count = 0;
|
||||
const walk = (node, cur) => {
|
||||
for (const name of Object.keys(node.files || {})) {
|
||||
const child = node.files[name];
|
||||
const abs = path.join(cur, name);
|
||||
if (child.files) {
|
||||
fs.mkdirSync(abs, { recursive: true });
|
||||
walk(child, abs);
|
||||
} else if (typeof child.link === 'string') {
|
||||
try {
|
||||
fs.symlinkSync(child.link, abs);
|
||||
} catch (e) {
|
||||
/* 已存在等情况忽略 */
|
||||
}
|
||||
} else {
|
||||
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
||||
const buf = Buffer.alloc(child.size);
|
||||
fs.readSync(fd, buf, 0, child.size, dataStart + parseInt(child.offset, 10));
|
||||
fs.writeFileSync(abs, buf);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(header, outDir);
|
||||
return { files: count };
|
||||
} finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- 打包 */
|
||||
function sha256hex(buf) {
|
||||
return crypto.createHash('sha256').update(buf).digest('hex');
|
||||
}
|
||||
|
||||
/**
|
||||
* 把 srcDir 打包为 asar。
|
||||
* 遍历顺序固定(按名称排序),保证同一输入产出同一字节序列 —— 便于校验与复现。
|
||||
*/
|
||||
function pack(srcDir, outFile) {
|
||||
const files = []; /* { rel, abs, size, buf } */
|
||||
const dirs = new Set();
|
||||
|
||||
(function walk(cur, rel) {
|
||||
const entries = fs.readdirSync(cur, { withFileTypes: true }).sort((a, b) =>
|
||||
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
||||
);
|
||||
if (entries.length === 0 && rel !== '') dirs.add(rel);
|
||||
for (const e of entries) {
|
||||
const abs = path.join(cur, e.name);
|
||||
const childRel = rel === '' ? e.name : rel + '/' + e.name;
|
||||
if (e.isDirectory()) {
|
||||
dirs.add(childRel);
|
||||
walk(abs, childRel);
|
||||
} else if (e.isSymbolicLink()) {
|
||||
files.push({ rel: childRel, abs, link: fs.readlinkSync(abs) });
|
||||
} else if (e.isFile()) {
|
||||
files.push({ rel: childRel, abs, buf: fs.readFileSync(abs) });
|
||||
}
|
||||
}
|
||||
})(srcDir, '');
|
||||
|
||||
/* 数据区顺序:文件按 rel 排序,依次追加 */
|
||||
const ordered = files.filter(f => f.buf).sort((a, b) => (a.rel < b.rel ? -1 : 1));
|
||||
let offset = 0;
|
||||
for (const f of ordered) {
|
||||
f.offset = offset;
|
||||
offset += f.buf.length;
|
||||
}
|
||||
|
||||
/* 构造 JSON 目录表 */
|
||||
const root = { files: {} };
|
||||
const ensureDir = rel => {
|
||||
const parts = rel.split('/');
|
||||
let node = root;
|
||||
for (const p of parts) {
|
||||
if (!node.files[p]) node.files[p] = { files: {} };
|
||||
node = node.files[p];
|
||||
}
|
||||
return node;
|
||||
};
|
||||
for (const d of [...dirs].sort()) ensureDir(d);
|
||||
for (const f of files) {
|
||||
const parts = f.rel.split('/');
|
||||
const name = parts.pop();
|
||||
const parent = parts.length ? ensureDir(parts.join('/')) : root;
|
||||
if (f.link !== undefined) {
|
||||
parent.files[name] = { link: f.link };
|
||||
} else {
|
||||
parent.files[name] = {
|
||||
size: f.buf.length,
|
||||
offset: String(f.offset),
|
||||
integrity: { algorithm: 'SHA256', hash: sha256hex(f.buf) },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const json = Buffer.from(JSON.stringify(root), 'utf8');
|
||||
/* 对齐:令 headerPickleLen = 8 + jsonLen + pad 为 4 的倍数 */
|
||||
let pad = (4 - ((HEADER_OFFSET + json.length) % 4)) % 4;
|
||||
const payloadLen = 4 + json.length + pad;
|
||||
const headerPickleLen = 4 + payloadLen;
|
||||
|
||||
const head = Buffer.alloc(16);
|
||||
head.writeUInt32LE(4, 0);
|
||||
head.writeUInt32LE(headerPickleLen, 4);
|
||||
head.writeUInt32LE(payloadLen, 8);
|
||||
head.writeUInt32LE(json.length, 12);
|
||||
|
||||
const out = fs.openSync(outFile, 'w');
|
||||
try {
|
||||
fs.writeSync(out, head);
|
||||
fs.writeSync(out, json);
|
||||
if (pad) fs.writeSync(out, Buffer.alloc(pad));
|
||||
for (const f of ordered) fs.writeSync(out, f.buf);
|
||||
} finally {
|
||||
fs.closeSync(out);
|
||||
}
|
||||
return { files: ordered.length, bytes: offset };
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- 单文件读取 */
|
||||
function readFile(asarPath, innerPath) {
|
||||
const fd = fs.openSync(asarPath, 'r');
|
||||
try {
|
||||
const { header, dataStart } = readHeader(fd);
|
||||
let node = header;
|
||||
for (const p of innerPath.split('/')) {
|
||||
if (!node.files || !node.files[p]) return null;
|
||||
node = node.files[p];
|
||||
}
|
||||
if (!node || node.files) return null;
|
||||
const buf = Buffer.alloc(node.size);
|
||||
fs.readSync(fd, buf, 0, node.size, dataStart + parseInt(node.offset, 10));
|
||||
return buf;
|
||||
} finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { extract, pack, readFile, readHeader };
|
||||
|
||||
/* -------------------------------------------------------------- CLI(可选) */
|
||||
if (require.main === module) {
|
||||
const [cmd, a, b] = process.argv.slice(2);
|
||||
if (cmd === 'extract') {
|
||||
const r = extract(a, b);
|
||||
console.log('已解包 ' + r.files + ' 个文件 -> ' + b);
|
||||
} else if (cmd === 'pack') {
|
||||
const r = pack(a, b);
|
||||
console.log('已打包 ' + r.files + ' 个文件 (' + r.bytes + ' 字节数据) -> ' + b);
|
||||
} else if (cmd === 'ls') {
|
||||
const { header } = readHeader(fs.openSync(a, 'r'));
|
||||
console.log(JSON.stringify(header, null, 1).slice(0, 2000));
|
||||
} else {
|
||||
console.log('用法: node asar.js <extract|pack|ls> <输入> [输出]');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,492 @@
|
||||
#!/usr/bin/env node
|
||||
/* ============================================================================
|
||||
* SideQuest 简体中文汉化 —— 构建脚本
|
||||
*
|
||||
* 用法:
|
||||
* node build.js inject # 合并词典 + 引擎,产出 dist-electron/l10n-zh-inject.js
|
||||
* node build.js app # 生成打过补丁的 app 目录 (work/app-zh)
|
||||
* node build.js asar # 打包 work/app.asar.zh
|
||||
* node build.js deb # 生成 work/out/SideQuest-<ver>-zh.deb
|
||||
* node build.js all # inject + app + asar + deb
|
||||
*
|
||||
* 产物:
|
||||
* work/app-zh/ 补丁后的 app 目录
|
||||
* work/app.asar.zh 补丁后的 asar
|
||||
* work/out/*.deb 可 dpkg -i 覆盖安装的安装包
|
||||
* ==========================================================================*/
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { execFileSync } = require('child_process');
|
||||
const asar = require('./asar.js');
|
||||
|
||||
const WORK = process.env.SQ_ZH_HOME || path.join(os.homedir(), '.sidequest-zh');
|
||||
const L10N = __dirname;
|
||||
const APP_PRISTINE = path.join(WORK, 'app');
|
||||
const APP_ZH = path.join(WORK, 'app-zh');
|
||||
const INJECT_OUT = path.join(APP_ZH, 'dist-electron', 'l10n-zh-inject.js');
|
||||
const ASAR_OUT = path.join(WORK, 'dist', 'app.asar.zh');
|
||||
const OUT_DIR = path.join(WORK, 'dist');
|
||||
const DEB_ROOT = path.join(WORK, 'deb');
|
||||
/* dpkg-deb --build <dir> 会把「除 DEBIAN 外的所有内容」当作载荷根,
|
||||
* 因此必须先组装出一个结构正确的构建根,否则载荷会落到 /data/ 下。 */
|
||||
const DEB_BUILD_ROOT = path.join(WORK, 'deb-build');
|
||||
|
||||
/* 由 deb 的 control 决定的版本号;Debian 版本必须单调递增 */
|
||||
const DEB_VERSION = process.env.SQ_ZH_VERSION || '1.4.1-zh.3';
|
||||
|
||||
function log(...a) {
|
||||
console.log('[build]', ...a);
|
||||
}
|
||||
|
||||
function die(msg) {
|
||||
console.error('[build] 失败: ' + msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function readJson(p) {
|
||||
return JSON.parse(fs.readFileSync(p, 'utf8'));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ inject */
|
||||
function stepInject() {
|
||||
const dict = Object.assign(
|
||||
{},
|
||||
readJson(path.join(L10N, 'dict-a.json')),
|
||||
readJson(path.join(L10N, 'dict-b.json')),
|
||||
readJson(path.join(L10N, 'dict-c.json')),
|
||||
readJson(path.join(L10N, 'dict-e.json')),
|
||||
readJson(path.join(L10N, 'dict-f.json')),
|
||||
readJson(path.join(L10N, 'dict-g.json')),
|
||||
readJson(path.join(L10N, 'dict-h.json')),
|
||||
readJson(path.join(L10N, 'dict-i.json'))
|
||||
);
|
||||
const rules = readJson(path.join(L10N, 'rules.json'));
|
||||
const engine = fs.readFileSync(path.join(L10N, 'engine.js'), 'utf8');
|
||||
|
||||
// 校验规则正则合法
|
||||
for (const [re] of rules) {
|
||||
try {
|
||||
new RegExp(re);
|
||||
} catch (e) {
|
||||
die('rules.json 中的正则无效: ' + re + ' -> ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
const banner =
|
||||
'/* SideQuest 简体中文语言包 —— 由 l10n/build.js 自动生成,请勿手工修改。\n' +
|
||||
' 词条数: ' +
|
||||
Object.keys(dict).length +
|
||||
' / 规则数: ' +
|
||||
rules.length +
|
||||
' */\n';
|
||||
const payload =
|
||||
banner +
|
||||
'window.__SQ_ZH__ = { dict: ' +
|
||||
JSON.stringify(dict) +
|
||||
', rules: ' +
|
||||
JSON.stringify(rules) +
|
||||
' };\n' +
|
||||
engine;
|
||||
|
||||
const target = path.join(WORK, 'l10n-zh-inject.js');
|
||||
fs.writeFileSync(target, payload, 'utf8');
|
||||
log('引擎已生成: ' + target + ' (词条 ' + Object.keys(dict).length + ' 条)');
|
||||
return target;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- app */
|
||||
function copyDir(src, dst) {
|
||||
fs.rmSync(dst, { recursive: true, force: true });
|
||||
fs.mkdirSync(dst, { recursive: true });
|
||||
for (const e of fs.readdirSync(src, { withFileTypes: true })) {
|
||||
const s = path.join(src, e.name);
|
||||
const d = path.join(dst, e.name);
|
||||
if (e.isDirectory()) copyDir(s, d);
|
||||
else if (e.isSymbolicLink()) fs.symlinkSync(fs.readlinkSync(s), d);
|
||||
else fs.copyFileSync(s, d);
|
||||
}
|
||||
}
|
||||
|
||||
function patchUpdater() {
|
||||
const p = path.join(APP_ZH, 'dist-electron', 'updater.js');
|
||||
let s = fs.readFileSync(p, 'utf8');
|
||||
const ORIG =
|
||||
"function supportsAppUpdates() {\n" +
|
||||
" return electron_1.app.isPackaged && !process.env['FLATPAK_ID'];\n" +
|
||||
'}';
|
||||
const PATCHED =
|
||||
'function supportsAppUpdates() {\n' +
|
||||
' // [l10n-zh] 汉化版默认禁用官方自动更新,避免中文界面被官方英文版静默覆盖。\n' +
|
||||
" // 如需恢复自动更新:设置环境变量 SQ_ZH_ALLOW_UPDATES=1 启动即可。\n" +
|
||||
" if (process.env['SQ_ZH_ALLOW_UPDATES'] !== '1') {\n" +
|
||||
' return false;\n' +
|
||||
' }\n' +
|
||||
" return electron_1.app.isPackaged && !process.env['FLATPAK_ID'];\n" +
|
||||
'}';
|
||||
if (s.indexOf(ORIG) === -1) {
|
||||
if (s.indexOf('[l10n-zh]') !== -1) {
|
||||
log('updater.js 已是补丁状态,跳过');
|
||||
return;
|
||||
}
|
||||
die('updater.js 中未找到 supportsAppUpdates() 原始实现,上游代码可能已变动');
|
||||
}
|
||||
s = s.replace(ORIG, PATCHED);
|
||||
// 跳过原因日志更准确
|
||||
s = s.replace(
|
||||
"'[updater] skipped — installation updates are managed by Flatpak.'",
|
||||
"'[updater] skipped — disabled by zh-CN localization build (set SQ_ZH_ALLOW_UPDATES=1 to re-enable).'"
|
||||
);
|
||||
fs.writeFileSync(p, s, 'utf8');
|
||||
log('updater.js 已禁用官方自动更新');
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- 站点 */
|
||||
/**
|
||||
* 切换内嵌商店的默认站点。需要同步改两处:
|
||||
* 1. 渲染进程的环境配置对象 webUrl(内嵌商店加载的首页)
|
||||
* 2. 主进程 STORE_HOSTS 白名单(否则 assertAllowedStoreUrl 会拒绝加载)
|
||||
* 站点地址来自 l10n/site.json,便于以后随时切换。
|
||||
*/
|
||||
function patchSite() {
|
||||
const site = readJson(path.join(L10N, 'site.json'));
|
||||
const target = site.webUrl;
|
||||
if (!target) die('site.json 缺少 webUrl');
|
||||
|
||||
// 1) 渲染进程 webUrl
|
||||
const browserDir = path.join(APP_ZH, 'dist', 'sidequest-desktop', 'browser');
|
||||
const re = /webUrl:"([^"]+)"/;
|
||||
let hit = 0;
|
||||
let seen = null;
|
||||
for (const f of fs.readdirSync(browserDir).filter(x => x.endsWith('.js'))) {
|
||||
const p = path.join(browserDir, f);
|
||||
const s = fs.readFileSync(p, 'utf8');
|
||||
const m = re.exec(s);
|
||||
if (!m) continue;
|
||||
seen = m[1];
|
||||
if (m[1] === target) continue;
|
||||
fs.writeFileSync(p, s.replace(re, 'webUrl:"' + target + '"'), 'utf8');
|
||||
hit++;
|
||||
log('webUrl 已切换: ' + m[1] + ' -> ' + target + ' (' + f + ')');
|
||||
}
|
||||
if (hit === 0 && seen === null) {
|
||||
die('未在渲染进程中找到 webUrl 配置(上游代码可能已变动)');
|
||||
}
|
||||
if (hit === 0 && seen === target) log('webUrl 已是目标站点,跳过');
|
||||
|
||||
// 2) 主进程 STORE_HOSTS 白名单(保留旧 hosts,避免影响登录回跳等流程)
|
||||
const mp = path.join(APP_ZH, 'dist-electron', 'main.js');
|
||||
let ms = fs.readFileSync(mp, 'utf8');
|
||||
const sm = /const STORE_HOSTS = new Set\(\[([^\]]*)\]\);/.exec(ms);
|
||||
if (!sm) die('未找到 STORE_HOSTS 定义,上游代码可能已变动');
|
||||
const cur = sm[1]
|
||||
.split(',')
|
||||
.map(x => x.trim().replace(/^'|'$/g, ''))
|
||||
.filter(Boolean);
|
||||
const want = (site.extraStoreHosts || []).slice();
|
||||
try {
|
||||
want.push(new URL(target).hostname);
|
||||
} catch (e) {
|
||||
die('site.json 的 webUrl 不是合法 URL: ' + target);
|
||||
}
|
||||
const merged = cur.slice();
|
||||
for (const h of want) if (h && merged.indexOf(h) === -1) merged.push(h);
|
||||
if (merged.length !== cur.length) {
|
||||
const lit =
|
||||
'const STORE_HOSTS = new Set([' + merged.map(h => "'" + h + "'").join(', ') + ']);';
|
||||
ms = ms.replace(sm[0], lit);
|
||||
fs.writeFileSync(mp, ms, 'utf8');
|
||||
log('STORE_HOSTS 已扩展: ' + merged.join(', '));
|
||||
} else {
|
||||
log('STORE_HOSTS 已包含目标主机,跳过');
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ 日期本地化 */
|
||||
/**
|
||||
* 把 Angular 内置的 en-US 语言数据替换为中文,使日期/时间输出中文化。
|
||||
* 应用没有显式设置 LOCALE_ID,因此走 Angular 默认的 en-US,正好命中这段数据。
|
||||
* 每一项替换都要求「恰好命中 1 次」,上游代码变动时会直接报错而不是静默失效。
|
||||
*/
|
||||
function patchLocale() {
|
||||
const browserDir = path.join(APP_ZH, 'dist', 'sidequest-desktop', 'browser');
|
||||
const files = fs
|
||||
.readdirSync(browserDir)
|
||||
.filter(f => f.endsWith('.js'))
|
||||
.map(f => path.join(browserDir, f));
|
||||
|
||||
const SUBS = [
|
||||
// 语言标识
|
||||
['var CE=["en",', 'var CE=["zh-Hans",'],
|
||||
// 上午/下午
|
||||
['[["a","p"],["AM","PM"]]', '[["am","pm"],["\u4e0a\u5348","\u4e0b\u5348"]]'],
|
||||
// 星期
|
||||
[
|
||||
'["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]',
|
||||
'["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"],["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"]',
|
||||
],
|
||||
// 月份
|
||||
[
|
||||
'["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]',
|
||||
'["1","2","3","4","5","6","7","8","9","10","11","12"],["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"]',
|
||||
],
|
||||
// 纪元
|
||||
[
|
||||
'[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]]',
|
||||
'[["B","A"],["\u516c\u5143\u524d","\u516c\u5143"],["\u516c\u5143\u524d","\u516c\u5143"]]',
|
||||
],
|
||||
// 日期格式
|
||||
[
|
||||
'["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"]',
|
||||
'["yyyy/M/d","yyyy\u5e74M\u6708d\u65e5","yyyy\u5e74M\u6708d\u65e5","yyyy\u5e74M\u6708d\u65e5 EEEE"]',
|
||||
],
|
||||
// 时间格式
|
||||
[
|
||||
'["h:mm\\u202Fa","h:mm:ss\\u202Fa","h:mm:ss\\u202Fa z","h:mm:ss\\u202Fa zzzz"]',
|
||||
'["H:mm","H:mm:ss","H:mm:ss z","H:mm:ss zzzz"]',
|
||||
],
|
||||
// 相对时间(Intl)
|
||||
[
|
||||
'new Intl.RelativeTimeFormat("en",{numeric:"auto"})',
|
||||
'new Intl.RelativeTimeFormat("zh-CN",{numeric:"auto"})',
|
||||
],
|
||||
];
|
||||
|
||||
for (const [from, to] of SUBS) {
|
||||
let hits = 0;
|
||||
for (const p of files) {
|
||||
const s = fs.readFileSync(p, 'utf8');
|
||||
const n = s.split(from).length - 1;
|
||||
if (n === 0) continue;
|
||||
hits += n;
|
||||
fs.writeFileSync(p, s.split(from).join(to), 'utf8');
|
||||
}
|
||||
if (hits === 0) {
|
||||
if (to.indexOf('\u4e0a\u5348') !== -1 || to.indexOf('yyyy') !== -1 || to.indexOf('zh-CN') !== -1) {
|
||||
log(' 跳过(未命中,可能已是本地化状态): ' + from.slice(0, 40));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
log(' 日期本地化: ' + hits + ' 处 ' + from.slice(0, 46));
|
||||
}
|
||||
}
|
||||
|
||||
function patchMain() {
|
||||
const p = path.join(APP_ZH, 'dist-electron', 'main.js');
|
||||
let s = fs.readFileSync(p, 'utf8');
|
||||
if (s.indexOf('SideQuest 简体中文汉化 —— 主进程统一注入 hook') !== -1) {
|
||||
log('main.js 已含注入 hook,跳过');
|
||||
return;
|
||||
}
|
||||
const tail = fs.readFileSync(path.join(L10N, 'tail.js'), 'utf8');
|
||||
if (!s.endsWith('\n')) s += '\n';
|
||||
fs.writeFileSync(p, s + '\n' + tail + '\n', 'utf8');
|
||||
log('main.js 已追加注入 hook');
|
||||
}
|
||||
|
||||
function stepApp() {
|
||||
if (!fs.existsSync(path.join(APP_PRISTINE, 'dist-electron', 'main.js'))) {
|
||||
die('未找到原始 app 目录: ' + APP_PRISTINE + '(请先运行解包脚本)');
|
||||
}
|
||||
const inject = stepInject();
|
||||
copyDir(APP_PRISTINE, APP_ZH);
|
||||
fs.copyFileSync(inject, INJECT_OUT);
|
||||
patchUpdater();
|
||||
patchSite();
|
||||
patchLocale();
|
||||
patchMain();
|
||||
const st = fs.statSync(APP_ZH);
|
||||
log('app-zh 已生成: ' + APP_ZH);
|
||||
return APP_ZH;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- asar */
|
||||
function stepAsar() {
|
||||
if (!fs.existsSync(APP_ZH)) die('app-zh 不存在,请先运行: node build.js app');
|
||||
fs.mkdirSync(path.dirname(ASAR_OUT), { recursive: true });
|
||||
fs.rmSync(ASAR_OUT, { force: true });
|
||||
const r = asar.pack(APP_ZH, ASAR_OUT);
|
||||
/* 记录 asar 哈希:install.sh / verify.sh 用它确认「装的确实是验证过的那份」 */
|
||||
fs.writeFileSync(
|
||||
ASAR_OUT + '.sha256',
|
||||
require('crypto').createHash('sha256').update(fs.readFileSync(ASAR_OUT)).digest('hex') +
|
||||
' ' +
|
||||
path.basename(ASAR_OUT) +
|
||||
'\n',
|
||||
'utf8'
|
||||
);
|
||||
log(
|
||||
'app.asar 已生成: ' +
|
||||
ASAR_OUT +
|
||||
' (' + r.files + ' 个文件, ' + fs.statSync(ASAR_OUT).size + ' 字节)'
|
||||
);
|
||||
return ASAR_OUT;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- deb */
|
||||
function stepDeb() {
|
||||
if (!fs.existsSync(ASAR_OUT)) die('app.asar.zh 不存在,请先运行: node build.js asar');
|
||||
/* 只清理旧的 deb 产物:asar 产物现在也放在 OUT_DIR 下,
|
||||
不能整目录删除,否则会把自己的输入删掉。 */
|
||||
fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||
for (const f of fs.readdirSync(OUT_DIR)) {
|
||||
if (f.endsWith('.deb') || f.endsWith('.deb.sha256')) {
|
||||
fs.rmSync(path.join(OUT_DIR, f), { force: true });
|
||||
}
|
||||
}
|
||||
|
||||
// 用原始 deb 作为底包,仅替换 app.asar 并改版本号,保证 postinst/postrm 等完全一致
|
||||
const rootData = path.join(DEB_ROOT, 'data');
|
||||
const rootCtl = path.join(DEB_ROOT, 'DEBIAN');
|
||||
if (!fs.existsSync(rootData) || !fs.existsSync(rootCtl)) die('deb 底包未解压,请先运行解包脚本');
|
||||
|
||||
const asarDst = path.join(rootData, 'opt', 'SideQuest', 'resources', 'app.asar');
|
||||
if (!fs.existsSync(asarDst)) die('底包中未找到 app.asar: ' + asarDst);
|
||||
fs.copyFileSync(ASAR_OUT, asarDst);
|
||||
|
||||
// 版本号
|
||||
const ctlPath = path.join(rootCtl, 'control');
|
||||
let ctl = fs.readFileSync(ctlPath, 'utf8');
|
||||
ctl = ctl.replace(/^Version: .*$/m, 'Version: ' + DEB_VERSION);
|
||||
// Installed-Size 重新计算(KB)
|
||||
const installedKb = Number(
|
||||
execFileSync('du', ['-sk', rootData], { encoding: 'utf8' }).trim().split(/\s+/)[0]
|
||||
);
|
||||
ctl = ctl.replace(/^Installed-Size: .*$/m, 'Installed-Size: ' + installedKb);
|
||||
fs.writeFileSync(ctlPath, ctl, 'utf8');
|
||||
|
||||
// 重新生成 md5sums
|
||||
const files = [];
|
||||
(function walk(dir) {
|
||||
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const p = path.join(dir, e.name);
|
||||
if (e.isDirectory()) walk(p);
|
||||
else if (e.isFile()) files.push(p);
|
||||
}
|
||||
})(rootData);
|
||||
const lines = files
|
||||
.sort()
|
||||
.map(p => {
|
||||
const rel = path.relative(rootData, p);
|
||||
const md5 = execFileSync('md5sum', [p], { encoding: 'utf8' }).trim().split(/\s+/)[0];
|
||||
return md5 + ' ' + rel;
|
||||
})
|
||||
.join('\n');
|
||||
fs.writeFileSync(path.join(rootCtl, 'md5sums'), lines + '\n', 'utf8');
|
||||
|
||||
// 可执行文件权限(dpkg-deb 会保留,但确保与原始一致)
|
||||
const sq = path.join(rootData, 'opt', 'SideQuest', 'sidequest');
|
||||
if (fs.existsSync(sq)) fs.chmodSync(sq, 0o755);
|
||||
const sandbox = path.join(rootData, 'opt', 'SideQuest', 'chrome-sandbox');
|
||||
if (fs.existsSync(sandbox)) fs.chmodSync(sandbox, 0o755);
|
||||
|
||||
const outDeb = path.join(OUT_DIR, 'SideQuest-' + DEB_VERSION + '-amd64.deb');
|
||||
|
||||
// 组装结构正确的构建根: <root>/DEBIAN + <root>/opt + <root>/usr
|
||||
fs.rmSync(DEB_BUILD_ROOT, { recursive: true, force: true });
|
||||
fs.mkdirSync(DEB_BUILD_ROOT, { recursive: true });
|
||||
for (const entry of fs.readdirSync(rootData)) {
|
||||
execFileSync('cp', ['-a', path.join(rootData, entry), path.join(DEB_BUILD_ROOT, entry)]);
|
||||
}
|
||||
execFileSync('cp', ['-a', rootCtl, path.join(DEB_BUILD_ROOT, 'DEBIAN')]);
|
||||
|
||||
// 权限对齐原始包:构建根 755,app.asar 644(其余文件由 cp -a 保留原始权限)
|
||||
fs.chmodSync(DEB_BUILD_ROOT, 0o755);
|
||||
fs.chmodSync(path.join(DEB_BUILD_ROOT, 'opt', 'SideQuest', 'resources', 'app.asar'), 0o644);
|
||||
|
||||
// 与原包保持一致的压缩格式(官方 1.4.1 用的是 xz;新版 dpkg 默认改成了 zstd)
|
||||
execFileSync('dpkg-deb', ['--root-owner-group', '-Zxz', '--build', DEB_BUILD_ROOT, outDeb], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
fs.writeFileSync(
|
||||
outDeb + '.sha256',
|
||||
require('crypto').createHash('sha256').update(fs.readFileSync(outDeb)).digest('hex') +
|
||||
' ' + path.basename(outDeb) + '\n',
|
||||
'utf8'
|
||||
);
|
||||
log('deb 已生成: ' + outDeb + ' (' + fs.statSync(outDeb).size + ' 字节)');
|
||||
return outDeb;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ unpack */
|
||||
/**
|
||||
* 准备「原版基线」:从官方 deb(或 app.asar)解出可打补丁的 app 目录,
|
||||
* 以及用于重新打包 deb 的 DEBIAN + 载荷结构。
|
||||
*
|
||||
* node build.js unpack /path/to/SideQuest-1.4.1.deb
|
||||
* node build.js unpack /path/to/app.asar
|
||||
*
|
||||
* 只需要跑一次;之后 app / asar / deb / all 都基于它。
|
||||
*/
|
||||
function stepUnpack(srcArg) {
|
||||
if (!srcArg) die('用法: node build.js unpack <官方 deb 或 app.asar 路径>');
|
||||
if (!fs.existsSync(srcArg)) die('找不到输入文件: ' + srcArg);
|
||||
fs.mkdirSync(WORK, { recursive: true });
|
||||
|
||||
/* 按内容识别类型(deb 是 ar 归档,魔数 "!<arch>\n"),
|
||||
这样即使文件名被改过(如 xxx.deb.orig)也能正确处理。 */
|
||||
const magic = Buffer.alloc(8);
|
||||
{
|
||||
const fd = fs.openSync(srcArg, 'r');
|
||||
try {
|
||||
fs.readSync(fd, magic, 0, 8, 0);
|
||||
} finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
const isDeb = magic.toString('latin1') === '!<arch>\n';
|
||||
let asarPath = srcArg;
|
||||
log('输入类型: ' + (isDeb ? 'deb 安装包' : 'asar 归档'));
|
||||
|
||||
if (isDeb) {
|
||||
/* 解出 DEBIAN/ 与载荷(opt/ usr/ ...) */
|
||||
fs.rmSync(DEB_ROOT, { recursive: true, force: true });
|
||||
fs.mkdirSync(DEB_ROOT, { recursive: true });
|
||||
execFileSync('dpkg-deb', ['-e', srcArg, path.join(DEB_ROOT, 'DEBIAN')], { stdio: 'inherit' });
|
||||
const payload = path.join(DEB_ROOT, 'data');
|
||||
fs.mkdirSync(payload, { recursive: true });
|
||||
execFileSync('dpkg-deb', ['-x', srcArg, payload], { stdio: 'inherit' });
|
||||
asarPath = path.join(payload, 'opt', 'SideQuest', 'resources', 'app.asar');
|
||||
if (!fs.existsSync(asarPath)) die('deb 载荷中未找到 app.asar: ' + asarPath);
|
||||
log('deb 底包已解出: ' + DEB_ROOT);
|
||||
}
|
||||
|
||||
/* 解出原始 app 目录 */
|
||||
fs.rmSync(APP_PRISTINE, { recursive: true, force: true });
|
||||
fs.mkdirSync(APP_PRISTINE, { recursive: true });
|
||||
const r = asar.extract(asarPath, APP_PRISTINE);
|
||||
log('原版 app 已解出: ' + APP_PRISTINE + ' (' + r.files + ' 个文件)');
|
||||
if (!fs.existsSync(path.join(APP_PRISTINE, 'dist-electron', 'main.js'))) {
|
||||
die('解出的 app 中找不到 dist-electron/main.js —— 上游结构可能已变,请先确认版本');
|
||||
}
|
||||
log('完成。接着可执行: node build.js all');
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- main */
|
||||
const cmd = process.argv[2] || 'all';
|
||||
switch (cmd) {
|
||||
case 'unpack':
|
||||
stepUnpack(process.argv[3]);
|
||||
break;
|
||||
case 'inject':
|
||||
stepInject();
|
||||
break;
|
||||
case 'app':
|
||||
stepApp();
|
||||
break;
|
||||
case 'asar':
|
||||
stepAsar();
|
||||
break;
|
||||
case 'deb':
|
||||
stepDeb();
|
||||
break;
|
||||
case 'all':
|
||||
stepApp();
|
||||
stepAsar();
|
||||
stepDeb();
|
||||
break;
|
||||
default:
|
||||
die('未知命令: ' + cmd);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 145 KiB |
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Before Width: | Height: | Size: 353 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 607 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
@@ -1 +0,0 @@
|
||||
ManifestDPIAware true
|
||||
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 604 KiB |
@@ -1,14 +0,0 @@
|
||||
!macro customUnInstall
|
||||
MessageBox MB_YESNO "Delete app data and folder?" \
|
||||
/SD IDNO IDNO Skipped IDYES Accepted
|
||||
|
||||
Accepted:
|
||||
RMDir /r "$APPDATA\${APP_FILENAME}"
|
||||
!ifdef APP_PRODUCT_FILENAME
|
||||
RMDir /r "$APPDATA\${APP_PRODUCT_FILENAME}"
|
||||
!endif
|
||||
Goto done
|
||||
Skipped:
|
||||
Goto done
|
||||
done:
|
||||
!macroend
|
||||
@@ -1,57 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
const chalk = require('chalk');
|
||||
|
||||
const OwnerName = process.env.CERT_OWNERNAME || `"SideQuest LTD"`;
|
||||
const TimeStampServer = process.env.CERT_TIMESTAMPSERVER || 'http://time.certum.pl/';
|
||||
const Verbose = (process.env.CERT_VERBOSE && process.env.CERT_VERBOSE === 'true') || false;
|
||||
const Debug = (process.env.CERT_DEBUG && process.env.CERT_DEBUG === 'true') || false;
|
||||
const Skip = (process.env.CERT_SKIP && process.env.CERT_SKIP === 'true') || false;
|
||||
|
||||
async function doSign(file, hash, owner) {
|
||||
const sha256 = hash === 'sha256';
|
||||
const appendCert = sha256 ? '/as' : null;
|
||||
const timestamp = sha256 ? '/tr' : '/t';
|
||||
const appendTd = sha256 ? '/td sha256' : null;
|
||||
const debug = Debug ? '/debug' : null;
|
||||
|
||||
let args = [
|
||||
'cd',
|
||||
'%LOCALAPPDATA%\\electron-builder\\cache\\winCodeSign\\winCodeSign-2.6.0\\windows-10\\x64\\',
|
||||
'&&',
|
||||
'signtool',
|
||||
'sign',
|
||||
debug,
|
||||
'/n',
|
||||
owner,
|
||||
'/a',
|
||||
appendCert,
|
||||
'/fd',
|
||||
hash,
|
||||
timestamp,
|
||||
TimeStampServer,
|
||||
appendTd,
|
||||
'/v',
|
||||
`"${file}"`,
|
||||
];
|
||||
|
||||
try {
|
||||
const { stdout } = await exec(args.join(' '));
|
||||
if (Verbose) {
|
||||
console.log(stdout);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = async function(config) {
|
||||
if (!Skip) {
|
||||
console.info(
|
||||
`Signing ${chalk.green.bold(config.path)} with ${chalk.magenta(config.hash)} to ${chalk.cyan.bold(OwnerName)}`
|
||||
);
|
||||
await doSign(config.path, config.hash, OwnerName);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
# Browsers that we support
|
||||
last 1 version
|
||||
> 5%
|
||||
not dead
|
||||
not ie > 1
|
||||
not ie_mob > 1
|
||||
@@ -1,13 +0,0 @@
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,40 +0,0 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# misc
|
||||
/.angular/cache
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -1,27 +0,0 @@
|
||||
# DesktopApp
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.4.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
@@ -1,256 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"desktop-app": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"prefix": "app",
|
||||
"schematics": {},
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "../build/app",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss",
|
||||
"node_modules/materialize-css/dist/css/materialize.min.css"
|
||||
],
|
||||
"scripts": [
|
||||
"node_modules/materialize-css/dist/js/materialize.min.js",
|
||||
"node_modules/dom-autoscroller/dist/dom-autoscroller.min.js"
|
||||
],
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"buildOptimizer": false,
|
||||
"sourceMap": true,
|
||||
"optimization": false,
|
||||
"namedChunks": true,
|
||||
"allowedCommonJsDependencies": [
|
||||
"dragula"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true
|
||||
},
|
||||
"test": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false
|
||||
},
|
||||
"test2": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test2.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false
|
||||
},
|
||||
"local": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.local.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false
|
||||
},
|
||||
"localhost": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.localhost.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false
|
||||
},
|
||||
"fried": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "8kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.fried.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": false,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": ""
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"buildTarget": "desktop-app:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "desktop-app:build:production"
|
||||
},
|
||||
"test": {
|
||||
"buildTarget": "desktop-app:build:test"
|
||||
},
|
||||
"test2": {
|
||||
"buildTarget": "desktop-app:build:test2"
|
||||
},
|
||||
"local": {
|
||||
"buildTarget": "desktop-app:build:local"
|
||||
},
|
||||
"fried": {
|
||||
"buildTarget": "desktop-app:build:fried"
|
||||
},
|
||||
"localhost": {
|
||||
"buildTarget": "desktop-app:build:localhost"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"buildTarget": "desktop-app:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"karmaConfig": "src/karma.conf.js",
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": [],
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"desktop-app-e2e": {
|
||||
"root": "e2e/",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "e2e/protractor.conf.js",
|
||||
"devServerTarget": "desktop-app:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "desktop-app:serve:production"
|
||||
},
|
||||
"test": {
|
||||
"devServerTarget": "desktop-app:serve:test"
|
||||
},
|
||||
"test2": {
|
||||
"devServerTarget": "desktop-app:serve:test2"
|
||||
},
|
||||
"local": {
|
||||
"devServerTarget": "desktop-app:serve:local"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"packageManager": "yarn",
|
||||
"analytics": false
|
||||
},
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.2 MiB |
@@ -1,28 +0,0 @@
|
||||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./src/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: require('path').join(__dirname, './tsconfig.e2e.json')
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
import { AppPage } from './app.po';
|
||||
|
||||
describe('workspace-project App', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
|
||||
it('should display welcome message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toEqual('Welcome to desktop-app!');
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class AppPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root h1')).getText();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"name": "desktop-app",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"start:test": "ng serve -c test",
|
||||
"start:test2": "ng serve -c test2",
|
||||
"start:local": "ng serve -c local",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"e2e:test": "ng e2e -c test",
|
||||
"e2e:local": "ng e2e -c test2",
|
||||
"e2e:test2": "ng e2e -c local"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^17.2.2",
|
||||
"@angular/common": "^17.2.2",
|
||||
"@angular/compiler": "^17.2.2",
|
||||
"@angular/core": "^17.2.2",
|
||||
"@angular/forms": "^17.2.2",
|
||||
"@angular/platform-browser": "^17.2.2",
|
||||
"@angular/platform-browser-dynamic": "^17.2.2",
|
||||
"@angular/platform-server": "^17.2.2",
|
||||
"@angular/router": "^17.2.2",
|
||||
"@iharbeck/ngx-virtual-scroller": "17.0.2",
|
||||
"@simonwep/pickr": "^1.0.0-beta",
|
||||
"@steinv/ngx-materialize": "^17.0.0",
|
||||
"@tweenjs/tween.js": "^23.1.1",
|
||||
"@types/hammerjs": "^2.0.45",
|
||||
"dom-autoscroller": "^2.3.4",
|
||||
"dragula": "^3.7.3",
|
||||
"hammerjs": "^2.0.8",
|
||||
"materialize-css": "1.0.0",
|
||||
"ng2-dragula": "^5.0.1",
|
||||
"ngx-color-picker": "^16.0.0",
|
||||
"randomcolor": "^0.6.2",
|
||||
"rxjs": "^7.8.1",
|
||||
"rxjs-compat": "^6.6.7",
|
||||
"tslib": "^2.6.2",
|
||||
"type-func": "^1.0.3",
|
||||
"unzipper": "^0.10.14",
|
||||
"uuid": "^9.0.1",
|
||||
"zone.js": "~0.14.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^17.2.0",
|
||||
"@angular/cli": "^17.2.0",
|
||||
"@angular/compiler-cli": "^17.2.2",
|
||||
"@angular/language-service": "^17.2.2",
|
||||
"@angular/localize": "17.2.2",
|
||||
"@types/jasmine": "~5.1.4",
|
||||
"@types/jasminewd2": "~2.0.13",
|
||||
"@types/node": "^20.11.20",
|
||||
"codelyzer": "^6.0.2",
|
||||
"jasmine-core": "~5.1.2",
|
||||
"jasmine-spec-reporter": "~7.0.0",
|
||||
"karma": "~6.4.2",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-coverage-istanbul-reporter": "~3.0.3",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "^2.1.0",
|
||||
"protractor": "~7.0.0",
|
||||
"raw-loader": "^4.0.2",
|
||||
"rxjs-tslint": "^0.1.8",
|
||||
"ts-node": "~10.9.2",
|
||||
"tslint": "~6.1.3",
|
||||
"typescript": "5.3.3",
|
||||
"webpack": "^5.90.3"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
#
|
||||
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
<app-header></app-header>
|
||||
<app-header-banner></app-header-banner>
|
||||
<div class="app-container">
|
||||
<div class="glow-line"></div>
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
||||
<app-loading-spinner #spinner></app-loading-spinner>
|
||||
<app-status-bar #status></app-status-bar>
|
||||
<webview id="mainWebView" #webview httpreferrer="https://sdiequestvr.com" [attr.src]="webUrl" allowpopups [ngStyle]="{'left':webService.isWebviewOpen?'0':'-100%'}" class="bsaber-webview"></webview>
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
//.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;
|
||||
//}
|
||||
#mainWebView{
|
||||
width: 100%;
|
||||
height: calc(100% - 35px);
|
||||
top: 35px;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
z-index: 8;
|
||||
background:#161616;
|
||||
}
|
||||
|
||||
|
||||
.glow-line {
|
||||
border-top: 1px solid #fff;
|
||||
box-shadow: 0 0 20px 5px #e93392;
|
||||
height: 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.app-container{
|
||||
padding-top: 35px;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
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!');
|
||||
});
|
||||
});
|
||||
@@ -1,82 +0,0 @@
|
||||
import { AfterViewInit, Component, isDevMode, OnInit, 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 { AdbClientService } from './adb-client.service';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
// DO NOT REMOVE the ElectronService import
|
||||
import { ElectronService } from './electron.service';
|
||||
// ---------------------------------------------------
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
})
|
||||
export class AppComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('spinner') spinner;
|
||||
@ViewChild('status') status;
|
||||
@ViewChild('webview') webview;
|
||||
helpStatus: string;
|
||||
extraHelpStatus: string;
|
||||
devMode: boolean;
|
||||
webUrl = environment.configuration.web_url;
|
||||
shortenerUrl = environment.configuration.shortenerUrl;
|
||||
constructor(
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
public statusService: StatusBarService,
|
||||
private adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public webService: WebviewService,
|
||||
public dragService: DragAndDropService,
|
||||
// Do not remove
|
||||
private electronService: ElectronService
|
||||
// -------------
|
||||
) {
|
||||
this.devMode = isDevMode();
|
||||
}
|
||||
ngOnInit() {
|
||||
this.adbService
|
||||
.setupAdb()
|
||||
.then(() => this.appService.downloadScrCpyBinary(this.adbService))
|
||||
.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.webService.setWebView(this.webview.nativeElement);
|
||||
}
|
||||
setExterHelp() {
|
||||
let uninstall_instructions = `
|
||||
<div class="card-panel grey lighten-2 z-depth-1">
|
||||
<div class="row valign-wrapper">
|
||||
<div class="col s2">
|
||||
<img src="assets/images/app-icon.png" alt="" class="circle responsive-img">
|
||||
</div>
|
||||
<div class="col s10">
|
||||
<span class="black-text">
|
||||
SOLUTION: You may be able to resolve this issue by uninstalling the app first.<br><br>Click the <i class="material-icons vertical-align">apps</i> icon at the top, then click the <i class="material-icons vertical-align">settings</i> icon beside this app and finally click "Uninstall". You can then try to install this app again.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
switch (true) {
|
||||
case this.helpStatus.indexOf('INSTALL_FAILED_UPDATE_INCOMPATIBLE') > -1:
|
||||
this.extraHelpStatus = uninstall_instructions;
|
||||
break;
|
||||
default:
|
||||
this.extraHelpStatus = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { AppComponent } from './app.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
// import { MzButtonModule, MzCheckboxModule, MzModalModule, MzTooltipModule } from '@steinv/ngx-materialize';
|
||||
import { MzModalModule} from './mz-components/modal';
|
||||
import { NgxMaterialize } from '@steinv/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 { 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 { 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';
|
||||
import { VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
|
||||
import { HeadsetSettingsComponent } from './headset-settings/headset-settings.component';
|
||||
import { SetupGuideComponent } from './setup-guide/setup-guide.component';
|
||||
import { ConnectionStatusComponent } from './connection-status/connection-status.component';
|
||||
import { HeaderBannerComponent } from './header-banner/header-banner.component';
|
||||
import { WirelessConnectionComponent } from './wireless-connection/wireless-connection.component';
|
||||
import { StreamOptionsComponent } from './stream-options/stream-options.component';
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HeaderComponent,
|
||||
StatusBarComponent,
|
||||
LoadingSpinnerComponent,
|
||||
LoadingSpinnerSmallComponent,
|
||||
PackagesComponent,
|
||||
PackageItemComponent,
|
||||
LinkComponent,
|
||||
SanitizeHtmlPipe,
|
||||
WebviewComponent,
|
||||
WebviewDirective,
|
||||
FilesComponent,
|
||||
CurrentTasksComponent,
|
||||
CurrentTaskItemComponent,
|
||||
HeadsetSettingsComponent,
|
||||
SetupGuideComponent,
|
||||
ConnectionStatusComponent,
|
||||
HeaderBannerComponent,
|
||||
WirelessConnectionComponent,
|
||||
StreamOptionsComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
DragulaModule.forRoot(),
|
||||
FormsModule,
|
||||
RouterModule.forRoot(AppRoutes, { useHash: true }),
|
||||
// MzTooltipModule,
|
||||
MzModalModule,
|
||||
// MzButtonModule,
|
||||
HttpClientModule,
|
||||
// MzCheckboxModule,
|
||||
NgxMaterialize,
|
||||
ColorPickerModule,
|
||||
BrowserAnimationsModule,
|
||||
VirtualScrollerModule,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { PackagesComponent } from './packages/packages.component';
|
||||
import { WebviewComponent } from './webview/webview.component';
|
||||
import { FilesComponent } from './files/files.component';
|
||||
import { CurrentTasksComponent } from './current-tasks/current-tasks.component';
|
||||
import { HeadsetSettingsComponent } from './headset-settings/headset-settings.component';
|
||||
import { SetupGuideComponent } from './setup-guide/setup-guide.component';
|
||||
import { WirelessConnectionComponent } from './wireless-connection/wireless-connection.component';
|
||||
import { StreamOptionsComponent } from './stream-options/stream-options.component';
|
||||
|
||||
export const AppRoutes: Routes = [
|
||||
{ path: 'tasks', component: CurrentTasksComponent },
|
||||
{ path: 'packages', component: PackagesComponent },
|
||||
{ path: 'packages/:packageName', component: PackagesComponent },
|
||||
{ path: 'tools', component: HeadsetSettingsComponent },
|
||||
{ path: 'setup', component: SetupGuideComponent },
|
||||
{ path: 'webview', component: WebviewComponent },
|
||||
{ path: 'wireless', component: WirelessConnectionComponent },
|
||||
{ path: 'streaming', component: StreamOptionsComponent },
|
||||
{ path: 'device-files', component: FilesComponent },
|
||||
{ path: '**', component: WebviewComponent },
|
||||
];
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,523 +0,0 @@
|
||||
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';
|
||||
import { Router } from '@angular/router';
|
||||
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;
|
||||
// isSetupOpen: boolean;
|
||||
// isFilesOpen: boolean;
|
||||
// isPackagesOpen: boolean;
|
||||
// isSettingsOpen: boolean;
|
||||
// isTasksOpen: boolean;
|
||||
hideNSFW: boolean;
|
||||
filesComponent: FilesComponent;
|
||||
appData: string;
|
||||
apkPath: string;
|
||||
fs: any;
|
||||
path: any;
|
||||
nativeApp: any;
|
||||
remote: any;
|
||||
electron: any;
|
||||
os: 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, private router: Router) {
|
||||
this.path = (<any>window).require('path');
|
||||
this.fs = (<any>window).require('fs');
|
||||
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 = (<any>window).require('@electron/remote');
|
||||
this.nativeApp = this.remote.app;
|
||||
this.appData = this.path.join(this.nativeApp.getPath('appData'), 'SideQuest');
|
||||
|
||||
this.apkPath = this.path.join(this.appData, 'experimental.apk');
|
||||
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) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].resolve();
|
||||
delete this.extractResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('extract-progress', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].scb(data.stats);
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-url-fail', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].reject(data.e);
|
||||
delete this.downloadResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-url', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isPageOpen(page: string) {
|
||||
return this.router.url.includes(page);
|
||||
}
|
||||
|
||||
get pageTitle() {
|
||||
if (this.isSettingsOpen) {
|
||||
return 'Headset Settings';
|
||||
} else if (this.isFilesOpen) {
|
||||
return 'File Manager';
|
||||
} else if (this.isPackagesOpen) {
|
||||
return 'App Manager';
|
||||
} else if (this.isTasksOpen) {
|
||||
return 'Task Manager';
|
||||
} else if (this.isSetupOpen) {
|
||||
return 'Setup & Support';
|
||||
} else if (this.isWirelessOpen) {
|
||||
return 'Wireless Connection';
|
||||
} else if (this.isStreamingOpen) {
|
||||
return 'Streaming Options';
|
||||
}
|
||||
}
|
||||
get isSetupOpen() {
|
||||
return this.isPageOpen('/setup');
|
||||
}
|
||||
get isFilesOpen() {
|
||||
return this.isPageOpen('/device-files');
|
||||
}
|
||||
get isPackagesOpen() {
|
||||
return this.isPageOpen('/packages');
|
||||
}
|
||||
get isSettingsOpen() {
|
||||
return this.isPageOpen('/tools');
|
||||
}
|
||||
get isTasksOpen() {
|
||||
return this.isPageOpen('/tasks');
|
||||
}
|
||||
get isWirelessOpen() {
|
||||
return this.isPageOpen('/wireless');
|
||||
}
|
||||
get isStreamingOpen() {
|
||||
return this.isPageOpen('/streaming');
|
||||
}
|
||||
|
||||
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 = (task.app_name ? task.app_name + ': ' : '') + '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.showBrowserBar = false;
|
||||
this.showCustomActions = false;
|
||||
this.showTaskActions = false;
|
||||
this.showRepo = 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.openPath(this.appData);
|
||||
break;
|
||||
case FolderType.BSABER:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber'));
|
||||
break;
|
||||
case FolderType.BSABER_BACKUPS:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber-backups'));
|
||||
break;
|
||||
case FolderType.ADB:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'platform-tools'));
|
||||
break;
|
||||
case FolderType.APK_BACKUPS:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'backups'));
|
||||
break;
|
||||
case FolderType.DATA_BACKUPS:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber-data-backups'));
|
||||
break;
|
||||
case FolderType.QUEST_SABER_PATCH:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'saber-quest-patch', 'questsaberpatch'));
|
||||
break;
|
||||
case FolderType.APP_BACKUP:
|
||||
this.electron.shell.openPath(this.path.join(this.backupPath, packageName));
|
||||
break;
|
||||
case FolderType.SONG_FOLDER:
|
||||
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber', packageName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private foundSeedToolsPath: string | null = null;
|
||||
getPlatformToolsSeedPath() {
|
||||
if (this.foundSeedToolsPath !== null) {
|
||||
return this.foundSeedToolsPath;
|
||||
}
|
||||
let ogSourcesPath = this.path.join(process.resourcesPath, 'build', 'platform-tools');
|
||||
let sourcesPath = ogSourcesPath;
|
||||
if (!this.doesFileExist(sourcesPath)) {
|
||||
sourcesPath = sourcesPath.replace('app.asar', 'app.asar.unpacked');
|
||||
}
|
||||
if (!this.doesFileExist(sourcesPath)) {
|
||||
sourcesPath = this.path.join(process.resourcesPath, 'app.asar.unpacked', 'build', 'platform-tools');
|
||||
}
|
||||
if (!this.doesFileExist(sourcesPath)) {
|
||||
sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools');
|
||||
}
|
||||
if (!this.doesFileExist(sourcesPath)) {
|
||||
return null;
|
||||
}
|
||||
this.foundSeedToolsPath = sourcesPath;
|
||||
return sourcesPath;
|
||||
}
|
||||
seedPlatformTools() {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
let sourcesPath = this.getPlatformToolsSeedPath();
|
||||
if (sourcesPath == null) {
|
||||
console.error('Unable to locate platform tools! Try reinstalling sidequest.');
|
||||
reject('Unable to locate platform tools! Try reinstalling sidequest.');
|
||||
return;
|
||||
}
|
||||
await this.mkdir(this.path.join(this.appData, 'platform-tools'));
|
||||
try {
|
||||
let files: [] = this.fs.readdirSync(sourcesPath);
|
||||
//always copy the adb executable last so this will retry in the event some copying fails
|
||||
files.sort((a: string, b) => (a.endsWith('adb') || a.endsWith('adb.exe') ? 1 : -1));
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
try {
|
||||
this.fs.copyFileSync(
|
||||
this.path.join(sourcesPath, files[i]),
|
||||
this.path.join(this.appData, 'platform-tools', files[i])
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('Error copying platform tools file ' + files[i] + e);
|
||||
//if the file exists and isn't writeable, don't give up, have some hope it's just in use and is fine.
|
||||
if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools', files[i]))) {
|
||||
throw 'Error copying platform tools file: ' + e.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
||||
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() =>
|
||||
setTimeout(() => resolve(), 8000)
|
||||
);
|
||||
} else {
|
||||
setTimeout(() => resolve(), 8000);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error seeding platform tools! ', e);
|
||||
reject('Error seeding platform tools: ' + e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
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<void>(resolve => {
|
||||
const ls = this.spawn('chmod', ['+x', path]);
|
||||
ls.stdout.on('data', res => {
|
||||
console.log(res);
|
||||
});
|
||||
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, options, task?): Promise<string> {
|
||||
// Send request to application thread to download a file. Store the callback for the response.
|
||||
return new Promise((resolve, reject) => {
|
||||
let token = this.uuidv4();
|
||||
this.downloadResolves[token] = {
|
||||
scb: stats => {
|
||||
if (task) {
|
||||
task.status = (task.app_name ? task.app_name + ': ' : '') + 'Downloading... ' + stats + '%';
|
||||
}
|
||||
},
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
this.electron.ipcRenderer.send('download-url', { token, url, directory, filename, options });
|
||||
});
|
||||
}
|
||||
|
||||
uploadFileAPI(url, filename, options, task?): Promise<string> {
|
||||
// Send request to application thread to upload a file. Store the callback for the response.
|
||||
return new Promise((resolve, reject) => {
|
||||
let token = this.uuidv4();
|
||||
this.downloadResolves[token] = {
|
||||
scb: stats => {
|
||||
if (task) {
|
||||
task.status = (task.app_name ? task.app_name + ': ' : '') + 'Uploading... ' + stats + '%';
|
||||
}
|
||||
},
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
this.electron.ipcRenderer.send('upload-url', { token, url, filename, options });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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}`;
|
||||
}
|
||||
|
||||
startScrCpy(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"' +
|
||||
' ' +
|
||||
(options.device ? '-s ' + options.device : '');
|
||||
console.log(command);
|
||||
this.exec(command, function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
return reject({ err, stderr, command });
|
||||
}
|
||||
resolve(stdout);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
runScrCpy(options: any) {
|
||||
let platform = this.os.platform();
|
||||
if (platform === 'linux' || platform === 'darwin') {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.exec('scrcpy -v', (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
this.startScrCpy(options)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return this.startScrCpy(options);
|
||||
}
|
||||
}
|
||||
|
||||
downloadScrCpyBinary(adbClientService) {
|
||||
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/v2.0/scrcpy-win64-v2.0.zip';
|
||||
let folderName = 'scrcpy-win64-v2.0';
|
||||
let downloadPath = this.path.join(this.appData, folderName, '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) }, callback);
|
||||
this.scrcpyBinaryPath = downloadPath;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.scrcpyBinaryPath = 'ADB=' + adbClientService.adbPath + ' scrcpy';
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
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) : Promise<void> => {
|
||||
|
||||
let zipPath = this.appService.path.join(this.appService.appData, this.appService.path.basename(downloadUrl));
|
||||
const requestOptions = {
|
||||
timeout: 30000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
useContentDispositionFilename: true
|
||||
};
|
||||
task.status = 'Saving to Audica...';
|
||||
return new Promise((resolve, reject) => {
|
||||
this.appService.downloadFileAPI( downloadUrl, null, zipPath, requestOptions, task).then( async (fileName) => {
|
||||
let ext = this.appService.path.extname(fileName).toLowerCase();
|
||||
let basename = this.appService.path.basename(fileName);
|
||||
await adbService.uploadFile([ {
|
||||
name: fileName,
|
||||
savePath: '/sdcard/Audica/' + basename,
|
||||
}], task);
|
||||
task.status = 'Saved! ' + basename;
|
||||
this.appService.fs.unlink(fileName, err => {
|
||||
if (err) console.warn(err);
|
||||
});
|
||||
resolve();
|
||||
}).catch((error) => {
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save item... ' + error.toString();
|
||||
reject(error);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,251 +0,0 @@
|
||||
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) : Promise<void> => {
|
||||
let parts = downloadUrl.split('/');
|
||||
let zipPath = this.appService.path.join(this.appService.appData, this.appService.uuidv4() + '.zip');
|
||||
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.downloadFileAPI( downloadUrl, null, zipPath, requestOptions, task).then( async (fileName) => {
|
||||
let url = 'http://' + adbService.deviceIp + ':50000/host/beatsaber/upload';
|
||||
return this.appService.uploadFileAPI( url, zipPath, {contentType: 'application/zip', fileName: parts[parts.length -1], method: "post"}, task).then( async () => {
|
||||
this.appService.fs.unlink(zipPath, err => {
|
||||
task.status = 'Saved! ' + downloadUrl;
|
||||
resolve(parts[parts.length - 1].split('.')[0]);
|
||||
});
|
||||
});
|
||||
}).catch((error) => {
|
||||
task.failed = true;
|
||||
task.status = 'Failed to save song... ' + error.toString();
|
||||
reject(error);
|
||||
});
|
||||
} 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.'
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
<div class="right-side-diagnostics" *ngIf="adb.diagnostics">
|
||||
<h4 i18n>Connection Status</h4>
|
||||
<div i18n>
|
||||
<div class="status-circle" [ngClass]="{'green': adb.diagnostics?.usb && adb.diagnostics.usb.is_connected}"></div>
|
||||
<span class="status-text">{{adb.diagnostics?.usb && adb.diagnostics.usb.is_connected?'Quest Detected':'Quest Not Detected'}}</span>
|
||||
</div>
|
||||
<div i18n>
|
||||
<div class="status-circle" [ngClass]="{'green': adb.diagnostics?.usb && adb.diagnostics.usb.is_dev_mode_enabled}"></div>
|
||||
<span class="status-text">{{adb.diagnostics?.usb && adb.diagnostics.usb.is_dev_mode_enabled?'Dev Mode Enabled':'Dev Mode Not Enabled'}}</span>
|
||||
</div>
|
||||
<div i18n>
|
||||
<div class="status-circle" [ngClass]="{'green': adb.diagnostics?.usb && adb.diagnostics.usb.is_adb_enabled}"></div>
|
||||
<span class="status-text">{{adb.diagnostics?.usb && adb.diagnostics.usb.is_adb_enabled?'ADB Detected':'No ADB Detected'}}</span>
|
||||
</div>
|
||||
<div i18n>
|
||||
<div class="status-circle" [ngClass]="{'green': adb.devices.length && adb.deviceStatus !== ConnectionStatus.UNAUTHORIZED}"></div>
|
||||
<span class="status-text">{{adb.devices.length && adb.deviceStatus === ConnectionStatus.UNAUTHORIZED?'Not Authorized.':'Device Authorized'}}</span>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="pure-material-button-contained button-margin-bottom" (click)="helpOpen = true;" *ngIf="!adb.isReady">Fix It For Me</div>
|
||||
|
||||
</div>
|
||||
<div class="help-section" *ngIf="helpOpen">
|
||||
<div class="diag-recommend">
|
||||
<h2 class="clearfix" i18n>
|
||||
{{(adb.diagnostics?.usb && adb.diagnostics.usb.result_status=='diag-good' && adb.devices.length && adb.deviceStatus !== ConnectionStatus.UNAUTHORIZED)?'You\'re all set!':'So how do I fix it?'}}
|
||||
</h2>
|
||||
<div class="switch-margin-bottom">
|
||||
Here are some solutions we have come across related to this problem. <br>Please try the recommendations here before following tutorials online, this information is always the most up to date.
|
||||
</div>
|
||||
|
||||
<div class="diag-recommend-details" i18n>{{(adb.diagnostics?.usb && adb.diagnostics.usb.result_status=='diag-good' && adb.devices.length && adb.deviceStatus !== ConnectionStatus.UNAUTHORIZED) ? "Check for a popup to accept inside the headset.":adb.diagnostics.usb ? adb.diagnostics.usb.recommendation : ''}}</div>
|
||||
<br>
|
||||
<div class="pure-material-button-contained button-margin-bottom" (click)="helpOpen = false">Close</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,70 +0,0 @@
|
||||
|
||||
.diag-recommend .diag-recommend-details {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.diag-recommend-details{
|
||||
//background: rgba(255,255,255,0.3);
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid white;
|
||||
}
|
||||
.help-section{
|
||||
position: absolute;
|
||||
z-index: 200;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
background: #222222;
|
||||
box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
|
||||
padding: 0 40px;
|
||||
}
|
||||
|
||||
.right-side-diagnostics{
|
||||
position: absolute;
|
||||
width: 545px;
|
||||
top: 56px;
|
||||
right: 20px;
|
||||
}
|
||||
.switch-margin-bottom{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.status-circle{
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
display: inline-block;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(to right, #d71d33, #d92613); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
vertical-align: middle;
|
||||
}
|
||||
.status-circle.green{
|
||||
background: linear-gradient(to right, #12c4b5, #22c05d); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
}
|
||||
.status-circle.purple{
|
||||
background: linear-gradient(to right, #aa076b, #61045f); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
}
|
||||
|
||||
|
||||
.status-text{
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1448px){
|
||||
|
||||
|
||||
.right-side-diagnostics{
|
||||
width: 445px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 1279px){
|
||||
|
||||
|
||||
.right-side-diagnostics{
|
||||
width: 345px;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConnectionStatusComponent } from './connection-status.component';
|
||||
|
||||
describe('ConnectionStatusComponent', () => {
|
||||
let component: ConnectionStatusComponent;
|
||||
let fixture: ComponentFixture<ConnectionStatusComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ConnectionStatusComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConnectionStatusComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-connection-status',
|
||||
templateUrl: './connection-status.component.html',
|
||||
styleUrls: ['./connection-status.component.scss'],
|
||||
})
|
||||
export class ConnectionStatusComponent implements OnInit {
|
||||
ConnectionStatus = ConnectionStatus;
|
||||
helpOpen: boolean;
|
||||
@Output() backHome = new EventEmitter();
|
||||
constructor(public adb: AdbClientService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<div class="col s10 package-height chip-padding package-item relative">
|
||||
<div #tooltip 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}"
|
||||
mTooltip [attr.data-tooltip]="task.running ? 'This task is running' : task.failed ? 'This task has failed' : task.succeeded ? 'This task succeeded' : 'This task is waiting'"
|
||||
data-position="bottom" [innerHTML]="'<i class=material-icons>' + task.icon + '</i>' + task.status">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col s2 package-height centered package-item right-align">
|
||||
<i class="material-icons white-text cursor settings" (click)="task.running?processService.skipCurrent(task):deleteItem()">close</i>
|
||||
</div>
|
||||
<div class="col s12 no-padding">
|
||||
<div class="divider margin-bottom"></div>
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
.menu-chip{
|
||||
max-width: 100%;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { CurrentTaskItemComponent } from './current-task-item.component';
|
||||
|
||||
describe('CurrentTaskItemComponent', () => {
|
||||
let component: CurrentTaskItemComponent;
|
||||
let fixture: ComponentFixture<CurrentTaskItemComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CurrentTaskItemComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CurrentTaskItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Component, Input, AfterViewInit, OnDestroy, ViewChild } 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.scss'],
|
||||
})
|
||||
export class CurrentTaskItemComponent implements AfterViewInit, OnDestroy {
|
||||
@Input() task;
|
||||
@ViewChild('tooltip') tooltip;
|
||||
toolTipInterval: number
|
||||
toolTipStatus: number = 0
|
||||
constructor(public processService: ProcessBucketService) {}
|
||||
|
||||
ngAfterViewInit() {
|
||||
return;
|
||||
this.toolTipInterval = setInterval(() => {
|
||||
if (this.task) {
|
||||
if (this.task.running && this.toolTipStatus !== 2) {
|
||||
this.toolTipStatus = 2;
|
||||
this.tooltip.nativeElement.dataset.tooltip = 'This task is running';
|
||||
} else if (this.task.failed && this.toolTipStatus !== 3) {
|
||||
this.toolTipStatus = 3;
|
||||
this.tooltip.nativeElement.dataset.tooltip = 'This task has failed';
|
||||
} else if (this.task.succeeded && this.toolTipStatus !== 4) {
|
||||
this.toolTipStatus = 4;
|
||||
this.tooltip.nativeElement.dataset.tooltip = 'This task succeeded';
|
||||
} else if (this.toolTipStatus !== 1) {
|
||||
this.toolTipStatus = 1;
|
||||
this.tooltip.nativeElement.dataset.tooltip = 'This task is waiting';
|
||||
}
|
||||
} else {
|
||||
this.toolTipStatus = 1;
|
||||
this.tooltip.nativeElement.dataset.tooltip = 'This task is waiting';
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// clearInterval(this.toolTipInterval);
|
||||
}
|
||||
|
||||
deleteItem() {
|
||||
this.processService.tasks = this.processService.tasks.filter(t => t !== this.task);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<div class="inner-app-container no-select">
|
||||
<div class="screen-description">Manage tasks for downloading, transferring and installing to your headset.</div>
|
||||
<div class="sync-songs">
|
||||
<div class="pure-material-button-contained spaced" data-position="bottom"
|
||||
mTooltip data-tooltip="Clear out the finished tasks." (click)="processService.clearDone()">
|
||||
Clear Done
|
||||
</div>
|
||||
<div class="pure-material-button-contained spaced active" data-position="bottom"
|
||||
mTooltip data-tooltip="Restart the failed tasks." (click)="processService.retryFailed()">
|
||||
Retry Failed
|
||||
</div>
|
||||
<div class="pure-material-button-contained spaced active" data-position="bottom"
|
||||
mTooltip data-tooltip="Clear out the failed tasks." (click)="processService.clearFailed()">
|
||||
Clear Failed
|
||||
</div>
|
||||
<div class="pure-material-button-contained spaced active glowing" data-position="bottom"
|
||||
mTooltip data-tooltip="Clear out the finished tasks." (click)="processService.clearAll()">
|
||||
Clear All
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider divider-margin-top margin-bottom"></div>
|
||||
<div *ngIf="!processService.tasks.length" class="no-tasks">
|
||||
No tasks running...
|
||||
<!-- <div class="pure-material-button-contained" routerLink="/">Back Home</div>-->
|
||||
</div>
|
||||
|
||||
<div class="row margin-bottom" *ngIf="processService.tasks.length">
|
||||
<app-current-task-item *ngFor="let task of processService.tasks;" [task]="task"></app-current-task-item>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { CurrentTasksComponent } from './current-tasks.component';
|
||||
|
||||
describe('CurrentTasksComponent', () => {
|
||||
let component: CurrentTasksComponent;
|
||||
let fixture: ComponentFixture<CurrentTasksComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CurrentTasksComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CurrentTasksComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
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.scss'],
|
||||
})
|
||||
export class CurrentTasksComponent implements OnInit {
|
||||
constructor(public processService: ProcessBucketService, public appService: AppService) {
|
||||
this.appService.resetTop();
|
||||
appService.webService.isWebviewOpen = false;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Current Tasks');
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
const OCULUS_VID = 10291;
|
||||
const Q2_DEV_OFF_FILES_OFF_PID = 311;
|
||||
const Q2_DEV_OFF_FILES_ON_PID = 386;
|
||||
const Q2_DEV_ON_FILES_ON_PID = 387;
|
||||
const Q2_DEV_ON_FILES_OFF_PID = 390;
|
||||
declare let process;
|
||||
export interface UsbDeviceInfo {
|
||||
locationId: number;
|
||||
vendorId: number;
|
||||
productId: number;
|
||||
deviceName: string;
|
||||
manufacturer: string;
|
||||
serialNumber: string;
|
||||
deviceAddress: number;
|
||||
}
|
||||
export enum UsbDiagResultStatus {
|
||||
Bad = 'diag-bad',
|
||||
Maybe = 'diag-maybe',
|
||||
Good = 'diag-good',
|
||||
}
|
||||
|
||||
export interface DeviceUsbStatus {
|
||||
is_connected: boolean;
|
||||
is_mtp_enabled: boolean;
|
||||
is_adb_enabled: boolean;
|
||||
is_dev_mode_enabled: boolean;
|
||||
all_oculus_devices: UsbDeviceInfo[];
|
||||
adb_device: UsbDeviceInfo | null;
|
||||
log: string;
|
||||
success: boolean;
|
||||
result: string;
|
||||
result_status: UsbDiagResultStatus;
|
||||
recommendation: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DiagnosticatorService {
|
||||
public usbDetect;
|
||||
constructor() {}
|
||||
|
||||
async getDeviceStatus(): Promise<DeviceUsbStatus> {
|
||||
if (!this.usbDetect) {
|
||||
this.usbDetect = (window as any).require('usb-detection2');
|
||||
}
|
||||
const ret: DeviceUsbStatus = {
|
||||
is_adb_enabled: false,
|
||||
is_connected: false,
|
||||
is_mtp_enabled: false,
|
||||
is_dev_mode_enabled: false,
|
||||
all_oculus_devices: [],
|
||||
adb_device: null,
|
||||
success: false,
|
||||
result: 'Error',
|
||||
recommendation: `Something went wrong, you can try again, but the diagnostics may not support your device`,
|
||||
result_status: UsbDiagResultStatus.Bad,
|
||||
log: 'Starting USB diagnostics...\n',
|
||||
};
|
||||
|
||||
return new Promise<DeviceUsbStatus>(async (resolve, reject) => {
|
||||
try {
|
||||
const devices = await this.usbDetect.find(OCULUS_VID);
|
||||
// console.log('Devices: ' + JSON.stringify(devices, null, 3));
|
||||
ret.log += 'Detected Oculus devices: ' + JSON.stringify(devices, null, 3) + '\n';
|
||||
|
||||
try {
|
||||
ret.success = true;
|
||||
if (!devices || !devices.length) {
|
||||
ret.log += 'No Oculus USB devices seem to be connected.\n';
|
||||
ret.result = `Computer doesn't see Quest plugged in at all`;
|
||||
ret.recommendation = `- Try a different USB cable or a different USB port on your computer.
|
||||
- There are a lot of bad USB-C cables out there, maybe try several.
|
||||
- Make sure the quest is powered on.
|
||||
- Sometimes rebooting the Quest may resolve the problem.
|
||||
- Try rebooting your computer.`;
|
||||
ret.result_status = UsbDiagResultStatus.Bad;
|
||||
resolve(ret);
|
||||
return;
|
||||
} else {
|
||||
ret.all_oculus_devices.push(...devices);
|
||||
let devMode = false;
|
||||
let adb = false;
|
||||
let mtpMode = false;
|
||||
let foundAny = false;
|
||||
let devs = devices.filter(x => x.productId === Q2_DEV_ON_FILES_OFF_PID);
|
||||
if (devs.length) {
|
||||
ret.log += 'Found some oculus devices in dev mode without MTP: ';
|
||||
ret.log += devs.map(x => `(PID ${x.productId}) ${x.deviceName}`).join(', ') + '\n';
|
||||
devMode = true;
|
||||
foundAny = true;
|
||||
if (process.platform == 'win32') {
|
||||
const adbdev = devs.find(x => x.deviceName.toLowerCase().includes('adb'));
|
||||
if (adbdev) {
|
||||
ret.adb_device = ret.adb_device || adbdev;
|
||||
ret.log += 'Seemed to find an adb device: ' + adbdev.deviceName + '\n';
|
||||
adb = true;
|
||||
}
|
||||
} else {
|
||||
adb = true;
|
||||
}
|
||||
}
|
||||
devs = devices.filter(x => x.productId === Q2_DEV_ON_FILES_ON_PID);
|
||||
if (devs.length) {
|
||||
ret.log += 'Found some oculus devices in dev mode with MTP: ';
|
||||
ret.log += devs.map(x => `(PID ${x.productId}) ${x.deviceName}`).join(', ') + '\n';
|
||||
mtpMode = true;
|
||||
devMode = true;
|
||||
foundAny = true;
|
||||
if (process.platform == 'win32') {
|
||||
const adbdev = devs.find(x => x.deviceName.toLowerCase().includes('adb'));
|
||||
if (adbdev) {
|
||||
ret.adb_device = ret.adb_device || adbdev;
|
||||
ret.log += 'Seemed to find an adb device: ' + adbdev.deviceName + '\n';
|
||||
adb = true;
|
||||
}
|
||||
} else {
|
||||
adb = true;
|
||||
}
|
||||
}
|
||||
devs = devices.filter(x => x.productId === Q2_DEV_OFF_FILES_ON_PID);
|
||||
if (devs.length) {
|
||||
ret.log += 'Found some oculus devices NO dev mode with MTP: ';
|
||||
ret.log += devs.map(x => `(PID ${x.productId}) ${x.deviceName}`).join(', ') + '\n';
|
||||
mtpMode = true;
|
||||
foundAny = true;
|
||||
const adbdev = devs.find(x => x.deviceName.toLowerCase().includes('adb'));
|
||||
if (adbdev) {
|
||||
ret.adb_device = ret.adb_device || adbdev;
|
||||
ret.log +=
|
||||
'Unexpected... seemed to find an adb device but no dev mode PID: ' + adbdev.deviceName + '\n';
|
||||
adb = true;
|
||||
}
|
||||
}
|
||||
devs = devices.filter(x => x.productId === Q2_DEV_OFF_FILES_OFF_PID);
|
||||
if (devs.length) {
|
||||
ret.log += 'Found some oculus devices NO dev mode without MTP: ';
|
||||
ret.log += devs.map(x => `(PID ${x.productId}) ${x.deviceName}`).join(', ') + '\n';
|
||||
foundAny = true;
|
||||
const adbdev = devs.find(x => x.deviceName.toLowerCase().includes('adb'));
|
||||
if (adbdev) {
|
||||
ret.adb_device = ret.adb_device || adbdev;
|
||||
ret.log +=
|
||||
'Unexpected... seemed to find an adb device but no dev mode PID: ' + adbdev.deviceName + '\n';
|
||||
adb = true;
|
||||
}
|
||||
}
|
||||
if (!foundAny) {
|
||||
ret.log = "Didn't find any of the expected PIDs. Not sure what's going on. Here's the list: ";
|
||||
ret.log += JSON.stringify(devices, null, 3) + '\n';
|
||||
|
||||
ret.result = `Unknown Oculus device detected`;
|
||||
ret.recommendation = `Some sort of USB device from Oculus is detected, but it's none of the ones SideQuest knows about. \
|
||||
Sidequest MAY still work if Oculus has changed things in a firmware update, but it may not. \
|
||||
You can try rebooting your Quest. Make sure you've installed any available SideQuest updates.`;
|
||||
ret.result_status = UsbDiagResultStatus.Maybe;
|
||||
|
||||
resolve(ret);
|
||||
return;
|
||||
} else {
|
||||
ret.is_connected = true;
|
||||
ret.is_mtp_enabled = mtpMode;
|
||||
ret.is_adb_enabled = adb;
|
||||
ret.is_dev_mode_enabled = devMode;
|
||||
ret.log += 'MTP (drive mode): ' + (mtpMode ? 'ON' : 'OFF') + '\n';
|
||||
ret.log += 'Developer Mode: ' + (devMode ? 'ON' : 'OFF') + '\n';
|
||||
ret.log += 'ADB Device Found: ' + (adb ? 'YES' : 'NO') + '\n';
|
||||
if (devMode && adb) {
|
||||
ret.result = `The Quest is connected, developer mode is on and ADB device is present`;
|
||||
ret.recommendation = `Your computer sees the Quest and it looks like developer mode is on. An ADB device is also connected. If SideQuest isn't working, you can try the following things:
|
||||
|
||||
- Make sure your antivirus isn't blocking anything related to sidequest or 'adb'.
|
||||
- Uninstall and reinstall SideQuest
|
||||
- Try rebooting the Quest and your computer
|
||||
- if you've done all these things and are still having issues, you can reach out to SideQuest support.`;
|
||||
ret.result_status = UsbDiagResultStatus.Good;
|
||||
} else if (devMode) {
|
||||
ret.result = `The Quest is connected, developer mode is on, but can't find an ADB device`;
|
||||
ret.recommendation = `SideQuest MAY still work. Your computer sees the Quest and it looks like developer mode is on, but it isn't clear if the ADB device or driver is present. If SideQuest isn't working, you can try:
|
||||
|
||||
- Reboot the Quest
|
||||
- Reboot your computer
|
||||
- If you're on windows, try installing the Oculus software (which is currently the only way to manually install the
|
||||
USB drivers for the quest).`;
|
||||
ret.result_status = UsbDiagResultStatus.Maybe;
|
||||
} else if (adb) {
|
||||
ret.result = `The Quest 2 is connected, developer mode is off, but there's an ADB device showing up?`;
|
||||
ret.recommendation = `Not sure how this has happened to you, but SideQuest MAY still work. \
|
||||
This is likely an unhandled device identifier in SideQuest. Contact us \
|
||||
and provide the log below so that we can add your scenario.`;
|
||||
ret.result_status = UsbDiagResultStatus.Maybe;
|
||||
} else {
|
||||
ret.result = `The Quest 2 is connected, but developer mode is OFF`;
|
||||
ret.recommendation = `- You need to enable developer mode in your in the OCULUS MOBILE app. Even if you already did it, it sometimes turns off on its own.
|
||||
|
||||
- If you don't have access to the mobile app or haven't created a developer account, there's no other way around, you have to do this.
|
||||
- Follow the various instructions and tutorials in the GET SIDEQUEST section.
|
||||
- You can try turning developer mode off and back on again or rebooting your headset
|
||||
- If developer mode is definitely on in the MOBILE APP, you may need to contact Oculus Support.`;
|
||||
ret.result_status = UsbDiagResultStatus.Bad;
|
||||
}
|
||||
}
|
||||
resolve(ret);
|
||||
}
|
||||
} catch (e) {
|
||||
ret.success = false;
|
||||
ret.log += 'Error looking for devices: ' + e + '\n';
|
||||
resolve(ret);
|
||||
}
|
||||
} catch (e) {
|
||||
ret.success = false;
|
||||
ret.log += 'Error trying to find USB devices: ' + e + '\n';
|
||||
resolve(ret);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
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))) {
|
||||
this.adbService.savePath = this.appService.path.dirname(filepath);
|
||||
let install = this.adbService.installMultiFile(filepath);
|
||||
if (install) {
|
||||
await install.catch(_e => {
|
||||
this.statusService.showStatus(_e.toString(), true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.statusService.showStatus('Unrecognised File: ' + filepath, true);
|
||||
}
|
||||
}
|
||||
this.spinnerService.hideLoader();
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,299 +0,0 @@
|
||||
import { Injectable, isDevMode } from '@angular/core';
|
||||
import { AppService } from './app.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';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ElectronService {
|
||||
isInstalledLauncher: boolean;
|
||||
isInstallingLauncher: boolean;
|
||||
constructor(
|
||||
private appService: AppService,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async installFromToken(token) {
|
||||
let res = await this.adbService.adbCommand('installFromToken', { token });
|
||||
res.forEach((l, i) => {
|
||||
switch (l.type) {
|
||||
case 'Mod':
|
||||
this.beatonService.downloadSong(l.url, this.adbService);
|
||||
break;
|
||||
case 'APK':
|
||||
this.adbService.installAPK(l.url, false, false, i + 1, res.length, false, l.name + ': ');
|
||||
break;
|
||||
case 'OBB':
|
||||
this.adbService.installObb(l.url, i + 1, res.length, l.name);
|
||||
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, 0, 0, data.name);
|
||||
break;
|
||||
case '.apk':
|
||||
this.adbService.installAPK(data.url, false, false, 0, 0, true, data.name + ': ');
|
||||
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', async (event, data) => {
|
||||
if (data.indexOf("sidequest://app/") === 0 && data.indexOf("#") === -1) {
|
||||
data = data.substring(0,16) + "#" + data.substring(16);
|
||||
}
|
||||
if (data) {
|
||||
let url = data.split('#');
|
||||
switch (url[0]) {
|
||||
case 'sidequest://app/':
|
||||
this.webviewService.loadUrl(environment.configuration.web_url + '/app/' + url[1]);
|
||||
break;
|
||||
case 'sidequest://w/':
|
||||
this.adbService
|
||||
.runAdbCommand(
|
||||
'adb shell am start -a android.intent.action.VIEW -d \'"' + new URL(url[1]).toString() + '"\'',
|
||||
true
|
||||
)
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Launching WebXR in browser...', false, true);
|
||||
});
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
case 'sidequest://i/':
|
||||
this.installFromToken(url[1]);
|
||||
this.webviewService.isWebviewLoading = false;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
<div *ngIf="isConnected()" class="top-bar no-drag">
|
||||
<nav class="pink lighten-2 breadcrumb-wrapper ">
|
||||
<div class="nav-wrapper inner-app-container">
|
||||
<div class="col s12 truncate">
|
||||
<a *ngFor="let breadcrumb of breadcrumbs; let i = index" href="javascript:void(0)" class="breadcrumb no-drag"
|
||||
(click)="open('/'+breadcrumb.path)">{{breadcrumb.name}}<span *ngIf="i === breadcrumbs.length-1 && folderSize"> ({{folderSize}})</span> </a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="inner-app-container files-section no-drag">
|
||||
<div *ngIf="!isConnected()" class="white-text">
|
||||
<br>You are not currently connected.
|
||||
<br><br>
|
||||
<div class="pure-material-button-contained" routerLink="/setup">Open Setup Instructions</div>
|
||||
</div>
|
||||
<div *ngIf="isConnected()" class="no-drag">
|
||||
<div *ngIf="!files.length">
|
||||
<h4 class="text-dark-theme">
|
||||
No files here...</h4>
|
||||
<div class="grey-text">{{this.currentPath}}</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="beast-saber-buttons">
|
||||
<ng-container *ngFor="let favourite of appService.headerComponent.favourites.fileFavourites">
|
||||
<a href="javascript:void(0)" class="waves-effect waves-light synthrideerz margin-right no-drag"
|
||||
(click)="appService.filesComponent.open(favourite.uri)"
|
||||
mTooltip [attr.data-tooltip]="favourite.name">
|
||||
<img *ngIf="favourite.icon" src="{{favourite.icon}}" class="responsive-img" /></a>
|
||||
</ng-container>
|
||||
<div class="divider divider-margin-top margin-bottom"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngFor="let file of files" class="cursor text-dark-theme">
|
||||
<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"
|
||||
title="Copy full file path to the clipboard" (click)="copyPathToClipboard(file.filePath)">content_copy</i>
|
||||
<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 left text-dark-theme">{{file.icon}}</i>
|
||||
<div class="filename-padding-top">{{file.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<div class="fixed-action-btn" #fixedAction *ngIf="isConnected()">
|
||||
<a class="dropdown-trigger btn-floating btn-large pink lightn-2" data-position="left" mTooltip data-tooltip="Add a file." >
|
||||
<i class="large material-icons">add</i>
|
||||
</a>
|
||||
<ul>
|
||||
<li data-position="left" mTooltip data-tooltip="Manage favourite folders"
|
||||
(click)="appService.headerComponent.favoriteType = 'fileFavourites';appService.headerComponent.manageFavs.openModal(); appService.headerComponent.favouriteMax = 10; appService.headerComponent.favoritePathType = 'Path';"
|
||||
><a class="btn-floating red"><i class="material-icons">favorite</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Upload file to this folder" (click)="uploadFiles()"><a
|
||||
class="btn-floating purple"><i class="material-icons">file_upload</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Make new folder in this folder" (click)="mkDirModal.openModal()"><a
|
||||
class="btn-floating blue"><i class="material-icons">create_new_folder</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Open current save location" (click)="openSaveLocation()"><a
|
||||
class="btn-floating yellow darken-2"><i class="material-icons">open_in_new</i></a></li>
|
||||
<li *ngIf="quickSaveSupported()" data-position="left" mTooltip data-tooltip="Save screenshots and recordings"
|
||||
(click)="downloadMediaModal.openModal()"><a class="btn-floating green"><i class="material-icons">get_app</i></a>
|
||||
</li>
|
||||
<li [class.hidden]="selectedFiles.length === 0" class="divider"></li>
|
||||
<li [class.hidden]="selectedFiles.length === 0" data-position="left" mTooltip data-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 [class.hidden]="selectedFiles.length === 0" data-position="left" mTooltip data-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 (keyup)="autoReturn($event, makeFolder.bind(this, true))"/>
|
||||
<label for="devicePaste">Folder Name</label>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="mkDirModal.closeModal()">Close</div>
|
||||
<div class="pure-material-button-contained spaced " (click)="makeFolder(true); mkDirModal.closeModal()">Make Folder</div>
|
||||
</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>
|
||||
<div class="pure-material-button-contained" (click)="pickLocation()">Select Location</div>
|
||||
<br><br>
|
||||
Current Location: {{adbService.savePath}}
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="filesModal.closeModal()">Close</div>
|
||||
<div class="pure-material-button-contained spaced" (click)="mkDirModal.closeModal(); saveFiles(filesToBeSaved); clearSelection(filesToBeSaved)">Save To PC</div>
|
||||
</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>
|
||||
<div class="pure-material-button-contained spaced" (click)="pickLocation()">Select Location</div><br><br>
|
||||
Current Location: {{adbService.savePath}}
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="downloadMediaModal.closeModal()">Close</div>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="downloadMediaModal.closeModal(); downloadMedia()">Save To PC</div>
|
||||
</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>
|
||||
WARNING: This cannot be undone!!
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="confirmModal.closeModal()">Close</div>
|
||||
|
||||
<div class="pure-material-button-contained spaced red" (click)="confirmModal.closeModal();deleteFiles(filesToBeDeleted); clearSelection(filesToBeDeleted)">Delete Items</div>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -1,46 +0,0 @@
|
||||
.breadcrumb-wrapper{
|
||||
position: relative;
|
||||
top: -20px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
z-index: 1;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.synthrideerz{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.drag-indicator{
|
||||
font-size: 2rem;
|
||||
line-height: 3rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.filename-padding-top{
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.selected{
|
||||
background: #e93c96;
|
||||
border-radius: 10px;
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
.save-icon{
|
||||
margin-right: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.top-bar{
|
||||
direction: rtl;
|
||||
white-space: nowrap;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { FilesComponent } from './files.component';
|
||||
|
||||
describe('FilesComponent', () => {
|
||||
let component: FilesComponent;
|
||||
let fixture: ComponentFixture<FilesComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FilesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FilesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,434 +0,0 @@
|
||||
import {
|
||||
afterNextRender,
|
||||
AfterRenderPhase,
|
||||
AfterViewInit,
|
||||
Component,
|
||||
OnDestroy,
|
||||
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.scss'],
|
||||
})
|
||||
export class FilesComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('filesModal') filesModal;
|
||||
@ViewChild('fixedAction') fixedAction;
|
||||
@ViewChild('downloadMediaModal') downloadMediaModal;
|
||||
@ViewChild('mkDirModal', { static: true }) mkDirModal;
|
||||
files: FileFolderListing[] = [];
|
||||
selectedFiles: FileFolderListing[] = [];
|
||||
filesToBeSaved: FileFolderListing[];
|
||||
filesToBeDeleted: FileFolderListing[];
|
||||
breadcrumbs: BreadcrumbListing[] = [];
|
||||
isOpen = false;
|
||||
currentPath: string;
|
||||
folderName: string;
|
||||
folderSize: 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;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setupActionButton();
|
||||
}
|
||||
|
||||
private setupActionButton() {
|
||||
// We have to wait until it is actually ready, this component isn't ready even afterViewInit, so we have to loop wait
|
||||
if (this.fixedAction == null) {
|
||||
setTimeout(() => this.setupActionButton(), 100);
|
||||
return;
|
||||
}
|
||||
M.FloatingActionButton.init(this.fixedAction.nativeElement, {});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Headset Files');
|
||||
}
|
||||
async makeFolder(shouldOpen?: boolean) {
|
||||
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 => {
|
||||
if (shouldOpen) {
|
||||
this.open(this.appService.path.posix.join(this.currentPath, this.folderName));
|
||||
} else {
|
||||
this.open(this.currentPath);
|
||||
}
|
||||
this.folderName = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
copyPathToClipboard(path = null) {
|
||||
this.appService.electron.clipboard.writeText(path || this.currentPath);
|
||||
this.statusService.showStatus(`Copied file path to your clipboard!`);
|
||||
}
|
||||
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<void> {
|
||||
if (!files.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const f = files.shift();
|
||||
const savePath = f.save; // this.appService.path.posix.join(this.currentPath, this.appService.path.basename(f));
|
||||
if (!this.appService.fs.existsSync(f.file)) {
|
||||
Promise.resolve().then(() => setTimeout(() => this.uploadFile(files, task), 500));
|
||||
return;
|
||||
}
|
||||
if (this.appService.fs.lstatSync(f.file).isDirectory()) {
|
||||
return new Promise(async resolve => {
|
||||
this.folderName = this.appService.path.basename(f.file);
|
||||
await this.makeFolder();
|
||||
await this.uploadFolder(f.file, files, task);
|
||||
resolve(null);
|
||||
});
|
||||
}
|
||||
task.status = 'Transferring ' + this.appService.path.basename(f.file) + ' to ' + f.save;
|
||||
return this.adbService
|
||||
.adbCommand('push', { serial: this.adbService.deviceSerial, path: f.file, savePath }, stats => {
|
||||
task.status =
|
||||
'File uploading: ' +
|
||||
this.appService.path.basename(f.file) +
|
||||
' ' +
|
||||
Math.round((stats.bytesTransferred / 1024 / 1024) * 100) / 100 +
|
||||
'MB';
|
||||
})
|
||||
.then(() => {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => this.uploadFile(files, task).then(() => resolve()), 500);
|
||||
});
|
||||
});
|
||||
}
|
||||
uploadFilesFromList(files: string[]) {
|
||||
if (files !== undefined && files.length) {
|
||||
return this.processService.addItem('restore_files', async task => {
|
||||
task.status = 'Starting Upload to ' + this.currentPath;
|
||||
let fileObjs = files.map(file => ({
|
||||
file,
|
||||
save: this.appService.path.posix.join(this.currentPath, this.appService.path.basename(file)),
|
||||
}));
|
||||
return this.uploadFile(fileObjs, task)
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.open(this.currentPath);
|
||||
}, 1500);
|
||||
task.status = 'Transfer complete!';
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e.toString(), true));
|
||||
});
|
||||
}
|
||||
}
|
||||
async uploadFiles() {
|
||||
let res = await this.appService.remote.dialog.showOpenDialog({
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
});
|
||||
this.uploadFilesFromList(res.filePaths);
|
||||
}
|
||||
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 saving: ' +
|
||||
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!'));
|
||||
});
|
||||
}
|
||||
async pickLocation() {
|
||||
let res = await this.appService.remote.dialog.showOpenDialog({
|
||||
properties: ['openDirectory'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
});
|
||||
if (res && res.filePaths && res.filePaths.length === 1) {
|
||||
this.adbService.savePath = res.filePaths[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('/');
|
||||
let name = parts.pop();
|
||||
const parentPath = parts.join('/');
|
||||
if (parts.length > 0) {
|
||||
this.getCrumb(parentPath);
|
||||
}
|
||||
this.breadcrumbs.push({ path, name });
|
||||
}
|
||||
autoReturn(event, callback) {
|
||||
if (event.keyCode === 13) {
|
||||
callback();
|
||||
this.mkDirModal.closeModal();
|
||||
}
|
||||
}
|
||||
open(path: string) {
|
||||
this.currentPath = path;
|
||||
this.breadcrumbs = [];
|
||||
this.selectedFiles.length = 0;
|
||||
this.files.length = 0;
|
||||
if (!this.isConnected()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
this.getCrumb(
|
||||
this.currentPath
|
||||
.split('/')
|
||||
.filter(d => d)
|
||||
.join('/')
|
||||
);
|
||||
if (this.breadcrumbs.length === 1) {
|
||||
this.adbService.getFreeSpace().then(() => {
|
||||
if (this.breadcrumbs[0].path == 'sdcard' && this.breadcrumbs[0].name == 'sdcard') {
|
||||
this.breadcrumbs[0].name +=
|
||||
' (' + this.adbService.freespace.available + 'b of ' + this.adbService.freespace.total + 'b free)';
|
||||
}
|
||||
});
|
||||
}
|
||||
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'));
|
||||
});
|
||||
}
|
||||
openSaveLocation() {
|
||||
this.appService.remote.shell.openPath(this.adbService.savePath);
|
||||
}
|
||||
async readdir(path: string) {
|
||||
let dirContents: FileFolderListing[];
|
||||
let isRoot = ['/sdcard/', 'sdcard', 'sdcard/', '/sdcard'].indexOf(path) > -1;
|
||||
if (isRoot) {
|
||||
this.folderSize = null;
|
||||
} else {
|
||||
this.folderSize = await this.adbService.adbCommand('shell', {
|
||||
serial: this.adbService.deviceSerial,
|
||||
command: 'du -sh "' + path + '"',
|
||||
});
|
||||
this.folderSize = this.folderSize.split('\t')[0];
|
||||
}
|
||||
await this.adbService.adbCommand('readdir', { serial: this.adbService.deviceSerial, path }).then(files => {
|
||||
dirContents = files.map(file => {
|
||||
const name = file.name;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<div class="banner-container no-select">
|
||||
<div class="right in-vr-installer">
|
||||
<img src="assets/images/in-vr-logo.png" class="left no-drag"/>
|
||||
<div class="right">
|
||||
<div class="in-vr-title">SideQuest inside your VR headset</div>
|
||||
<div class="in-vr-description">Discover, Download & Play thousands of FREE VR apps and games with SideQuest's VR App</div>
|
||||
<!-- <div class="pure-material-button-contained" position="bottom"-->
|
||||
<!-- mTooltip data-tooltip="Clear out the finished tasks.">-->
|
||||
<!-- Install SideQuest in your headset-->
|
||||
<!-- </div>-->
|
||||
<ng-container *ngIf="!adb.isReady">
|
||||
<div class="pure-material-button-contained glowing" routerLink="/setup">
|
||||
Open Setup Instructions
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="adb.isReady">
|
||||
<div class="pure-material-button-contained " (click)="install()" *ngIf="!isLoading && (adb.notInstalled || isOutOfDate)">
|
||||
{{ (adb.notInstalled ? 'Install SideQuest in your Headset' : 'Update SideQuest in your Headset') }}
|
||||
</div>
|
||||
<div *ngIf="!adb.notInstalled && !isOutOfDate && !isLoading " class="in-vr-installed">
|
||||
Latest version installed <i class="material-icons green-text done-icon">done</i>
|
||||
</div>
|
||||
<div *ngIf="isLoading" class="loader-tiny"></div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<div class="back-button pointer" routerLink="/webview">
|
||||
<i class="material-icons">arrow_back_ios</i> Back Home
|
||||
</div>
|
||||
<div class="title">
|
||||
{{appService.pageTitle}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,71 +0,0 @@
|
||||
.banner-container{
|
||||
background: #1c1c1c;
|
||||
//background-size: cover;
|
||||
height: 170px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
top: 35px;
|
||||
padding-right: 46px;
|
||||
}
|
||||
.back-button{
|
||||
position: absolute;
|
||||
height: 21px;
|
||||
left: 46px;
|
||||
top: 32px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 18px;
|
||||
line-height: 21px;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
color: #B9BBD2;
|
||||
i{
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
}
|
||||
.title{
|
||||
position: absolute;
|
||||
height: 35px;
|
||||
left: 46px;
|
||||
top: 77px;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-size: 30px;
|
||||
line-height: 35px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.in-vr-title, .in-vr-installed{
|
||||
color: white;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
line-height: 23px;
|
||||
margin-top: 24px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.in-vr-installed{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.in-vr-description{
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
max-width: 300px;
|
||||
line-height: 16px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.in-vr-installed, .in-vr-description{
|
||||
color: #B9BBD2;
|
||||
}
|
||||
.in-vr-installer img{
|
||||
margin-top: 10px;
|
||||
margin-right: 19px;
|
||||
}
|
||||
.done-icon{
|
||||
vertical-align: text-bottom;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { HeaderBannerComponent } from './header-banner.component';
|
||||
|
||||
describe('HeaderBannerComponent', () => {
|
||||
let component: HeaderBannerComponent;
|
||||
let fixture: ComponentFixture<HeaderBannerComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HeaderBannerComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderBannerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,218 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AppService } from '../app.service';
|
||||
import { AdbClientService } from '../adb-client.service';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
declare const process;
|
||||
|
||||
const ADBErrors = {
|
||||
INSTALL_FAILED_INSUFFICIENT_STORAGE: `Your headset does not have enough storage to install this app. Try removing some apps and trying again.`,
|
||||
INSTALL_FAILED_USER_RESTRICTED: `The install was cancelled, please try again.`,
|
||||
INSTALL_FAILED_NO_MATCHING_ABIS: `The install failed because the app is not compatible with this device, is this a supported VR headset?`,
|
||||
INSTALL_FAILED_VERSION_DOWNGRADE: `The installed failed because the app is already installed and the installed version is newer than this version.`,
|
||||
INSTALL_FAILED_VERIFICATION_FAILURE: `The installed failed because the app is possibly corrupt. Try restarting your headset just in-case.`,
|
||||
INSTALL_FAILED_UPDATE_INCOMPATIBLE: `The installed failed because the new version is signed differently. Try uninstalling first.`,
|
||||
INSTALL_FAILED_OLDER_SDK: `The installed failed because the app is intended for a newer version of Android than is on the headset.`,
|
||||
INSTALL_FAILED_TEST_ONLY: `The installed failed because I'm a teapot.`,
|
||||
INSTALL_FAILED_CONFLICTING_PROVIDER: `The installed failed for an unknown reason: CONFLICTING_PROVIDER`,
|
||||
};
|
||||
@Component({
|
||||
selector: 'app-header-banner',
|
||||
templateUrl: './header-banner.component.html',
|
||||
styleUrls: ['./header-banner.component.scss'],
|
||||
})
|
||||
export class HeaderBannerComponent implements OnInit {
|
||||
apkDownloadPath: string;
|
||||
isLoading: boolean;
|
||||
isOutOfDate: boolean;
|
||||
// the latest available version of the in-headset app
|
||||
private latestAppVersion: string | null = null;
|
||||
private appId: string | null = null;
|
||||
private addedPerms = false;
|
||||
constructor(public appService: AppService, public adb: AdbClientService) {}
|
||||
|
||||
ngOnInit() {
|
||||
setInterval(() => {
|
||||
this.getLatestApk();
|
||||
}, 120000);
|
||||
this.getLatestApk();
|
||||
}
|
||||
|
||||
setOutOfDate() {
|
||||
// any time we don't know the currently installed app version, or we don't know the latest available version, treat it as up to date
|
||||
if (this.latestAppVersion !== null && this.adb.appVersionCode !== null && this.adb.appVersionCode !== undefined) {
|
||||
if (Number(this.adb.appVersionCode) < Number(this.latestAppVersion)) {
|
||||
this.isOutOfDate = true;
|
||||
return;
|
||||
}
|
||||
if (!this.addedPerms) {
|
||||
this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', true).then(() => {
|
||||
this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', true);
|
||||
});
|
||||
this.addedPerms = true;
|
||||
}
|
||||
}
|
||||
this.isOutOfDate = false;
|
||||
}
|
||||
|
||||
async getLatestApk() {
|
||||
|
||||
const request = await fetch(environment.configuration.http_url + '/v2/apps/get-sidequest-apk', {
|
||||
body: JSON.stringify({ package_name: 'quest.side.vr' }), method: 'POST',
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
|
||||
let json = await request.json();
|
||||
this.appId = json.app_id;
|
||||
this.latestAppVersion = json.version_code;
|
||||
this.apkDownloadPath = json.url;
|
||||
this.setOutOfDate();
|
||||
}
|
||||
|
||||
|
||||
async downloadAPK() {
|
||||
if (!this.apkDownloadPath) {
|
||||
return Promise.reject('Could not download latest apk, please try again!');
|
||||
}
|
||||
|
||||
console.log('downloadAPK', this.appId);
|
||||
const requestOptions = {
|
||||
timeout: 60000,
|
||||
'User-Agent': this.appService.getUserAgent(),
|
||||
};
|
||||
const fileName = this.appService.path.join(this.appService.appData, 'experimental.apk');
|
||||
return this.appService.downloadFileAPI(this.apkDownloadPath, null, fileName, requestOptions, null);
|
||||
}
|
||||
|
||||
useBundledAPK() {
|
||||
const sourcesPath = this.appService.getPlatformToolsSeedPath().replace('platform-tools', 'experimental.apk');
|
||||
console.log(sourcesPath);
|
||||
if (sourcesPath == null) {
|
||||
console.error('Unable to locate experimental apk! Try reinstalling sidequest.');
|
||||
throw new Error(`Unable to locate experimental apk! Try reinstalling sidequest.`);
|
||||
}
|
||||
this.appService.fs.copyFileSync(
|
||||
this.appService.path.join(sourcesPath),
|
||||
this.appService.path.join(this.appService.appData, 'experimental.apk')
|
||||
);
|
||||
}
|
||||
|
||||
async install() {
|
||||
try {
|
||||
const oldVersion = this.adb.appVersionCode || null;
|
||||
let telemEvent;
|
||||
if (this.isOutOfDate) {
|
||||
telemEvent = 'upgrade';
|
||||
} else if (this.adb.notInstalled) {
|
||||
telemEvent = 'new';
|
||||
} else {
|
||||
telemEvent = 'reinstall';
|
||||
}
|
||||
// this.telemetry.telemetry({ event: 'install-sidequest-apk', installType: telemEvent, oldVersion });
|
||||
this.isLoading = true;
|
||||
try {
|
||||
await this.getLatestApk();
|
||||
await this.downloadAPK();
|
||||
} catch (e) {
|
||||
// this.toast.show('Failed to download updated SQ apk, falling back to bundled apk. Are you online?', true);
|
||||
console.warn(e);
|
||||
this.useBundledAPK();
|
||||
}
|
||||
await this.adb.runAdbCommand('push "' + this.appService.apkPath + '" /data/local/tmp/sq.apk', true);
|
||||
await this.adb.runAdbCommand('shell pm install -r /data/local/tmp/sq.apk', true);
|
||||
// this.toast.show('SideQuest installed to headset!');
|
||||
// this.showConfetti = true;
|
||||
this.adb.appVersionCode = await this.adb.getAppVersion(true);
|
||||
|
||||
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', true);
|
||||
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', true);
|
||||
try {
|
||||
const homedir = process.env.USERPROFILE || process.env.HOME;
|
||||
if (this.appService.fs.existsSync(homedir + '/.android/adbkey')) {
|
||||
let rawCertificate = this.appService.fs.readFileSync(homedir + '/.android/adbkey', 'utf8').toString();
|
||||
rawCertificate = rawCertificate
|
||||
.replace('-----BEGIN RSA PRIVATE KEY-----', '')
|
||||
.replace('-----END RSA PRIVATE KEY-----', '');
|
||||
rawCertificate = rawCertificate
|
||||
.replace('-----BEGIN PRIVATE KEY-----', '')
|
||||
.replace('-----END PRIVATE KEY-----', '');
|
||||
rawCertificate = rawCertificate.replace(/\n|\r|\n\r|\r\n/g, '');
|
||||
|
||||
if (rawCertificate && rawCertificate.length) {
|
||||
await this.adb.runAdbCommand(
|
||||
[
|
||||
'shell',
|
||||
'am',
|
||||
'start',
|
||||
'-a',
|
||||
'android.intent.action.MAIN',
|
||||
'-n',
|
||||
'quest.side.vr/.SignInActivity',
|
||||
'--es',
|
||||
'CERTIFICATE',
|
||||
rawCertificate,
|
||||
].join(' '), true
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error sending certificate to SideQuestVR', e);
|
||||
}
|
||||
|
||||
this.adb.skipStatusUpdates = true;
|
||||
await this.adb.runAdbCommand('tcpip 5555');
|
||||
setTimeout(() => { this.adb.skipStatusUpdates = false; }, 3000);
|
||||
|
||||
// this.telemetry.telemetry({ event: 'install-sidequest-apk-success',
|
||||
// installType: telemEvent, oldVersion, newVersion: this.adb.appVersionCode || null});
|
||||
// setTimeout(() => {
|
||||
// this.showConfetti = false;
|
||||
// }, 8000);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
await this.handleInstallError(e);
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async handleInstallError(e) {
|
||||
let err;
|
||||
for (const error of Object.keys(ADBErrors)) {
|
||||
if (e.toString().includes(error)) {
|
||||
err = error;
|
||||
}
|
||||
}
|
||||
if (err) {
|
||||
if (err === 'INSTALL_FAILED_VERSION_DOWNGRADE') {
|
||||
await this.uninstall();
|
||||
await this.install();
|
||||
} else if (err === 'INSTALL_FAILED_UPDATE_INCOMPATIBLE') {
|
||||
// TODO need to show a better error here and confirm with the user to uninstall first.
|
||||
await this.uninstall();
|
||||
await this.install();
|
||||
} else {
|
||||
// this.telemetry.telemetry({event: 'install-error-adb', errorMessage: ADBErrors[err]});
|
||||
// this.toast.show(ADBErrors[err], true);
|
||||
}
|
||||
} else {
|
||||
// this.telemetry.telemetry({event: 'install-error-unhandled', errorMessage: e.toString()});
|
||||
// this.toast.show(e, true);
|
||||
}
|
||||
}
|
||||
|
||||
async uninstall() {
|
||||
await this.adb.runAdbCommand('uninstall ' + this.adb.VR_APP_PACKAGE, true);
|
||||
}
|
||||
|
||||
async userUninstall() {
|
||||
try {
|
||||
// await this.telemetry.telemetry({event: 'user-uninstall'});
|
||||
await this.uninstall();
|
||||
// await this.telemetry.telemetry({event: 'user-uninstall-success'});
|
||||
} catch (e) {
|
||||
// await this.telemetry.telemetry({event: 'user-uninstall-failed', error: e.toString()});
|
||||
// this.toast.show(e, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,367 +0,0 @@
|
||||
<div id=header class="header">
|
||||
<div class="top-bar">
|
||||
<div class="relative">
|
||||
<div class="topper {{headerClass}}"></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="sideenvironment {{headerClass}}">{{headerText}}</div>
|
||||
|
||||
<div class="title-menu-container no-select">
|
||||
<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';adbCommandToRun = favourite.uri; runAdbCommand(); 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(webUrl || '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 Favs</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="pure-material-button-contained slim update-available" *ngIf="appService.updateAvailable" (click)="updateAvailable()">Update Available</div>
|
||||
|
||||
|
||||
<!-- <app-link *ngIf="appService.updateAvailable"-->
|
||||
<!-- class="waves-effect waves-light btn-flat link small-button warning" (click)="updateAvailable()"-->
|
||||
<!-- text="Update"></app-link>-->
|
||||
<i routerLink="/webview" (click)="doBack()"
|
||||
class="material-icons white-text no-outline" data-position="bottom" mTooltip data-tooltip="Back">
|
||||
arrow_back
|
||||
</i>
|
||||
<i *ngIf="!webService.isWebviewLoading" (click)="browserMenu.style.display = 'block';browserMenuBack.style.display = 'block'"
|
||||
class="material-icons white-text no-outline" data-position="bottom" mTooltip data-tooltip="Web Browser">
|
||||
public
|
||||
</i>
|
||||
<div *ngIf="webService.isWebviewLoading" (click)="browserMenu.style.display = 'block';browserMenuBack.style.display = 'block'"
|
||||
class="loader-tiny pointer" data-position="bottom"
|
||||
mTooltip data-tooltip="Web Browser Loading..."></div>
|
||||
<i routerLink="/webview" (click)="webService.forward()"
|
||||
class="material-icons white-text no-outline" data-position="bottom" mTooltip data-tooltip="Forward">
|
||||
arrow_forward
|
||||
</i>
|
||||
<i routerLink="/streaming" *ngIf="isConnected()&&osPlatform === 'win32'"
|
||||
class="material-icons white-text no-outline" data-position="bottom"
|
||||
mTooltip data-tooltip="Stream from your headset to your PC with ScrCpy.">
|
||||
live_tv
|
||||
</i>
|
||||
<i *ngIf="adbService.deviceIp" routerLink="/wireless"
|
||||
class="material-icons no-outline"
|
||||
[ngClass]="{'green-text':adbService.wifiEnabled,'white-text':!adbService.wifiEnabled}" data-position="bottom"
|
||||
mTooltip data-tooltip="Enable wireless mode. (Experimental)">
|
||||
wifi
|
||||
</i>
|
||||
<i #mainLogo (click)="selectAppToInstall()"
|
||||
class="material-icons white-text no-outline" data-position="bottom"
|
||||
mTooltip data-tooltip="Install APK file from folder on computer.">
|
||||
archive
|
||||
</i>
|
||||
<i class="material-icons white-text no-outline " routerLink="/device-files"
|
||||
data-position="bottom" mTooltip data-tooltip="Manage files on the headset.">
|
||||
folder
|
||||
</i>
|
||||
<i routerLink="packages" class="material-icons white-text no-outline"
|
||||
data-position="bottom" mTooltip data-tooltip="Currently installed apps">
|
||||
apps
|
||||
</i>
|
||||
<i routerLink="tasks" class="material-icons white-text no-outline" data-position="bottom"
|
||||
mTooltip [attr.data-tooltip]="'Running ' + processService.left_length + ' tasks.'">
|
||||
playlist_add_check
|
||||
</i><span routerLink="tasks" *ngIf="processService.left_length" data-position="bottom"
|
||||
mTooltip data-tooltip="Running {{processService.left_length}} tasks."
|
||||
class="process-badge pink-button">{{processService.left_length>100?'99+':processService.left_length}}</span>
|
||||
<span routerLink="tasks" *ngIf="!processService.left_length&&processService.failed_length"
|
||||
data-position="bottom" mTooltip data-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"
|
||||
class="material-icons white-text no-outline" data-position="bottom"
|
||||
mTooltip data-tooltip="Device settings & tools">
|
||||
build
|
||||
</i>
|
||||
<i id="support-screen" routerLink="/setup"
|
||||
class="material-icons white-text no-outline" data-position="bottom"
|
||||
mTooltip data-tooltip="Help and support with SideQuest">
|
||||
contact_support
|
||||
</i>
|
||||
|
||||
<i (click)="commandMenu.style.display = 'block';commandMenuBack.style.display = 'block'"
|
||||
class="material-icons white-text no-outline"
|
||||
data-position="bottom" mTooltip data-tooltip="Run ADB commands">
|
||||
input
|
||||
</i>
|
||||
</div>
|
||||
<div id="connection-status-container">
|
||||
<i class="material-icons white-text no-outline connection-device-select pointer left"
|
||||
*ngIf="adbService.devices && adbService.devices.length > 1"
|
||||
(click)="deviceMenu.style.display = 'block';deviceMenuBack.style.display = 'block'"
|
||||
data-position="bottom" mTooltip data-tooltip="Select Device">
|
||||
arrow_drop_down
|
||||
</i>
|
||||
<div class="connection-status-outer left">
|
||||
<div id="connection-status" [class]="adbService.connectionCss"
|
||||
data-position="bottom" [ngClass]="adbService.connectionCss" mTooltip [attr.data-tooltip]="adbService.lastErrorMessage||'Device connection status.'">
|
||||
|
||||
|
||||
</div>
|
||||
<div id="connection-status-message" [innerHTML]="adbService.deviceStatusMessage"></div>
|
||||
</div>
|
||||
<div class="pure-material-button-contained slim get-help" *ngIf="!adbService.isReady" routerLink="/setup">Open Setup Instructions</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-dnd-backing">
|
||||
<div class="top-banner">
|
||||
<!-- <div>-->
|
||||
<!-- <a href="#/" class="logo">-->
|
||||
<!-- <img src="assets/images/new-logo.png" />-->
|
||||
<!-- </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>
|
||||
<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>
|
||||
</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="pure-material-button-contained search-button-margin" routerLink="/webview"
|
||||
(click)="webService.loadUrl(webService.currentAddress);" mz-modal-close>Open</a>
|
||||
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="bookmarksModal.closeModal()">Close</div>
|
||||
<div class="pure-material-button-contained spaced" routerLink="/webview" (click)="bookmarksModal.closeModal(); webService.loadUrl(webUrl || 'https://sidequestvr.com');" >SideQuest Home</div>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #logcatModal [fixedFooter]="true" [options]="{dismissible: false}">
|
||||
<mz-modal-header>
|
||||
<div class="pure-material-button-contained spaced glowing right" (click)="logcatModal.closeModal();stopLogcat(); currentLogCat.length = 0; isStarted = false;">Close</div>
|
||||
<div class="pure-material-button-contained spaced glowing right" (click)="stopLogcat(); isStarted = false;">Stop</div>
|
||||
<div class="pure-material-button-contained spaced right" *ngIf="!saveLogcatPath" (click)="selectLogcatOutput();">Pick Output Folder</div>
|
||||
<div class="pure-material-button-contained spaced glowing right" *ngIf="saveLogcatPath" (click)="cancelLogcatOutput(); isStarted = false;">Cancel Output</div>
|
||||
|
||||
<h4>ADB Logcat</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Select your options and click start to begin receiving logcat messages.
|
||||
<div class="truncate">{{saveLogcatPath ? 'Saving to: ' + appService.path.join(saveLogcatPath,'logcat.log') : ''}}
|
||||
<div class="pure-material-button-contained spaced red" *ngIf="saveLogcatPath" (click)="clearLogcatFile();">Clear File</div>
|
||||
|
||||
</div>
|
||||
<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>
|
||||
<!-- <virtual-scroller #scroll [items]="currentLogCat">-->
|
||||
<div class="child-item" *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>
|
||||
<!-- </virtual-scroller>-->
|
||||
</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">
|
||||
<div class="pure-material-button-contained" (click)="startLogcat(); isStarted = true;">{{isStarted?'Restart':'Start'}}</div>
|
||||
</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 no-drag" 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 think this has happened in error, please contact us on Discord with a link to the apk file.<br><br>
|
||||
We have protected you from:<br><br>
|
||||
- Causing physical damage to your headset.<br>
|
||||
- Having your personal information stolen ( including tracking your movements 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 activities.<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>
|
||||
<div class="pure-material-button-contained spaced" (click)="safeModal.closeModal(); ">Back to Safety</div>
|
||||
</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)="this.adbCommandToRun = favourite.uri; runAdbCommand()"><img *ngIf="favourite.icon" src="{{favourite.icon}}"/>{{favourite.name}}</span>
|
||||
</ng-container>
|
||||
<br><br>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<div class="pure-material-button-contained flat active spaced" (click)="adbModal.closeModal(); ">Close</div>
|
||||
<div class="pure-material-button-contained spaced" (click)="runAdbCommand()">Run Command</div>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #manageFavs [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<div class="pure-material-button-contained spaced right" (click)="showAddFavourite = !showAddFavourite">{{showAddFavourite? 'Hide' : 'Add New'}}</div>
|
||||
<div class="pure-material-button-contained spaced right" *ngIf="!showAddFavourite" (click)="addCurrentFavourite()">Add Current to favs</div>
|
||||
<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 (Optional)</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 s3 m4"><input type="text" [(ngModel)]="fav.name"/></div>
|
||||
<div class="col s3"><input type="text" [(ngModel)]="fav.uri"/></div>
|
||||
<div class="col s3"><input type="text" [(ngModel)]="fav.icon"/></div>
|
||||
<div class="col s3 center-align m2">
|
||||
<div class="pure-material-button-contained" (click)="setLocalIcon(fav)">Pick Icon</div>
|
||||
</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>
|
||||
<div class="pure-material-button-contained flat active spaced" (click)="resetFavourites(favoriteType); showAddFavourite = false;manageFavs.closeModal()">Cancel</div>
|
||||
<div class="pure-material-button-contained spaced" (click)="saveFavourites(favoriteType); showAddFavourite = false;manageFavs.closeModal()">Save</div>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
@@ -1,489 +0,0 @@
|
||||
|
||||
#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: 3.5em;
|
||||
transition: 0.35s;
|
||||
}
|
||||
virtual-scroller{
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.child-item{
|
||||
min-height: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
#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;
|
||||
//margin-top: 35px;
|
||||
}
|
||||
.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;
|
||||
margin-left: 10px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
color: white;
|
||||
}
|
||||
#connection-status-container{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 6px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.connection-device-select{
|
||||
vertical-align: top;
|
||||
}
|
||||
.connection-status-outer{
|
||||
white-space: nowrap;
|
||||
}
|
||||
#connection-status {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.connection-status-connected {
|
||||
background-color: #4caf50;
|
||||
}
|
||||
.connection-status-unauthorized, .connection-status-dev-mode {
|
||||
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: fixed;
|
||||
z-index: 998;
|
||||
display:none;
|
||||
background-color: rgba(0,0,0,0.8);
|
||||
}
|
||||
.user-menu{
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 80px;
|
||||
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: 200px;
|
||||
}
|
||||
.device-menu{
|
||||
right: initial;
|
||||
left: 16px;
|
||||
width: 300px;
|
||||
}
|
||||
.code{
|
||||
|
||||
}
|
||||
.command-menu{
|
||||
width: 240px;
|
||||
right: 20px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
.top-bar{
|
||||
position: fixed;
|
||||
z-index: 99999;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
.get-help{
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
@-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;
|
||||
}
|
||||
}
|
||||
.footer-margin-right{
|
||||
margin-right: 1em!important;
|
||||
}
|
||||
|
||||
.sidetestvr {
|
||||
background-color: darkgreen;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.friedquestvr {
|
||||
background-color: darkred;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.localtest {
|
||||
background-color: darkblue;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.sideenvironment {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: calc(50% - 50px);
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
|
||||
describe('HeaderComponent', () => {
|
||||
let component: HeaderComponent;
|
||||
let fixture: ComponentFixture<HeaderComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HeaderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,317 +0,0 @@
|
||||
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 { 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';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
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.scss'],
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
// @ViewChild('header') header;
|
||||
@ViewChild('bookmarksModal') bookmarksModal;
|
||||
// @ViewChild('beatOnModal') beatOnModal;
|
||||
@ViewChild('mainLogo') mainLogo;
|
||||
@ViewChild('safeModal') safeModal;
|
||||
@ViewChild('manageFavs') manageFavs;
|
||||
ConnectionStatus = ConnectionStatus;
|
||||
folder = FolderType;
|
||||
isAlive = true;
|
||||
replaceText: ReplaceText[] = [];
|
||||
adbCommandToRun: string;
|
||||
osPlatform: string;
|
||||
saveLogcatPath: string;
|
||||
webUrl = environment.configuration.web_url;
|
||||
favourites: {
|
||||
browserFavourites: FavouriteItem[];
|
||||
fileFavourites: FavouriteItem[];
|
||||
commandFavourites: FavouriteItem[];
|
||||
} = {
|
||||
browserFavourites: [],
|
||||
fileFavourites: [],
|
||||
commandFavourites: [],
|
||||
};
|
||||
favoriteName: string;
|
||||
favoriteUri: string;
|
||||
favoriteIcon: string;
|
||||
favoriteType = 'fileFavourites';
|
||||
favoritePathType = 'Path';
|
||||
favouriteImportExport: boolean;
|
||||
favouriteMax: number;
|
||||
// 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',
|
||||
};
|
||||
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',
|
||||
device: '',
|
||||
};
|
||||
currentLogCat: LogCatEntry[] = [];
|
||||
isStarted: boolean;
|
||||
showAddFavourite: boolean;
|
||||
protected headerClass: string;
|
||||
protected headerText: string;
|
||||
constructor(
|
||||
public adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
public webService: WebviewService,
|
||||
public spinnerService: LoadingSpinnerService,
|
||||
public statusService: StatusBarService,
|
||||
public beatonService: BeatOnService,
|
||||
public dragAndDropService: DragAndDropService,
|
||||
public processService: ProcessBucketService,
|
||||
private router: Router
|
||||
) {
|
||||
this.osPlatform = this.appService.os.platform();
|
||||
//console.log('Platform: ' + this.osPlatform);
|
||||
this.resetFavourites('browserFavourites');
|
||||
this.resetFavourites('fileFavourites');
|
||||
this.resetFavourites('commandFavourites');
|
||||
this.appService.headerComponent = this;
|
||||
this.headerClass = environment.header?.color || "";
|
||||
this.headerText = environment.header?.text || "";
|
||||
//console.log('Header: ' + this.headerClass + ' ' + this.headerText);
|
||||
}
|
||||
doBack() {
|
||||
if (
|
||||
this.appService.isTasksOpen ||
|
||||
this.appService.isFilesOpen ||
|
||||
this.appService.isPackagesOpen ||
|
||||
this.appService.isSettingsOpen
|
||||
) {
|
||||
this.router.navigateByUrl('/webview');
|
||||
return;
|
||||
} else {
|
||||
this.webService.back();
|
||||
}
|
||||
}
|
||||
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/SynthRidersUC/", "icon": "https://i.imgur.com/cmH6q6D.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":"Audio Trip", "uri": "/sdcard/Android/data/com.KinemotikStudios.AudioTripQuest/files/Songs/", "icon": "https://i.imgur.com/5EgzxTl.png"},
|
||||
{"name":"OhShape", "uri": "/sdcard/OhShape/Songs/", "icon": "https://i.imgur.com/yIu0sSQ.png"},
|
||||
{"name":"Battle Talent", "uri": "/sdcard/Android/data/com.CyDream.BattleTalent/files/Mods/", "icon": "https://i.imgur.com/MFdfn9J.png"},
|
||||
{"name":"Blade and Sorcery", "uri": "/sdcard/Android/data/com.Warpfrog.BladeAndSorcery/files/Mods/", "icon": "https://i.imgur.com/lxK5bny.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]));
|
||||
}
|
||||
async setLocalIcon(fav: FavouriteItem) {
|
||||
const res = await this.appService.remote.dialog.showOpenDialog({
|
||||
filters: [{ name: 'Pictures', extensions: ['png', 'jpg', 'jpeg'] }],
|
||||
properties: ['openFile'],
|
||||
defaultPath: this.appService.backupPath,
|
||||
});
|
||||
if (res && res.filePaths && res.filePaths.length === 1) {
|
||||
fav.icon = res.filePaths[0];
|
||||
}
|
||||
}
|
||||
ngOnInit() {}
|
||||
runAdbCommand() {
|
||||
return this.adbService.runAdbCommand(this.adbCommandToRun).catch(e => {
|
||||
this.statusService.showStatus(e, true);
|
||||
});
|
||||
}
|
||||
isConnected() {
|
||||
return this.adbService.deviceStatus === ConnectionStatus.CONNECTED;
|
||||
}
|
||||
|
||||
updateAvailable() {
|
||||
this.appService.opn(`${environment.configuration.web_url || '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);
|
||||
this.attemptToSaveLogcat(stats);
|
||||
}
|
||||
} else {
|
||||
this.currentLogCat.unshift(stats);
|
||||
this.attemptToSaveLogcat(stats);
|
||||
}
|
||||
if (this.currentLogCat.length > 4000) {
|
||||
this.currentLogCat.length = 4000;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
cancelLogcatOutput() {
|
||||
this.saveLogcatPath = null;
|
||||
}
|
||||
async selectLogcatOutput() {
|
||||
const res = await this.appService.remote.dialog.showOpenDialog({
|
||||
properties: ['openDirectory'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
});
|
||||
res.filePaths.forEach(filepath => {
|
||||
this.saveLogcatPath = filepath;
|
||||
});
|
||||
}
|
||||
clearLogcatFile() {
|
||||
if (this.saveLogcatPath) {
|
||||
if (this.appService.fs.existsSync(this.saveLogcatPath)) {
|
||||
this.appService.fs.writeFile(this.appService.path.join(this.saveLogcatPath, 'logcat.log'), '', () => {});
|
||||
this.statusService.showStatus('Cleared log file');
|
||||
} else {
|
||||
this.statusService.showStatus('Log file does not exist', true);
|
||||
}
|
||||
} else {
|
||||
this.statusService.showStatus('NO log file selected', true);
|
||||
}
|
||||
}
|
||||
attemptToSaveLogcat(logcat) {
|
||||
if (this.saveLogcatPath) {
|
||||
if (this.appService.fs.existsSync(this.saveLogcatPath)) {
|
||||
this.appService.fs.appendFile(
|
||||
this.appService.path.join(this.saveLogcatPath, 'logcat.log'),
|
||||
logcat.date +
|
||||
':' +
|
||||
this.priorities[logcat.priority] +
|
||||
logcat.tid +
|
||||
'/' +
|
||||
logcat.pid +
|
||||
' ' +
|
||||
logcat.tag +
|
||||
'\n' +
|
||||
logcat.message +
|
||||
'\n',
|
||||
() => {}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stopLogcat() {
|
||||
this.adbService.adbCommand('endLogcat');
|
||||
}
|
||||
|
||||
gogo(e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.webService.loadUrl(this.webService.currentAddress);
|
||||
this.bookmarksModal.closeModal();
|
||||
}
|
||||
}
|
||||
async addCurrentFavourite() {
|
||||
const request = await fetch( 'https://i.olsh.me/allicons.json?url=' + this.webService.currentAddress, {
|
||||
method: 'GET',
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
|
||||
let json = await request.json();
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
async selectAppToInstall() {
|
||||
let files = await this.appService.remote.dialog.showOpenDialog({
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
defaultPath: this.adbService.savePath,
|
||||
});
|
||||
files.filePaths.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);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
|
||||
<div class="inner-app-container no-select">
|
||||
<!-- <div class="screen-description">Manage settings on your headset.</div>
|
||||
<div class="divider divider-margin-top margin-bottom"></div> -->
|
||||
<div *ngIf="!adbService.isReady" class="diagnostics-inner white-text">
|
||||
<br>You are not currently connected.
|
||||
<br><br>
|
||||
<div class="pure-material-button-contained" routerLink="/setup">Open Setup Instructions</div>
|
||||
</div>
|
||||
<ng-container *ngIf="adbService.isReady">
|
||||
<h4 class="section-title">Quality & Performance</h4>
|
||||
<div class="section-container card z-depth-2">
|
||||
<h5 class="section-title">Set CPU and GPU level</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This can improve performance for apps & games at the expense of quicker battery draining and your device may get a little hotter than normal but totally within limits.
|
||||
</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="cpuGpuLevel" type="radio" value="app-app" [(ngModel)]="cpuGpuLevel" (click)="setGPU(GPU._app)"/>
|
||||
<span>Set by App ( Default )</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="cpuGpuLevel" type="radio" value="2-2" [(ngModel)]="cpuGpuLevel" (click)="setGPU(GPU._2)"/>
|
||||
<span>Level 2</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="cpuGpuLevel" type="radio" value="4-4" [(ngModel)]="cpuGpuLevel" (click)="setGPU(GPU._4)"/>
|
||||
<span>Level 4</span>
|
||||
</label>
|
||||
</p>
|
||||
<h5 class="section-title">Default Texture Size</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<div class="description-section">
|
||||
This will change how high quality some of the in game textures are rendered at.
|
||||
</div>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1216-1344" [(ngModel)]="textureSize" (click)="setSSO(SSO._Quest1)"/>
|
||||
<span>Default - Quest 1</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1440-1584" [(ngModel)]="textureSize" (click)="setSSO(SSO._Quest2)"/>
|
||||
<span>Default - Quest 2</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1680-1760" [(ngModel)]="textureSize" (click)="setSSO(SSO._Quest3)"/>
|
||||
<span>Default - Quest 3</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="512-563" [(ngModel)]="textureSize" (click)="setSSO(SSO._512)"/>
|
||||
<span>512</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="768-845" [(ngModel)]="textureSize" (click)="setSSO(SSO._768)"/>
|
||||
<span>768</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1024-1127" [(ngModel)]="textureSize" (click)="setSSO(SSO._1024)"/>
|
||||
<span>1024</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1280-1408" [(ngModel)]="textureSize" (click)="setSSO(SSO._1280)"/>
|
||||
<span>1280</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="1536-1690" [(ngModel)]="textureSize" (click)="setSSO(SSO._1536)"/>
|
||||
<span>1536</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="2048-2253" [(ngModel)]="textureSize" (click)="setSSO(SSO._2048)"/>
|
||||
<span>2048</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="2560-2816" [(ngModel)]="textureSize" (click)="setSSO(SSO._2560)"/>
|
||||
<span>2560</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="textureSize" type="radio" value="3072-3380" [(ngModel)]="textureSize" (click)="setSSO(SSO._3072)"/>
|
||||
<span>3072</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<h5 class="section-title">Refresh Rate</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">This will allow you to change to 90Hz refresh rate for 90fps support in games on Quest 2.</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="refreshRate" type="radio" value="60" [(ngModel)]="refreshRate" (click)="setRR(RR._60)"/>
|
||||
<span>60Hz</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="refreshRate" type="radio" value="72" [(ngModel)]="refreshRate" (click)="setRR(RR._72)"/>
|
||||
<span>72Hz ( Default )</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="refreshRate" type="radio" value="90" [(ngModel)]="refreshRate" (click)="setRR(RR._90)"/>
|
||||
<span>90Hz</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="refreshRate" type="radio" value="120" [(ngModel)]="refreshRate" (click)="setRR(RR._120)"/>
|
||||
<span>120Hz</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<h5 class="section-title">
|
||||
Set FFR ( Fixed Foveated Rendering ) level
|
||||
</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
|
||||
<h4 class="description-section">
|
||||
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.
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input name="fixedFoveatedRendering" type="radio" value="0" [(ngModel)]="fixedFoveatedRendering" (click)="setFFR(FFR.OFF)"/>
|
||||
<span>Off</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="fixedFoveatedRendering" type="radio" value="1" [(ngModel)]="fixedFoveatedRendering" (click)="setFFR(FFR.LOW)"/>
|
||||
<span>Low</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="fixedFoveatedRendering" type="radio" value="2" [(ngModel)]="fixedFoveatedRendering" (click)="setFFR(FFR.MEDIUM)"/>
|
||||
<span>Medium ( Default )</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="fixedFoveatedRendering" type="radio" value="3" [(ngModel)]="fixedFoveatedRendering" (click)="setFFR(FFR.HIGH)"/>
|
||||
<span>High</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="fixedFoveatedRendering" type="radio" value="4" [(ngModel)]="fixedFoveatedRendering" (click)="setFFR(FFR.HIGH_TOP)"/>
|
||||
<span>High Top</span>
|
||||
</label>
|
||||
</p>
|
||||
<h5 class="section-title">Chromatic Aberration</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This will enable/disable chromatic aberration.
|
||||
</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="chromaticAberration" type="radio" value="1" [(ngModel)]="chromaticAberration" (click)="setCa(CA.ON)"/>
|
||||
<span>On ( Default )</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="chromaticAberration" type="radio" value="0" [(ngModel)]="chromaticAberration" (click)="setCa(CA.OFF)"/>
|
||||
<span>Off</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="chromaticAberration" type="radio" value="-1" [(ngModel)]="chromaticAberration" (click)="setCa(CA.APP)"/>
|
||||
<span>App Selected</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4 class="section-title">Streaming & Video</h4>
|
||||
|
||||
<div class="section-container card z-depth-2">
|
||||
|
||||
<h5 class="section-title">Tetiana's Presets</h5>
|
||||
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
Quickly set the video capture resolution while also using 60 FPS and 10Mbps bitrate capture settings too.
|
||||
</h4>
|
||||
<div class="button-section">
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="setTetianasPreset(TP._FHD)">Full HD ( 1920 x 1080 )</div>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="setTetianasPreset(TP._SQUARE)">Square ( 1600 x 1600 )</div>
|
||||
</div>
|
||||
|
||||
<h5 class="section-title">Video Capture Size</h5>
|
||||
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This changes the resolution of captured videos on the Quest
|
||||
</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="videoCaptureSize" type="radio" value="640-480" [(ngModel)]="videoCaptureSize" (click)="setCR(CR._480)"/>
|
||||
<span>640 x 480</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="videoCaptureSize" type="radio" value="1280-720" [(ngModel)]="videoCaptureSize" (click)="setCR(CR._720)"/>
|
||||
<span>1280 x 720</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="videoCaptureSize" type="radio" value="1920-1080" [(ngModel)]="videoCaptureSize" (click)="setCR(CR._1080)"/>
|
||||
<span>1920 x 1080</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="videoCaptureSize" type="radio" value="1024-1024" [(ngModel)]="videoCaptureSize" (click)="setCR(CR._1024)"/>
|
||||
<span>1024 X 1024 ( Default )</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="videoCaptureSize" type="radio" value="1600-1600" [(ngModel)]="videoCaptureSize" (click)="setCR(CR._1600)"/>
|
||||
<span>1600 X 1600</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<!-- <h5 class="section-title">Full Rate Capture</h5>-->
|
||||
<!-- <h4 class="description-section">-->
|
||||
<!-- This will enable/disable the full rate capture for videos recorded i.e. 60/72fps rather than 30fps.-->
|
||||
<!-- </h4>-->
|
||||
<!-- <div class="switch">-->
|
||||
<!-- <label>-->
|
||||
<!-- Off-->
|
||||
<!-- <input type="checkbox" class="disable-reviews" [checked]="fullRateCaptureEnabled" (click)="fullRateCaptureEnabled ? setFullRate(GU.OFF) : setFullRate(GU.ON)">-->
|
||||
<!-- <span class="lever disable-reviews-switch"></span>-->
|
||||
<!-- On-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
<h5 class="section-title">Video Capture FPS</h5>
|
||||
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This changes the frame rate of captured videos on the Quest
|
||||
</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureFps" type="radio" value="24" [(ngModel)]="captureFps" (click)="setCaptureFPSRate(FPS._24)"/>
|
||||
<span>24fps</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureFps" type="radio" value="30" [(ngModel)]="captureFps" (click)="setCaptureFPSRate(FPS._30)"/>
|
||||
<span>30fps</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureFps" type="radio" value="60" [(ngModel)]="captureFps" (click)="setCaptureFPSRate(FPS._60)"/>
|
||||
<span>60fps</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<h5 class="section-title">Video Capture Bitrate</h5>
|
||||
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This changes the quality of captured videos on the Quest
|
||||
</h4>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureBitrate" type="radio" value="5000000" [(ngModel)]="captureBitrate" (click)="setCaptureBitrate(BR._5K)"/>
|
||||
<span>5mbps</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureBitrate" type="radio" value="10000000" [(ngModel)]="captureBitrate" (click)="setCaptureBitrate(BR._10K)"/>
|
||||
<span>10mbps</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureBitrate" type="radio" value="15000000" [(ngModel)]="captureBitrate" (click)="setCaptureBitrate(BR._15K)"/>
|
||||
<span>15mbps</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="captureBitrate" type="radio" value="20000000" [(ngModel)]="captureBitrate" (click)="setCaptureBitrate(BR._20K)"/>
|
||||
<span>20mbps</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<h5 class="section-title">Stereo Capture</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This will enable/disable the stereo video capture for videos recorded i.e. side-by-side view.
|
||||
</h4>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" class="disable-reviews" [checked]="sbsEnabled == '2'" (click)="sbsEnabled == '2' ? setSBS(GU.OFF) : setSBS(GU.ON)">
|
||||
<span class="lever disable-reviews-switch"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h4 class="section-title">Experimental & Miscellaneous </h4>
|
||||
<div class="section-container card z-depth-2">
|
||||
|
||||
<h5 class="section-title">Experimental Mode</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This enables experimental features in your Oculus Quest such as Passthrough API support ( requires guardian to be enabled ).
|
||||
</h4>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" class="disable-reviews" [checked]="experimentalEnabled"
|
||||
(click)="experimentalEnabled ? setExperimental(EXP.Off) : setExperimental(EXP.On);">
|
||||
<span class="lever disable-reviews-switch"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
<h5 class="section-title">MTP ( Media Transfer Protocol )</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This allows you to transfer files between your computer and your headset using your favourite file explorer. You may need to re-enable this when you re-connect your headset.
|
||||
</h4>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" class="disable-reviews" [checked]="adbService.diagnostics.usb && adbService.diagnostics.usb.is_mtp_enabled" (click)="adbService.toggleMTP()">
|
||||
<span class="lever disable-reviews-switch"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<h5 class="section-title">BONELAB Mods</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This will enable mods inside BONELAB on your quest.
|
||||
</h4>
|
||||
<div class="button-section">
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="enableBonelabMods()">Enable BONELAB Mods</div>
|
||||
</div>
|
||||
|
||||
<h5 class="section-title">Proximity Sensor</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This disables the proximity sensor effectively keeping your quest awake.
|
||||
</h4>
|
||||
<div class="button-section">
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="disableProximity(true)">Enable Proximity Sensor</div>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="disableProximity(false)">Disable Proximity Sensor</div>
|
||||
</div>
|
||||
|
||||
<h5 class="section-title">Guardian</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This will enable/disable the guardian.
|
||||
</h4>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" class="disable-reviews" [checked]="!guardianEnabled" (click)="guardianEnabled ? setGuardian(GU.ON) : setGuardian(GU.OFF)">
|
||||
<span class="lever disable-reviews-switch"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<h5 class="section-title">Full Rate Capture</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This will enable/disable the full rate capture for videos recorded i.e. 60/72fps rather than 30fps.
|
||||
</h4>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Off
|
||||
<input type="checkbox" class="disable-reviews" [checked]="fullRateCaptureEnabled" (click)="fullRateCaptureEnabled ? setFullRate(GU.OFF) : setFullRate(GU.ON)">
|
||||
<span class="lever disable-reviews-switch"></span>
|
||||
On
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h5 class="section-title">Paste Text to your device</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
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.
|
||||
</h4>
|
||||
|
||||
<div class="button-section">
|
||||
<div class="input-field ">
|
||||
<input id="devicePaste"
|
||||
[type]="isPassword?'password':'text'" [(ngModel)]="textToSend" />
|
||||
<label for="devicePaste">Text to Paste</label>
|
||||
</div>
|
||||
<div class="switch">
|
||||
<label>
|
||||
Text
|
||||
<input type="checkbox" [(ngModel)]="isPassword" />
|
||||
<span class="lever"></span>
|
||||
Password
|
||||
</label>
|
||||
</div>
|
||||
<div class="pure-material-button-contained spaced flat active margin-top" (click)="pasteToDevice()">Send</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container>
|
||||
<h4 class="section-title">SideQuest Stuff </h4>
|
||||
<div class="section-container card z-depth-2">
|
||||
|
||||
<h5 class="section-title">SideQuest Folders</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
This allows you to open a folder in your file explorer.
|
||||
</h4>
|
||||
|
||||
<div class="button-section">
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="appService.openFolder(folder.MAIN)">Open Main App Folder</div>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="appService.openFolder(folder.APK_BACKUPS)">Open APK Backup Folder</div>
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="appService.openFolder(folder.ADB)">Open ADB Folder</div>
|
||||
</div>
|
||||
|
||||
<h5 class="section-title">SideQuest Debugger</h5>
|
||||
<!-- <div class="divider header-divider-margin margin-bottom"></div> -->
|
||||
<h4 class="description-section">
|
||||
Open the SideQuest chromium dev tools.
|
||||
</h4>
|
||||
<div class="button-section">
|
||||
<div class="pure-material-button-contained spaced flat active" (click)="openDebugger()">Open SideQuest Debugger</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="side-quest-version">
|
||||
SideQuest Advanced Installer: {{appService.versionName}}
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -1,23 +0,0 @@
|
||||
.button-section{
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
.side-quest-version{
|
||||
position:relative;
|
||||
text-align: right;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.description-section{
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.section-container{
|
||||
padding: 20px 40px 30px;
|
||||
//border: 1px solid white;
|
||||
//border-radius: 5px;
|
||||
background: #1c1c1c;
|
||||
}
|
||||
.header-divider-margin{
|
||||
margin-top: 1em;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { HeadsetSettingsComponent } from './headset-settings.component';
|
||||
|
||||
describe('HeadsetSettingsComponent', () => {
|
||||
let component: HeadsetSettingsComponent;
|
||||
let fixture: ComponentFixture<HeadsetSettingsComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HeadsetSettingsComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeadsetSettingsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,514 +0,0 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { AdbClientService } from '../adb-client.service';
|
||||
import { AppService, FolderType } from '../app.service';
|
||||
import { StatusBarService } from '../status-bar.service';
|
||||
enum FFR {
|
||||
OFF,
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
HIGH_TOP,
|
||||
}
|
||||
enum GPU {
|
||||
_2,
|
||||
_4,
|
||||
_app,
|
||||
}
|
||||
enum EXP {
|
||||
Off,
|
||||
On,
|
||||
}
|
||||
enum GU {
|
||||
ON,
|
||||
OFF,
|
||||
}
|
||||
enum CA {
|
||||
APP,
|
||||
OFF,
|
||||
ON,
|
||||
}
|
||||
enum SSO {
|
||||
_512,
|
||||
_768,
|
||||
_1024,
|
||||
_1280,
|
||||
_1536,
|
||||
_2048,
|
||||
_2560,
|
||||
_3072,
|
||||
_1440,
|
||||
_Go,
|
||||
_Quest1,
|
||||
_Quest2,
|
||||
_Quest3,
|
||||
}
|
||||
enum CR {
|
||||
_480,
|
||||
_720,
|
||||
_1080,
|
||||
_1024,
|
||||
_1600,
|
||||
}
|
||||
enum RR {
|
||||
_60,
|
||||
_72,
|
||||
_72_DEF,
|
||||
_90,
|
||||
_120,
|
||||
}
|
||||
enum FPS {
|
||||
_24,
|
||||
_30,
|
||||
_60,
|
||||
}
|
||||
enum BR {
|
||||
_2K,
|
||||
_5K,
|
||||
_10K,
|
||||
_15K,
|
||||
_20K,
|
||||
}
|
||||
enum TP {
|
||||
_FHD,
|
||||
_SQUARE,
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-headset-settings',
|
||||
templateUrl: './headset-settings.component.html',
|
||||
styleUrls: ['./headset-settings.component.scss'],
|
||||
})
|
||||
export class HeadsetSettingsComponent implements OnInit {
|
||||
@Output() close = new EventEmitter();
|
||||
folder = FolderType;
|
||||
experimentalEnabled: boolean;
|
||||
refreshRate: string;
|
||||
chromaticAberration: string;
|
||||
guardianEnabled: boolean;
|
||||
fullRateCaptureEnabled: boolean;
|
||||
sbsEnabled: string;
|
||||
fixedFoveatedRendering: string;
|
||||
videoCaptureSize: string;
|
||||
cpuGpuLevel: string;
|
||||
textureSize: string;
|
||||
captureFps: string;
|
||||
captureBitrate: string;
|
||||
textToSend: string;
|
||||
_textToSend: string[];
|
||||
isPassword: boolean;
|
||||
FFR = FFR;
|
||||
SSO = SSO;
|
||||
GU = GU;
|
||||
CA = CA;
|
||||
CR = CR;
|
||||
GPU = GPU;
|
||||
RR = RR;
|
||||
EXP = EXP;
|
||||
BR = BR;
|
||||
FPS = FPS;
|
||||
TP = TP;
|
||||
constructor(public adbService: AdbClientService, public appService: AppService, private statusService: StatusBarService) {
|
||||
this.appService.resetTop();
|
||||
appService.webService.isWebviewOpen = false;
|
||||
// appService.isSettingsOpen = true;
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.getInitialValues();
|
||||
}
|
||||
|
||||
async getInitialValues() {
|
||||
if (this.adbService.isReady) {
|
||||
this.getPropertyValues();
|
||||
} else {
|
||||
setTimeout(() => this.getInitialValues(), 200);
|
||||
}
|
||||
}
|
||||
|
||||
async getPropertyValues() {
|
||||
await this.getBool('experimentalEnabled', 'debug.oculus.experimentalEnabled');
|
||||
await this.getBool('guardianEnabled', 'debug.oculus.guardian_pause');
|
||||
await this.getBool('fullRateCaptureEnabled', 'debug.oculus.fullRateCapture');
|
||||
await this.getString('debug.oculus.screenCaptureEye', '1', 'sbsEnabled');
|
||||
|
||||
//setSBS
|
||||
await this.getString('debug.oculus.refreshRate', '72', 'refreshRate');
|
||||
await this.getString('debug.oculus.forceChroma', '1', 'chromaticAberration');
|
||||
await this.getString('debug.oculus.foveation.level', '2', 'fixedFoveatedRendering');
|
||||
await this.getString('debug.oculus.capture.fps', '24', 'captureFps');
|
||||
await this.getString('debug.oculus.capture.bitrate', '5000000', 'captureBitrate');
|
||||
await this.getDoubleString('debug.oculus.capture.width', 'debug.oculus.capture.height', '1024', '1024', 'videoCaptureSize');
|
||||
await this.getDoubleString('debug.oculus.cpuLevel', 'debug.oculus.gpuLevel', 'app', 'app', 'cpuGpuLevel');
|
||||
await this.getDoubleString('debug.oculus.textureWidth', 'debug.oculus.textureHeight', '1440', '1584', 'textureSize');
|
||||
}
|
||||
|
||||
openDebugger() {
|
||||
this.appService.remote.getCurrentWindow().toggleDevTools();
|
||||
}
|
||||
|
||||
async getDoubleString(
|
||||
firstProperty: string,
|
||||
secondProperty: string,
|
||||
firstDefault: string,
|
||||
secondDefault: string,
|
||||
value: string
|
||||
) {
|
||||
const response = await this.getValue(firstProperty);
|
||||
const response2 = await this.getValue(secondProperty);
|
||||
this[value] =
|
||||
(response.trim() ? response.trim() : firstDefault) + '-' + (response2.trim() ? response2.trim() : secondDefault);
|
||||
}
|
||||
|
||||
async getString(property: string, defaultValue: string, value: string) {
|
||||
const response = await this.getValue(property);
|
||||
this[value] = response.trim() ? response.trim() : defaultValue;
|
||||
}
|
||||
|
||||
async getBool(value: string, property: string) {
|
||||
const response = await this.getValue(property);
|
||||
if (value === 'fullRateCaptureEnabled') {
|
||||
console.log(response);
|
||||
}
|
||||
if (response.trim() === '1') {
|
||||
this[value] = true;
|
||||
}
|
||||
}
|
||||
|
||||
async getValue(property: string) {
|
||||
const response = await this.adbService.adbCommand('shell', {
|
||||
serial: this.adbService.deviceSerial,
|
||||
command: 'getprop ' + property,
|
||||
});
|
||||
return response;
|
||||
}
|
||||
setFFR(ffr: FFR) {
|
||||
let value = 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.runAdbCommand('setprop debug.oculus.foveation.level ' + value)
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Fixed Foveated Rendering set OK!!');
|
||||
return this.getString('debug.oculus.foveation.level', '2', 'fixedFoveatedRendering');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
disableProximity(shouldEnable) {
|
||||
this.runAdbCommand('am broadcast -a com.oculus.vrpowermanager.' + (shouldEnable ? 'automation_disable' : 'prox_close'))
|
||||
.then(() => {
|
||||
this.statusService.showStatus((shouldEnable ? 'Enable' : 'Disable') + ' proximity message sent OK!!');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
runAdbCommand(command: string) {
|
||||
return this.adbService.adbCommand('shell', { command, serial: this.adbService.deviceSerial });
|
||||
}
|
||||
setExperimental(exp: EXP) {
|
||||
this.runAdbCommand('setprop debug.oculus.experimentalEnabled ' + exp)
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Experimental Mode set OK!!');
|
||||
return this.getBool('experimentalEnabled', 'debug.oculus.experimentalEnabled');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setGPU(gpu: GPU) {
|
||||
const value = gpu === GPU._2 ? 2 : gpu === GPU._app ? "''" : 4;
|
||||
this.runAdbCommand('setprop debug.oculus.cpuLevel ' + value)
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.gpuLevel ' + value))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('CPU/GPU level set OK!!');
|
||||
return this.getDoubleString('debug.oculus.cpuLevel', 'debug.oculus.gpuLevel', 'app', 'app', 'cpuGpuLevel');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setCaptureFPSRate(fps: FPS) {
|
||||
let value = 0;
|
||||
switch (fps) {
|
||||
case FPS._24:
|
||||
value = 24;
|
||||
break;
|
||||
case FPS._30:
|
||||
value = 30;
|
||||
break;
|
||||
case FPS._60:
|
||||
value = 60;
|
||||
break;
|
||||
}
|
||||
this.runAdbCommand('setprop debug.oculus.capture.fps ' + value)
|
||||
.then(async () => {
|
||||
this.statusService.showStatus('Capture FPS set OK!!');
|
||||
await this.getString('debug.oculus.capture.fps', '24', 'captureFps');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setCaptureBitrate(bitrate: BR) {
|
||||
let value = 0;
|
||||
switch (bitrate) {
|
||||
case BR._5K:
|
||||
value = 5000000;
|
||||
break;
|
||||
case BR._10K:
|
||||
value = 10000000;
|
||||
break;
|
||||
case BR._15K:
|
||||
value = 15000000;
|
||||
break;
|
||||
case BR._20K:
|
||||
value = 20000000;
|
||||
break;
|
||||
}
|
||||
this.runAdbCommand('setprop debug.oculus.capture.bitrate ' + value)
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Capture Bit Rate set OK!!');
|
||||
return this.getString('debug.oculus.capture.bitrate', '5000000', 'captureBitrate');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
enableBonelabMods() {
|
||||
this.runAdbCommand(
|
||||
'echo https://blrepo.laund.moe/repository.json > ' +
|
||||
'/sdcard/Android/data/com.StressLevelZero.BONELAB/files/repositories.txt'
|
||||
)
|
||||
.then(res => {
|
||||
if (res.trim()) {
|
||||
this.statusService.showStatus(res.trim(), true);
|
||||
} else {
|
||||
this.statusService.showStatus('Enabled BONELAB mods OK!!');
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.statusService.showStatus(e, true);
|
||||
});
|
||||
}
|
||||
setSBS(sbs: GU) {
|
||||
console.log('setprop debug.oculus.screenCaptureEye ' + (sbs === GU.ON ? 2 : 1));
|
||||
this.runAdbCommand('setprop debug.oculus.screenCaptureEye ' + (sbs === GU.ON ? 2 : 1))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('SBS Capture set OK!!');
|
||||
return this.getString('debug.oculus.screenCaptureEye', '1', 'sbsEnabled');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setFullRate(fullRate: GU) {
|
||||
console.log('setprop debug.oculus.fullRateCapture ' + (fullRate === GU.ON ? 1 : 0));
|
||||
this.runAdbCommand('setprop debug.oculus.fullRateCapture ' + (fullRate === GU.ON ? 1 : 0))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Full Rate Capture set OK!!');
|
||||
return this.getBool('fullRateCaptureEnabled', 'debug.oculus.fullRateCapture');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setTetianasPreset(tp: TP) {
|
||||
let width = 1920;
|
||||
let height = 1080;
|
||||
switch (tp) {
|
||||
case TP._FHD:
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
break;
|
||||
case TP._SQUARE:
|
||||
width = 1600;
|
||||
height = 1600;
|
||||
break;
|
||||
}
|
||||
this.runAdbCommand('setprop debug.oculus.capture.width ' + width)
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.capture.height ' + height))
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.capture.fps 60'))
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.capture.bitrate 10000000'))
|
||||
.then(async () => {
|
||||
this.statusService.showStatus('Capture settings set OK!!');
|
||||
await this.getString('debug.oculus.capture.bitrate', '5000000', 'captureBitrate');
|
||||
await this.getString('debug.oculus.capture.fps', '24', 'captureFps');
|
||||
await this.getDoubleString(
|
||||
'debug.oculus.capture.width',
|
||||
'debug.oculus.capture.height',
|
||||
'1024',
|
||||
'1024',
|
||||
'videoCaptureSize'
|
||||
);
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setGuardian(guardian: GU) {
|
||||
this.runAdbCommand('setprop debug.oculus.guardian_pause ' + (guardian === GU.ON ? 0 : 1))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Guardian pause set OK!!');
|
||||
return this.getBool('guardianEnabled', 'debug.oculus.guardian_pause');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setCa(ca: CA) {
|
||||
this.runAdbCommand('setprop debug.oculus.forceChroma ' + (ca === CA.ON ? 1 : ca === CA.APP ? -1 : 0))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Chromatic Aberration set OK!!');
|
||||
return this.getString('debug.oculus.forceChroma', '1', 'chromaticAberration');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setRR(rr: RR) {
|
||||
let value = 72;
|
||||
switch (rr) {
|
||||
case RR._60:
|
||||
value = 60;
|
||||
break;
|
||||
case RR._72_DEF:
|
||||
case RR._72:
|
||||
value = 72;
|
||||
break;
|
||||
case RR._90:
|
||||
value = 90;
|
||||
break;
|
||||
case RR._120:
|
||||
value = 120;
|
||||
break;
|
||||
}
|
||||
this.runAdbCommand('setprop debug.oculus.refreshRate ' + value)
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Refresh Rate set OK!!');
|
||||
return this.getString('debug.oculus.refreshRate', '72', 'refreshRate');
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setSSO(sso: SSO) {
|
||||
let value = 1440;
|
||||
let hvalue = 1584;
|
||||
switch (sso) {
|
||||
case SSO._512:
|
||||
value = 512;
|
||||
hvalue = 563;
|
||||
break;
|
||||
case SSO._768:
|
||||
value = 768;
|
||||
hvalue = 845;
|
||||
break;
|
||||
case SSO._1024:
|
||||
value = 1024;
|
||||
hvalue = 1127;
|
||||
break;
|
||||
case SSO._1280:
|
||||
value = 1280;
|
||||
hvalue = 1408;
|
||||
break;
|
||||
case SSO._1536:
|
||||
value = 1536;
|
||||
hvalue = 1690;
|
||||
break;
|
||||
case SSO._2048:
|
||||
value = 2048;
|
||||
hvalue = 2253;
|
||||
break;
|
||||
case SSO._2560:
|
||||
value = 2560;
|
||||
hvalue = 2816;
|
||||
break;
|
||||
case SSO._3072:
|
||||
value = 3072;
|
||||
hvalue = 3380;
|
||||
break;
|
||||
case SSO._1440:
|
||||
value = 1440;
|
||||
hvalue = 1584;
|
||||
break;
|
||||
case SSO._Go:
|
||||
value = 1024;
|
||||
hvalue = 1024;
|
||||
break;
|
||||
case SSO._Quest1:
|
||||
value = 1216;
|
||||
hvalue = 1344;
|
||||
break;
|
||||
case SSO._Quest2:
|
||||
value = 1440;
|
||||
hvalue = 1584;
|
||||
break;
|
||||
case SSO._Quest3:
|
||||
value = 1680;
|
||||
hvalue = 1760;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
this.runAdbCommand('setprop debug.oculus.textureWidth ' + value)
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.textureHeight ' + hvalue))
|
||||
.then(() => this.runAdbCommand('"settings put system font_scale 0.85 && settings put system font_scale 1.0"'))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Texture Resolution set OK!!');
|
||||
return this.getDoubleString(
|
||||
'debug.oculus.textureWidth',
|
||||
'debug.oculus.textureHeight',
|
||||
'1440',
|
||||
'1584',
|
||||
'textureSize'
|
||||
);
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
setCR(svr: CR) {
|
||||
let width = 1024;
|
||||
let height = 1024;
|
||||
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;
|
||||
case CR._1024:
|
||||
width = 1024;
|
||||
height = 1024;
|
||||
break;
|
||||
case CR._1600:
|
||||
width = 1600;
|
||||
height = 1600;
|
||||
break;
|
||||
}
|
||||
this.runAdbCommand('setprop debug.oculus.capture.width ' + width)
|
||||
.then(() => this.runAdbCommand('setprop debug.oculus.capture.height ' + height))
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Capture Resolution set OK!!');
|
||||
return this.getDoubleString(
|
||||
'debug.oculus.capture.width',
|
||||
'debug.oculus.capture.height',
|
||||
'1024',
|
||||
'1024',
|
||||
'videoCaptureSize'
|
||||
);
|
||||
})
|
||||
.catch(e => this.statusService.showStatus(e, true));
|
||||
}
|
||||
pasteToDevice() {
|
||||
this._textToSend = this.textToSend.split('');
|
||||
this.textToSend = '';
|
||||
this.inputCharacters()
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Text sent to the device!!');
|
||||
})
|
||||
.catch(e => {
|
||||
this.statusService.showStatus(e.toString(), true);
|
||||
});
|
||||
}
|
||||
inputCharacters() {
|
||||
let character = this._textToSend.shift();
|
||||
return this.runAdbCommand('input text "' + character + '"').then(() => {
|
||||
if (this._textToSend.length) {
|
||||
return this.inputCharacters();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<span class="link link-white" (click)="open()">{{text}}</span>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { LinkComponent } from './link.component';
|
||||
|
||||
describe('LinkComponent', () => {
|
||||
let component: LinkComponent;
|
||||
let fixture: ComponentFixture<LinkComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LinkComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LinkComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,21 +0,0 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { AppService } from '../app.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-link',
|
||||
templateUrl: './link.component.html',
|
||||
styleUrls: ['./link.component.scss'],
|
||||
})
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<div class="loader-small"></div>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { LoadingSpinnerSmallComponent } from './loading-spinner-small.component';
|
||||
|
||||
describe('LoadingSpinnerSmallComponent', () => {
|
||||
let component: LoadingSpinnerSmallComponent;
|
||||
let fixture: ComponentFixture<LoadingSpinnerSmallComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoadingSpinnerSmallComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoadingSpinnerSmallComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loading-spinner-small',
|
||||
templateUrl: './loading-spinner-small.component.html',
|
||||
styleUrls: ['./loading-spinner-small.component.scss'],
|
||||
})
|
||||
export class LoadingSpinnerSmallComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -1,46 +0,0 @@
|
||||
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() : Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.spinner.isConfirm = true;
|
||||
this.spinner.confirmResolve = resolve;
|
||||
this.spinner.confirmReject = reject;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<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>
|
||||
<div class="pure-material-button-contained flat active" (click)="cancel()">Cancel</div>
|
||||
<div class="pure-material-button-contained" (click)="confirm()">Continue</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isActive" class="spinner-background"></div>
|
||||