add pwa to lbry-desktop
This commit is contained in:
parent
b8c5a0ed29
commit
2e5cfe7a1e
7 changed files with 33 additions and 0 deletions
|
@ -62,6 +62,9 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<link rel="manifest" href="./public/pwa/manifest.json"/>
|
||||
<script src="./public/pwa/serviceWorker.js"></script>
|
||||
|
||||
<!-- VARIABLE_HEAD_BEGIN -->
|
||||
<!-- VARIABLE_HEAD_END -->
|
||||
</head>
|
||||
|
|
BIN
static/pwa/icon-512.png
Normal file
BIN
static/pwa/icon-512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
static/pwa/icon.png
Normal file
BIN
static/pwa/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
14
static/pwa/manifest.json
Normal file
14
static/pwa/manifest.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "LBRY",
|
||||
"short_name": "LBRY",
|
||||
"theme_color": "#183793",
|
||||
"background_color": "#FAFAFA",
|
||||
"display": "minimal-ui",
|
||||
"scope": "/",
|
||||
"start_url": "/",
|
||||
"icons": [{
|
||||
"src": "/public/pwa/icon-512.png",
|
||||
"type" : "image/png",
|
||||
"sizes": "512x512"
|
||||
}]
|
||||
}
|
3
static/pwa/pwa.js
Normal file
3
static/pwa/pwa.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
self.addEventListener('fetch', function(event) {
|
||||
console.log(`start server worker`);
|
||||
});
|
7
static/pwa/serviceWorker.js
Normal file
7
static/pwa/serviceWorker.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('./public/pwa/sw.js').then(function(reg) {
|
||||
console.log('Successfully registered service worker', reg);
|
||||
}).catch(function(err) {
|
||||
console.warn('Error whilst registering service worker', err);
|
||||
});
|
||||
}
|
|
@ -20,6 +20,7 @@ const isProduction = process.env.NODE_ENV === 'production';
|
|||
const hasSentryToken = process.env.SENTRY_AUTH_TOKEN !== undefined;
|
||||
const jsBundleId = getJsBundleId();
|
||||
|
||||
// copy static files to dist file
|
||||
const copyWebpackCommands = [
|
||||
{
|
||||
from: `${STATIC_ROOT}/index-web.html`,
|
||||
|
@ -55,6 +56,10 @@ const copyWebpackCommands = [
|
|||
from: `${STATIC_ROOT}/font/`,
|
||||
to: `${DIST_ROOT}/public/font/`,
|
||||
},
|
||||
{
|
||||
from: `${STATIC_ROOT}/pwa/`,
|
||||
to: `${DIST_ROOT}/public/pwa/`,
|
||||
},
|
||||
];
|
||||
|
||||
const CUSTOM_OG_PATH = `${CUSTOM_ROOT}/v2-og.png`;
|
||||
|
@ -111,6 +116,7 @@ const webConfig = {
|
|||
devServer: {
|
||||
port: WEBPACK_WEB_PORT,
|
||||
contentBase: path.join(__dirname, 'dist'),
|
||||
disableHostCheck: true, // to allow debugging with ngrok
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
|
Loading…
Reference in a new issue