Project

General

Profile

« Previous | Next » 

Revision bf3b0ca1

Added by koszko over 1 year ago

update README.md

View differences:

README.md
1
# Haketilo - Make The Web Great Again!
2

  
1 3
[//]: # ( SPDX-License-Identifier: CC0-1.0 )
2 4

  
3 5
[//]: # ( Haketilo's README file )
......
6 8

  
7 9
[//]: # ( Available under the terms of Creative Commons Zero v1.0 Universal. )
8 10

  
9
# Haketilo - Make The Web Great Again!
11
This WebExtension's goal is to allow replacing javascript served by websites with scripts specified by user. If you know NoScript or Greasemonkey, Haketilo is an extension that overlaps with functionalities and use-cases of both. It is also correct to consider it a response to a call made in RMS' ["The JavaScript Trap"](https://www.gnu.org/philosophy/javascript-trap.html).
12

  
13
## Targetted browsers
14

  
15
Currently we support Chromium (versions 90+, older might also work but are untested), Firefox (versions 60+) and their derivatives.
16

  
17
## Building
18
There're currently 2 ways to build Haketilo.
19

  
20
### 1. Simple stupid way - `build.sh` script
21
You only need a POSIX-compliant environment for this (shell, awk, etc.). It is a viable option if you don't need to run the automated test suite. From project's root directory, using a POSIX shell, you type either:
22
``` shell
23
./build.sh mozilla # to build for Firefox-based browsers
24
```
25
or:
26
``` shell
27
./build.sh chromium # to build for Chromium-based browsers
28
```
29
The unpacked extension shall be generated under `./mozilla-unpacked/` or `./chromium-unpacked/`, respectively. You can then load it into your browser as a temporary extension or pack it into an xpi/crx/zip archive manually, e.g.:
30
``` shell
31
7z a -tzip haketilo.xpi -w mozilla-unpacked/.
32
```
33

  
34
### 2. `configure`-based build
35
This method assumes you have not only a POSIX environment but also a working Make tool and the zip command. From project's root directory, run the shell commands:
36
``` shell
37
./configure --host=mozilla # or analogically with --host=chromium
38
make
39
```
40
This would generate the unpacked extension under `./mozilla-unpacked/` and its zipped version under `./mozilla_build.zip` (which you can rename to .xpi if you want).
41

  
42
You can also perform an out-of-source build, for example:
43
``` shell
44
mkdir /tmp/haketilo-build && cd /tmp/haketilo-build
45
/path/to/haketilo/sources/configure --host=chromium
46
make all # will generate both ./mozilla-build.zip and ./chromium-build.zip
47
```
48

  
49
## Testing
50

  
51
### Requirements
52

  
53
- all that is needed for `configure`-based build
54
- a Firefox-based browser (testing under Chromium is not yet supported)
55
- geckodriver
56
- Python3
57
- Python3 bindings for Selenium
58
- Python3 Pytest
59

  
60
### Configuring
10 61

  
11
This extension's goal is to allow replacing javascript served by websites
12
with scripts specified by user. Something like NoScript and Greasemonkey
13
together. Such facility is necessary to enable browsing World Wide Web
14
without executing nonfree software.
62
*Note: like building, testing can be performed out-of-source.*
15 63

  
16
Currently, the target browsers for this extension are Ungoogled Chromium
17
and various forks of Firefox (version 60+).
64
Running tests requires you to pass some additional information to `configure`. Relevant options are:
18 65

  
19
This extension is still in an early stage. Also see
20
[our wiki](https://hydrillabugs.koszko.org/projects/haketilo/wiki/)
21
for documentation in development.
66
| **option name**  | **explanation**                                                                                                                                                                                                                                                                                                                                                                       |
67
|------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68
| `BROWSER_BINARY` | Path to the browser's binary executable. Under many scenarios the browser executable in `PATH` is a shell wrapper around the actual binary. Selenium will refuse to work with that and instead requires the binary to be passed (e.g. `/usr/lib/abrowser/abrowser` instead of `/usr/bin/abrowser`                                                                                     |
69
| `CLEAN_PROFILE`  | Path to a directory with browser profile that is *"clean"*, i.e. has all extensions disabled. This is to mitigate the fact that some browsers pick up globally-installed extensions when creating a new profile for testing and these could interfere with our automated tests. This option can currently be skipped because all tests written so far run the browser in safe mode.  |
70
| `DRIVER`         | Selenium driver command (e.g. `geckodriver`).                                                                                                                                                                                                                                                                                                                                         |
71
| `PYTHON`         | Python 3 command. The interpreter spawned with this command is expected to have Pytest and Selenium in its import path.                                                                                                                                                                                                                                                               |
22 72

  
23
## Installation
24
The extension can be "built" with `./build.sh mozilla` or `./build.sh chromium`.
25
This creates directories build_mozilla/ and  build_chromium/, respectively.
26
Such directory can be loaded into Ungoogled Chromium or a modern Gecko-based
27
browser as unpacked extension.
73
Options can be specified to `configure` using the following notations (can be mixed):
74
``` shell
75
./configure --host=mozilla --browser-binary=/usr/local/lib/icecat/icecat
76
./configure --host mozilla --browser-binary /usr/local/lib/icecat/icecat
77
./configure HOST=mozilla BROWSER_BINARY=/usr/local/lib/icecat/icecat
78
```
28 79

  
29
## Copyright
30
All copyright information is gathered in the `copyright` file which follows
31
(loosely) the [format of debian/copyright file](https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/). License notices are also present in all text files of the extension.
80
`configure` will try to guess the proper values for options that were not given. To help with this, you can (in some cases) give your actual browser name to `--host`, for example:
81
```
82
$ ./configure --host=abrowser
83
Guessing SRCDIR: /home/urz/haketilo-development/browser-extension
84
Guessing BROWSER_BINARY: /usr/lib/abrowser/abrowser
85
Guessing DRIVER: /usr/bin/geckodriver
86
Guessing PYTHON: /usr/bin/python3
87
Guessing DESTDIR: /usr/share/mozilla/extensions/
88
$
89
```
32 90

  
33
In general, this entire extension is available under the terms of GPLv3+ with
34
various additional licenses and permissions for particular files.
91
This may or may not work, depending on the underlying operating system and how the tools were installed.
35 92

  
36
I, Wojtek Kosior, thereby promise not to sue for violation of this program's
37
licenses. Although I request that you do not make use of this code in a
38
proprietary program, I am not going to enforce this in court.
93
### Running
94

  
95
After configuring, the entire test suite can be run with:
96
``` shell
97
make test
98
```
99

  
100
Alternatively, it is possible to run Pytest directly to have some fine-grained control over which tests are run, e.g.:
101
``` shell
102
# Generate the necessary certificates and pytest.ini. This is done automatically
103
# when running `make test`.
104
make test-prepare
105

  
106
# Optionally prevent Python from clobbering source directories with .pyc files.
107
# `make test` rule does the same.
108
#export PYTHONPYCACHEPREFIX="$(pwd)/test__pycache__"
109

  
110
# Optionally stop Firefox from spawning window(s) during test.
111
#export MOZ_HEADLESS=whatever
112

  
113
# Run all popup tests with high verbosity.
114
python3 -m pytest -vv -k popup
115
```
116

  
117
As of Haketilo 1.0-beta1 some tests may spuriously fail. This is the result it being notoriously difficult to avoid some weirdnesses when driving Firefox using Selenium. To make sure a failed test is not the result of some more serious bug, you might want to rerun the test suite.
118

  
119
## Copying
120

  
121
All copyright information is gathered in the `copyright` file which follows the [format of debian/copyright file](https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/). License notices are also present in all text files of the extension.
122

  
123
In general, this entire extension is available under the terms of GPLv3+ with various additional licenses and permissions for particular files.
124

  
125
I, Wojtek Kosior, thereby promise not to sue for violation of this program's licenses. Although I request that you do not make use of this code in a proprietary program, I am not going to enforce this in court.
126

  
127
## More documentation
128

  
129
See [our wiki](https://hydrillabugs.koszko.org/projects/haketilo/wiki/) for information.
39 130

  
40 131
## Contributing
41
Get the code from: https://git.koszko.org/browser-extension/
42
Come to: https://hydrillabugs.koszko.org/projects/haketilo
43 132

  
44
Optionally, write to `$(echo a29zemtvQGtvc3prby5vcmcK | base64 -d)`
133
Development happens on [our Redmine instance](https://hydrillabugs.koszko.org/projects/haketilo).
134

  
135
Alternatively, you can write to koszko@koszko.org.

Also available in: Unified diff