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

Allow updating ghost_root url #82

Merged
merged 3 commits into from Nov 21, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -47,6 +47,8 @@ To use this version of ghostHunter, you'll need to create a Custom Integration a
```txt
<script>
var ghosthunter_key = 'PASTE_THE_GENERATED_KEY_HERE';
//optional: set your custom ghost_root url, default is `"/ghost/api/v2"`
var ghost_root_url = "/ghost/api/v2"
</script>
```

Expand Down
7 changes: 4 additions & 3 deletions dist/jquery.ghosthunter.js
Expand Up @@ -3229,7 +3229,8 @@ lunr.QueryParser.parseBoost = function (parser) {
// console.log('ghostHunter: grabAndIndex');
this.blogData = {};
this.latestPost = 0;
var url = "/ghost/api/v2/content/posts/?key=" + ghosthunter_key + "&limit=all&include=tags";
var ghost_root = ghost_root_url || "/ghost/api/v2";
var url = ghost_root + "/content/posts/?key=" + ghosthunter_key + "&limit=all&include=tags";

var params = {
limit: "all",
Expand Down Expand Up @@ -3386,8 +3387,8 @@ lunr.QueryParser.parseBoost = function (parser) {
filter: "updated_at:>\'" + this.latestPost.replace(/\..*/, "").replace(/T/, " ") + "\'",
fields: "id"
};

var url = "/ghost/api/v2/content/posts/?key=" + ghosthunter_key + "&limit=all&fields=id" + "&filter=" + "updated_at:>\'" + this.latestPost.replace(/\..*/, "").replace(/T/, " ") + "\'";
var ghost_root = ghost_root_url || "/ghost/api/v2";
var url = ghost_root + "/content/posts/?key=" + ghosthunter_key + "&limit=all&fields=id" + "&filter=" + "updated_at:>\'" + this.latestPost.replace(/\..*/, "").replace(/T/, " ") + "\'";

var me = this;
$.get(url).done(function(data){
Expand Down