I built a GitHub User Page (https://username.github.io) with create-react-app. And I also have a project page at https://username.github.io/myProject which is built using Vuejs. The create-react-app seems to have a built-in service worker that does the caching automatically, which is what I wanted, but it also make my https://username.github.io/myProject not showing the project page correctly but showing my https://username.github.io page instead. I tried to unregister and clear the storage but it's only work once, when I located to my User's page and then to my Project's page, the problem still coming again.
How do I keep the caching behavior, and make these two urls able to show properly?
When you register an SW at the root ("/") it automatically takes control of everything below it ("/myapp2"). This is bu design and there's no exclusion config available.
I think you have two options:
Move the React project out of the root to it's own sub dir and have the SE control only that
Write some logic in the SW itself that checks all fetches it's handling and does a no-op if the they match a dir you don't want to be handled by the SW
Related
I am creating a forum using Gatsby
I have develop a form that users can use to create threads to add to the forum in a page called create.js which which sends the data to an external DB.
Once, the user has submitted the thread, I want to create a new page using a template, normally I would use in Gatsby-node.js; according to the Gatsby Docs Gatsby-node.js is only run once on deployment.
Is there another way that I can access CreatePage() outside of Gatsby-node.js or is there another function I am missing?
Ultimately I want the new page to available in the Gatsby application, without redeploying, after the user has created the necessary content.
The way Gatsby works is that all pages need to be generated at build time. You cannot add new pages without triggering a new build.
Gatsby is not a suitable platform for a forum since content changes hundreds or thousands of times a day. Gatsby is intended for content that changes infrequently such as blogs (which might update a few times a day).
I order to generate pages without using CreatePage in Gatsby-node.js, Gatsby advises to use #reach/Router and matchPage to extend the client application's router, we call this functionality (Client-only Routes)
more info here
We're integrating SAP Commerce 2005 and Spartacus 2.0.3 with CDS (Context-Driven Services). We followed the instructions from https://sap.github.io/spartacus-docs/cds-integration/ and we got it work right.
Nevertheless, we've noticed one issue.
When we clear the site data (either from Chrome DevTool or via browser Settings), the cookie named profile.consent.given is not being set anew while refreshing the page - even though the PROFILE consent has consentState "GIVEN" in local storage in spartacus-local-data > anonymous-consents > consents.
Initially I thought that it's just not visible in DevTools, but when I've added the url parameter ?profileTagDebug=true, in the console there is a log saying:
"[Profile Tag] No cookie found with name profile.consent.given".
When I set this cookie manually with value true, everything starts to work just fine, all other needed cookies and local storage data responsible for tracking users behavior is being set properly.
Do you see any place where we could have done something wrong, which may have caused this cookie to work improperly? Which module or component of Spartacus library would be of any clue in resolving this issue?
Edit: the reason of this strange behavior was in profile tag created by our team in CDS. It contained:
"consentListener": "type":"cookie","cookieName":"profile.consent.given","cookieValue":"true"},
which made the cookie profile.consent.given necessary while it shouldn't be. Using profile tag without this part made all work just fine.
With Spartacus, this cookie doesn’t make sense anymore. It is created by the Commerce backend and works best in combination with an accelerator frontend. Cds-spartacus in combination with ProfileTag relies on the anonymous consents or the user consents (depending on the user being logged in or not) loaded by Spartacus. More information about anonymous consents can be found here: https://sap.github.io/spartacus-docs/anonymous-consent/.
Just a quick FYI about the CDS-Spartacus integration: the profile tag script is pulled from the configured URL by Spartacus, and the script is doing all the event and data "scraping". The cookie is also being placed in the browser by the script.
Your question and this comment lead me to think that the script is not handling this case.
I'm not even sure if it should handle it, so it might be a better idea to contact CDS team directly about this one.
I was studying mozilla django tutorial and in between that I came across one point where I have to redirect the url ' ' to '/catalog/' with permanent = True.
Now I have one new project (another project in different directory ) with django-admin and gave the command of manage.py runserver (notice I haven't made any changes in this project) the url '' is automatically being redirect to '/catalog/' in chrome it works fine in opera mini though.
It’s probably not a Django issue, but due to Chrome caching certain requests. You could try a hard refresh of the page:
https://www.getfilecloud.com/blog/2015/03/tech-tip-how-to-do-hard-refresh-in-browsers/
Unless the redirect is being handled by some unusual Javascript (and you are doing this in Django so probably not), you probably just need to refresh the page. Hold the shift key while clicking on the refresh button in Chrome.
This is because chrome has cached this particular redirect and uses it without checking with the server. You can get rid of this by clearing your browser cache - but you might not want to do this because you'll lose other data too. Instead, right click on the page in question and go to developer tools (or hit F12). Go to the Network tab and tick "Disable cache". Now refresh the page without the redirected part of the url, and the page should load correctly. Now close developer tools and it should continue to work as intended.
I solved it by deleting the browser history(going to Advanced mode and selecting everything).
Meteor concatenates, minifies and compiles all html, css and javascript and sends them all to the client. But as I noticed, it's not useful for some cases.
For example, for most users we have app which works on myapp.com and another big part of app - admin dashboard works on myapp.com/admin. The size of admin part is compatible to the size of a main app part, but it's used only by hundreds of users or so. As a result most of the users load 2x size on client, half of which is useless and can't be used.
Does Meteor have solutions of this problem or maybe someone can suggest any hacks to solve it?
if you made your whole /admin/ section a separate package you could deploy two builds, with and without, and then route any clicks on "/admin/" URLs to "admin.APP.com/admin". both apps would of course need to talk to the same database.
Some people are using nginx proxy to decide what to serve, but this is not so much based on URLs as on some property of the userAgent, eg for mobile devices. this is nicer than having separate subdomains. the user doesn't see "admin.APP.com", the different backends are masked from them. But, you may not care so much about that. Having admin.* be explicit is a good thing.
Short Version
Is there any tool that will let me use a single Django admin page to affect multiple Django installations on different servers?
Detailed Version
I've got a bunch of different servers, each with their own Django installation. This works great ... except when I want to do something via the Django admin to all of the servers, in which case I have to log on to each server separately.
For instance, let's say I have a release coming and a co-worker (who's not a programmer) wants to use the admin to make a "message" record about the release for the server's users to see. They have to log in to each server's admin individually, create the message record, then move on to the next server until they've gotten through all of them.
To get around this whenever I have a multi-server change I've been using Git; ie.:
I make a commit with files for the change
I push that commit
I pull that commit on all of the servers at once (using Fabric).
However, this too is sub-optimal, because we can't take advantage of the admin interface, and doing something as simple as adding a "new release coming" message requires an actual (mini-)release itself.
So, it seems to me the best way to handle this would be if there was some sort of meta-admin tool my co-worker could use to Django admin work on multiple servers at once. Does anything like that exist?