commit 01756fd3fdfbee8d6bd198a7f403cac492740033 Author: Scott Wallace Date: Sat Sep 14 16:41:02 2019 +0100 Initial check-in of code diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5aa5ccc --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules + +# testing +/coverage + +# production +/dist + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +yarn.lock diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..b14796c --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +src +node_modules +screenshot.png +yarn.lock diff --git a/package.json b/package.json new file mode 100644 index 0000000..30999fb --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "cerebro-searx", + "version": "1.0.0", + "description": "Cerebro plugin to search using a Searx instance", + "license": "MIT", + "repository": "scottwallacesh/cerebro-searx", + "author": { + "name": "Scott Wallace", + "email": "scott@wallace.sh", + "url": "https://scott.wallace.sh" + }, + "engines": { + "node": ">=4" + }, + "dependencies": { + "cerebro-tools": "^0.1.8", + "cerebro-ui": "^0.0.16" + }, + "devDependencies": { + "cerebro-scripts": "0.0.25" + }, + "main": "dist/index.js", + "keywords": [ + "cerebro", + "cerebro-plugin", + "search", + "searx" + ], + "scripts": { + "start": "cerebro-scripts start", + "build": "cerebro-scripts build", + "test": "cerebro-scripts test", + "clear": "cerebro-scripts clear", + "prepublish": "yarn clear && yarn build" + } + } diff --git a/src/icon.png b/src/icon.png new file mode 100644 index 0000000..15b4575 Binary files /dev/null and b/src/icon.png differ diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..c7d4602 --- /dev/null +++ b/src/index.js @@ -0,0 +1,29 @@ +const React = require("react"); + +const icon = require("./icon.png"); + +const { search, shellCommand } = require("cerebro-tools"); + +const order = 10; +const lookup = ({ term, actions, display, settings }) => { + const result = { + icon, + order, + title: "Searx lookup: " + term, + subtitle: settings.url, + term, + onSelect: () => actions.open(settings.url + "/?q=" + term) + }; + + display(result); +}; + +module.exports = { + fn: lookup, + settings: { + url: { + type: "string", + description: "Base URL for the Searx engine" + } + } +};