Skip to content

irfinnew/webcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webcli cover image

About

webcli is a web service that takes a command with optional arguments, and then redirects the request to a corresponding web page. Set it as the default search engine in your browser, and you can do things like gim peacock to search Google Images for peacocks, wp Lady Gaga to take you to the Wikipedia page for Lady Gaga, and tiny http://example.com/ to create a tinyurl link. You can define custom commands, tailored to what you want to do.

webcli uses an OpenSearch description to easily register with browsers.
It was inspired by YubNub.

Using webcli

To start using webcli, visit its home page with your browser.

With Chrome, just visit the webcli home page, and Chrome should register it as a search engine. Then, go to Settings » Search Engine » Manage search engines and site search. At the bottom of the page, find the webcli entry, click the three dots on the right side, and choose Make default.

With Firefox, visit the webcli home page, click the URL bar or search bar, find the webcli icon with a little ⊕ on it, and click it. This will register it as a search engine. Next, go to Settings » Search » Default Search Engine, and choose webcli.

Installation

webcli is a simple Django project. For various ways how to host Django projects, see their official documentation. webcli's configuration uses a bunch of environment variables starting with WEB_, so modifying settings.py shouldn't be necessary in many cases. It can either read these variables from the environment, or from a .env file somewhere up its path. See env.example for the possible variables.

To quickly get webcli up and running in a development environment, create a folder somewhere appropriate, and in that folder, execute the following commands and visit localhost:8000:

git clone https://github.com/mmoreaux/webcli app/
virtualenv venv/
source venv/bin/activate
pip install -r app/requirements.txt
cp app/env.example app/.env
sed -i 's/WEB_DEBUG=False/WEB_DEBUG=True/' app/.env
./app/webcli/manage.py migrate
./app/webcli/manage.py createsuperuser
./app/webcli/manage.py runserver

For running webcli in a production environment, I recommend running the application under an application server such as gunicorn that is proxied from a real web server. webcli comes with a script to start gunicorn in bin/appserver, an example systemd service file in system/webcli.service and an example nginx virtualhost file in system/webcli.nginx. If you use simple logging to a file, you may also want to add a cron job for bin/logrotate.

When running webcli in a production setting, you want to change the following variables in .env:

  • WEB_DEBUG must be False. Using True is a security risk.
  • WEB_SECRET_KEY must be set to a strongly random generated password, unique to this deployment.
  • You may want to modify WEB_LOGFILE_PATH and WEB_DB_NAME to point to a more appropriate location. Or change the various DB_* variables to use a real database.
  • If your server can send emails, set WEB_ERROR_EMAIL_* to enable Django to send emails with detailed error reports.

Managing commands

Visit /admin/ (default path, can be changed with WEB_ADMIN_PATH) on a webcli installation and log in with an admin account to get access to the admin interface. Click on Commands to see an overview of the defined commands. Here you can edit existing commands, delete them, and add new ones.

About

A command-line interface to the web.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published