aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-02-19 03:21:36 +0100
committerDaniel Schadt <kingdread@gmx.de>2020-02-19 03:21:36 +0100
commit8af5ca42d73b408cdc1878bc378aeef15f11b881 (patch)
tree55af716084b9e732292d3c3e3ef52c78e02c2460
parentc0b89369bb6f6339d1eec4bf2a042636918fd4e2 (diff)
downloadsimghost-8af5ca42d73b408cdc1878bc378aeef15f11b881.tar.gz
simghost-8af5ca42d73b408cdc1878bc378aeef15f11b881.tar.bz2
simghost-8af5ca42d73b408cdc1878bc378aeef15f11b881.zip
Update README.md
-rw-r--r--README.md90
1 files changed, 90 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3024b14..69b3649 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,91 @@
# simghost
+
+Simple image hosting script, written in Haskell.
+
+Features:
+
+* Can upload images either from files or from the clipboard.
+* Uses a username/password system to avoid spammers and unauthorized uploads.
+* Works as a CGI script in a single-file binary.
+
+## Compilation (static)
+
+The default compilation mode is to produce a static binary. This requires a
+static version of `libgmp` to be installed (e.g. with `libgmp-static` on Arch).
+
+If you cannot install a static version of `libgmp` system-wide, you can compile
+it yourself and add the following lines to `package.yaml`:
+
+```yaml
+extra-lib-dirs:
+- /path/to/gmp-6.2.0/.libs
+```
+
+So that `libgmp.a` can be found. You can also pass this as a command line flag
+to `stack`: `stack build --extra-lib-dirs=/path/to/...`.
+
+Afterwards, just run `stack build` to build the executable in
+`.stack-work/install/...`.
+
+## Compilation (dynamic)
+
+If you do not want to use static compilation and would rather link the
+libraries dynamically, you can remove the `-static` from `ghc-options`,
+`cc-options` and `ld-options` in `package.yaml`:
+
+```diff
+--- a/package.yaml
++++ b/package.yaml
+@@ -60,6 +60,5 @@ tests:
+ dependencies:
+ - simghost
+
+-ghc-options: -Wall -O2 -static -threaded
+-cc-options: -static
+-ld-options: -static -pthread
++ghc-options: -Wall -O2 -threaded
++ld-options: -pthread
+```
+
+After that, just run `stack build` to build the executable.
+
+## Installing & Configuration
+
+* Copy the executable to the path where you want the script to be accessible.
+* Make sure that your webserver executes the script as CGI.
+* Set up the configuration in `settings.json` (same directory as the script):
+
+```json
+{
+ "outputDir": "images/",
+ "users": {
+ "foo": "$2y$12$XiBSIoGnHcfaztfxEXe/uuCwuC5PEPlEIhavL28t4Kph/LLJYskke"
+ }
+}
+```
+
+(The passwords are bcrypt hashed)
+
+* Make sure that the output directory exists.
+* Congratulations, it should work!
+
+For extra security, you should configure your webserver to deny access to at
+least the `settings.json` document. Preferably, you should also disable the
+directory listing for your output directory and deny access to any `*.meta`
+files.
+
+As an example for Apache2, the following `.htaccess` can be used:
+
+```
+AddHandler cgi-script .cgi
+DirectoryIndex simghost.cgi
+Options -Indexes
+
+<Files settings.json>
+Deny from all
+</Files>
+
+<FilesMatch "\.meta$">
+Deny from all
+</FilesMatch>
+```