Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make Preferences link to docs site #871

Merged
merged 14 commits into from
May 10, 2020
Merged
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c

### Creating New Issues

Do not hesitate and [create a new Issue](https://github.com/ipfs/ipfs-companion/issues/new) if you see a bug, room for improvement or simply have a question.
Do not hesitate and [create a new Issue](https://github.com/ipfs/ipfs-companion/issues/new/choose) if you see a bug, room for improvement or simply have a question.

### Working on existing Issues

Expand All @@ -19,7 +19,7 @@ As a courtesy, please add a comment informing about your intent. That way we wi

### Submitting Pull Requests

Just make sure your PR comes with its own tests and does pass [automated CI build](https://ci.ipfs.team/blue/organizations/jenkins/IPFS%20Shipyard%2Fipfs-companion/pr).
Just make sure your PR comes with its own tests and does pass CI tests.
See the [GitHub Flow Guide](https://guides.github.com/introduction/flow/) for details.


Expand All @@ -28,11 +28,11 @@ See the [GitHub Flow Guide](https://guides.github.com/introduction/flow/) for de

Go to Transifex and join [IPFS Companion Translation Project](https://www.transifex.com/ipfs/ipfs-companion/) :sparkles:

If you want to downoad translations from Transifex and run them locally, make sure to read [Localization Notes](docs/localization-notes.md) first.
If you want to downoad translations from Transifex and run them locally, make sure to read [Localization Notes](LOCALIZATION-NOTES.md) first.

## Writing Code

**If you plan to write code make sure to read [Developer Notes](docs/developer-notes.md) to get familiar with tools and commands that will make your work easier.**
**If you plan to write code make sure to read [Developer Notes](DEVELOPER-NOTES.md) to get familiar with tools and commands that will make your work easier.**

## How to Help with Things Beyond Browser Extension?

Expand Down
174 changes: 174 additions & 0 deletions DEVELOPER-NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Developer notes for IPFS Companion

### Table of contents

* [Build from source](#build-from-source)
* [Clone and install dependencies](#clone-and-install-dependencies)
* [Build and run in Firefox](#build-and-run-in-firefox)
* [Build and manually install in Chromium](#build-and-manually-install-in-chromium)
* [Useful tasks](#useful-tasks)
* [Other tips](#other-tips)
* [Using IPFS Companion on Firefox for Android](#using-ipfs-companion-on-firefox-for-android)
* [Install Firefox for Android](#install-firefox-for-android)
* [Install IPFS Companion](#install-ipfs-companion)
* [Hot-deploy over USB](#hot-deploy-over-usb)
* [Debugging in Firefox for Android](#debugging-in-firefox-for-android)
* [Further resources](#further-resources)

## Build from source

If you're looking to develop on IPFS Companion, you should build the project from source. You will need [NodeJS](https://nodejs.org/) and [Firefox](https://www.mozilla.org/en-US/firefox/developer/). Make sure `npm` and `firefox` are in your `PATH`.

You can use `yarn` instead of `npm`. We provide `yarn.lock` if you choose to do so. This guide assumes you are using `npm`.

### Clone and install dependencies

First, clone the `ipfs-shipyard/ipfs-companion` [repository](https://github.com/ipfs-shipyard/ipfs-companion):

```bash
git clone https://github.com/ipfs-shipyard/ipfs-companion.git
```

To install all dependencies into the `node_modules` directory, execute:

```bash
npm install
```

### Build and run in Firefox

Use this one-stop command to build, test and deploy the add-on to Firefox:

```bash
npm start # all-in-one
```

If you run into issues, you can run each step manually to pinpoint where the process is failing:

```bash
npm run build # build runs bundle:firefox at the end, so manifest will be ok
npm run test # test suite
npm run firefox # spawn new Firefox
```

It is also possible to load the extension manually. Enter `about:debugging` in the URL bar, and then click "Load Temporary Add-on" and point it at `add-on/manifest.json`.

### Build and manually install in Chromium

First, clone the repository:

```bash
git clone https://github.com/ipfs-shipyard/ipfs-companion.git
```

Then build it manually:

```bash
npm run build bundle:chromium # last part is important: it overwrites manifest
```

Then open `chrome://extensions` in your Chromium-based browser, enable "Developer mode", click "Load unpacked extension..." and point it at the `add-on` folder within your project folder.

| Chrome "unpacked extension" | Firefox "temporary add-on" |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ![installing ipfs-companion as an unpacked extension in chrome](https://bafybeih34e3a5sgkh57lwv26c6253fxn2jdvte6ilhyld6l4ghuhybzldi.ipfs.dweb.link/ipfs-companion-install-chrome-dev.gif) | ![installing ipfs-companion as a temporary add on in firefox](https://bafybeih34e3a5sgkh57lwv26c6253fxn2jdvte6ilhyld6l4ghuhybzldi.ipfs.dweb.link/ipfs-companion-install-firefox-dev.gif) |


## Useful tasks

Each `npm` task can run separately, but most of the time, `dev-build`, `test`, and `fix:lint` are all you need.

- `npm install`: Install all NPM dependencies
- `npm run build`: Build the add-on (copy external libraries, create `.zip` bundles for Chrome and Firefox)
- `npm run bundle:chromium`: Overwrite manifest and package a generic, Chromium-compatible version
- `npm run bundle:brave`: Overwrite manifest and package a Brave-compatible version requesting access to `chrome.sockets`
- `npm run bundle:firefox`: Overwrite manifest and package a Firefox-compatible version
- `npm run build:rename-artifacts`: Rename artifacts to include runtimes in filenames
- `npm run ci`: Run tests and build (with frozen `yarn.lock`)
- `npm test`: Run the entire test suite
- `npm run lint`: Read-only check for potential syntax problems (run all linters)
- `npm run fix:lint`: Try to fix simple syntax problems (run `standard` with `--fix`, etc.)
- `npm run lint:standard`: Run [Standard](http://standardjs.com) linter ([IPFS JavaScript projects default to standard code style](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md))
- `npm run lint:web-ext`: Run [addons-linter](https://github.com/mozilla/addons-linter) shipped with `web-ext` tool
- `npm run firefox`: Run as temporary add-on in Firefox
- `npm run chromium`: Run as temporary add-on in Chromium
- `npm run get-firefox-nightly`: Fetch latest Firefox nightly build to `./firefox/`
- `npm run firefox:beta:add -- --update-link "https://host/path/to/file.xpi" file.xpi`: Add a manifest entry for new self-hosted beta for Firefox

Release build shortcuts:

- `npm run dev-build`: All-in-one: fast dependency install, build with yarn (updates yarn.lock if needed)
- `npm run beta-build`: Reproducible beta build in docker with frozen `yarn.lock`
- `npm run release-build`: Reproducible release build in docker with frozen `yarn.lock`

## Other tips

- You can switch to an alternative Firefox version by overriding your `PATH`:

```bash
export PATH="/path/to/alternative/version/of/firefox/:${PATH}"
```

- [Using localization in IPFS Companion](LOCALIZATION-NOTES.md) (running browsers with specific locale, etc)
- [Testing persistent and restart features (Mozilla)](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Testing_persistent_and_restart_features)

## Using IPFS Companion on Firefox for Android

Firefox for Android is capable of running some of the same extensions as the desktop version. This makes it very useful for experimenting with IPFS.

### Install Firefox for Android

All channels are available at the Google Play Store:

- [Latest stable](https://play.google.com/store/apps/details?id=org.mozilla.firefox&hl=en)
- [Latest beta](https://play.google.com/store/apps/details?id=org.mozilla.firefox_beta)

### Install IPFS Companion

For full installation instructions, see [`README/#install`](https://github.com/ipfs-shipyard/ipfs-companion#install) in the IPFS Companion repo.

You can also test the latest code locally on an emulator, or via USB on your own device. See below for details.

### Hot-deploy over USB

To run your extension in [Firefox for Android](https://www.mozilla.org/en-US/firefox/mobile/), follow these instructions:

- [Set up your computer and Android emulator or device](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android#Set_up_your_computer_and_Android_emulator_or_device) (enable Developer Mode, USB debugging, etc.)

Build everything, and switch `add-on/manifest.json` to the Fennec profile:

```
npm run dev-build
npm run bundle:fennec
```

Then, with your device connected to your development computer, run:

```
web-ext run -s add-on --target=firefox-android
```

It will list all connected devices with their IDs. If the list is empty, go back to the setup step and try again.

Next, deploy your extension to the specific device:

```
web-ext run -s add-on --target=firefox-android --android-device=<device ID>
```

The first time you run this command, there may be a popup on your Android device asking if you want to grant access over USB.


### Debugging in Firefox for Android

The remote debug port will be printed to the console right after successful deployment:

```
You can connect to this Android device on TCP port <debug PORT>
```

The fastest way to connect is to open `chrome://devtools/content/framework/connect/connect.xhtml` in Firefox on the same machine you run `web-ext` from.

### Further resources

- [MDN: Developing extensions for Firefox for Android](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android)
47 changes: 47 additions & 0 deletions LOCALIZATION-NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Localization in IPFS Companion

### Table of contents

* [Running Chrome with a specific locale](#running-chrome-with-a-specific-locale)
* [Running Firefox with a specific locale](#running-firefox-with-a-specific-locale)
* [Contributing translations](#contributing-translations)

IPFS Companion supports running in specific locales, with translations provided by the community via Transifex.

## Running Chrome with a specific locale

Chrome comes with locales out of the box, so it is enough to set the proper env:

```go
LANGUAGE=pl chromium --user-data-dir=`mktemp -d`
```

### Further resources

- [Language Codes in Chromium Project](https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc)

## Running Firefox with a specific locale

Unless you've installed a locale-specific build, Firefox will have English only. If your build already has the locale you are interested in, skip step #2.

1. Set `intl.locale.requested` in `about:config` or the command line via:

```bash
web-ext run --pref intl.locale.requested=pl
```

2. Install your language pack from https://addons.mozilla.org/firefox/language-tools/
3. Reload the browser extension; it should detect your new locale

### Further resources

- [Mozilla: Use Firefox in another language](https://support.mozilla.org/en-US/kb/use-firefox-interface-other-languages-language-pack#w_how-to-change-the-language-of-the-user-interface)
- [Mozilla: Locale Codes](https://wiki.mozilla.org/L10n:Locale_Codes)

## Contributing translations

Internationalization in IPFS Companion (and all IPFS-related projects) depends on the contributions of the community. You can give back by contributing translations in your language(s)! Go to the [IPFS Companion Transifex page](https://www.transifex.com/ipfs/ipfs-companion/), send a request to join a specific language team, and start translating. You can also download raw files from Transifex, translate them in your own editor/tool, and then upload them back there, but many people prefer using the simple and friendly Transifex GUI.

If your language is not present in `add-on/_locales` yet, but is supported by mainstream browsers, please create a [new issue](https://github.com/ipfs/ipfs-companion/issues/new) requesting it.

Don't worry if GitHub does not immediately reflect translations added at Transifex: New translations are merged manually before every release. Locale files at GitHub are often behind what is already translated at Transifex. It is a good idea to keep Transifex email notifications enabled to be notified about new strings to translate.
2 changes: 1 addition & 1 deletion docs/privacy-policy.md → PRIVACY-POLICY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# **IPFS Companion Privacy Policy**

<em>First Posted: 2019-02-15<br/>
Last Update: 2019-12-10</em> ([change history](https://github.com/ipfs-shipyard/ipfs-companion/commits/master/docs/privacy-policy.md))
Last Update: 2020-05-08</em> ([change history](https://github.com/ipfs-shipyard/ipfs-companion/commits/master/PRIVACY-POLICY.md))

The IPFS Companion browser extension is owned by Protocol Labs Inc. and created
by the IPFS Project. We know you care about how your personal data is used and
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Feel free to modify it, but get familiar with [ABE rule syntax](https://noscript

## Privacy Policy

See [`docs/privacy-policy.md`](docs/privacy-policy.md)
See [`PRIVACY-POLICY.md`](PRIVACY-POLICY.md)

## License

Expand Down
4 changes: 2 additions & 2 deletions add-on/src/options/forms/dnslink-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function dnslinkForm ({
<dt>${browser.i18n.getMessage('option_dnslinkPolicy_title')}</dt>
<dd>
${browser.i18n.getMessage('option_dnslinkPolicy_description')}
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/blob/master/docs/dnslink.md#dnslink-support-in-ipfs-companion" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/dnslink-companion/" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down Expand Up @@ -65,7 +65,7 @@ function dnslinkForm ({
<dd>
${browser.i18n.getMessage('option_dnslinkRedirect_description')}
${dnslinkRedirect ? html`<p class="red i">${browser.i18n.getMessage('option_dnslinkRedirect_warning')}</p>` : null}
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/issues/667" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#subdomain-gateway" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down
4 changes: 2 additions & 2 deletions add-on/src/options/forms/experiments-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function experimentsForm ({
<dl>
<dt>${browser.i18n.getMessage('option_detectIpfsPathHeader_title')}</dt>
<dd>${browser.i18n.getMessage('option_detectIpfsPathHeader_description')}
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/blob/master/docs/x-ipfs-path-header.md#x-ipfs-path-header-support-in-ipfs-companion" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/companion-x-ipfs-path-header/" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand All @@ -91,7 +91,7 @@ function experimentsForm ({
</a>` : html`<del>${browser.i18n.getMessage('option_ipfsProxy_link_manage_permissions')}</del>`}
</p>
-->
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/blob/master/docs/window.ipfs.md#%EF%B8%8F-windowipfs-is-disabled-for-now" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/companion-window-ipfs/" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/options/forms/file-import-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function fileImportForm ({ importDir, openViaWebUI, preloadAtPublicGateway, onOp
<dt>${browser.i18n.getMessage('option_importDir_title')}</dt>
<dd>
${browser.i18n.getMessage('option_importDir_description')}
<p><a href="https://docs.ipfs.io/guides/concepts/mfs/" target="_blank">
<p><a href="https://docs-beta.ipfs.io/concepts/file-systems/#mutable-file-system-mfs" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down
4 changes: 2 additions & 2 deletions add-on/src/options/forms/gateways-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function gatewaysForm ({
<dt>${browser.i18n.getMessage('option_publicSubdomainGatewayUrl_title')}</dt>
<dd>
${browser.i18n.getMessage('option_publicSubdomainGatewayUrl_description')}
<p><a href="https://docs.ipfs.io/guides/guides/addressing/#subdomain-gateway" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#subdomain-gateway" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down Expand Up @@ -118,7 +118,7 @@ function gatewaysForm ({
<dt>${browser.i18n.getMessage('option_useSubdomains_title')}</dt>
<dd>
${browser.i18n.getMessage('option_useSubdomains_description')}
<p><a href="https://docs.ipfs.io/guides/guides/addressing/#subdomain-gateway" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#subdomain-gateway" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/options/forms/ipfs-node-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ipfsNodeForm ({ ipfsNodeType, ipfsNodeConfig, onOptionChange }) {
<dd>
<p>${browser.i18n.getMessage('option_ipfsNodeType_external_description')}</p>
<p>${browser.i18n.getMessage(withChromeSockets ? 'option_ipfsNodeType_embedded_chromesockets_description' : 'option_ipfsNodeType_embedded_description')}</p>
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/blob/master/docs/node-types.md#node-types-in-ipfs-companion" target="_blank">
<p><a href="https://docs-beta.ipfs.io/how-to/companion-node-types/" target="_blank">
${browser.i18n.getMessage('option_legend_readMore')}
</a></p>
</dd>
Expand Down
4 changes: 1 addition & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# IPFS Companion

These pages are scheduled to be moved to [IPFS Docs](https://docs-beta.ipfs.io).
Content present in this directory was moved to [IPFS Docs](https://docs-beta.ipfs.io).
1 change: 0 additions & 1 deletion docs/_config.yml

This file was deleted.

Loading