Whoops
[lainsafe.git] / doc / index.md
bloba6c195f87c1f9a5bae805387540bcd45e16399f2
1 # lainsafecli documentation
3 ## History
5 [delegao](https://kill-9.xyz/rocks/people/delegao) and I were talking about how much I hate the modern web. He runs <https://safe.delegao.moe> which is the same but with JS, so I think it sucked. I started to make lainsafe to replace lolisafe.
7 ## Lainsafe installation
9 Just put index.html and upload.cgi in a HTTP directory. I use fcgi to run my cgi scripts. So it's what i recommend. To install fcgi on Debian, run: ```# apt install fcgiwrap```
11 here's an example configuration for lainsafe, using nginx.
13 ~~~
14 server
16         server_name lainsafe.foo.tld;
18         listen 80;
19         listen [::]:80;
20         client_max_body_size 100m; # max size 100MBs, change 10 to 100 in upload.cgi in line 30
21         root /var/www/lainsafe;
23         location ~ \.cgi$ {
24                 gzip off;
25                 include /etc/nginx/fastcgi_params;
26                 fastcgi_pass unix:/var/run/fcgiwrap.socket;
27                 fastcgi_index index.cgi;
28                 fastcgi_param SCRIPT_FILENAME /var/www/lainsafe/$fastcgi_script_name;
29         }
31 ~~~
33 ## lainsafecli
35 lainsafecli is a command line interface for lainsafe. It can be used in whatever that runs Perl. Installation is simple: if you're running Debian install the libwww-perl package. If you are not running Debian, search for that package in your repositories. Or use ```# cpan -i LWP::UserAgent```
37 ### Installation
39 I haven't made a package for lainsafecli yet. So installation is basically:
41 ~~~
42 # wget https://raw.githubusercontent.com/qorg11/lainsafe/master/lainsafecli \
43 -O /bin/lainsafecli && chmod +x /bin/lainsafecli
44 ~~~
46 That will install lainsafecli, run ```lainsafecli``` to make sure it is installed.
48 ### Configuration
50 lainsafecli is a simple software. So it has just 2 configurable
51 parameters. lainsafecli do not have a config file. So you have to
52 change these parameters in the executable file.
54 These parameters are located in the line 34 of lainsafecli.
56 ```$DEFAULT_SERVER``` the server that will be used if --server is not
57 specified.
58 ```$DISPLAY_ASCII``` By default is true, change to 0 if you don't want
59 the Lain ASCII art to appear when you upload a file.
61 the most "official" lainsafe instance is <https://lainsafe.delegao.moe>.
63 ### Usage
65 Before 1b8373
67 ~~~
68 USAGE: lainsafecli [--server] --file=FILE
69 ~~~
71 After 1b8373
73 ~~~
74 USAGE: lainsafecli [--server] FILE
75 ~~~
78 for example:
80 ```lainsafe --server=https://lainsafe.foo.bar sicp.pdf```
82 will upload sicp.pdf to lainsafe.foo.bar
84 ### Sample output
86 In this output, ```$DEFAULT_SERVER``` is lainsafe.delegao.moe. and ```
87 $DISPLAY_ASCII``` equals 1 (true)
89 ~~~
90 lainsafecli sicp.pdf
92           _..-- ----- --.._
93         ,-''                `-.
94        ,                       \
95       /                         \
96      /        ` .                \
97     '         /  ||               ;
98     ;      ^/|   |/        |      |
99     |      /v    /\`-'v√\'-|\     ,
100     |   /v` ,---      ---- .^.|    ;
101     :  |   /´@@`,     ,@@`\  |    ;
102     '  |  '. @@ /     \@@ /  |\  |;
103     | ^|    -----      ---   | \/||
104     ` |`                     | /\ /
105     \    \                   |/ |,
106     ' ;   \                 /|  |
107       `    \      --       / |  |
108       `     `.          .-'  |  /
109        v,-    `;._   _.;     | |
110           `'`\ |-_      -^'^'| |
111                   ------     |/
112           
113 https://lainsafe.delegao.moe/files/nzOhDKtB.pdf
116 # upload.cgi
118 ```upload.cgi``` is the perl script that do all the works. You could
119 delete index.cgi from your sever and just upload.cgi. You'd upload
120 files through ```lainsafecli```.
122 ## Configuration
124 Only one parameter: ```$MAX_SIZE``` specify, in megabytes, the max size of files allowed. So for example. If you want to set 100MBs as max size . ```$MAX_SIZE``` would be like this: ```$MAX_SIZE = 1024*1024*100```
126 If someone tries to upload a file bigger than 100MBs. It will return
127 Max size for a file is 100 MBs, then, upload.cgi will die.