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

Pass client agents to meilisearch #244

Merged
merged 4 commits into from
Jul 12, 2022
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
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = {
PLACEHOLDER: 'readonly',
LAYOUT: 'readonly',
DEBUG: 'readonly',
ENABLE_DARK_MODE: 'readonly'
ENABLE_DARK_MODE: 'readonly',
CLIENT_AGENTS: 'readonly'
},
parserOptions: {
parser: 'babel-eslint',
Expand Down
1 change: 1 addition & 0 deletions MeiliSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
hostUrl: HOST_URL,
apiKey: API_KEY,
indexUid: INDEX_UID,
clientAgents: CLIENT_AGENTS,
meilisearchOptions: {
limit:
MAX_SUGGESTIONS || this.$site.themeConfig.searchMaxSuggestions || 5,
Expand Down
11 changes: 11 additions & 0 deletions client_agents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { version } = require('./package.json')

const constructClientAgents = (clientAgents = []) => {
const vuepressAgents = `Meilisearch Vuepress (v${version})`

return clientAgents.concat(vuepressAgents)
}

module.exports = {
constructClientAgents
}
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const path = require('path')

const { constructClientAgents } = require('./client_agents')

module.exports = (options) => {
return {
alias: {
Expand All @@ -15,7 +17,8 @@ module.exports = (options) => {
CROP_LENGTH: options.cropLength || 30,
LAYOUT: options.layout || 'columns',
DEBUG: options.debug || false,
ENABLE_DARK_MODE: options.enableDarkMode || false
ENABLE_DARK_MODE: options.enableDarkMode || false,
CLIENT_AGENTS: constructClientAgents(options.clientAgents) || []
}
}
}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
CROP_LENGTH: 30,
LAYOUT: 'columns',
DEBUG: false,
ENABLE_DARK_MODE: false
ENABLE_DARK_MODE: false,
CLIENT_AGENTS: []
}
}