0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch.git synced 2024-12-22 05:12:57 -05:00

Create PWA support #87

This commit is contained in:
dragongoose 2024-07-13 12:14:37 -04:00
parent 7431b7f1bf
commit 89e177d8b1
No known key found for this signature in database
GPG key ID: 01397EEC371CDAA5
3 changed files with 5545 additions and 169 deletions

5670
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,13 +3,13 @@
"version": "2.3.1", "version": "2.3.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --", "build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", "lint": "eslint . --ext .vue,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/" "build-only": "vite build",
"dev": "vite",
"format": "prettier --write src/",
"preview": "vite preview",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
}, },
"dependencies": { "dependencies": {
"@intlify/unplugin-vue-i18n": "^0.11.0", "@intlify/unplugin-vue-i18n": "^0.11.0",
@ -17,6 +17,7 @@
"@types/vue-i18n": "^7.0.0", "@types/vue-i18n": "^7.0.0",
"hls.js": "^1.4.10", "hls.js": "^1.4.10",
"oh-vue-icons": "^1.0.0-rc3", "oh-vue-icons": "^1.0.0-rc3",
"register-service-worker": "^1.7.2",
"video.js": "^8.0.4", "video.js": "^8.0.4",
"videojs-contrib-quality-levels": "^3.0.0", "videojs-contrib-quality-levels": "^3.0.0",
"videojs-hls-quality-selector": "^1.1.4", "videojs-hls-quality-selector": "^1.1.4",
@ -34,6 +35,7 @@
"@types/videojs-contrib-quality-levels": "^2.0.1", "@types/videojs-contrib-quality-levels": "^2.0.1",
"@types/videojs-hls-quality-selector": "^1.1.0", "@types/videojs-hls-quality-selector": "^1.1.0",
"@vitejs/plugin-vue": "^4.4.0", "@vitejs/plugin-vue": "^4.4.0",
"@vue/cli-plugin-pwa": "~5.0.0",
"@vue/eslint-config-prettier": "^8.0.0", "@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0", "@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.4.0", "@vue/tsconfig": "^0.4.0",

View file

@ -0,0 +1,32 @@
/* eslint-disable no-console */
import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready () {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
},
registered () {
console.log('Service worker has been registered.')
},
cached () {
console.log('Content has been cached for offline use.')
},
updatefound () {
console.log('New content is downloading.')
},
updated () {
console.log('New content is available; please refresh.')
},
offline () {
console.log('No internet connection found. App is running in offline mode.')
},
error (error) {
console.error('Error during service worker registration:', error)
}
})
}