mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Implemented a basic RoutingService for Mentions
refs https://github.com/TryGhost/Team/issues/2466 This initial implementation just checks that we're on the right origin and subdomain, but should be extended to check if the URL actually resolves to a page hosted on the site!
This commit is contained in:
parent
5b4bc01504
commit
833182bc7f
@ -45,7 +45,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
routingService: {
|
routingService: {
|
||||||
async pageExists() {
|
async pageExists(url) {
|
||||||
|
const siteUrl = new URL(urlUtils.getSiteUrl());
|
||||||
|
if (siteUrl.origin !== url.origin) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const subdir = urlUtils.getSubdir();
|
||||||
|
if (subdir && !url.pathname.startsWith(subdir)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user