Skip to content

dmpop/hako

Repository files navigation

Hako

Stupidly simple self-hosted web page archiving tool written in PHP.

Features

  • Archive web pages instantly using a bookmarklet
  • Readability functionality
  • Basic password protection

Dependencies

  • Monolith (x86_64 binary is included)
  • PHP
  • php-xml
  • php-mbstring
  • Git (optional)

Hako is designed to work out of the box on Linux. With a bit of tweaking, it's possible to make it run on Windows and macOS.

Installation and usage

Install PHP as well as the php-xml and php-mbstring packages on your system. Clone then the project's Git repository using the git clone https://github.com/dmpop/hako.git command. Switch to the resulting hako directory, open the config.php file for editing, and replace the default value of the $password variable with the desired password. Save the changes and start the PHP server using the php -S 0.0.0.0:3000 command.

Instead of using the Add button and specifying the URL and title of the web page you want to archive, you can add the following bookmarklet to the bookmark toolbar of your browser (replace 127.0.0.1 with the actual IP address of the machine running Hako and password with the string that matches the value of the $password variable):

javascript:var%20title=window.getSelection();location.href='http://127.0.0.1:8000/index.php?url='+encodeURIComponent(location.href)+'&title='+'&password=secret

Navigate to the page you want to archive, select the title, and click on the Hako bookmarklet. If the page has been archived successfully, you should see it in the list of saved pages.

If everything works properly, you might want to create a system service to start Hako automatically. Run the sudo nano /etc/systemd/system/hako.service command and add the following definition (replace /path/to/hako with the actual path to the hako directory):

[Unit]
Description=Hako
Wants=syslog.service

[Service]
Restart=always
ExecStart=/usr/bin/php -S 0.0.0.0:3000 -t /path/to/hako
ExecStop=/usr/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable hako.service
sudo systemctl start hako.service

Problems?

Please report bugs and issues in the Issues section.

Contribute

If you've found a bug or have a suggestion for improvement, open an issue in the Issues section.

To add a new feature or fix issues yourself, follow the following steps.

  1. Fork the project's repository.
  2. Create a feature branch using the git checkout -b new-feature command.
  3. Add your new feature or fix bugs and run the git commit -am 'Add a new feature' command to commit changes.
  4. Push changes using the git push origin new-feature command.
  5. Submit a merge request.

Author

Dmitri Popov

License

The GNU General Public License version 3