Skip to content

Commit

Permalink
publish project code
Browse files Browse the repository at this point in the history
  • Loading branch information
tongyuantongyu committed Nov 12, 2020
0 parents commit 80a2483
Show file tree
Hide file tree
Showing 301 changed files with 42,174 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# IDE
.idea

debug-server
exec
test
dev-docs

# real config file
config.toml

cmake-*
c/debug
c/release
c/libs/*
11 changes: 11 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2020 Yuan Tong

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Chromatic

Chromatic is a private image hosting site focused on optimizing web experience.

# Requirement

**Run this server on a decent machine!**

Image encoding, especially using libaom for AVIF encoding, requires a lot of CPU and memory resources.
You should have at least 8GB memory for a 4096x4096 size image.

This site uses MongoDB as database.

## Deploy

To deploy the site, follow the steps below.

1. Get a domain.
2. Create a reCAPTCHA key for your site. You can get one free at [here](https://www.google.com/recaptcha/admin/create).
3. Copy `config.example.toml` to `config.toml`, and change the config items to your need.
4. Replace default website key (`6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI`) to yours in `main.*.js` and `main.*.js.map`.
5. (Optional) Execute `front/compress.sh` in `static` folder to get brotli and gzip compressed static files.
6. Everything ready. Run the executable to start the server.

## Build

To build this project from source, follow the instructions below.

### Dependence libraries

On Linux, You should have [libpng](http://www.libpng.org/pub/png/libpng.html),
libjpeg([mozjpeg](https://github.com/mozilla/mozjpeg), optimally),
[libwebp](https://chromium.googlesource.com/webm/libwebp) and
[libavif](https://github.com/AOMediaCodec/libavif) installed with headers and
static library available for compiler. Specially, mozjpeg's default install dir
`/opt/mozjpeg/` will also be considered.

On Windows, you should have the same libraries, with headers and libraries
placed in `c/header` and `c/libs`.

### Build C Part

This project has a small wrapper written in C. You need `cmake` to build it.
This can be build on Linux and Windows(using MinGW).

```
cd c
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=Release ..
make
```

### Build Go Part
Loading

0 comments on commit 80a2483

Please sign in to comment.