Mangane/README.md

248 lines
6.7 KiB
Markdown
Raw Normal View History

# Mangane FE
2020-03-28 22:06:29 +01:00
2022-08-27 16:45:16 +02:00
![UI Mixed](ui-mixed.png)
![UI Dark](ui-dark.png)
![UI Light](ui-light.png)
2020-05-24 15:57:41 +02:00
**Mangane FE** is a frontend for Pleroma with a focus on custom branding and ease of use.
2022-03-17 20:45:40 +01:00
## :rocket: Deploy on Pleroma/Akkoma
2020-04-26 23:30:39 +02:00
Installing Mangane FE on an existing Pleroma server is easy.
Log in your server and follow those instructions depending on your configuration.
2020-04-26 23:30:39 +02:00
### Download
2020-04-26 23:30:39 +02:00
First you need to download mangane on your server.
#### OTP
```
/opt/pleroma/bin/pleroma_ctl frontend install mangane --ref dist --build-url https://github.com/Cl0v1s/mangane-ui/releases/latest/download/static.zip
```
*Note: The pleroma_ctl path may vary on your system*
#### Mix / Source
```
mix pleroma.frontend install mangane --ref dist --build-url https://github.com/Cl0v1s/mangane-ui/releases/latest/download/static.zip
```
#### Admin-fe with database configuration enabled
Just fill the form at Frontend/Available like this.
![admin-fe](./admin-fe.png)
### Activation
Then you need to activate the frontend the it will be available to your users.
#### Config.exs
Edit your configuration files to add/edit the `config :pleroma, :frontends` section like this
```
config :pleroma, :frontends,
primary: %{
"name" => "mangane",
"ref" => "dist"
}
2020-04-26 23:30:39 +02:00
```
##### Admin-fe with database configuration enabled
Just fill the form at Frontend/frontends/Primary like this.
![admin-fe](./admin-fe2.png)
2020-04-26 23:30:39 +02:00
**That's it!** :tada:
**Mangane FE is installed.**
2020-04-26 23:30:39 +02:00
The change will take effect immediately, just refresh your browser tab.
You may need to restart pleroma/akkoma for the change to take effect.
2020-06-10 20:32:03 +02:00
## :elephant: Deploy on Mastodon
2022-10-26 23:00:21 +02:00
See [Installing Mangane over Mastodon](https://docs.soapbox.pub/frontend/administration/mastodon/).
2020-06-10 20:32:03 +02:00
## How does it work?
Mangane FE is a [single-page application (SPA)](https://en.wikipedia.org/wiki/Single-page_application) that runs entirely in the browser with JavaScript.
2020-06-10 20:32:03 +02:00
It has a single HTML file, `index.html`, responsible only for loading the required JavaScript and CSS.
It interacts with the backend through [XMLHttpRequest (XHR)](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest).
Here is a simplified example with Nginx:
```nginx
location /api {
proxy_pass http://backend;
}
location / {
root /opt/soapbox;
try_files $uri index.html;
}
```
(See [`mastodon.conf`](https://gitlab.com/soapbox-pub/soapbox-fe/-/blob/develop/installation/mastodon.conf) for a full example.)
Soapbox incorporates much of the [Mastodon API](https://docs.joinmastodon.org/methods/), [Pleroma API](https://api.pleroma.social/), and more.
It detects features supported by the backend to provide the right experience for the backend.
2020-04-26 23:30:39 +02:00
2020-04-30 18:42:09 +02:00
# Running locally
2020-04-07 03:30:05 +02:00
To get it running, just clone the repo:
```sh
git clone https://github.com/Cl0v1s/mangane.git
cd mangane-fe
2020-04-07 03:30:05 +02:00
```
Ensure that Node.js and Yarn are installed, then install dependencies:
```sh
2020-04-07 03:30:05 +02:00
yarn
```
Finally, run the dev server:
```sh
2020-07-26 22:09:45 +02:00
yarn dev
2020-04-07 03:30:05 +02:00
```
2020-04-21 20:34:18 +02:00
**That's it!** :tada:
2020-04-07 03:30:05 +02:00
It will serve at `http://localhost:3036` by default.
You should see an input box - just enter the domain name of your instance to log in.
Tip: you can even enter a local instance like `http://localhost:3000`!
2020-04-21 20:34:18 +02:00
### Troubleshooting: `ERROR: NODE_ENV must be set`
Create a `.env` file if you haven't already.
```sh
cp .env.example .env
```
And ensure that it contains `NODE_ENV=development`.
Try again.
2020-04-21 20:34:18 +02:00
## Developing against a live backend
You can also run Mangane FE locally with a live production server as the backend.
2020-04-21 20:34:18 +02:00
2020-06-27 04:19:35 +02:00
> **Note:** Whether or not this works depends on your production server. It does not seem to work with Cloudflare or VanwaNet.
2020-04-21 20:39:30 +02:00
2020-04-21 20:34:18 +02:00
To do so, just copy the env file:
2020-04-07 03:30:05 +02:00
2020-04-30 18:42:09 +02:00
## Local Dev Configuration
2020-04-21 20:34:18 +02:00
The following configuration variables are supported supported in local development.
Edit `.env` to set them.
All configuration is optional, except `NODE_ENV`.
#### `NODE_ENV`
The Node environment.
Mangane FE checks for the following options:
- `development` - What you should use while developing Mangane FE.
- `production` - Use when compiling to deploy to a live server.
- `test` - Use when running automated tests.
2020-04-21 20:34:18 +02:00
#### `BACKEND_URL`
URL to the backend server.
Can be http or https, and can include a port.
For https, be sure to also set `PROXY_HTTPS_INSECURE=true`.
**Default:** `http://localhost:4000`
#### `PROXY_HTTPS_INSECURE`
Allows using an HTTPS backend if set to `true`.
2020-07-01 00:33:21 +02:00
This is needed if `BACKEND_URL` is set to an `https://` value.
2020-04-21 20:34:18 +02:00
[More info](https://stackoverflow.com/a/48624590/8811886).
**Default:** `false`
# Yarn Commands
The following commands are supported.
You must set `NODE_ENV` to use these commands.
To do so, you can add the following line to your `.env` file:
```sh
NODE_ENV=development
```
#### Local dev server
2020-07-26 22:09:45 +02:00
- `yarn dev` - Run the local dev server.
2020-04-14 23:50:42 +02:00
#### Building
- `yarn build` - Compile without a dev server, into `/static` directory.
#### Translations
- `yarn manage:translations` - Normalizes translation files. Should always be run after editing i18n strings.
#### Tests
2022-04-04 17:50:14 +02:00
- `yarn test:all` - Runs all tests and linters.
2022-04-04 17:50:14 +02:00
- `yarn test` - Runs Jest for frontend unit tests.
2022-04-04 17:50:14 +02:00
- `yarn lint` - Runs all linters.
2022-04-04 17:50:14 +02:00
- `yarn lint:js` - Runs only JavaScript linter.
2022-04-04 17:50:14 +02:00
- `yarn lint:sass` - Runs only SASS linter.
# Contributing
We welcome contributions to this project. To contribute, first review the [Contributing doc](docs/contributing.md)
Additional supporting documents include:
* [Mangane History](docs/history.md)
* [Redux Store Map](docs/history.md)
# Customization
Mangane supports customization of the user interface, to allow per instance branding and other features. Current customization features include:
2022-07-18 19:12:50 +02:00
* Instance name
* Site logo
* Favicon
* About page
* Terms of Service page
2020-05-29 00:52:35 +02:00
* Privacy Policy page
* Copyright Policy (DMCA) page
* Promo panel list items, e.g. blog site link
* Mangane extensions, e.g. Patron module
2020-05-29 00:52:35 +02:00
* Default settings, e.g. default theme
2022-07-18 19:12:50 +02:00
Customization details can be found in the [Customization doc](docs/customization.md)
2020-06-10 20:32:03 +02:00
# License & Credits
Mangane FE is based on [Soapbox](https://soapbox.pub)'s frontend.
2020-03-28 22:06:29 +01:00
2020-09-18 06:10:58 +02:00
- `static/sounds/chat.mp3` and `static/sounds/chat.oga` are from [notificationsounds.com](https://notificationsounds.com/notification-sounds/intuition-561) licensed under CC BY 4.0.
Mangane FE is free software: you can redistribute it and/or modify
2020-03-28 22:06:29 +01:00
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mangane FE is distributed in the hope that it will be useful,
2020-03-28 22:06:29 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Mangane FE. If not, see <https://www.gnu.org/licenses/>.