mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-03-01 05:04:08 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
parent
8e40749101
commit
2a6174e955
@ -27,10 +27,10 @@ function datocmsDateToIng(date : string) : number {
|
||||
export async function datocmsQueryIntercept(query : any) : Promise<object> {
|
||||
let parent = pluckFirstParentFromQuery(query);
|
||||
let pageQueryWhitelist = getPageQueryBypassWhitelist();
|
||||
let listingDirectory = getListingDirectoryByQueryParent(parent);
|
||||
let listingQueryWhitelist = getListingQueryDirectories();
|
||||
let interceptData = {};
|
||||
|
||||
if (listingDirectory) {
|
||||
if (listingDirectory.includes(parent)) {
|
||||
interceptData = await datocmsListingQueryIntercept(query);
|
||||
} else if (pageQueryWhitelist.includes(parent)) {
|
||||
interceptData = await datocmsPageQueryIntercept(query);
|
||||
@ -42,6 +42,30 @@ export async function datocmsQueryIntercept(query : any) : Promise<object> {
|
||||
return interceptData;
|
||||
}
|
||||
|
||||
function getPageQueryBypassWhitelist() : string[] {
|
||||
//-----stuff that has been (to the best of my knowledge) completley pulled over into JSON
|
||||
//-----does not include iterative stuff like blog posts or events etc...
|
||||
//-----this may only end up being scaffolding.
|
||||
|
||||
let whitelist : string [] = [];
|
||||
|
||||
whitelist.push('aboutPage');
|
||||
whitelist.push('careersPage');
|
||||
whitelist.push('communityPage');
|
||||
whitelist.push('contactPage');
|
||||
whitelist.push('homePage');
|
||||
whitelist.push('partnersPage');
|
||||
whitelist.push('pressPage');
|
||||
whitelist.push('privacyPage');
|
||||
whitelist.push('productsPage');
|
||||
whitelist.push('termsPage');
|
||||
|
||||
whitelist.push('header');
|
||||
whitelist.push('footer');
|
||||
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
function getListingQueryDirectories() : string[] {
|
||||
//-----whitelist the listying types of content...
|
||||
|
||||
@ -57,20 +81,6 @@ function getListingQueryDirectories() : string[] {
|
||||
|
||||
}
|
||||
|
||||
function getListingDirectoryByQueryParent(parent : string) : string {
|
||||
//-----this acts as a whitelist and a mapping to the folder name...
|
||||
|
||||
let directories : any[] = getListingQueryDirectories();
|
||||
let directory : string = '';
|
||||
|
||||
if (directories.includes(parent)) {
|
||||
directory = directories[parent];
|
||||
}
|
||||
|
||||
return directory;
|
||||
|
||||
}
|
||||
|
||||
function pluckFirstParentFromQuery(query : any) : string {
|
||||
|
||||
//-----only plucks the FIRST parent, if there are multiple parents in the query they will be ignored.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user