shiori/README.md

263 lines
6.9 KiB
Markdown
Raw Normal View History

2018-02-26 21:02:12 +08:00
# Shiori
2018-03-05 15:37:50 +08:00
[![Travis CI](https://travis-ci.org/RadhiFadlillah/shiori.svg?branch=master)](https://travis-ci.org/RadhiFadlillah/shiori)
[![Go Report Card](https://goreportcard.com/badge/github.com/radhifadlillah/shiori)](https://goreportcard.com/report/github.com/radhifadlillah/shiori)
Shiori is a simple bookmarks manager written in Go language. Intended as a simple clone of [Pocket](https://getpocket.com//). You can use it as command line application or as web application. This application is distributed as a single binary, which means it can be installed and used easily.
2018-02-26 21:02:12 +08:00
![Screenshot](https://raw.githubusercontent.com/RadhiFadlillah/shiori/master/screenshot.png)
## Table of Contents
2018-02-26 21:45:57 +08:00
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
2018-03-05 08:21:05 +08:00
- [Advanced](#advanced)
2018-02-27 11:53:55 +08:00
- [Examples](#examples)
2018-02-26 21:45:57 +08:00
- [License](#license)
2018-02-26 21:02:12 +08:00
## Features
- Simple and clean command line interface.
2018-02-26 21:02:12 +08:00
- Basic bookmarks management i.e. add, edit and delete.
- Search bookmarks by their title, tags, url and page content.
2018-02-26 21:02:12 +08:00
- Import and export bookmarks from and to Netscape Bookmark file.
- Portable, thanks to its single binary format and sqlite3 database
- Simple web interface for those who don't want to use a command line app.
- Where possible, by default `shiori` will download a static copy of the webpage in simple text and HTML format, which later can be used as an offline archive for that page.
2018-02-26 21:02:12 +08:00
## Installation
You can download the latest version of `shiori` from [the release page](https://github.com/RadhiFadlillah/shiori/releases/latest), then put it in your `PATH`. If you want to build from source, make sure `go` is installed, then run :
2018-02-26 21:02:12 +08:00
```
go get github.com/RadhiFadlillah/shiori
2018-02-26 21:02:12 +08:00
```
## Usage
```
Simple command-line bookmark manager built with Go.
Usage:
shiori [command]
Available Commands:
account Manage account for accessing web interface
add Bookmark the specified URL
delete Delete the saved bookmarks
export Export bookmarks into HTML file in Netscape Bookmark format
2018-02-26 21:02:12 +08:00
help Help about any command
import Import bookmarks from HTML file in Netscape Bookmark format
open Open the saved bookmarks
print Print the saved bookmarks
search Search bookmarks by submitted keyword
serve Serve web app for managing bookmarks
update Update the saved bookmarks
2018-02-26 21:02:12 +08:00
Flags:
-h, --help help for shiori
Use "shiori [command] --help" for more information about a command.
```
2018-03-05 08:21:05 +08:00
### Advanced
By default, `shiori` will create database in the location where you run it. For example, if you run `shiori`. To set the database to a specific location, you can set the environment variable `ENV_SHIORI_DB` to your desired path.
2018-03-02 23:53:46 +08:00
## Usage with Docker
There's a Dockerfile that enables you to build your own dockerized Shiori (as by now there is no official image available on Docker Hub).
### Build the image
```bash
$ docker build -t shiori .
```
### Run the container
2018-03-10 18:19:16 +08:00
After building the image you will be able to start a container from it. To
preserve the database you need to bind the file. In this example we're locating
the `shiori.db` file in our CWD.
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
```sh
touch shiori.db
docker run --rm --name shiori -p 8080:8080 -v $(pwd)/shiori.db:/srv/shiori.db radhifadlillah/shiori
2018-03-02 23:53:46 +08:00
```
2018-03-10 18:19:16 +08:00
If you want to run the container in the background add `-d` after `run`.
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
### Console access for container
```sh
2018-03-02 23:53:46 +08:00
# First open a console to the container (as you will need to enter your password)
# and the default tty does not support hidden inputs
2018-03-10 18:19:16 +08:00
docker exec -it shiori sh
```
### Initialize shiori with password
As after running the container there will be no accounts created, you need to
open a console within your container and run the following command:
```sh
shiori account add <your-desired-username>
2018-03-02 23:53:46 +08:00
Password: <enter-your-password>
```
And you're now ready to go and access shiori via web.
2018-03-10 18:19:16 +08:00
### Run Shiori docker container as systemd image
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
1. Create a service unit for `systemd` at `/etc/systemd/system/shiori.service`.
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
```ini
[Unit]
Description=Shiori container
After=docker.service
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
[Service]
Restart=always
ExecStartPre=-/usr/bin/docker rm shiori-1
ExecStart=/usr/bin/docker run \
--rm \
--name shiori-1 \
-p 8080:8080 \
-v /srv/machines/shiori/shiori.db:/srv/shiori/shiori.db \
radhifadlillah/shiori
ExecStop=/usr/bin/docker stop -t 2 shiori-1
2018-03-02 23:53:46 +08:00
2018-03-10 18:19:16 +08:00
[Install]
WantedBy=multi-user.target
```
2. Set up data directory
This assumes, that the Shiori container has a runtime directory to store their
database, which is at `/srv/machines/shiori`. If you want to modify that,
make sure, to fix your `shiori.service` as well.
```sh
install -d /srv/machines/shiori
touch /srv/machines/shiori/shiori.db
```
3. Enable and start the container
```sh
systemctl enable --now shiori
```
2018-03-02 23:53:46 +08:00
2018-02-27 11:53:55 +08:00
## Examples
2018-03-10 18:19:16 +08:00
*Hint:* If you want to practice the following commands with the docker container,
[run the image](#run-the-container) and [open a
console](#console-access-for-container). After that go along with the examples.
2018-02-27 11:53:55 +08:00
1. Save new bookmark with tags "nature" and "climate-change".
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori add https://grist.org/article/let-it-go-the-arctic-will-never-be-frozen-again/ -t nature,climate-change
```
2. Print all saved bookmarks.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori print
```
2. Print bookmarks with index 1 and 2.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori print 1 2
```
3. Search bookmarks that contains "sqlite" in their title, excerpt, url or content.
2018-02-27 11:53:55 +08:00
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori search sqlite
```
4. Search bookmarks with tag "nature".
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori search -t nature
```
5. Delete all bookmarks.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori delete
```
6. Delete all bookmarks with tag "nature".
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori delete $(shiori search -t nature -i)
```
7. Update all bookmarks' data and content.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori update
```
8. Update bookmark in index 1.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori update 1
```
9. Change title and excerpt from bookmark in index 1.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori update 1 -i "New Title" -e "New excerpt"
```
10. Add tag "future" and remove tag "climate-change" from bookmark in index 1.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 12:19:04 +08:00
shiori update 1 -t future,-climate-change
```
2018-02-27 11:53:55 +08:00
11. Import bookmarks from HTML Netscape Bookmark file.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori import exported-from-firefox.html
```
12. Export saved bookmarks to HTML Netscape Bookmark file.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori export target.html
```
13. Open all saved bookmarks in browser.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori open
```
14. Open text cache of bookmark in index 1.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori open 1 -c
```
15. Serve web app in port 9000.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori serve -p 9000
```
16. Create new account for login to web app.
2018-03-10 18:19:16 +08:00
```sh
2018-02-27 11:53:55 +08:00
shiori account add username
```
2018-02-26 21:02:12 +08:00
## License
Shiori is distributed using [MIT license](https://choosealicense.com/licenses/mit/), which means you can use and modify it however you want. However, if you make an enhancement for it, if possible, please send a pull request.