mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
feat: dpad navigation, wt error handling
This commit is contained in:
parent
053c4adb10
commit
e09053bb27
7 changed files with 38 additions and 17 deletions
|
|
@ -6,7 +6,8 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:banner="@drawable/banner">
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
android:name=".MainActivity"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
"@capacitor/core": "^5.5.1",
|
||||
"@capacitor/ios": "^5.5.1",
|
||||
"@capacitor/status-bar": "^5.0.6",
|
||||
"capacitor-nodejs": "https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.6/capacitor-nodejs.tgz",
|
||||
"capacitor-nodejs": "https://github.com/funniray/Capacitor-NodeJS/releases/download/nodejs-18/capacitor-nodejs-1.0.0-beta.6.tgz",
|
||||
"capacitor-plugin-safe-area": "^2.0.5",
|
||||
"common": "workspace:*",
|
||||
"cordova-plugin-navigationbar": "^1.0.31",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import TorrentClient from 'common/modules/webtorrent.js'
|
||||
import { channel } from 'bridge'
|
||||
import { statfs } from 'fs/promises'
|
||||
|
||||
async function storageQuota (directory) {
|
||||
return Infinity
|
||||
const { bsize, bavail } = await statfs(directory)
|
||||
return bsize * bavail
|
||||
}
|
||||
|
||||
if (typeof localStorage === 'undefined') {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const capacitorConfig = {
|
|||
patterns: [
|
||||
{ from: join(__dirname, 'public', 'nodejs') }
|
||||
]
|
||||
}),
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,3 +128,14 @@ function navigateDPad (direction = 'up') {
|
|||
|
||||
closestElement.element.focus()
|
||||
}
|
||||
const keyMap = {
|
||||
ArrowDown: 'down',
|
||||
ArrowUp: 'up',
|
||||
ArrowLeft: 'left',
|
||||
ArrowRight: 'right'
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
e.preventDefault()
|
||||
navigateDPad(keyMap[e.key])
|
||||
})
|
||||
|
|
|
|||
|
|
@ -90,12 +90,13 @@ export default class TorrentClient extends WebTorrent {
|
|||
cat: new HTTPTracker({}, atob('aHR0cDovL255YWEudHJhY2tlci53Zjo3Nzc3L2Fubm91bmNl'))
|
||||
}
|
||||
|
||||
process.on('uncaughtException', this.dispatchError.bind(this))
|
||||
this.on('error', this.dispatchError.bind(this))
|
||||
}
|
||||
|
||||
loadLastTorrent (t) {
|
||||
const torrent = localStorage.getItem('torrent') || t
|
||||
if (torrent) this.addTorrent(new Uint8Array(JSON.parse(torrent)), JSON.parse(localStorage.getItem('lastFinished')))
|
||||
const torrent = localStorage.getItem('torrent') ? new Uint8Array(JSON.parse(localStorage.getItem('torrent'))) : t
|
||||
if (torrent) this.addTorrent(t, JSON.parse(localStorage.getItem('lastFinished')))
|
||||
}
|
||||
|
||||
async handleTorrent (torrent) {
|
||||
|
|
@ -176,12 +177,12 @@ export default class TorrentClient extends WebTorrent {
|
|||
}
|
||||
|
||||
dispatchError (e) {
|
||||
if (e instanceof ErrorEvent) return this.dispatchError(e.error)
|
||||
if (e instanceof PromiseRejectionEvent) return this.dispatchError(e.reason)
|
||||
if (typeof ErrorEvent !== 'undefined' && e instanceof ErrorEvent) return this.dispatchError(e.error)
|
||||
if (typeof PromiseRejectionEvent !== 'undefined' && e instanceof PromiseRejectionEvent) return this.dispatchError(e.reason)
|
||||
for (const exclude of TorrentClient.excludedErrorMessages) {
|
||||
if (e.message?.startsWith(exclude)) return
|
||||
}
|
||||
this.dispatch('error', e)
|
||||
this.dispatch('error', JSON.stringify(e))
|
||||
}
|
||||
|
||||
async addTorrent (data, skipVerify = false) {
|
||||
|
|
@ -209,8 +210,6 @@ export default class TorrentClient extends WebTorrent {
|
|||
switch (data.type) {
|
||||
case 'current': {
|
||||
if (data.data) {
|
||||
console.log('adding torrent')
|
||||
console.log(data.data)
|
||||
const torrent = await this.get(data.data.infoHash)
|
||||
const found = torrent?.files.find(file => file.path === data.data.path)
|
||||
if (!found) return
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ importers:
|
|||
specifier: ^5.0.6
|
||||
version: 5.0.6(@capacitor/core@5.5.1)
|
||||
capacitor-nodejs:
|
||||
specifier: https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.6/capacitor-nodejs.tgz
|
||||
specifier: https://github.com/funniray/Capacitor-NodeJS/releases/download/nodejs-18/capacitor-nodejs-1.0.0-beta.6.tgz
|
||||
version: '@github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.6/capacitor-nodejs.tgz(@capacitor/core@5.5.1)'
|
||||
capacitor-plugin-safe-area:
|
||||
specifier: ^2.0.5
|
||||
|
|
@ -132,10 +132,10 @@ importers:
|
|||
dependencies:
|
||||
'@fontsource-variable/material-symbols-outlined':
|
||||
specifier: latest
|
||||
version: 5.0.16
|
||||
version: 5.0.17
|
||||
'@fontsource-variable/nunito':
|
||||
specifier: latest
|
||||
version: 5.0.16
|
||||
version: 5.0.17
|
||||
'@fontsource/roboto':
|
||||
specifier: latest
|
||||
version: 5.0.8
|
||||
|
|
@ -150,7 +150,7 @@ importers:
|
|||
version: 1.0.1
|
||||
jassub:
|
||||
specifier: latest
|
||||
version: 1.7.12
|
||||
version: 1.7.14
|
||||
js-levenshtein:
|
||||
specifier: ^1.1.6
|
||||
version: 1.1.6
|
||||
|
|
@ -745,10 +745,18 @@ packages:
|
|||
resolution: {integrity: sha512-XqGrDFJ15dNHeD4tT4imnTqrPhNb5C49hXwlfGcvcfV64BxFX0S4mq41q/34kxlObnShqKIqHwvxd9SPtG3H/g==}
|
||||
dev: false
|
||||
|
||||
/@fontsource-variable/material-symbols-outlined@5.0.17:
|
||||
resolution: {integrity: sha512-K0/pwNGhM+L5/kgRQGBUv+uHJK7f/Vs087PpuwszuU0HQ8QyECQjnwseHt7SUjjYgJC06nLNcm0+EmebO/jHUA==}
|
||||
dev: false
|
||||
|
||||
/@fontsource-variable/nunito@5.0.16:
|
||||
resolution: {integrity: sha512-ZmmtDc/oBk7l3Tn33OmjUkcOapL8O/8w78Xm9AML0+t00gu5msH/BL5yeowLh8pFnKCIPsTYHqxnu5xdM1N+dA==}
|
||||
dev: false
|
||||
|
||||
/@fontsource-variable/nunito@5.0.17:
|
||||
resolution: {integrity: sha512-e9F+nYc8610HtmVB08kKzHdythbSJBN9CyV3ODzCAs2LuoOviAndYdNfKOw6rHqOh3j99gfOSNlHpLNNF9O5OA==}
|
||||
dev: false
|
||||
|
||||
/@fontsource/roboto@5.0.8:
|
||||
resolution: {integrity: sha512-XxPltXs5R31D6UZeLIV1td3wTXU3jzd3f2DLsXI8tytMGBkIsGcc9sIyiupRtA8y73HAhuSCeweOoBqf6DbWCA==}
|
||||
dev: false
|
||||
|
|
@ -5469,8 +5477,8 @@ packages:
|
|||
minimatch: 3.1.2
|
||||
dev: true
|
||||
|
||||
/jassub@1.7.12:
|
||||
resolution: {integrity: sha512-mYSI+3Rbyy2XF0Hk44ZbwHqX4PNrY6Rs2U7RxZ450NxSKGClfu6sW2dQSbygWD1Y3xQGtbeN3GIujX2XRaXwdA==}
|
||||
/jassub@1.7.14:
|
||||
resolution: {integrity: sha512-sybiXH8wTlRxk3vTZpyYLX66SPwwBdAT3Y2hFvjs/GWhggap89VUID/H/xJX2LYwHpCyLCvZE34xitNuexW9ZQ==}
|
||||
dependencies:
|
||||
rvfc-polyfill: 1.0.7
|
||||
dev: false
|
||||
|
|
|
|||
Loading…
Reference in a new issue