Learn from experience & rename output JS
This commit is contained in:
parent
bb9bfc1346
commit
8c5e4591a6
22
README.md
22
README.md
|
@ -39,7 +39,7 @@ lebab --replace output/ --transform arrow,arrow-return
|
|||
spago bundle-app --minify
|
||||
|
||||
# Perform some final optimizations
|
||||
uglifyjs --compress --mangle --toplevel --mangle-props -- index.js > index.js
|
||||
uglifyjs --compress --mangle --toplevel -- index.js > aviary.min.js
|
||||
```
|
||||
|
||||
Aside: If you know a way to bring the file size down further, *please* open an issue!
|
||||
|
@ -52,8 +52,9 @@ Aviary works with a [`0x0`]-compatible server as a backend. To set up a quick
|
|||
server for development, follow these steps:
|
||||
|
||||
**Prerequisites:**
|
||||
- Python, `pip`, and `venv`
|
||||
- Python3 with `pip`
|
||||
- `git`
|
||||
- A C++ compiler (e.g. `gcc`) & libc/python development headers
|
||||
|
||||
```bash
|
||||
# Download 0x0
|
||||
|
@ -61,8 +62,9 @@ git clone https://git.0x0.st/mia/0x0
|
|||
cd 0x0
|
||||
|
||||
# Set up the environment and install deps
|
||||
python -m venv venv --prompt 0x0
|
||||
source venv/bin/activate.sh || source venv/bin/activate.fish
|
||||
python3 -m venv venv --prompt 0x0
|
||||
source venv/bin/activate || source venv/bin/activate.fish
|
||||
pip install wheel
|
||||
pip install -r requirements.txt
|
||||
pip install gunicorn
|
||||
|
||||
|
@ -72,10 +74,6 @@ echo "
|
|||
# Use a local sqlite3 database to store information
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'
|
||||
|
||||
# Have the webserver deal with sending files rather than 0x0
|
||||
USE_X_SENDFILE = True
|
||||
FHOST_USE_X_ACCEL_REDIRECT = False
|
||||
|
||||
# Encrypted files really throw off mime guessers, which can cause some
|
||||
# encrypted images to get rejected for having ELF headers (e.g. looking like
|
||||
# executables). We don't want this, so we disable MIME filtering
|
||||
|
@ -98,10 +96,10 @@ ln -fs /path/to/aviary/dist/www/index.html templates/404.html
|
|||
gunicorn fhost:app
|
||||
```
|
||||
|
||||
You'll also need to serve the `index.js` file generated during the **building**
|
||||
step at `/index.js`. This can be done using an external webserver. A sample
|
||||
`Caddyfile` exists in `:dist/`. To use this, run the following command from
|
||||
the `dist/` directory.
|
||||
You'll also need to serve the `aviary.min.js` file generated during the
|
||||
**building** step at `/aviary.min.js`. This can be done using an external
|
||||
webserver. A sample `Caddyfile` exists in `:dist/`. To use this, run the
|
||||
following command from the `dist/` directory.
|
||||
|
||||
```bash
|
||||
caddy run
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
http://localhost:6660 {
|
||||
root www/
|
||||
file_server /index.js
|
||||
reverse_proxy localhost:8000
|
||||
route {
|
||||
file_server /aviary.min.js {
|
||||
pass_thru
|
||||
root www/
|
||||
}
|
||||
reverse_proxy localhost:8000 {
|
||||
@accel header X-Accel-Redirect *
|
||||
handle_response @accel {
|
||||
root * /path/to/0x0/
|
||||
rewrite * {rp.header.X-Accel-Redirect}
|
||||
file_server
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ p {
|
|||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
<script src="/index.js"></script>
|
||||
<script src="/aviary.min.js"></script>
|
||||
<script src="https://unpkg.com/rescript-blurhash@0.4.0/dist/production.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../index.js
|
Loading…
Reference in New Issue