(I'm using Nuxt 3.0.0-rc.13 and #kevinmarrec/nuxt-pwa 0.9.1, but I think my question is generic to any PWA.)
In my nuxt.config.ts file, I have defined my PWA with these two sections:
modules: [
['#kevinmarrec/nuxt-pwa'],
],
and
pwa: {
manifest: {
name: "My App",
lang: 'en'
},
workbox: {
offlineAssets: [ "/fonts/*.ttf", "/fonts/*.woff", "/fonts/*.svg" ]
}
},
When I'm connected to the internet, my fonts load and it looks right. When I'm not connected to the internet, the app works just fine but the fonts are not loaded and I get the fallback fonts.
All my fonts are hosted on the website in the /fonts folder.
Related
I am currently trying to build the pipeline for serving a bundle of data in my project and I can't make it work even by reading the step by step documentation that firebase gives us.
I have followed the documentation and was able to create a bundle through this documentation:
https://firebase.google.com/docs/extensions/official/firestore-bundle-builder
But when I get to the documentation on building and serving the bundle, things start to falling apart since I cannot find complete resources explaining how to implement it
So that is how I implemented it:
{
"functions": [
{
something
"ignore": [
something
],
something
]
}
],
"hosting": {
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/bundles/*",
"function": "ext-firestore-bundle-builder-serve"
}
]
}
}
Is it in the right level or not ? No idea... but that's what I did and I deployed it successfully.
Now, in the client integration part:
import { loadBundle } from "firebase/firestore";
// Download the bundle from the Firebase Hosting CDN:
const bundle = await fetch("/bundles/:bundleId");
// If not using a CDN, download the bundle directly:
// const bundle = await fetch('https://<location>-<project-id>.cloudfunctions.net/ext-firestore-bundle-builder-serve/:bundleId');
await loadBundle(bundle);
I do not know again how to implement it since the import give me an error, and every functions too.
I'd appreciate your help.
I am not new with firebase and I am not that bad at finding the documentation in order to understand but I don't know if the SEO is not good or the documentation not complete and will be completed but I failed to find it..
Thanks for your time
enter image description hereI need to allow the notification for the chrome browser to get incoming message notifications on my PC.
I have tried this code in the protractor.config file. It was still displaying the pop
capabilities: {
browserName: 'chrome',
'chromeOptions':{
'prefs' : {'profile.default_content_setting_values.geolocation': }
},
I have also tried using the following code in spec, it is not working
browser.switchTo().alert().accept()
for this code, I am getting an error as No such alert was found and the scripts fail.
Is there any provision to allow notification pop in the protractor for the chrome browser?
geolocation has nothing to do with it. You need to try these options https://chromium.googlesource.com/chromium/src/+/7e762c1f17514a29834506860961ba2f24e7e6e5/components/content_settings/core/common/pref_names.cc#36 Most likely these 3
"profile.default_content_setting_values.media_stream";
"profile.default_content_setting_values.media_stream_mic";
"profile.default_content_setting_values.media_stream_camera";
try these capabilities
{
browserName: 'chrome',
chromeOptions: {
prefs: {
'profile.default_content_setting_values.media_stream': 2,
"profile.default_content_setting_values.media_stream_mic": 2,
"profile.default_content_setting_values.media_stream_camera": 2
},
},
}
I am using flutter web to create a website for my buisness. I am hosting it on firebase hosting with the url
https://xspectre-9a3b3.web.app/
Now when I added the new domain
https://xspectre.net
The website does not load in this domain and gives the error
main.dart.js:1 Uncaught SyntaxError: Unexpected token '<'
(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://xspectre.net/') with script ('https://xspectre.net/flutter_service_worker.js'): The script has an unsupported MIME type ('text/html').
It does not work with https://xspectre-9a3b3.firebaseapp.com/ either. What should I do?
EDIT
I discovered the real error is not the MIME type one since it is in my real project too. The actual error is somehow
Uncaught SyntaxError: Unexpected token '<'
When I open the main.dart.js it shows me different code then it should. It shows me the html files not the main.dart.js code and I think that is what is causing the problem. I dont know how or why the files are different for both the URLs.
**EDIT 2 **
Finally figured out the root problem.
Whenever I try to do firebase init, it goes to initialize the whole flutter directory. This means that it says,
You're about to initialize a Firebase project in this directory:
C:\FlutterProjects\xspectre
and not
You're about to initialize a Firebase project in this directory:
C:\FlutterProjects\xspectre\build
Now I need to figure out how to do firebase init and deloy in the /build and not root
The website probably still works for you as it is already cached by the service worker. Try with another browser and it will not work.
firebase init should be run in the project directory, not in the build directory.
After that, edit your firebase.json file to look like
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
}
}
"public": "build/web" points to the directory where the files for deployment are.
Now you can do flutter build web and firebase deploy
I'm working on a GatsbyJS site using gatsby-plugin-offline which is available at example.com and would like to make PDF files to which I link on example.com but are at download.example.com/example.pdf available offline. Is that possible?
Yes, it's possible. I'm not 100% familiar with gatsby-plugin-offline's configuration, but it looks like https://www.gatsbyjs.org/packages/gatsby-plugin-offline/#available-options describes a process for appending additional service worker logic to thee end of its default configuration:
plugins: [{
resolve: `gatsby-plugin-offline`,
options: {
appendScript: require.resolve(`src/custom-sw-code.js`),
},
}]
Then in src/custom-sw-code.js:
workbox.routing.registerRoute(
({url}) => url.pathname.endsWith('.pdf'),
// Use StaleWhileRevalidate, CacheFirst, etc. as desired.
new workbox.strategies.StaleWhileRevalidate({cacheName: 'pdfs'})
);
I have deployed Mattermost Team Edition from the Helm Chart
onto my k8s Cluster and it's working great.
The issue is that the config.json file is mounted as a secret,
so configuration can't be done from the UI but in the config.json that is part of values.yaml in the helm chart.
How does one configure plugins? For starters, I would like to enable the zoom plugin
configJSON: {
"PluginSettings": {
"Enable": true,
"EnableUploads": true,
"Directory": "./plugins",
"ClientDirectory": "./client/plugins",
"Plugins": {},
"PluginStates": {
"zoom": {
"Enable": true
},
"com.mattermost.nps": {
"Enable": false
},
"mattermost-webrtc-video": {
"Enable": true
},
"github": {
"Enable": true
},
"jira": {
"Enable": true
},
}
}
Is this the right way of enabling the plugins?
How do I configure the plugins,
especially the zoom one needs API credentials..
I see two options:
The safe way
Run another Mattermost server instance locally (for exemple using the Mattermost preview Docker, very easy to set up), configure your plugins and use its configuration file section for your cluster instances.
The manual, error-prone way
Edit the config.json yourself as you've started. For each plugin, there are two sections to edit, Plugins and PluginStates:
"PluginSettings": {
// [...]
"Plugins": {
"your.plugin.id": {
"pluginProperty1": "...",
"pluginProperty2": "...",
"pluginProperty3": "...",
// [...]
},
},
"PluginStates": {
// [...]
"your.plugin.id": {
"Enable": true
},
}
}
As you see, this requires to know what properties are defined for each plugin, for which there's only the solution to consult the plugin's documentation, or even it's code (look for a file called plugin.json at the root of the plugin's GitHub repo, in the settings section).
I would recommand the first method if there's really no way for you to use the GUI to install&configure plugins.
For other readers' information, in most Mattermost setups, you should be able to use the UI for this, even in High Availability Mode if your version is recent enough.
Add the following to your values.yaml:
config:
MM_PLUGINSETTINGS_CLIENTDIRECTORY: "./client/plugins"
MM_PLUGINSETTINGS_ENABLEUPLOADS: "true"