Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allow query param to public pages. #373

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Most of the configuration can be done on the `/settings` page but there are some
|`database`|The database type to use. See **Database setup**|
|`google_analytics`|Adds Google Analytics to public facing pages. Include the entire code from Google including the <script> tags.|
|`style`|Add any Hex color codes, HTML color names and fonts to style the public pages of your KB.|
|`allow_query_param`|Allow main page query params to be passed without going to the login page.|

**Data sorting**
You can control the sort order or articles. You can sort on anything but popular fields are `kb_viewcount`, `kb_published_date`, `kb_last_updated` or `kb_votes`
Expand Down
3 changes: 2 additions & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"cssLinkColor": "",
"cssTextColor": "",
"cssFontFamily": ""
}
},
"allow_query_param": true
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions routes/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ exports.restrict = function (req, res, next){
return;
}

// if allowing query params and not protecting
if(config.settings.allow_query_param === true ) {
if(url_path.substring(0, 2).trim() === '/?'){
if(config.settings.password_protect === false){
next();
return;
}
}
}

// if not a public page we
exports.check_login(req, res, next);
};
Expand Down