Use IndexedDB for storage
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jack Hadrill 2021-01-08 17:59:53 +00:00
parent 359b01950c
commit 3c9b817674
4 changed files with 51 additions and 3 deletions

45
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "0.1.0",
"dependencies": {
"core-js": "^3.6.5",
"indexeddb-chunk-store": "^2.2.1",
"mitt": "^2.1.0",
"pretty-bytes": "^5.5.0",
"pretty-ms": "^7.0.1",
@ -8666,6 +8667,15 @@
"node": ">= 6"
}
},
"node_modules/idb-kv-store": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/idb-kv-store/-/idb-kv-store-4.5.0.tgz",
"integrity": "sha512-snvtAQRforYUI+C2+45L2LBJy/0/uQUffxv8/uwiS98fSUoXHVrFPClgzWZWxT0drwkLHJRm9inZcYzTR42GLA==",
"dependencies": {
"inherits": "^2.0.3",
"promisize": "^1.1.2"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -8851,6 +8861,14 @@
"node": ">=8"
}
},
"node_modules/indexeddb-chunk-store": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/indexeddb-chunk-store/-/indexeddb-chunk-store-2.2.1.tgz",
"integrity": "sha1-+P7j8aztkWUADhl9K+dT8a31EHo=",
"dependencies": {
"idb-kv-store": "^4.3.1"
}
},
"node_modules/indexes-of": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
@ -13034,6 +13052,11 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
"node_modules/promisize": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/promisize/-/promisize-1.1.2.tgz",
"integrity": "sha1-m0fiyyrkl+seutwsQZHWTRXJSdE="
},
"node_modules/proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
@ -25268,6 +25291,15 @@
"postcss": "^7.0.14"
}
},
"idb-kv-store": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/idb-kv-store/-/idb-kv-store-4.5.0.tgz",
"integrity": "sha512-snvtAQRforYUI+C2+45L2LBJy/0/uQUffxv8/uwiS98fSUoXHVrFPClgzWZWxT0drwkLHJRm9inZcYzTR42GLA==",
"requires": {
"inherits": "^2.0.3",
"promisize": "^1.1.2"
}
},
"ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -25388,6 +25420,14 @@
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true
},
"indexeddb-chunk-store": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/indexeddb-chunk-store/-/indexeddb-chunk-store-2.2.1.tgz",
"integrity": "sha1-+P7j8aztkWUADhl9K+dT8a31EHo=",
"requires": {
"idb-kv-store": "^4.3.1"
}
},
"indexes-of": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
@ -28719,6 +28759,11 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
"promisize": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/promisize/-/promisize-1.1.2.tgz",
"integrity": "sha1-m0fiyyrkl+seutwsQZHWTRXJSdE="
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",

View File

@ -9,6 +9,7 @@
},
"dependencies": {
"core-js": "^3.6.5",
"indexeddb-chunk-store": "^2.2.1",
"mitt": "^2.1.0",
"pretty-bytes": "^5.5.0",
"pretty-ms": "^7.0.1",

View File

@ -56,9 +56,10 @@
<script>
import { computed, inject, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { useToast } from 'primevue/usetoast'
import WebTorrent from 'webtorrent/webtorrent.min.js'
import IndexedDBChunkStore from 'indexeddb-chunk-store'
import prettyBytes from 'pretty-bytes'
import prettyMilliseconds from 'pretty-ms'
import WebTorrent from 'webtorrent/webtorrent.min.js'
import updateWireStatistics from '@/helpers/wire-statistics'
export default {
@ -153,7 +154,7 @@ export default {
// Utility functions.
const seedFile = (file) => {
webTorrent.seed(file, { announce: trackers }, torrent => {
webTorrent.seed(file, { announce: trackers, store: IndexedDBChunkStore }, torrent => {
torrent.on('error', () => {})
torrent.on('warning', () => {})
torrent.on('wire', wire => {

View File

@ -68,6 +68,7 @@ import { computed, inject, onBeforeMount, onBeforeUnmount, onMounted, reactive,
import { useRouter } from 'vue-router'
import { useToast } from 'primevue/usetoast'
import WebTorrent from 'webtorrent/webtorrent.min.js'
import IndexedDBChunkStore from 'indexeddb-chunk-store'
import prettyBytes from 'pretty-bytes'
import prettyMilliseconds from 'pretty-ms'
import updateWireStatistics from '@/helpers/wire-statistics'
@ -158,7 +159,7 @@ export default {
// Utility functions.
const downloadVideo = (infoHash) => {
webTorrent.add(infoHash, { announce: trackers }, torrent => {
webTorrent.add(infoHash, { announce: trackers, store: IndexedDBChunkStore }, torrent => {
torrent.on('error', () => {})
torrent.on('warning', () => {})
torrent.on('wire', () => {