How to hide a contenttype listing page from users? - bolt-cms

In Bolt dashboard, I could set the status of any instance of my contenttype to Draft, which would hide the page from users. However, the listing page would still be visible to the public. Is there a way to hide the contenttype entirely from the users?

In the contenttypes.yml file you can set the parameter
viewless: true
against the specific contenttype and that will disable frontend views for this contenttype. What the user will see when they hit the url /entries will be a standard 404 page.

Related

Why am I getting the “SameSite” attribute set to “None” or an invalid value, without the “secure", error when trying to implment Gmail Oauth

Errors
Cookie “G_AUTHUSER_H” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:159:401
Cookie “G_AUTHUSER_H” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:159:401
Cookie “G_ENABLED_IDPS” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:273:21
Problem
So I've been trying to use the Gmail Oauth API to set up logins into my website. It was working fine on my localhost just of XAMPP but once one of my team members tried to move the website off of XAMPP onto a Node Js server. It would refresh constantly if you logged in using your gmail.
Without the gmail Oauth the website seems to work fine it is just when I try use it.
I managed to fix the problem with the google refreshing the page by only loading the logIn function if I was on the logIn page. Otherwise, it was just running the function over and over again on other pages.
Maybe not the best solution but this is what I did.
//loads if page is login.html
switch (current) {
case "http://localhost:2000/login.html":
window.location.href = "./index.html"
console.log("Note on page");
break;
}

Passing Previous / Calling / Referrer URL from view to controller

I have course and pages controllers and views. Each of them have edit / details actions. The list of pages is displayed on the course view in both Edit and details mode. There's a "Back" button on page view that must take the user to the calling page. Below are the two sample urls, both of which will list pages with edit / details buttons :
root/edit/courses/course-url
root/details/courses/course-url
I way i found to work with this is using "Referer" header Request.UrlReferrer.ToString(). But i also read that the browser can block sending this header and also it can be easily tampered. Please suggest a way to send the referer Url from the view.
Details
May be you will send it as query parameter?
Details

HTML5 / JS / Offline mode - request for page with query parameters

I have a page which is part of Cache manifest (/cache).
As soon as my application is offline mode, I can open that page (http://app/cache). But if I try to access it with query string, Chrome treat it as Non-Existing and return fallback page (http://app/cache?url=1234 - does not work).
Does anyone know workaround for that?
I would use # - has tag to pass parameters. Like this:
http://app/cache#url/1234
Browsers ignores the hashtag, but your page javascript can parse and act on it.
It should be true that you will not be opening a page by tying the url on the browser. You will be clicking on a page to open the page. So on click call a Javascript function. Pass the querystring value to the function. save the querystring value to localstorage with a name.
When the page opens up read this value from localstorage on page load and get the value and use in your page.

Chrome extension, replace HTML in response code before browser displays it

i wonder if there is some way to do something like that:
If im on a specific site i want that some of javascript files to be loaded directly from my computer (f.e. file:///c:/test.js), not from the server.
For that i was thinking if there is a possibility to make an extension which could change HTML code in a response which browser gets right before displaying it. So whole process should look like that:
request is made
browser gets response from server
#response is changed# - this is the part when extension comes in
browser parse changed response and display page with that new response.
It doesnt even have to be a Chrome extension anyway. It should just do the job described above. It can block original file and serve another one (DNS/proxy?) or filter whole HTTP traffic in my computer and replace specific code to another one of matched response.
You can use the WebRequest API to achieve that. For example, you can add a onBeforeRequest listener and redirect some requests:
chrome.webRequest.onBeforeRequest.addListener(function(details)
{
var responseData = "<div>Some text</div>"
return {redirectUrl: "data:text/html," + encodeURIComponent(responseData)};
}, {urls: ["https://www.google.com/"]}, ["blocking"]);
This will display a <div> element with the text "some text" instead of the Google homepage. Note that you can only redirect to URLs that the web server itself is allowed to redirect to. This means that redirecting to file:/// URLs is not possible, and you can only redirect to files inside your extension if these are web accessible. data: and http: URLs work fine however.
In Windows you can use the Proxomitron (proxomitron.info) which is a local proxy that can intercept any page or file being loading into your browser and change it using regular expressions (no DOM parsing) however you want, before it is rendered by the browser.

Bookmarkable Ajax

I'm paginating a list of items, and currently the page listed on page load is set by a GET variable (e.g. www.example.com/page.html?page=2). I want to switch it to ajax, but I'm worried users won't be able to bookmark the page they want to view.
Is there a way I can update the URL without redirecting the page?
Use hash
Your website is www.example.com/page.html
Part I.
When you load page two using ajax add a hash to the url
www.example.com/page.html#page2
You can do that using javascript
window.location.hash = "page2".
Now users can bookmark www.example.com/page.html#page2
part II.
When a user request a page say, www.example.com/page.html#page2
You can read the hash using javascript.
var myHash = window.location.hash
If myHash is empty load the page normally.
If it contains "page2", then load the content of page2.
Yes, with a hash in the url. You can learn more here.
You can also find a nice jquery plugin for that purpose here.
Regards